[BACK]Return to ipc.h CVS log [TXT][DIR] Up to [local] / sys / sys

Annotation of sys/sys/ipc.h, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: ipc.h,v 1.10 2004/07/15 11:24:46 millert Exp $        */
                      2: /*     $NetBSD: ipc.h,v 1.15 1996/02/09 18:25:12 christos Exp $        */
                      3:
                      4: /*
                      5:  * Copyright (c) 1988 University of Utah.
                      6:  * Copyright (c) 1990, 1993
                      7:  *     The Regents of the University of California.  All rights reserved.
                      8:  * (c) UNIX System Laboratories, Inc.
                      9:  * All or some portions of this file are derived from material licensed
                     10:  * to the University of California by American Telephone and Telegraph
                     11:  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
                     12:  * the permission of UNIX System Laboratories, Inc.
                     13:  *
                     14:  * This code is derived from software contributed to Berkeley by
                     15:  * the Systems Programming Group of the University of Utah Computer
                     16:  * Science Department.
                     17:  *
                     18:  * Redistribution and use in source and binary forms, with or without
                     19:  * modification, are permitted provided that the following conditions
                     20:  * are met:
                     21:  * 1. Redistributions of source code must retain the above copyright
                     22:  *    notice, this list of conditions and the following disclaimer.
                     23:  * 2. Redistributions in binary form must reproduce the above copyright
                     24:  *    notice, this list of conditions and the following disclaimer in the
                     25:  *    documentation and/or other materials provided with the distribution.
                     26:  * 3. Neither the name of the University nor the names of its contributors
                     27:  *    may be used to endorse or promote products derived from this software
                     28:  *    without specific prior written permission.
                     29:  *
                     30:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     31:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     32:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     33:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     34:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     35:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     36:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     37:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     38:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     39:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     40:  * SUCH DAMAGE.
                     41:  *
                     42:  *     @(#)ipc.h       8.3 (Berkeley) 1/21/94
                     43:  */
                     44:
                     45: /*
                     46:  * SVID compatible ipc.h file
                     47:  */
                     48: #ifndef _SYS_IPC_H_
                     49: #define _SYS_IPC_H_
                     50:
                     51: struct ipc_perm {
                     52:        uid_t           cuid;   /* creator user id */
                     53:        gid_t           cgid;   /* creator group id */
                     54:        uid_t           uid;    /* user id */
                     55:        gid_t           gid;    /* group id */
                     56:        mode_t          mode;   /* r/w permission */
                     57:        unsigned short  seq;    /* sequence # (to generate unique msg/sem/shm id) */
                     58:        key_t           key;    /* user specified msg/sem/shm key */
                     59: };
                     60:
                     61: #ifdef _KERNEL
                     62: struct ipc_perm23 {
                     63:        unsigned short  cuid;   /* creator user id */
                     64:        unsigned short  cgid;   /* creator group id */
                     65:        unsigned short  uid;    /* user id */
                     66:        unsigned short  gid;    /* group id */
                     67:        unsigned short  mode;   /* r/w permission */
                     68:        unsigned short  seq;    /* sequence # (to generate unique msg/sem/shm id) */
                     69:        key_t           key;    /* user specified msg/sem/shm key */
                     70: };
                     71:
                     72: struct ipc_perm35 {
                     73:        uid_t           cuid;   /* creator user id */
                     74:        gid_t           cgid;   /* creator group id */
                     75:        uid_t           uid;    /* user id */
                     76:        gid_t           gid;    /* group id */
                     77:        u_int16_t       mode;   /* r/w permission */
                     78:        unsigned short  seq;    /* sequence # (to generate unique msg/sem/shm id) */
                     79:        key_t           key;    /* user specified msg/sem/shm key */
                     80: };
                     81: #endif
                     82:
                     83: /* common mode bits */
                     84: #define        IPC_R           000400  /* read permission */
                     85: #define        IPC_W           000200  /* write/alter permission */
                     86: #define        IPC_M           010000  /* permission to change control info */
                     87:
                     88: /* SVID required constants (same values as system 5) */
                     89: #define        IPC_CREAT       001000  /* create entry if key does not exist */
                     90: #define        IPC_EXCL        002000  /* fail if key exists */
                     91: #define        IPC_NOWAIT      004000  /* error if request must wait */
                     92:
                     93: #define        IPC_PRIVATE     (key_t)0 /* private key */
                     94:
                     95: #define        IPC_RMID        0       /* remove identifier */
                     96: #define        IPC_SET         1       /* set options */
                     97: #define        IPC_STAT        2       /* get options */
                     98:
                     99: #ifdef _KERNEL
                    100: /* Macros to convert between ipc ids and array indices or sequence ids */
                    101: #define        IPCID_TO_IX(id)         ((id) & 0xffff)
                    102: #define        IPCID_TO_SEQ(id)        (((id) >> 16) & 0xffff)
                    103: #define        IXSEQ_TO_IPCID(ix,perm) (((perm.seq) << 16) | (ix & 0xffff))
                    104:
                    105: int ipcperm(struct ucred *, struct ipc_perm *, int);
                    106:
                    107: #else /* !_KERNEL */
                    108:
                    109: #include <sys/cdefs.h>
                    110:
                    111: __BEGIN_DECLS
                    112: key_t  ftok(const char *, int);
                    113: __END_DECLS
                    114: #endif
                    115: #endif /* !_SYS_IPC_H_ */

CVSweb