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>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #if defined(LINUX) || defined(SUNOS4)
60 static struct xlat msgctl_flags[] = {
61 { IPC_RMID, "IPC_RMID" },
62 { IPC_SET, "IPC_SET" },
63 { IPC_STAT, "IPC_STAT" },
65 { IPC_INFO, "IPC_INFO" },
66 { MSG_STAT, "MSG_STAT" },
67 { MSG_INFO, "MSG_INFO" },
72 static struct xlat semctl_flags[] = {
73 { IPC_RMID, "IPC_RMID" },
74 { IPC_SET, "IPC_SET" },
75 { IPC_STAT, "IPC_STAT" },
77 { IPC_INFO, "IPC_INFO" },
78 { SEM_STAT, "SEM_STAT" },
79 { SEM_INFO, "SEM_INFO" },
84 { GETNCNT, "GETNCNT" },
85 { GETZCNT, "GETZCNT" },
91 static struct xlat shmctl_flags[] = {
92 { IPC_RMID, "IPC_RMID" },
93 { IPC_SET, "IPC_SET" },
94 { IPC_STAT, "IPC_STAT" },
96 { IPC_INFO, "IPC_INFO" },
97 { SHM_STAT, "SHM_STAT" },
98 { SHM_INFO, "SHM_INFO" },
100 { SHM_LOCK, "SHM_LOCK" },
101 { SHM_UNLOCK, "SHM_UNLOCK" },
105 static struct xlat resource_flags[] = {
106 { IPC_CREAT, "IPC_CREAT" },
107 { IPC_EXCL, "IPC_EXCL" },
108 { IPC_NOWAIT, "IPC_NOWAIT" },
112 static struct xlat shm_flags[] = {
114 { SHM_REMAP, "SHM_REMAP" },
116 { SHM_RDONLY, "SHM_RDONLY" },
117 { SHM_RND, "SHM_RND" },
121 static struct xlat msg_flags[] = {
122 { MSG_NOERROR, "MSG_NOERROR" },
124 { MSG_EXCEPT, "MSG_EXCEPT" },
126 { IPC_NOWAIT, "IPC_NOWAIT" },
135 tprintf("%lu", tcp->u_arg[0]);
137 tprintf("IPC_PRIVATE");
139 if (printflags(resource_flags, tcp->u_arg[1]) != 0)
141 tprintf("%#lo", tcp->u_arg[1] & 0666);
149 char *cmd = xlookup(msgctl_flags, tcp->u_arg[1]);
152 tprintf("%lu", tcp->u_arg[0]);
153 tprintf(", %s", cmd == NULL ? "MSG_???" : cmd);
155 tprintf(", %#lx", tcp->u_arg[3]);
157 tprintf(", %#lx", tcp->u_arg[2]);
169 tprintf("%lu", tcp->u_arg[0]);
171 umove(tcp, tcp->u_arg[3], &mtype);
172 tprintf(", {%lu, ", mtype);
173 printstr(tcp, tcp->u_arg[3] + sizeof(long),
175 tprintf("}, %lu", tcp->u_arg[1]);
177 if (printflags(msg_flags, tcp->u_arg[2]) == 0)
180 umove(tcp, tcp->u_arg[1], &mtype);
181 tprintf(", {%lu, ", mtype);
182 printstr(tcp, tcp->u_arg[1] + sizeof(long),
184 tprintf("}, %lu", tcp->u_arg[2]);
186 if (printflags(msg_flags, tcp->u_arg[3]) == 0)
206 tprintf("%lu", tcp->u_arg[0]);
208 umove(tcp, tcp->u_arg[3], &tmp);
209 umove(tcp, (long) tmp.msgp, &mtype);
210 tprintf(", {%lu, ", mtype);
211 printstr(tcp, (long) (tmp.msgp) + sizeof(long),
213 tprintf("}, %lu", tcp->u_arg[1]);
214 tprintf(", %ld", tmp.msgtyp);
216 if (printflags(msg_flags, tcp->u_arg[2]) == 0)
219 umove(tcp, tcp->u_arg[1], &mtype);
220 tprintf(", {%lu, ", mtype);
221 printstr(tcp, tcp->u_arg[1] + sizeof(long),
223 tprintf("}, %lu", tcp->u_arg[2]);
224 tprintf(", %ld", tcp->u_arg[3]);
226 if (printflags(msg_flags, tcp->u_arg[4]) == 0)
237 tprintf("%lu", tcp->u_arg[0]);
239 tprintf(", %#lx", tcp->u_arg[3]);
240 tprintf(", %lu", tcp->u_arg[1]);
242 tprintf(", %#lx", tcp->u_arg[1]);
243 tprintf(", %lu", tcp->u_arg[2]);
254 tprintf("%lu", tcp->u_arg[0]);
256 tprintf("IPC_PRIVATE");
257 tprintf(", %lu", tcp->u_arg[1]);
259 if (printflags(resource_flags, tcp->u_arg[2]) != 0)
261 tprintf("%#lo", tcp->u_arg[2] & 0666);
270 tprintf("%lu", tcp->u_arg[0]);
271 tprintf(", %lu, ", tcp->u_arg[1]);
272 printxval(semctl_flags, tcp->u_arg[2], "SEM_???");
273 tprintf(", %#lx", tcp->u_arg[3]);
283 tprintf("%lu", tcp->u_arg[0]);
285 tprintf("IPC_PRIVATE");
286 tprintf(", %lu", tcp->u_arg[1]);
288 if (printflags(resource_flags, tcp->u_arg[2]) != 0)
290 tprintf("%#lo", tcp->u_arg[2] & 0666);
299 tprintf("%lu, ", tcp->u_arg[0]);
300 printxval(shmctl_flags, tcp->u_arg[1], "SHM_???");
302 tprintf(", %#lx", tcp->u_arg[3]);
304 tprintf(", %#lx", tcp->u_arg[2]);
318 tprintf("%lu", tcp->u_arg[0]);
320 tprintf(", %#lx", tcp->u_arg[3]);
322 if (printflags(shm_flags, tcp->u_arg[1]) == 0)
325 tprintf(", %#lx", tcp->u_arg[1]);
327 if (printflags(shm_flags, tcp->u_arg[2]) == 0)
333 if (umove(tcp, tcp->u_arg[2], &raddr) < 0)
347 tprintf("%#lx", tcp->u_arg[3]);
349 tprintf("%#lx", tcp->u_arg[0]);
354 #endif /* defined(LINUX) || defined(SUNOS4) */