linux emulation - Major update
[dragonfly.git] / sys / emulation / linux / linux_ipc.h
blob67d565d2a6789fbf30f5958d127b9c1f8d30aa81
1 /*-
2 * Copyright (c) 2000 Marcel Moolenaar
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer
10 * in this position and unchanged.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 * $FreeBSD: src/sys/compat/linux/linux_ipc.h,v 1.2.2.4 2001/11/05 19:08:22 marcel Exp $
29 * $DragonFly: src/sys/emulation/linux/linux_ipc.h,v 1.7 2003/11/20 06:05:29 dillon Exp $
32 #ifndef _LINUX_IPC_H_
33 #define _LINUX_IPC_H_
35 #ifdef __i386__
38 struct l_msginfo {
39 l_int msgpool;
40 l_int msgmap;
41 l_int msgmax;
42 l_int msgmnb;
43 l_int msgmni;
44 l_int msgssz;
45 l_int msgtql;
46 l_ushort msgseg;
49 struct linux_msgctl_args
51 struct sysmsg sysmsg;
52 l_int msqid;
53 l_int cmd;
54 struct l_msqid_ds *buf;
57 struct linux_msgget_args
59 struct sysmsg sysmsg;
60 l_key_t key;
61 l_int msgflg;
64 struct linux_msgrcv_args
66 struct sysmsg sysmsg;
67 l_int msqid;
68 struct l_msgbuf *msgp;
69 l_size_t msgsz;
70 l_long msgtyp;
71 l_int msgflg;
74 struct linux_msgsnd_args
76 struct sysmsg sysmsg;
77 l_int msqid;
78 struct l_msgbuf *msgp;
79 l_size_t msgsz;
80 l_int msgflg;
83 struct linux_semctl_args
85 struct sysmsg sysmsg;
86 l_int semid;
87 l_int semnum;
88 l_int cmd;
89 union l_semun arg;
92 struct linux_semget_args
94 struct sysmsg sysmsg;
95 l_key_t key;
96 l_int nsems;
97 l_int semflg;
100 struct linux_semop_args
102 struct sysmsg sysmsg;
103 l_int semid;
104 struct l_sembuf *tsops;
105 l_uint nsops;
108 struct linux_shmat_args
110 struct sysmsg sysmsg;
111 l_int shmid;
112 char *shmaddr;
113 l_int shmflg;
114 l_ulong *raddr;
117 struct linux_shmctl_args
119 struct sysmsg sysmsg;
120 l_int shmid;
121 l_int cmd;
122 struct l_shmid_ds *buf;
125 struct linux_shmdt_args
127 struct sysmsg sysmsg;
128 char *shmaddr;
131 struct linux_shmget_args
133 struct sysmsg sysmsg;
134 l_key_t key;
135 l_size_t size;
136 l_int shmflg;
141 struct l_seminfo {
142 l_int semmap;
143 l_int semmni;
144 l_int semmns;
145 l_int semmnu;
146 l_int semmsl;
147 l_int semopm;
148 l_int semume;
149 l_int semusz;
150 l_int semvmx;
151 l_int semaem;
155 struct l_shminfo {
156 l_int shmmax;
157 l_int shmmin;
158 l_int shmmni;
159 l_int shmseg;
160 l_int shmall;
163 struct l_shm_info {
164 l_int used_ids;
165 l_ulong shm_tot; /* total allocated shm */
166 l_ulong shm_rss; /* total resident shm */
167 l_ulong shm_swp; /* total swapped shm */
168 l_ulong swap_attempts;
169 l_ulong swap_successes;
173 struct l_ipc64_perm
175 l_key_t key;
176 l_uid_t uid;
177 l_gid_t gid;
178 l_uid_t cuid;
179 l_gid_t cgid;
180 l_mode_t mode;
181 l_ushort __pad1;
182 l_ushort seq;
183 l_ushort __pad2;
184 l_ulong __unused1;
185 l_ulong __unused2;
189 * The msqid64_ds structure for i386 architecture.
190 * Note extra padding because this structure is passed back and forth
191 * between kernel and user space.
193 * Pad space is left for:
194 * - 64-bit time_t to solve y2038 problem
195 * - 2 miscellaneous 32-bit values
198 struct l_msqid64_ds {
199 struct l_ipc64_perm msg_perm;
200 l_time_t msg_stime; /* last msgsnd time */
201 l_ulong __unused1;
202 l_time_t msg_rtime; /* last msgrcv time */
203 l_ulong __unused2;
204 l_time_t msg_ctime; /* last change time */
205 l_ulong __unused3;
206 l_ulong msg_cbytes; /* current number of bytes on queue */
207 l_ulong msg_qnum; /* number of messages in queue */
208 l_ulong msg_qbytes; /* max number of bytes on queue */
209 l_pid_t msg_lspid; /* pid of last msgsnd */
210 l_pid_t msg_lrpid; /* last receive pid */
211 l_ulong __unused4;
212 l_ulong __unused5;
216 * The semid64_ds structure for i386 architecture.
217 * Note extra padding because this structure is passed back and forth
218 * between kernel and user space.
220 * Pad space is left for:
221 * - 64-bit time_t to solve y2038 problem
222 * - 2 miscellaneous 32-bit values
225 struct l_semid64_ds {
226 struct l_ipc64_perm sem_perm; /* permissions */
227 l_time_t sem_otime; /* last semop time */
228 l_ulong __unused1;
229 l_time_t sem_ctime; /* last change time */
230 l_ulong __unused2;
231 l_ulong sem_nsems; /* no. of semaphores in array */
232 l_ulong __unused3;
233 l_ulong __unused4;
237 * The shmid64_ds structure for i386 architecture.
238 * Note extra padding because this structure is passed back and forth
239 * between kernel and user space.
241 * Pad space is left for:
242 * - 64-bit time_t to solve y2038 problem
243 * - 2 miscellaneous 32-bit values
246 struct l_shmid64_ds {
247 struct l_ipc64_perm shm_perm; /* operation perms */
248 l_size_t shm_segsz; /* size of segment (bytes) */
249 l_time_t shm_atime; /* last attach time */
250 l_ulong __unused1;
251 l_time_t shm_dtime; /* last detach time */
252 l_ulong __unused2;
253 l_time_t shm_ctime; /* last change time */
254 l_ulong __unused3;
255 l_pid_t shm_cpid; /* pid of creator */
256 l_pid_t shm_lpid; /* pid of last operator */
257 l_ulong shm_nattch; /* no. of current attaches */
258 l_ulong __unused4;
259 l_ulong __unused5;
262 struct l_shminfo64 {
263 l_ulong shmmax;
264 l_ulong shmmin;
265 l_ulong shmmni;
266 l_ulong shmseg;
267 l_ulong shmall;
268 l_ulong __unused1;
269 l_ulong __unused2;
270 l_ulong __unused3;
271 l_ulong __unused4;
275 struct l_ipc_perm {
276 l_key_t key;
277 l_uid16_t uid;
278 l_gid16_t gid;
279 l_uid16_t cuid;
280 l_gid16_t cgid;
281 l_ushort mode;
282 l_ushort seq;
285 struct l_msqid_ds {
286 struct l_ipc_perm msg_perm;
287 l_uintptr_t msg_first; /* first message on queue,unused */
288 l_uintptr_t msg_last; /* last message in queue,unused */
289 l_time_t msg_stime; /* last msgsnd time */
290 l_time_t msg_rtime; /* last msgrcv time */
291 l_time_t msg_ctime; /* last change time */
292 l_ulong msg_lcbytes; /* Reuse junk fields for 32 bit */
293 l_ulong msg_lqbytes; /* ditto */
294 l_ushort msg_cbytes; /* current number of bytes on queue */
295 l_ushort msg_qnum; /* number of messages in queue */
296 l_ushort msg_qbytes; /* max number of bytes on queue */
297 l_pid_t msg_lspid; /* pid of last msgsnd */
298 l_pid_t msg_lrpid; /* last receive pid */
301 struct l_semid_ds {
302 struct l_ipc_perm sem_perm;
303 l_time_t sem_otime;
304 l_time_t sem_ctime;
305 void *sem_base;
306 void *sem_pending;
307 void *sem_pending_last;
308 void *undo;
309 l_ushort sem_nsems;
312 struct l_shmid_ds {
313 struct l_ipc_perm shm_perm;
314 l_int shm_segsz;
315 l_time_t shm_atime;
316 l_time_t shm_dtime;
317 l_time_t shm_ctime;
318 l_ushort shm_cpid;
319 l_ushort shm_lpid;
320 l_short shm_nattch;
321 l_ushort private1;
322 void *private2;
323 void *private3;
326 int linux_msgctl (struct linux_msgctl_args *);
327 int linux_msgget (struct linux_msgget_args *);
328 int linux_msgrcv (struct linux_msgrcv_args *);
329 int linux_msgsnd (struct linux_msgsnd_args *);
331 int linux_semctl (struct linux_semctl_args *);
332 int linux_semget (struct linux_semget_args *);
333 int linux_semop (struct linux_semop_args *);
335 int linux_shmat (struct linux_shmat_args *);
336 int linux_shmctl (struct linux_shmctl_args *);
337 int linux_shmdt (struct linux_shmdt_args *);
338 int linux_shmget (struct linux_shmget_args *);
339 #define LINUX_MSG_INFO 12
340 #define LINUX_IPC_64 0x0100 /* New version (support 32-bit UIDs, bigger */
341 #endif /* __i386__ */
343 #endif /* _LINUX_IPC_H_ */