|
|
1.1 ! root 1: /* $Header: /kernel/kersrc/io.286/msgcon.c,v 1.1 92/07/17 15:24:36 bin Exp Locker: bin $ ! 2: * ! 3: * The information contained herein is a trade secret of INETCO ! 4: * Systems, and is confidential information. It is provided under ! 5: * a license agreement, and may be copied or disclosed only under ! 6: * the terms of that agreement. Any reproduction or disclosure of ! 7: * this material without the express written authorization of ! 8: * INETCO Systems or persuant to the license agreement is unlawful. ! 9: * ! 10: * Copyright (c) 1987, 1985, 1984. ! 11: * An unpublished work by INETCO Systems, Ltd. ! 12: * All rights reserved. ! 13: */ ! 14: ! 15: /* ! 16: * System V Compatible Message Device Driver ! 17: * ! 18: * This device driver provides System V compatible messaging operations. ! 19: * Operations are performed through the message device (/dev/msg). ! 20: * and are implemented as ioctl calls from msgctl, msgget, msgsnd, msgrcv ! 21: * utilities. ! 22: * ! 23: * Author: Allan Cornish, INETCO Systems Ltd., Oct 1984 ! 24: * ! 25: * $Log: msgcon.c,v $ ! 26: * Revision 1.1 92/07/17 15:24:36 bin ! 27: * Initial revision ! 28: * ! 29: * Revision 2.1 88/09/03 13:09:32 src ! 30: * *** empty log message *** ! 31: * ! 32: * Revision 1.1 88/03/24 17:05:49 src ! 33: * Initial revision ! 34: * ! 35: * 87/03/02 Allan Cornish /usr/src/sys/i8086/drv/msgcon.c ! 36: * Msgioctl() now supports long key [was short] on MSGGET operations. ! 37: * This allows compatability with System V. ! 38: * ! 39: * 85/08/06 Allan Cornish ! 40: * Msg.c split into configuration (msgcon.c) and implementation (msg.c). ! 41: * ! 42: * 85/07/03 Allan Cornish ! 43: * Simplified msgopen by ignoring minor device, which previously had to be 0. ! 44: * ! 45: * 84/01/30 Allan Cornish ! 46: * Initial revision. ! 47: */ ! 48: ! 49: #include <coherent.h> ! 50: #include <types.h> ! 51: #include <errno.h> ! 52: #include <con.h> ! 53: #include <msg.h> ! 54: ! 55: /* ! 56: * Functions. ! 57: */ ! 58: ! 59: int msgopen(); ! 60: int msgioctl(); ! 61: int nulldev(); ! 62: int nonedev(); ! 63: ! 64: /* ! 65: * Device Configuration. ! 66: */ ! 67: ! 68: CON msgcon = { ! 69: DFCHR, /* Flags */ ! 70: 25, /* Major Index */ ! 71: msgopen, /* Open */ ! 72: nulldev, /* Close */ ! 73: nonedev, /* Block */ ! 74: nonedev, /* Read */ ! 75: nonedev, /* Write */ ! 76: msgioctl, /* Ioctl */ ! 77: nulldev, /* Power fail */ ! 78: nulldev, /* Timeout */ ! 79: nulldev, /* Load */ ! 80: nulldev /* Unload */ ! 81: }; ! 82: ! 83: /* ! 84: * Message Device Open. ! 85: */ ! 86: ! 87: static ! 88: msgopen( dev, mode ) ! 89: ! 90: dev_t dev; ! 91: int mode; ! 92: ! 93: { ! 94: extern struct msqid_ds * msqs; /* Pointer to array of message queues */ ! 95: ! 96: if ( ! msqs ) /* message queues not initialized */ ! 97: msginit(); ! 98: ! 99: if ( ! msqs ) /* no message queues */ ! 100: u.u_error = ENODEV; ! 101: } ! 102: ! 103: /* ! 104: * Message Device Ioctl. ! 105: */ ! 106: ! 107: static ! 108: msgioctl( dev, com, vec ) ! 109: ! 110: dev_t dev; ! 111: int com; ! 112: register int *vec; ! 113: ! 114: { ! 115: switch ( com ) { ! 116: ! 117: case MSGCTL: ! 118: putuwd( vec+0, ! 119: umsgctl(getuwd( vec+1 ), ! 120: getuwd( vec+2 ), ! 121: getuwd( vec+3 ) )); ! 122: return; ! 123: ! 124: case MSGGET: ! 125: putuwd( vec+0, ! 126: umsgget(getuwd( vec+1 ), ! 127: getuwd( vec+2 ), ! 128: getuwd( vec+3 ) )); ! 129: return; ! 130: ! 131: case MSGSND: ! 132: putuwd( vec+0, ! 133: umsgsnd(getuwd( vec+1 ), ! 134: getuwd( vec+2 ), ! 135: getuwd( vec+3 ), ! 136: getuwd( vec+4 ) )); ! 137: return; ! 138: ! 139: case MSGRCV: ! 140: putuwd( vec+0, ! 141: umsgrcv(getuwd( vec+1 ), ! 142: getuwd( vec+2 ), ! 143: getuwd( vec+3 ), ! 144: getuwd( vec+4 ), ! 145: getuwd( vec+5 ), ! 146: getuwd( vec+6 ) )); ! 147: return; ! 148: ! 149: default: ! 150: u.u_error = EINVAL; ! 151: return; ! 152: } ! 153: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.