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