Annotation of coherent/d/286_KERNEL/USRSRC/io/msgcon.c, revision 1.1

1.1     ! root        1: /* $Header: /usr/src/sys/i8086/drv/RCS/msgcon.c,v 2.1 88/09/03 13:09:32 src Exp $
        !             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:       /usr/src/sys/i8086/drv/RCS/msgcon.c,v $
        !            26:  * Revision 2.1        88/09/03  13:09:32      src
        !            27:  * *** empty log message ***
        !            28:  * 
        !            29:  * Revision 1.1        88/03/24  17:05:49      src
        !            30:  * Initial revision
        !            31:  * 
        !            32:  * 87/03/02    Allan Cornish           /usr/src/sys/i8086/drv/msgcon.c
        !            33:  * Msgioctl() now supports long key [was short] on MSGGET operations.
        !            34:  * This allows compatability with System V.
        !            35:  *
        !            36:  * 85/08/06    Allan Cornish
        !            37:  * Msg.c split into configuration (msgcon.c) and implementation (msg.c).
        !            38:  *
        !            39:  * 85/07/03    Allan Cornish
        !            40:  * Simplified msgopen by ignoring minor device, which previously had to be 0.
        !            41:  *
        !            42:  * 84/01/30    Allan Cornish
        !            43:  * Initial revision.
        !            44:  */
        !            45: 
        !            46: #include <coherent.h>
        !            47: #include <types.h>
        !            48: #include <uproc.h>
        !            49: #include <errno.h>
        !            50: #include <con.h>
        !            51: #include <msg.h>
        !            52: 
        !            53: /*
        !            54:  * Functions.
        !            55:  */
        !            56: 
        !            57: int msgopen();
        !            58: int msgioctl();
        !            59: int nulldev();
        !            60: int nonedev();
        !            61: 
        !            62: /*
        !            63:  * Device Configuration.
        !            64:  */
        !            65: 
        !            66: CON msgcon = {
        !            67:        DFCHR,                  /* Flags                        */
        !            68:        25,                     /* Major Index                  */
        !            69:        msgopen,                /* Open                         */
        !            70:        nulldev,                /* Close                        */
        !            71:        nonedev,                /* Block                        */
        !            72:        nonedev,                /* Read                         */
        !            73:        nonedev,                /* Write                        */
        !            74:        msgioctl,               /* Ioctl                        */
        !            75:        nulldev,                /* Power fail                   */
        !            76:        nulldev,                /* Timeout                      */
        !            77:        nulldev,                /* Load                         */
        !            78:        nulldev                 /* Unload                       */
        !            79: };
        !            80: 
        !            81: /*
        !            82:  * Message Device Open.
        !            83:  */
        !            84: 
        !            85: static
        !            86: msgopen( dev, mode )
        !            87: 
        !            88: dev_t dev;
        !            89: int mode;
        !            90: 
        !            91: {
        !            92:        extern struct msqid_ds * msqs; /* Pointer to array of message queues */
        !            93: 
        !            94:        if ( ! msqs )                   /* message queues not initialized */
        !            95:                msginit();
        !            96: 
        !            97:        if ( ! msqs )                   /* no message queues */
        !            98:                u.u_error = ENODEV;
        !            99: }
        !           100: 
        !           101: /*
        !           102:  * Message Device Ioctl.
        !           103:  */
        !           104: 
        !           105: static
        !           106: msgioctl( dev, com, vec )
        !           107: 
        !           108: dev_t dev;
        !           109: int com;
        !           110: register int *vec;
        !           111: 
        !           112: {
        !           113:        switch ( com ) {
        !           114: 
        !           115:        case MSGCTL:
        !           116:                putuwd( vec+0,
        !           117:                        umsgctl(getuwd( vec+1 ),
        !           118:                                getuwd( vec+2 ),
        !           119:                                getuwd( vec+3 ) ));
        !           120:                return;
        !           121: 
        !           122:        case MSGGET:
        !           123:                putuwd( vec+0,
        !           124:                        umsgget(getuwd( vec+1 ),
        !           125:                                getuwd( vec+2 ),
        !           126:                                getuwd( vec+3 ) ));
        !           127:                return;
        !           128: 
        !           129:        case MSGSND:
        !           130:                putuwd( vec+0,
        !           131:                        umsgsnd(getuwd( vec+1 ),
        !           132:                                getuwd( vec+2 ),
        !           133:                                getuwd( vec+3 ),
        !           134:                                getuwd( vec+4 ) ));
        !           135:                return;
        !           136: 
        !           137:        case MSGRCV:
        !           138:                putuwd( vec+0,
        !           139:                        umsgrcv(getuwd( vec+1 ),
        !           140:                                getuwd( vec+2 ),
        !           141:                                getuwd( vec+3 ),
        !           142:                                getuwd( vec+4 ),
        !           143:                                getuwd( vec+5 ),
        !           144:                                getuwd( vec+6 ) ));
        !           145:                return;
        !           146: 
        !           147:        default:
        !           148:                u.u_error = EINVAL;
        !           149:                return;
        !           150:        }
        !           151: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.