epoc32/include/stdapis/sys/ipc.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 ipc.h
     1 /*-
       
     2  *© Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
       
     3  * Copyright (c) 1988 University of Utah.
       
     4  * Copyright (c) 1990, 1993
       
     5  *	The Regents of the University of California.  All rights reserved.
       
     6  * (c) UNIX System Laboratories, Inc.
       
     7  * All or some portions of this file are derived from material licensed
       
     8  * to the University of California by American Telephone and Telegraph
       
     9  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
       
    10  * the permission of UNIX System Laboratories, Inc.
       
    11  *
       
    12  * This code is derived from software contributed to Berkeley by
       
    13  * the Systems Programming Group of the University of Utah Computer
       
    14  * Science Department.
       
    15  *
       
    16  * Redistribution and use in source and binary forms, with or without
       
    17  * modification, are permitted provided that the following conditions
       
    18  * are met:
       
    19  * 1. Redistributions of source code must retain the above copyright
       
    20  *    notice, this list of conditions and the following disclaimer.
       
    21  * 2. Redistributions in binary form must reproduce the above copyright
       
    22  *    notice, this list of conditions and the following disclaimer in the
       
    23  *    documentation and/or other materials provided with the distribution.
       
    24  * 4. Neither the name of the University nor the names of its contributors
       
    25  *    may be used to endorse or promote products derived from this software
       
    26  *    without specific prior written permission.
       
    27  *
       
    28  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
       
    29  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
       
    30  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
       
    31  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
       
    32  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
       
    33  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
       
    34  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
       
    35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
       
    36  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
       
    37  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
       
    38  * SUCH DAMAGE.
       
    39  *
       
    40  *	@(#)ipc.h	8.4 (Berkeley) 2/19/95
       
    41  * $FreeBSD: src/sys/sys/ipc.h,v 1.25 2005/01/07 02:29:23 imp Exp $
       
    42  */
       
    43 
       
    44 /*
       
    45  * SVID compatible ipc.h file
       
    46  */
       
    47 #ifndef _SYS_IPC_H_
       
    48 #define _SYS_IPC_H_
       
    49 
       
    50 #include <sys/cdefs.h>
       
    51 #include <sys/types.h>
       
    52 
       
    53 #ifndef _GID_T_DECLARED
       
    54 typedef	__gid_t		gid_t;
       
    55 #define	_GID_T_DECLARED
       
    56 #endif
       
    57 
       
    58 #ifndef _KEY_T_DECLARED
       
    59 typedef	__key_t		key_t;
       
    60 #define	_KEY_T_DECLARED
       
    61 #endif
       
    62 
       
    63 #ifndef _MODE_T_DECLARED
       
    64 typedef	__mode_t	mode_t;
       
    65 #define	_MODE_T_DECLARED
       
    66 #endif
       
    67 
       
    68 #ifndef _UID_T_DECLARED
       
    69 typedef	__uid_t		uid_t;
       
    70 #define	_UID_T_DECLARED
       
    71 #endif
       
    72 
       
    73 /*
       
    74  * XXX almost all members have wrong types.
       
    75  */
       
    76 struct ipc_perm {
       
    77 	unsigned short	cuid;	/* creator user id */
       
    78 	unsigned short	cgid;	/* creator group id */
       
    79 	unsigned short	uid;	/* user id */
       
    80 	unsigned short	gid;	/* group id */
       
    81 	unsigned short	mode;	/* r/w permission */
       
    82 	unsigned short	seq;	/* sequence # (to generate unique ipcid) */
       
    83 	key_t		key;	/* user specified msg/sem/shm key */
       
    84 };
       
    85 
       
    86 #if __BSD_VISIBLE
       
    87 /* common mode bits */
       
    88 #define	IPC_R		000400	/* read permission */
       
    89 #define	IPC_W		000200	/* write/alter permission */
       
    90 #define	IPC_M		010000	/* permission to change control info */
       
    91 #endif
       
    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 #if __BSD_VISIBLE
       
   104 #define	IPC_INFO	3	/* get info */
       
   105 #endif
       
   106 
       
   107 #ifdef _KERNEL
       
   108 /* Macros to convert between ipc ids and array indices or sequence ids */
       
   109 #define	IPCID_TO_IX(id)		((id) & 0xffff)
       
   110 #define	IPCID_TO_SEQ(id)	(((id) >> 16) & 0xffff)
       
   111 #define	IXSEQ_TO_IPCID(ix,perm)	(((perm.seq) << 16) | (ix & 0xffff))
       
   112 
       
   113 struct thread;
       
   114 struct proc;
       
   115 struct vmspace;
       
   116 
       
   117 extern void (*shmfork_hook)(struct proc *, struct proc *);
       
   118 extern void (*shmexit_hook)(struct vmspace *);
       
   119 
       
   120 #else /* ! _KERNEL */
       
   121 
       
   122 __BEGIN_DECLS
       
   123 /*
       
   124 * Convert a pathname and project identifier to an IPC key.
       
   125 */
       
   126 IMPORT_C key_t ftok(const char *pathname, int proj_id);
       
   127 
       
   128 __END_DECLS
       
   129 
       
   130 #endif /* _KERNEL */
       
   131 
       
   132 #endif /* !_SYS_IPC_H_ */
       
   133 
       
   134 
       
   135 
       
   136 //  End of File