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