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)
66 #if defined LINUX && !defined IPC_64
70 extern void printsigevent(struct tcb *tcp, long arg);
72 static const struct xlat msgctl_flags[] = {
73 { IPC_RMID, "IPC_RMID" },
74 { IPC_SET, "IPC_SET" },
75 { IPC_STAT, "IPC_STAT" },
77 { IPC_INFO, "IPC_INFO" },
78 { MSG_STAT, "MSG_STAT" },
79 { MSG_INFO, "MSG_INFO" },
84 static const struct xlat semctl_flags[] = {
85 { IPC_RMID, "IPC_RMID" },
86 { IPC_SET, "IPC_SET" },
87 { IPC_STAT, "IPC_STAT" },
89 { IPC_INFO, "IPC_INFO" },
90 { SEM_STAT, "SEM_STAT" },
91 { SEM_INFO, "SEM_INFO" },
96 { GETNCNT, "GETNCNT" },
97 { GETZCNT, "GETZCNT" },
103 static const struct xlat shmctl_flags[] = {
104 { IPC_RMID, "IPC_RMID" },
105 { IPC_SET, "IPC_SET" },
106 { IPC_STAT, "IPC_STAT" },
108 { IPC_INFO, "IPC_INFO" },
109 { SHM_STAT, "SHM_STAT" },
110 { SHM_INFO, "SHM_INFO" },
113 { SHM_LOCK, "SHM_LOCK" },
116 { SHM_UNLOCK, "SHM_UNLOCK" },
121 static const struct xlat resource_flags[] = {
122 { IPC_CREAT, "IPC_CREAT" },
123 { IPC_EXCL, "IPC_EXCL" },
124 { IPC_NOWAIT, "IPC_NOWAIT" },
128 static const struct xlat shm_resource_flags[] = {
129 { IPC_CREAT, "IPC_CREAT" },
130 { IPC_EXCL, "IPC_EXCL" },
132 { SHM_HUGETLB, "SHM_HUGETLB" },
137 static const struct xlat shm_flags[] = {
139 { SHM_REMAP, "SHM_REMAP" },
141 { SHM_RDONLY, "SHM_RDONLY" },
142 { SHM_RND, "SHM_RND" },
146 static const struct xlat msg_flags[] = {
147 { MSG_NOERROR, "MSG_NOERROR" },
149 { MSG_EXCEPT, "MSG_EXCEPT" },
151 { IPC_NOWAIT, "IPC_NOWAIT" },
160 tprintf("%#lx", tcp->u_arg[0]);
162 tprintf("IPC_PRIVATE");
164 if (printflags(resource_flags, tcp->u_arg[1] & ~0777, NULL) != 0)
166 tprintf("%#lo", tcp->u_arg[1] & 0777);
172 # define PRINTCTL(flagset, arg, dflt) \
173 if ((arg) & IPC_64) tprintf("IPC_64|"); \
174 printxval((flagset), (arg) &~ IPC_64, dflt)
176 # define PRINTCTL printxval
180 indirect_ipccall(tcp)
185 return current_personality > 0;
188 return tcp->scno < 1024; /* ia32 emulation syscalls are low */
190 #if !defined MIPS && !defined HPPA
201 tprintf("%lu, ", tcp->u_arg[0]);
202 PRINTCTL(msgctl_flags, tcp->u_arg[1], "MSG_???");
203 tprintf(", %#lx", tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2]);
214 tprintf("%lu", tcp->u_arg[0]);
215 if (indirect_ipccall(tcp)) {
216 umove(tcp, tcp->u_arg[3], &mtype);
217 tprintf(", {%lu, ", mtype);
218 printstr(tcp, tcp->u_arg[3] + sizeof(long),
220 tprintf("}, %lu", tcp->u_arg[1]);
222 printflags(msg_flags, tcp->u_arg[2], "MSG_???");
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]);
230 printflags(msg_flags, tcp->u_arg[3], "MSG_???");
242 tprintf("%lu, ", tcp->u_arg[0]);
244 tprintf("%lu", tcp->u_arg[0]);
245 if (indirect_ipccall(tcp)) {
250 umove(tcp, tcp->u_arg[3], &tmp);
251 umove(tcp, (long) tmp.msgp, &mtype);
252 tprintf(", {%lu, ", mtype);
253 printstr(tcp, (long) (tmp.msgp) + sizeof(long),
255 tprintf("}, %lu", tcp->u_arg[1]);
256 tprintf(", %ld", tmp.msgtyp);
258 printflags(msg_flags, tcp->u_arg[2], "MSG_???");
260 umove(tcp, tcp->u_arg[1], &mtype);
261 tprintf("{%lu, ", mtype);
262 printstr(tcp, tcp->u_arg[1] + sizeof(long),
264 tprintf("}, %lu", tcp->u_arg[2]);
265 tprintf(", %ld", tcp->u_arg[3]);
267 printflags(msg_flags, tcp->u_arg[4], "MSG_???");
277 tprintf("%lu", tcp->u_arg[0]);
278 if (indirect_ipccall(tcp)) {
279 tprintf(", %#lx", tcp->u_arg[3]);
280 tprintf(", %lu", tcp->u_arg[1]);
282 tprintf(", %#lx", tcp->u_arg[1]);
283 tprintf(", %lu", tcp->u_arg[2]);
290 int sys_semtimedop(tcp)
294 tprintf("%lu", tcp->u_arg[0]);
295 if (indirect_ipccall(tcp)) {
296 tprintf(", %#lx", tcp->u_arg[3]);
297 tprintf(", %lu, ", tcp->u_arg[1]);
298 printtv(tcp, tcp->u_arg[5]);
300 tprintf(", %#lx", tcp->u_arg[1]);
301 tprintf(", %lu, ", tcp->u_arg[2]);
302 printtv(tcp, tcp->u_arg[3]);
314 tprintf("%#lx", tcp->u_arg[0]);
316 tprintf("IPC_PRIVATE");
317 tprintf(", %lu", tcp->u_arg[1]);
319 if (printflags(resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
321 tprintf("%#lo", tcp->u_arg[2] & 0777);
330 tprintf("%lu", tcp->u_arg[0]);
331 tprintf(", %lu, ", tcp->u_arg[1]);
332 PRINTCTL(semctl_flags, tcp->u_arg[2], "SEM_???");
333 tprintf(", %#lx", tcp->u_arg[3]);
343 tprintf("%#lx", tcp->u_arg[0]);
345 tprintf("IPC_PRIVATE");
346 tprintf(", %lu", tcp->u_arg[1]);
348 if (printflags(shm_resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
350 tprintf("%#lo", tcp->u_arg[2] & 0777);
359 tprintf("%lu, ", tcp->u_arg[0]);
360 PRINTCTL(shmctl_flags, tcp->u_arg[1], "SHM_???");
361 if (indirect_ipccall(tcp)) {
362 tprintf(", %#lx", tcp->u_arg[3]);
364 tprintf(", %#lx", tcp->u_arg[2]);
378 tprintf("%lu", tcp->u_arg[0]);
379 if (indirect_ipccall(tcp)) {
380 tprintf(", %#lx", tcp->u_arg[3]);
382 printflags(shm_flags, tcp->u_arg[1], "SHM_???");
384 tprintf(", %#lx", tcp->u_arg[1]);
386 printflags(shm_flags, tcp->u_arg[2], "SHM_???");
391 if (umove(tcp, tcp->u_arg[2], &raddr) < 0)
404 if (indirect_ipccall(tcp)) {
405 tprintf("%#lx", tcp->u_arg[3]);
407 tprintf("%#lx", tcp->u_arg[0]);
413 #endif /* defined(LINUX) || defined(SUNOS4) || defined(FREEBSD) */
417 sys_mq_open(struct tcb *tcp)
420 printpath(tcp, tcp->u_arg[0]);
423 tprint_open_modes(tcp->u_arg[1]);
424 if (tcp->u_arg[1] & O_CREAT) {
425 # ifndef HAVE_MQUEUE_H
426 tprintf(", %lx", tcp->u_arg[2]);
430 tprintf(", %#lo, ", tcp->u_arg[2]);
431 if (umove(tcp, tcp->u_arg[3], &attr) < 0)
434 tprintf("{mq_maxmsg=%ld, mq_msgsize=%ld}",
435 attr.mq_maxmsg, attr.mq_msgsize);
443 sys_mq_timedsend(struct tcb *tcp)
446 tprintf("%ld, ", tcp->u_arg[0]);
447 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
448 tprintf(", %lu, %ld, ", tcp->u_arg[2], tcp->u_arg[3]);
449 printtv(tcp, tcp->u_arg[4]);
455 sys_mq_timedreceive(struct tcb *tcp)
458 tprintf("%ld, ", tcp->u_arg[0]);
460 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
461 tprintf(", %lu, %ld, ", tcp->u_arg[2], tcp->u_arg[3]);
462 printtv(tcp, tcp->u_arg[4]);
468 sys_mq_notify(struct tcb *tcp)
471 tprintf("%ld, ", tcp->u_arg[0]);
472 printsigevent(tcp, tcp->u_arg[1]);
478 printmqattr(struct tcb *tcp, long addr)
483 # ifndef HAVE_MQUEUE_H
484 tprintf("%#lx", addr);
487 if (umove(tcp, addr, &attr) < 0) {
491 tprintf("{mq_flags=");
492 tprint_open_modes(attr.mq_flags);
493 tprintf(", mq_maxmsg=%ld, mq_msgsize=%ld, mq_curmsg=%ld}",
494 attr.mq_maxmsg, attr.mq_msgsize, attr.mq_curmsgs);
500 sys_mq_getsetattr(struct tcb *tcp)
503 tprintf("%ld, ", tcp->u_arg[0]);
504 printmqattr(tcp, tcp->u_arg[1]);
507 printmqattr(tcp, tcp->u_arg[2]);