Annotation of coherent/b/STREAMS/io.386/ipc.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Inter-Process Communication common access routine.
                      3:  *
                      4:  * $Log:       ipc.c,v $
                      5:  * Revision 2.2  93/07/26  15:28:59  nigel
                      6:  * Nigel's R80
                      7:  * 
                      8:  * Revision 1.3  93/04/14  10:11:48  root
                      9:  * r75
                     10:  * 
                     11:  * Revision 1.1        88/03/24  17:05:02      src
                     12:  * Initial revision
                     13:  * 
                     14:  */
                     15: #include <sys/coherent.h>
                     16: #include <sys/ipc.h>
                     17: 
                     18: /*
                     19:  * Determine Inter-Process Communication Access Permissions.
                     20:  *
                     21:  *     Input:  p = pointer to inter-process communication permission struct.
                     22:  *
                     23:  *     Action: If super user, permissions are 0600.
                     24:  *             If uid is that of the creator or owner of the message id,
                     25:  *                     use user permissions.
                     26:  *             If gid is that of the creator or owner of the message id,
                     27:  *                     use group permissions.
                     28:  *             Otherwise, use others permissions.
                     29:  *
                     30:  *     Output: 0600 = Read/Alter permission.
                     31:  *             0400 = Read permission.
                     32:  *             0200 = Alter permission.
                     33:  *                0 = No permission.
                     34:  */
                     35: int
                     36: ipcaccess(p)
                     37: register struct ipc_perm * p;
                     38: {
                     39:        if (u.u_uid == 0)
                     40:                return 0600;
                     41: 
                     42:        if ((u.u_uid == p->uid) || (u.u_uid == p->cuid))
                     43:                return p->mode & 0600;
                     44: 
                     45:        if ((u.u_gid == p->gid) || (u.u_gid == p->cgid))
                     46:                return (p->mode << 3) & 0600;
                     47: 
                     48:        return (p->mode << 6) & 0600;
                     49: }

unix.superglobalmegacorp.com

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