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 static struct xlat msgctl_flags[] = {
62 { IPC_RMID, "IPC_RMID" },
63 { IPC_SET, "IPC_SET" },
64 { IPC_STAT, "IPC_STAT" },
66 { IPC_INFO, "IPC_INFO" },
67 { MSG_STAT, "MSG_STAT" },
68 { MSG_INFO, "MSG_INFO" },
73 static struct xlat semctl_flags[] = {
74 { IPC_RMID, "IPC_RMID" },
75 { IPC_SET, "IPC_SET" },
76 { IPC_STAT, "IPC_STAT" },
78 { IPC_INFO, "IPC_INFO" },
79 { SEM_STAT, "SEM_STAT" },
80 { SEM_INFO, "SEM_INFO" },
85 { GETNCNT, "GETNCNT" },
86 { GETZCNT, "GETZCNT" },
92 static struct xlat shmctl_flags[] = {
93 { IPC_RMID, "IPC_RMID" },
94 { IPC_SET, "IPC_SET" },
95 { IPC_STAT, "IPC_STAT" },
97 { IPC_INFO, "IPC_INFO" },
98 { SHM_STAT, "SHM_STAT" },
99 { SHM_INFO, "SHM_INFO" },
102 { SHM_LOCK, "SHM_LOCK" },
105 { SHM_UNLOCK, "SHM_UNLOCK" },
110 static struct xlat resource_flags[] = {
111 { IPC_CREAT, "IPC_CREAT" },
112 { IPC_EXCL, "IPC_EXCL" },
113 { IPC_NOWAIT, "IPC_NOWAIT" },
117 static struct xlat shm_flags[] = {
119 { SHM_REMAP, "SHM_REMAP" },
121 { SHM_RDONLY, "SHM_RDONLY" },
122 { SHM_RND, "SHM_RND" },
126 static struct xlat msg_flags[] = {
127 { MSG_NOERROR, "MSG_NOERROR" },
129 { MSG_EXCEPT, "MSG_EXCEPT" },
131 { IPC_NOWAIT, "IPC_NOWAIT" },
140 tprintf("%lu", tcp->u_arg[0]);
142 tprintf("IPC_PRIVATE");
144 if (printflags(resource_flags, tcp->u_arg[1]) != 0)
146 tprintf("%#lo", tcp->u_arg[1] & 0666);
154 char *cmd = xlookup(msgctl_flags, tcp->u_arg[1]);
157 tprintf("%lu", tcp->u_arg[0]);
158 tprintf(", %s", cmd == NULL ? "MSG_???" : cmd);
160 tprintf(", %#lx", tcp->u_arg[3]);
162 tprintf(", %#lx", tcp->u_arg[2]);
174 tprintf("%lu", tcp->u_arg[0]);
176 umove(tcp, tcp->u_arg[3], &mtype);
177 tprintf(", {%lu, ", mtype);
178 printstr(tcp, tcp->u_arg[3] + sizeof(long),
180 tprintf("}, %lu", tcp->u_arg[1]);
182 if (printflags(msg_flags, tcp->u_arg[2]) == 0)
185 umove(tcp, tcp->u_arg[1], &mtype);
186 tprintf(", {%lu, ", mtype);
187 printstr(tcp, tcp->u_arg[1] + sizeof(long),
189 tprintf("}, %lu", tcp->u_arg[2]);
191 if (printflags(msg_flags, tcp->u_arg[3]) == 0)
211 tprintf("%lu", tcp->u_arg[0]);
213 umove(tcp, tcp->u_arg[3], &tmp);
214 umove(tcp, (long) tmp.msgp, &mtype);
215 tprintf(", {%lu, ", mtype);
216 printstr(tcp, (long) (tmp.msgp) + sizeof(long),
218 tprintf("}, %lu", tcp->u_arg[1]);
219 tprintf(", %ld", tmp.msgtyp);
221 if (printflags(msg_flags, tcp->u_arg[2]) == 0)
224 umove(tcp, tcp->u_arg[1], &mtype);
225 tprintf(", {%lu, ", mtype);
226 printstr(tcp, tcp->u_arg[1] + sizeof(long),
228 tprintf("}, %lu", tcp->u_arg[2]);
229 tprintf(", %ld", tcp->u_arg[3]);
231 if (printflags(msg_flags, tcp->u_arg[4]) == 0)
242 tprintf("%lu", tcp->u_arg[0]);
244 tprintf(", %#lx", tcp->u_arg[3]);
245 tprintf(", %lu", tcp->u_arg[1]);
247 tprintf(", %#lx", tcp->u_arg[1]);
248 tprintf(", %lu", tcp->u_arg[2]);
259 tprintf("%lu", tcp->u_arg[0]);
261 tprintf("IPC_PRIVATE");
262 tprintf(", %lu", tcp->u_arg[1]);
264 if (printflags(resource_flags, tcp->u_arg[2]) != 0)
266 tprintf("%#lo", tcp->u_arg[2] & 0666);
275 tprintf("%lu", tcp->u_arg[0]);
276 tprintf(", %lu, ", tcp->u_arg[1]);
277 printxval(semctl_flags, tcp->u_arg[2], "SEM_???");
278 tprintf(", %#lx", tcp->u_arg[3]);
288 tprintf("%lu", tcp->u_arg[0]);
290 tprintf("IPC_PRIVATE");
291 tprintf(", %lu", tcp->u_arg[1]);
293 if (printflags(resource_flags, tcp->u_arg[2]) != 0)
295 tprintf("%#lo", tcp->u_arg[2] & 0666);
304 tprintf("%lu, ", tcp->u_arg[0]);
305 printxval(shmctl_flags, tcp->u_arg[1], "SHM_???");
307 tprintf(", %#lx", tcp->u_arg[3]);
309 tprintf(", %#lx", tcp->u_arg[2]);
323 tprintf("%lu", tcp->u_arg[0]);
325 tprintf(", %#lx", tcp->u_arg[3]);
327 if (printflags(shm_flags, tcp->u_arg[1]) == 0)
330 tprintf(", %#lx", tcp->u_arg[1]);
332 if (printflags(shm_flags, tcp->u_arg[2]) == 0)
338 if (umove(tcp, tcp->u_arg[2], &raddr) < 0)
352 tprintf("%#lx", tcp->u_arg[3]);
354 tprintf("%#lx", tcp->u_arg[0]);
359 #endif /* defined(LINUX) || defined(SUNOS4) || defined(FREEBSD) */