williamr@2: /*- williamr@2: *© Portions copyright (c) 2006 Nokia Corporation. All rights reserved. williamr@2: * Copyright (c) 1988 University of Utah. williamr@2: * Copyright (c) 1990, 1993 williamr@2: * The Regents of the University of California. All rights reserved. williamr@2: * (c) UNIX System Laboratories, Inc. williamr@2: * All or some portions of this file are derived from material licensed williamr@2: * to the University of California by American Telephone and Telegraph williamr@2: * Co. or Unix System Laboratories, Inc. and are reproduced herein with williamr@2: * the permission of UNIX System Laboratories, Inc. williamr@2: * williamr@2: * This code is derived from software contributed to Berkeley by williamr@2: * the Systems Programming Group of the University of Utah Computer williamr@2: * Science Department. williamr@2: * williamr@2: * Redistribution and use in source and binary forms, with or without williamr@2: * modification, are permitted provided that the following conditions williamr@2: * are met: williamr@2: * 1. Redistributions of source code must retain the above copyright williamr@2: * notice, this list of conditions and the following disclaimer. williamr@2: * 2. Redistributions in binary form must reproduce the above copyright williamr@2: * notice, this list of conditions and the following disclaimer in the williamr@2: * documentation and/or other materials provided with the distribution. williamr@2: * 4. Neither the name of the University nor the names of its contributors williamr@2: * may be used to endorse or promote products derived from this software williamr@2: * without specific prior written permission. williamr@2: * williamr@2: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND williamr@2: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE williamr@2: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE williamr@2: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE williamr@2: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL williamr@2: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS williamr@2: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) williamr@2: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT williamr@2: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY williamr@2: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF williamr@2: * SUCH DAMAGE. williamr@2: * williamr@2: * @(#)ipc.h 8.4 (Berkeley) 2/19/95 williamr@2: * $FreeBSD: src/sys/sys/ipc.h,v 1.25 2005/01/07 02:29:23 imp Exp $ williamr@2: */ williamr@2: williamr@2: /* williamr@2: * SVID compatible ipc.h file williamr@2: */ williamr@2: #ifndef _SYS_IPC_H_ williamr@2: #define _SYS_IPC_H_ williamr@2: williamr@2: #include williamr@2: #include williamr@2: williamr@2: #ifndef _GID_T_DECLARED williamr@2: typedef __gid_t gid_t; williamr@2: #define _GID_T_DECLARED williamr@2: #endif williamr@2: williamr@2: #ifndef _KEY_T_DECLARED williamr@2: typedef __key_t key_t; williamr@2: #define _KEY_T_DECLARED williamr@2: #endif williamr@2: williamr@2: #ifndef _MODE_T_DECLARED williamr@2: typedef __mode_t mode_t; williamr@2: #define _MODE_T_DECLARED williamr@2: #endif williamr@2: williamr@2: #ifndef _UID_T_DECLARED williamr@2: typedef __uid_t uid_t; williamr@2: #define _UID_T_DECLARED williamr@2: #endif williamr@2: williamr@2: /* williamr@2: * XXX almost all members have wrong types. williamr@2: */ williamr@2: struct ipc_perm { williamr@2: unsigned short cuid; /* creator user id */ williamr@2: unsigned short cgid; /* creator group id */ williamr@2: unsigned short uid; /* user id */ williamr@2: unsigned short gid; /* group id */ williamr@2: unsigned short mode; /* r/w permission */ williamr@2: unsigned short seq; /* sequence # (to generate unique ipcid) */ williamr@2: key_t key; /* user specified msg/sem/shm key */ williamr@2: }; williamr@2: williamr@2: #if __BSD_VISIBLE williamr@2: /* common mode bits */ williamr@2: #define IPC_R 000400 /* read permission */ williamr@2: #define IPC_W 000200 /* write/alter permission */ williamr@2: #define IPC_M 010000 /* permission to change control info */ williamr@2: #endif williamr@2: williamr@2: /* SVID required constants (same values as system 5) */ williamr@2: #define IPC_CREAT 001000 /* create entry if key does not exist */ williamr@2: #define IPC_EXCL 002000 /* fail if key exists */ williamr@2: #define IPC_NOWAIT 004000 /* error if request must wait */ williamr@2: williamr@2: #define IPC_PRIVATE (key_t)0 /* private key */ williamr@2: williamr@2: #define IPC_RMID 0 /* remove identifier */ williamr@2: #define IPC_SET 1 /* set options */ williamr@2: #define IPC_STAT 2 /* get options */ williamr@2: #if __BSD_VISIBLE williamr@2: #define IPC_INFO 3 /* get info */ williamr@2: #endif williamr@2: williamr@2: #ifdef _KERNEL williamr@2: /* Macros to convert between ipc ids and array indices or sequence ids */ williamr@2: #define IPCID_TO_IX(id) ((id) & 0xffff) williamr@2: #define IPCID_TO_SEQ(id) (((id) >> 16) & 0xffff) williamr@2: #define IXSEQ_TO_IPCID(ix,perm) (((perm.seq) << 16) | (ix & 0xffff)) williamr@2: williamr@2: struct thread; williamr@2: struct proc; williamr@2: struct vmspace; williamr@2: williamr@2: extern void (*shmfork_hook)(struct proc *, struct proc *); williamr@2: extern void (*shmexit_hook)(struct vmspace *); williamr@2: williamr@2: #else /* ! _KERNEL */ williamr@2: williamr@2: __BEGIN_DECLS williamr@2: /* williamr@2: * Convert a pathname and project identifier to an IPC key. williamr@2: */ williamr@2: IMPORT_C key_t ftok(const char *pathname, int proj_id); williamr@2: williamr@2: __END_DECLS williamr@2: williamr@2: #endif /* _KERNEL */ williamr@2: williamr@2: #endif /* !_SYS_IPC_H_ */ williamr@2: williamr@2: williamr@2: williamr@2: // End of File