1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/include/sys/ipc.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,136 @@
1.4 +/*-
1.5 + *© Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
1.6 + * Copyright (c) 1988 University of Utah.
1.7 + * Copyright (c) 1990, 1993
1.8 + * The Regents of the University of California. All rights reserved.
1.9 + * (c) UNIX System Laboratories, Inc.
1.10 + * All or some portions of this file are derived from material licensed
1.11 + * to the University of California by American Telephone and Telegraph
1.12 + * Co. or Unix System Laboratories, Inc. and are reproduced herein with
1.13 + * the permission of UNIX System Laboratories, Inc.
1.14 + *
1.15 + * This code is derived from software contributed to Berkeley by
1.16 + * the Systems Programming Group of the University of Utah Computer
1.17 + * Science Department.
1.18 + *
1.19 + * Redistribution and use in source and binary forms, with or without
1.20 + * modification, are permitted provided that the following conditions
1.21 + * are met:
1.22 + * 1. Redistributions of source code must retain the above copyright
1.23 + * notice, this list of conditions and the following disclaimer.
1.24 + * 2. Redistributions in binary form must reproduce the above copyright
1.25 + * notice, this list of conditions and the following disclaimer in the
1.26 + * documentation and/or other materials provided with the distribution.
1.27 + * 4. Neither the name of the University nor the names of its contributors
1.28 + * may be used to endorse or promote products derived from this software
1.29 + * without specific prior written permission.
1.30 + *
1.31 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1.32 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1.33 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1.34 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1.35 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1.36 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1.37 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1.38 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1.39 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1.40 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1.41 + * SUCH DAMAGE.
1.42 + *
1.43 + * @(#)ipc.h 8.4 (Berkeley) 2/19/95
1.44 + * $FreeBSD: src/sys/sys/ipc.h,v 1.25 2005/01/07 02:29:23 imp Exp $
1.45 + */
1.46 +
1.47 +/*
1.48 + * SVID compatible ipc.h file
1.49 + */
1.50 +#ifndef _SYS_IPC_H_
1.51 +#define _SYS_IPC_H_
1.52 +
1.53 +#include <sys/cdefs.h>
1.54 +#include <sys/types.h>
1.55 +
1.56 +#ifndef _GID_T_DECLARED
1.57 +typedef __gid_t gid_t;
1.58 +#define _GID_T_DECLARED
1.59 +#endif
1.60 +
1.61 +#ifndef _KEY_T_DECLARED
1.62 +typedef __key_t key_t;
1.63 +#define _KEY_T_DECLARED
1.64 +#endif
1.65 +
1.66 +#ifndef _MODE_T_DECLARED
1.67 +typedef __mode_t mode_t;
1.68 +#define _MODE_T_DECLARED
1.69 +#endif
1.70 +
1.71 +#ifndef _UID_T_DECLARED
1.72 +typedef __uid_t uid_t;
1.73 +#define _UID_T_DECLARED
1.74 +#endif
1.75 +
1.76 +/*
1.77 + * XXX almost all members have wrong types.
1.78 + */
1.79 +struct ipc_perm {
1.80 + unsigned short cuid; /* creator user id */
1.81 + unsigned short cgid; /* creator group id */
1.82 + unsigned short uid; /* user id */
1.83 + unsigned short gid; /* group id */
1.84 + unsigned short mode; /* r/w permission */
1.85 + unsigned short seq; /* sequence # (to generate unique ipcid) */
1.86 + key_t key; /* user specified msg/sem/shm key */
1.87 +};
1.88 +
1.89 +#if __BSD_VISIBLE
1.90 +/* common mode bits */
1.91 +#define IPC_R 000400 /* read permission */
1.92 +#define IPC_W 000200 /* write/alter permission */
1.93 +#define IPC_M 010000 /* permission to change control info */
1.94 +#endif
1.95 +
1.96 +/* SVID required constants (same values as system 5) */
1.97 +#define IPC_CREAT 001000 /* create entry if key does not exist */
1.98 +#define IPC_EXCL 002000 /* fail if key exists */
1.99 +#define IPC_NOWAIT 004000 /* error if request must wait */
1.100 +
1.101 +#define IPC_PRIVATE (key_t)0 /* private key */
1.102 +
1.103 +#define IPC_RMID 0 /* remove identifier */
1.104 +#define IPC_SET 1 /* set options */
1.105 +#define IPC_STAT 2 /* get options */
1.106 +#if __BSD_VISIBLE
1.107 +#define IPC_INFO 3 /* get info */
1.108 +#endif
1.109 +
1.110 +#ifdef _KERNEL
1.111 +/* Macros to convert between ipc ids and array indices or sequence ids */
1.112 +#define IPCID_TO_IX(id) ((id) & 0xffff)
1.113 +#define IPCID_TO_SEQ(id) (((id) >> 16) & 0xffff)
1.114 +#define IXSEQ_TO_IPCID(ix,perm) (((perm.seq) << 16) | (ix & 0xffff))
1.115 +
1.116 +struct thread;
1.117 +struct proc;
1.118 +struct vmspace;
1.119 +
1.120 +extern void (*shmfork_hook)(struct proc *, struct proc *);
1.121 +extern void (*shmexit_hook)(struct vmspace *);
1.122 +
1.123 +#else /* ! _KERNEL */
1.124 +
1.125 +__BEGIN_DECLS
1.126 +/*
1.127 +* Convert a pathname and project identifier to an IPC key.
1.128 +*/
1.129 +IMPORT_C key_t ftok(const char *pathname, int proj_id);
1.130 +
1.131 +__END_DECLS
1.132 +
1.133 +#endif /* _KERNEL */
1.134 +
1.135 +#endif /* !_SYS_IPC_H_ */
1.136 +
1.137 +
1.138 +
1.139 +// End of File