]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
9bccf70c | 2 | * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved. |
1c79356b A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
d7e50217 | 6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. |
1c79356b | 7 | * |
d7e50217 A |
8 | * This file contains Original Code and/or Modifications of Original Code |
9 | * as defined in and that are subject to the Apple Public Source License | |
10 | * Version 2.0 (the 'License'). You may not use this file except in | |
11 | * compliance with the License. Please obtain a copy of the License at | |
12 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | * file. | |
14 | * | |
15 | * The Original Code and all software distributed under the License are | |
16 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
d7e50217 A |
19 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
20 | * Please see the License for the specific language governing rights and | |
21 | * limitations under the License. | |
1c79356b A |
22 | * |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | /* | |
26 | * Copyright (c) 1988 University of Utah. | |
27 | * Copyright (c) 1990, 1993 | |
28 | * The Regents of the University of California. All rights reserved. | |
29 | * (c) UNIX System Laboratories, Inc. | |
30 | * All or some portions of this file are derived from material licensed | |
31 | * to the University of California by American Telephone and Telegraph | |
32 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | |
33 | * the permission of UNIX System Laboratories, Inc. | |
34 | * | |
35 | * This code is derived from software contributed to Berkeley by | |
36 | * the Systems Programming Group of the University of Utah Computer | |
37 | * Science Department. | |
38 | * | |
39 | * Redistribution and use in source and binary forms, with or without | |
40 | * modification, are permitted provided that the following conditions | |
41 | * are met: | |
42 | * 1. Redistributions of source code must retain the above copyright | |
43 | * notice, this list of conditions and the following disclaimer. | |
44 | * 2. Redistributions in binary form must reproduce the above copyright | |
45 | * notice, this list of conditions and the following disclaimer in the | |
46 | * documentation and/or other materials provided with the distribution. | |
47 | * 3. All advertising materials mentioning features or use of this software | |
48 | * must display the following acknowledgement: | |
49 | * This product includes software developed by the University of | |
50 | * California, Berkeley and its contributors. | |
51 | * 4. Neither the name of the University nor the names of its contributors | |
52 | * may be used to endorse or promote products derived from this software | |
53 | * without specific prior written permission. | |
54 | * | |
55 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
56 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
57 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
58 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
59 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
60 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
61 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
62 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
63 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
64 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
65 | * SUCH DAMAGE. | |
66 | * | |
67 | * @(#)ipc.h 8.4 (Berkeley) 2/19/95 | |
68 | */ | |
69 | ||
9bccf70c A |
70 | #include <sys/appleapiopts.h> |
71 | ||
1c79356b A |
72 | /* |
73 | * SVID compatible ipc.h file | |
74 | */ | |
75 | #ifndef _SYS_IPC_H_ | |
76 | #define _SYS_IPC_H_ | |
77 | ||
78 | struct ipc_perm { | |
79 | ushort cuid; /* creator user id */ | |
80 | ushort cgid; /* creator group id */ | |
81 | ushort uid; /* user id */ | |
82 | ushort gid; /* group id */ | |
83 | ushort mode; /* r/w permission */ | |
84 | ushort seq; /* sequence # (to generate unique msg/sem/shm id) */ | |
85 | key_t key; /* user specified msg/sem/shm key */ | |
86 | }; | |
87 | ||
88 | /* common mode bits */ | |
89 | #define IPC_R 000400 /* read permission */ | |
90 | #define IPC_W 000200 /* write/alter permission */ | |
91 | #define IPC_M 010000 /* permission to change control info */ | |
92 | ||
93 | /* SVID required constants (same values as system 5) */ | |
94 | #define IPC_CREAT 001000 /* create entry if key does not exist */ | |
95 | #define IPC_EXCL 002000 /* fail if key exists */ | |
96 | #define IPC_NOWAIT 004000 /* error if request must wait */ | |
97 | ||
98 | #define IPC_PRIVATE (key_t)0 /* private key */ | |
99 | ||
100 | #define IPC_RMID 0 /* remove identifier */ | |
101 | #define IPC_SET 1 /* set options */ | |
102 | #define IPC_STAT 2 /* get options */ | |
103 | ||
104 | #ifdef KERNEL | |
9bccf70c A |
105 | #ifdef __APPLE_API_PRIVATE |
106 | ||
1c79356b A |
107 | /* Macros to convert between ipc ids and array indices or sequence ids */ |
108 | #define IPCID_TO_IX(id) ((id) & 0xffff) | |
109 | #define IPCID_TO_SEQ(id) (((id) >> 16) & 0xffff) | |
110 | #define IXSEQ_TO_IPCID(ix,perm) (((perm.seq) << 16) | (ix & 0xffff)) | |
111 | ||
112 | struct ucred; | |
113 | ||
114 | int ipcperm __P((struct ucred *, struct ipc_perm *, int)); | |
9bccf70c | 115 | #endif /* __APPLE_API_PRIVATE */ |
1c79356b A |
116 | #else /* ! KERNEL */ |
117 | ||
118 | /* XXX doesn't really belong here, but has been historical practice in SysV. */ | |
119 | ||
120 | #include <sys/cdefs.h> | |
121 | ||
122 | __BEGIN_DECLS | |
123 | key_t ftok __P((const char *, int)); | |
124 | __END_DECLS | |
125 | ||
126 | #endif /* KERNEL */ | |
127 | ||
128 | #endif /* !_SYS_IPC_H_ */ |