1*e7776783SApple OSS Distributions /* 2*e7776783SApple OSS Distributions * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved. 3*e7776783SApple OSS Distributions * 4*e7776783SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5*e7776783SApple OSS Distributions * 6*e7776783SApple OSS Distributions * This file contains Original Code and/or Modifications of Original Code 7*e7776783SApple OSS Distributions * as defined in and that are subject to the Apple Public Source License 8*e7776783SApple OSS Distributions * Version 2.0 (the 'License'). You may not use this file except in 9*e7776783SApple OSS Distributions * compliance with the License. The rights granted to you under the License 10*e7776783SApple OSS Distributions * may not be used to create, or enable the creation or redistribution of, 11*e7776783SApple OSS Distributions * unlawful or unlicensed copies of an Apple operating system, or to 12*e7776783SApple OSS Distributions * circumvent, violate, or enable the circumvention or violation of, any 13*e7776783SApple OSS Distributions * terms of an Apple operating system software license agreement. 14*e7776783SApple OSS Distributions * 15*e7776783SApple OSS Distributions * Please obtain a copy of the License at 16*e7776783SApple OSS Distributions * http://www.opensource.apple.com/apsl/ and read it before using this file. 17*e7776783SApple OSS Distributions * 18*e7776783SApple OSS Distributions * The Original Code and all software distributed under the License are 19*e7776783SApple OSS Distributions * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20*e7776783SApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21*e7776783SApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22*e7776783SApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23*e7776783SApple OSS Distributions * Please see the License for the specific language governing rights and 24*e7776783SApple OSS Distributions * limitations under the License. 25*e7776783SApple OSS Distributions * 26*e7776783SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27*e7776783SApple OSS Distributions */ 28*e7776783SApple OSS Distributions /* 29*e7776783SApple OSS Distributions * Copyright (c) 1988 University of Utah. 30*e7776783SApple OSS Distributions * Copyright (c) 1990, 1993 31*e7776783SApple OSS Distributions * The Regents of the University of California. All rights reserved. 32*e7776783SApple OSS Distributions * (c) UNIX System Laboratories, Inc. 33*e7776783SApple OSS Distributions * All or some portions of this file are derived from material licensed 34*e7776783SApple OSS Distributions * to the University of California by American Telephone and Telegraph 35*e7776783SApple OSS Distributions * Co. or Unix System Laboratories, Inc. and are reproduced herein with 36*e7776783SApple OSS Distributions * the permission of UNIX System Laboratories, Inc. 37*e7776783SApple OSS Distributions * 38*e7776783SApple OSS Distributions * This code is derived from software contributed to Berkeley by 39*e7776783SApple OSS Distributions * the Systems Programming Group of the University of Utah Computer 40*e7776783SApple OSS Distributions * Science Department. 41*e7776783SApple OSS Distributions * 42*e7776783SApple OSS Distributions * Redistribution and use in source and binary forms, with or without 43*e7776783SApple OSS Distributions * modification, are permitted provided that the following conditions 44*e7776783SApple OSS Distributions * are met: 45*e7776783SApple OSS Distributions * 1. Redistributions of source code must retain the above copyright 46*e7776783SApple OSS Distributions * notice, this list of conditions and the following disclaimer. 47*e7776783SApple OSS Distributions * 2. Redistributions in binary form must reproduce the above copyright 48*e7776783SApple OSS Distributions * notice, this list of conditions and the following disclaimer in the 49*e7776783SApple OSS Distributions * documentation and/or other materials provided with the distribution. 50*e7776783SApple OSS Distributions * 3. All advertising materials mentioning features or use of this software 51*e7776783SApple OSS Distributions * must display the following acknowledgement: 52*e7776783SApple OSS Distributions * This product includes software developed by the University of 53*e7776783SApple OSS Distributions * California, Berkeley and its contributors. 54*e7776783SApple OSS Distributions * 4. Neither the name of the University nor the names of its contributors 55*e7776783SApple OSS Distributions * may be used to endorse or promote products derived from this software 56*e7776783SApple OSS Distributions * without specific prior written permission. 57*e7776783SApple OSS Distributions * 58*e7776783SApple OSS Distributions * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 59*e7776783SApple OSS Distributions * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 60*e7776783SApple OSS Distributions * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 61*e7776783SApple OSS Distributions * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 62*e7776783SApple OSS Distributions * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 63*e7776783SApple OSS Distributions * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 64*e7776783SApple OSS Distributions * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 65*e7776783SApple OSS Distributions * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 66*e7776783SApple OSS Distributions * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 67*e7776783SApple OSS Distributions * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 68*e7776783SApple OSS Distributions * SUCH DAMAGE. 69*e7776783SApple OSS Distributions * 70*e7776783SApple OSS Distributions * @(#)ipc.h 8.4 (Berkeley) 2/19/95 71*e7776783SApple OSS Distributions */ 72*e7776783SApple OSS Distributions 73*e7776783SApple OSS Distributions /* 74*e7776783SApple OSS Distributions * SVID compatible ipc.h file 75*e7776783SApple OSS Distributions */ 76*e7776783SApple OSS Distributions #ifndef _SYS_IPC_H_ 77*e7776783SApple OSS Distributions #define _SYS_IPC_H_ 78*e7776783SApple OSS Distributions 79*e7776783SApple OSS Distributions #include <sys/appleapiopts.h> 80*e7776783SApple OSS Distributions #include <sys/cdefs.h> 81*e7776783SApple OSS Distributions 82*e7776783SApple OSS Distributions #include <sys/_types.h> 83*e7776783SApple OSS Distributions 84*e7776783SApple OSS Distributions /* 85*e7776783SApple OSS Distributions * [XSI] The uid_t, gid_t, mode_t, and key_t types SHALL be defined as 86*e7776783SApple OSS Distributions * described in <sys/types.h>. 87*e7776783SApple OSS Distributions */ 88*e7776783SApple OSS Distributions #include <sys/_types/_uid_t.h> 89*e7776783SApple OSS Distributions #include <sys/_types/_gid_t.h> 90*e7776783SApple OSS Distributions #include <sys/_types/_mode_t.h> 91*e7776783SApple OSS Distributions #include <sys/_types/_key_t.h> 92*e7776783SApple OSS Distributions 93*e7776783SApple OSS Distributions 94*e7776783SApple OSS Distributions #pragma pack(4) 95*e7776783SApple OSS Distributions 96*e7776783SApple OSS Distributions /* 97*e7776783SApple OSS Distributions * Technically, we should force all code references to the new structure 98*e7776783SApple OSS Distributions * definition, not in just the standards conformance case, and leave the 99*e7776783SApple OSS Distributions * legacy interface there for binary compatibility only. Currently, we 100*e7776783SApple OSS Distributions * are only forcing this for programs requesting standards conformance. 101*e7776783SApple OSS Distributions */ 102*e7776783SApple OSS Distributions #if __DARWIN_UNIX03 || defined(KERNEL) 103*e7776783SApple OSS Distributions /* 104*e7776783SApple OSS Distributions * [XSI] Information used in determining permission to perform an IPC 105*e7776783SApple OSS Distributions * operation 106*e7776783SApple OSS Distributions */ 107*e7776783SApple OSS Distributions struct ipc_perm { 108*e7776783SApple OSS Distributions uid_t uid; /* [XSI] Owner's user ID */ 109*e7776783SApple OSS Distributions gid_t gid; /* [XSI] Owner's group ID */ 110*e7776783SApple OSS Distributions uid_t cuid; /* [XSI] Creator's user ID */ 111*e7776783SApple OSS Distributions gid_t cgid; /* [XSI] Creator's group ID */ 112*e7776783SApple OSS Distributions mode_t mode; /* [XSI] Read/write permission */ 113*e7776783SApple OSS Distributions unsigned short _seq; /* Reserved for internal use */ 114*e7776783SApple OSS Distributions key_t _key; /* Reserved for internal use */ 115*e7776783SApple OSS Distributions }; 116*e7776783SApple OSS Distributions #define __ipc_perm_new ipc_perm 117*e7776783SApple OSS Distributions #else /* !__DARWIN_UNIX03 */ 118*e7776783SApple OSS Distributions #define ipc_perm __ipc_perm_old 119*e7776783SApple OSS Distributions #endif /* !__DARWIN_UNIX03 */ 120*e7776783SApple OSS Distributions 121*e7776783SApple OSS Distributions #if !__DARWIN_UNIX03 122*e7776783SApple OSS Distributions /* 123*e7776783SApple OSS Distributions * Legacy structure; this structure is maintained for binary backward 124*e7776783SApple OSS Distributions * compatability with previous versions of the interface. New code 125*e7776783SApple OSS Distributions * should not use this interface, since ID values may be truncated. 126*e7776783SApple OSS Distributions */ 127*e7776783SApple OSS Distributions struct __ipc_perm_old { 128*e7776783SApple OSS Distributions __uint16_t cuid; /* Creator's user ID */ 129*e7776783SApple OSS Distributions __uint16_t cgid; /* Creator's group ID */ 130*e7776783SApple OSS Distributions __uint16_t uid; /* Owner's user ID */ 131*e7776783SApple OSS Distributions __uint16_t gid; /* Owner's group ID */ 132*e7776783SApple OSS Distributions mode_t mode; /* Read/Write permission */ 133*e7776783SApple OSS Distributions __uint16_t seq; /* Reserved for internal use */ 134*e7776783SApple OSS Distributions key_t key; /* Reserved for internal use */ 135*e7776783SApple OSS Distributions }; 136*e7776783SApple OSS Distributions #endif /* !__DARWIN_UNIX03 */ 137*e7776783SApple OSS Distributions 138*e7776783SApple OSS Distributions #pragma pack() 139*e7776783SApple OSS Distributions 140*e7776783SApple OSS Distributions /* 141*e7776783SApple OSS Distributions * [XSI] Definitions shall be provided for the following constants: 142*e7776783SApple OSS Distributions */ 143*e7776783SApple OSS Distributions 144*e7776783SApple OSS Distributions /* Mode bits */ 145*e7776783SApple OSS Distributions #define IPC_CREAT 001000 /* Create entry if key does not exist */ 146*e7776783SApple OSS Distributions #define IPC_EXCL 002000 /* Fail if key exists */ 147*e7776783SApple OSS Distributions #define IPC_NOWAIT 004000 /* Error if request must wait */ 148*e7776783SApple OSS Distributions 149*e7776783SApple OSS Distributions /* Keys */ 150*e7776783SApple OSS Distributions #define IPC_PRIVATE ((key_t)0) /* Private key */ 151*e7776783SApple OSS Distributions 152*e7776783SApple OSS Distributions /* Control commands */ 153*e7776783SApple OSS Distributions #define IPC_RMID 0 /* Remove identifier */ 154*e7776783SApple OSS Distributions #define IPC_SET 1 /* Set options */ 155*e7776783SApple OSS Distributions #define IPC_STAT 2 /* Get options */ 156*e7776783SApple OSS Distributions 157*e7776783SApple OSS Distributions 158*e7776783SApple OSS Distributions #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) 159*e7776783SApple OSS Distributions 160*e7776783SApple OSS Distributions /* common mode bits */ 161*e7776783SApple OSS Distributions #define IPC_R 000400 /* Read permission */ 162*e7776783SApple OSS Distributions #define IPC_W 000200 /* Write/alter permission */ 163*e7776783SApple OSS Distributions #define IPC_M 010000 /* Modify control info permission */ 164*e7776783SApple OSS Distributions 165*e7776783SApple OSS Distributions #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ 166*e7776783SApple OSS Distributions 167*e7776783SApple OSS Distributions 168*e7776783SApple OSS Distributions #ifdef BSD_KERNEL_PRIVATE 169*e7776783SApple OSS Distributions /* 170*e7776783SApple OSS Distributions * Kernel implementation details which should not be utilized by user 171*e7776783SApple OSS Distributions * space programs. 172*e7776783SApple OSS Distributions */ 173*e7776783SApple OSS Distributions 174*e7776783SApple OSS Distributions /* Macros to convert between ipc ids and array indices or sequence ids */ 175*e7776783SApple OSS Distributions #define IPCID_TO_IX(id) ((id) & 0xffff) 176*e7776783SApple OSS Distributions #define IPCID_TO_SEQ(id) (((id) >> 16) & 0xffff) 177*e7776783SApple OSS Distributions #define IXSEQ_TO_IPCID(ix, perm) (((perm._seq) << 16L) | ((ix) & 0xffff)) 178*e7776783SApple OSS Distributions 179*e7776783SApple OSS Distributions struct ucred; 180*e7776783SApple OSS Distributions 181*e7776783SApple OSS Distributions int ipcperm(struct ucred *, struct ipc_perm *, int); 182*e7776783SApple OSS Distributions #endif /* BSD_KERNEL_PRIVATE */ 183*e7776783SApple OSS Distributions 184*e7776783SApple OSS Distributions #ifndef KERNEL 185*e7776783SApple OSS Distributions 186*e7776783SApple OSS Distributions __BEGIN_DECLS 187*e7776783SApple OSS Distributions /* [XSI] */ 188*e7776783SApple OSS Distributions key_t ftok(const char *, int); 189*e7776783SApple OSS Distributions __END_DECLS 190*e7776783SApple OSS Distributions 191*e7776783SApple OSS Distributions #endif /* !KERNEL */ 192*e7776783SApple OSS Distributions 193*e7776783SApple OSS Distributions #endif /* !_SYS_IPC_H_ */ 194