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)
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" },
101 { SHM_LOCK, "SHM_LOCK" },
102 { SHM_UNLOCK, "SHM_UNLOCK" },
106 static struct xlat resource_flags[] = {
107 { IPC_CREAT, "IPC_CREAT" },
108 { IPC_EXCL, "IPC_EXCL" },
109 { IPC_NOWAIT, "IPC_NOWAIT" },
113 static struct xlat shm_flags[] = {
115 { SHM_REMAP, "SHM_REMAP" },
117 { SHM_RDONLY, "SHM_RDONLY" },
118 { SHM_RND, "SHM_RND" },
122 static struct xlat msg_flags[] = {
123 { MSG_NOERROR, "MSG_NOERROR" },
125 { MSG_EXCEPT, "MSG_EXCEPT" },
127 { IPC_NOWAIT, "IPC_NOWAIT" },
136 tprintf("%lu", tcp->u_arg[0]);
138 tprintf("IPC_PRIVATE");
140 if (printflags(resource_flags, tcp->u_arg[1]) != 0)
142 tprintf("%#lo", tcp->u_arg[1] & 0666);
150 char *cmd = xlookup(msgctl_flags, tcp->u_arg[1]);
153 tprintf("%lu", tcp->u_arg[0]);
154 tprintf(", %s", cmd == NULL ? "MSG_???" : cmd);
156 tprintf(", %#lx", tcp->u_arg[3]);
158 tprintf(", %#lx", tcp->u_arg[2]);
170 tprintf("%lu", tcp->u_arg[0]);
172 umove(tcp, tcp->u_arg[3], &mtype);
173 tprintf(", {%lu, ", mtype);
174 printstr(tcp, tcp->u_arg[3] + sizeof(long),
176 tprintf("}, %lu", tcp->u_arg[1]);
178 if (printflags(msg_flags, tcp->u_arg[2]) == 0)
181 umove(tcp, tcp->u_arg[1], &mtype);
182 tprintf(", {%lu, ", mtype);
183 printstr(tcp, tcp->u_arg[1] + sizeof(long),
185 tprintf("}, %lu", tcp->u_arg[2]);
187 if (printflags(msg_flags, tcp->u_arg[3]) == 0)
207 tprintf("%lu", tcp->u_arg[0]);
209 umove(tcp, tcp->u_arg[3], &tmp);
210 umove(tcp, (long) tmp.msgp, &mtype);
211 tprintf(", {%lu, ", mtype);
212 printstr(tcp, (long) (tmp.msgp) + sizeof(long),
214 tprintf("}, %lu", tcp->u_arg[1]);
215 tprintf(", %ld", tmp.msgtyp);
217 if (printflags(msg_flags, tcp->u_arg[2]) == 0)
220 umove(tcp, tcp->u_arg[1], &mtype);
221 tprintf(", {%lu, ", mtype);
222 printstr(tcp, tcp->u_arg[1] + sizeof(long),
224 tprintf("}, %lu", tcp->u_arg[2]);
225 tprintf(", %ld", tcp->u_arg[3]);
227 if (printflags(msg_flags, tcp->u_arg[4]) == 0)
238 tprintf("%lu", tcp->u_arg[0]);
240 tprintf(", %#lx", tcp->u_arg[3]);
241 tprintf(", %lu", tcp->u_arg[1]);
243 tprintf(", %#lx", tcp->u_arg[1]);
244 tprintf(", %lu", tcp->u_arg[2]);
255 tprintf("%lu", tcp->u_arg[0]);
257 tprintf("IPC_PRIVATE");
258 tprintf(", %lu", tcp->u_arg[1]);
260 if (printflags(resource_flags, tcp->u_arg[2]) != 0)
262 tprintf("%#lo", tcp->u_arg[2] & 0666);
271 tprintf("%lu", tcp->u_arg[0]);
272 tprintf(", %lu, ", tcp->u_arg[1]);
273 printxval(semctl_flags, tcp->u_arg[2], "SEM_???");
274 tprintf(", %#lx", tcp->u_arg[3]);
284 tprintf("%lu", tcp->u_arg[0]);
286 tprintf("IPC_PRIVATE");
287 tprintf(", %lu", tcp->u_arg[1]);
289 if (printflags(resource_flags, tcp->u_arg[2]) != 0)
291 tprintf("%#lo", tcp->u_arg[2] & 0666);
300 tprintf("%lu, ", tcp->u_arg[0]);
301 printxval(shmctl_flags, tcp->u_arg[1], "SHM_???");
303 tprintf(", %#lx", tcp->u_arg[3]);
305 tprintf(", %#lx", tcp->u_arg[2]);
319 tprintf("%lu", tcp->u_arg[0]);
321 tprintf(", %#lx", tcp->u_arg[3]);
323 if (printflags(shm_flags, tcp->u_arg[1]) == 0)
326 tprintf(", %#lx", tcp->u_arg[1]);
328 if (printflags(shm_flags, tcp->u_arg[2]) == 0)
334 if (umove(tcp, tcp->u_arg[2], &raddr) < 0)
348 tprintf("%#lx", tcp->u_arg[3]);
350 tprintf("%#lx", tcp->u_arg[0]);
355 #endif /* defined(LINUX) || defined(SUNOS4) */