2 * Copyright (c) 1993 Ulrich Pegelow <pegelow@moorea.uni-muenster.de>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
5 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 #if defined(LINUX) || defined(SUNOS4) || defined(FREEBSD)
61 #if defined LINUX && !defined IPC_64
65 static struct xlat msgctl_flags[] = {
66 { IPC_RMID, "IPC_RMID" },
67 { IPC_SET, "IPC_SET" },
68 { IPC_STAT, "IPC_STAT" },
70 { IPC_INFO, "IPC_INFO" },
71 { MSG_STAT, "MSG_STAT" },
72 { MSG_INFO, "MSG_INFO" },
77 static struct xlat semctl_flags[] = {
78 { IPC_RMID, "IPC_RMID" },
79 { IPC_SET, "IPC_SET" },
80 { IPC_STAT, "IPC_STAT" },
82 { IPC_INFO, "IPC_INFO" },
83 { SEM_STAT, "SEM_STAT" },
84 { SEM_INFO, "SEM_INFO" },
89 { GETNCNT, "GETNCNT" },
90 { GETZCNT, "GETZCNT" },
96 static struct xlat shmctl_flags[] = {
97 { IPC_RMID, "IPC_RMID" },
98 { IPC_SET, "IPC_SET" },
99 { IPC_STAT, "IPC_STAT" },
101 { IPC_INFO, "IPC_INFO" },
102 { SHM_STAT, "SHM_STAT" },
103 { SHM_INFO, "SHM_INFO" },
106 { SHM_LOCK, "SHM_LOCK" },
109 { SHM_UNLOCK, "SHM_UNLOCK" },
114 static struct xlat resource_flags[] = {
115 { IPC_CREAT, "IPC_CREAT" },
116 { IPC_EXCL, "IPC_EXCL" },
117 { IPC_NOWAIT, "IPC_NOWAIT" },
121 static struct xlat shm_flags[] = {
123 { SHM_REMAP, "SHM_REMAP" },
125 { SHM_RDONLY, "SHM_RDONLY" },
126 { SHM_RND, "SHM_RND" },
130 static struct xlat msg_flags[] = {
131 { MSG_NOERROR, "MSG_NOERROR" },
133 { MSG_EXCEPT, "MSG_EXCEPT" },
135 { IPC_NOWAIT, "IPC_NOWAIT" },
144 tprintf("%lu", tcp->u_arg[0]);
146 tprintf("IPC_PRIVATE");
148 if (printflags(resource_flags, tcp->u_arg[1]) != 0)
150 tprintf("%#lo", tcp->u_arg[1] & 0666);
156 # define PRINTCTL(flagset, arg, dflt) \
157 if ((arg) & IPC_64) tprintf("IPC_64|"); \
158 printxval((flagset), (arg) &~ IPC_64, dflt)
160 # define PRINTCTL printxval
167 tprintf("%lu, ", tcp->u_arg[0]);
168 PRINTCTL(msgctl_flags, tcp->u_arg[1], "MSG_???");
170 tprintf(", %#lx", tcp->u_arg[3]);
172 tprintf(", %#lx", tcp->u_arg[2]);
184 tprintf("%lu", tcp->u_arg[0]);
186 umove(tcp, tcp->u_arg[3], &mtype);
187 tprintf(", {%lu, ", mtype);
188 printstr(tcp, tcp->u_arg[3] + sizeof(long),
190 tprintf("}, %lu", tcp->u_arg[1]);
192 if (printflags(msg_flags, tcp->u_arg[2]) == 0)
195 umove(tcp, tcp->u_arg[1], &mtype);
196 tprintf(", {%lu, ", mtype);
197 printstr(tcp, tcp->u_arg[1] + sizeof(long),
199 tprintf("}, %lu", tcp->u_arg[2]);
201 if (printflags(msg_flags, tcp->u_arg[3]) == 0)
221 tprintf("%lu", tcp->u_arg[0]);
223 umove(tcp, tcp->u_arg[3], &tmp);
224 umove(tcp, (long) tmp.msgp, &mtype);
225 tprintf(", {%lu, ", mtype);
226 printstr(tcp, (long) (tmp.msgp) + sizeof(long),
228 tprintf("}, %lu", tcp->u_arg[1]);
229 tprintf(", %ld", tmp.msgtyp);
231 if (printflags(msg_flags, tcp->u_arg[2]) == 0)
234 umove(tcp, tcp->u_arg[1], &mtype);
235 tprintf(", {%lu, ", mtype);
236 printstr(tcp, tcp->u_arg[1] + sizeof(long),
238 tprintf("}, %lu", tcp->u_arg[2]);
239 tprintf(", %ld", tcp->u_arg[3]);
241 if (printflags(msg_flags, tcp->u_arg[4]) == 0)
252 tprintf("%lu", tcp->u_arg[0]);
254 tprintf(", %#lx", tcp->u_arg[3]);
255 tprintf(", %lu", tcp->u_arg[1]);
257 tprintf(", %#lx", tcp->u_arg[1]);
258 tprintf(", %lu", tcp->u_arg[2]);
269 tprintf("%lu", tcp->u_arg[0]);
271 tprintf("IPC_PRIVATE");
272 tprintf(", %lu", tcp->u_arg[1]);
274 if (printflags(resource_flags, tcp->u_arg[2]) != 0)
276 tprintf("%#lo", tcp->u_arg[2] & 0666);
285 tprintf("%lu", tcp->u_arg[0]);
286 tprintf(", %lu, ", tcp->u_arg[1]);
287 PRINTCTL(semctl_flags, tcp->u_arg[2], "SEM_???");
288 tprintf(", %#lx", tcp->u_arg[3]);
298 tprintf("%lu", tcp->u_arg[0]);
300 tprintf("IPC_PRIVATE");
301 tprintf(", %lu", tcp->u_arg[1]);
303 if (printflags(resource_flags, tcp->u_arg[2]) != 0)
305 tprintf("%#lo", tcp->u_arg[2] & 0666);
314 tprintf("%lu, ", tcp->u_arg[0]);
315 PRINTCTL(shmctl_flags, tcp->u_arg[1], "SHM_???");
317 tprintf(", %#lx", tcp->u_arg[3]);
319 tprintf(", %#lx", tcp->u_arg[2]);
333 tprintf("%lu", tcp->u_arg[0]);
335 tprintf(", %#lx", tcp->u_arg[3]);
337 if (printflags(shm_flags, tcp->u_arg[1]) == 0)
340 tprintf(", %#lx", tcp->u_arg[1]);
342 if (printflags(shm_flags, tcp->u_arg[2]) == 0)
348 if (umove(tcp, tcp->u_arg[2], &raddr) < 0)
362 tprintf("%#lx", tcp->u_arg[3]);
364 tprintf("%#lx", tcp->u_arg[0]);
369 #endif /* defined(LINUX) || defined(SUNOS4) || defined(FREEBSD) */