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.
64 extern void printsigevent(struct tcb *tcp, long arg);
66 #include "xlat/msgctl_flags.h"
67 #include "xlat/semctl_flags.h"
68 #include "xlat/shmctl_flags.h"
69 #include "xlat/resource_flags.h"
70 #include "xlat/shm_resource_flags.h"
71 #include "xlat/shm_flags.h"
72 #include "xlat/ipc_msg_flags.h"
73 #include "xlat/semop_flags.h"
79 tprintf("%#lx, ", tcp->u_arg[0]);
81 tprints("IPC_PRIVATE, ");
82 if (printflags(resource_flags, tcp->u_arg[1] & ~0777, NULL) != 0)
84 tprintf("%#lo", tcp->u_arg[1] & 0777);
90 # define PRINTCTL(flagset, arg, dflt) \
91 if ((arg) & IPC_64) tprints("IPC_64|"); \
92 printxval((flagset), (arg) &~ IPC_64, dflt)
94 # define PRINTCTL printxval
98 indirect_ipccall(struct tcb *tcp)
100 return tcp->s_ent->sys_flags & TRACE_INDIRECT_SUBCALL;
106 tprintf("%lu, ", tcp->u_arg[0]);
107 PRINTCTL(msgctl_flags, tcp->u_arg[1], "MSG_???");
108 tprintf(", %#lx", tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2]);
114 tprint_msgsnd(struct tcb *tcp, long addr, unsigned long count,
119 if (umove(tcp, addr, &mtype) < 0) {
120 tprintf("%#lx", addr);
122 tprintf("{%lu, ", mtype);
123 printstr(tcp, addr + sizeof(mtype), count);
126 tprintf(", %lu, ", count);
127 printflags(ipc_msg_flags, flags, "MSG_???");
133 tprintf("%d, ", (int) tcp->u_arg[0]);
134 if (indirect_ipccall(tcp)) {
135 tprint_msgsnd(tcp, tcp->u_arg[3], tcp->u_arg[1],
138 tprint_msgsnd(tcp, tcp->u_arg[1], tcp->u_arg[2],
146 tprint_msgrcv(struct tcb *tcp, long addr, unsigned long count, long msgtyp)
150 if (syserror(tcp) || umove(tcp, addr, &mtype) < 0) {
151 tprintf("%#lx", addr);
153 tprintf("{%lu, ", mtype);
154 printstr(tcp, addr + sizeof(mtype), count);
157 tprintf(", %lu, %ld, ", count, msgtyp);
163 tprintf("%d, ", (int) tcp->u_arg[0]);
165 if (indirect_ipccall(tcp)) {
171 if (umove(tcp, tcp->u_arg[3], &tmp) < 0) {
172 tprintf("%#lx, %lu, ",
173 tcp->u_arg[3], tcp->u_arg[1]);
175 tprint_msgrcv(tcp, (long) tmp.msgp,
176 tcp->u_arg[1], tmp.msgtyp);
178 printflags(ipc_msg_flags, tcp->u_arg[2], "MSG_???");
180 tprint_msgrcv(tcp, tcp->u_arg[1],
181 tcp->u_arg[2], tcp->u_arg[3]);
182 printflags(ipc_msg_flags, tcp->u_arg[4], "MSG_???");
189 tprint_sembuf(struct tcb *tcp, long addr, unsigned long count)
191 unsigned long i, max_count;
194 max_count = (max_strlen < count) ? max_strlen : count;
199 tprintf("%#lx, %lu", addr, count);
203 for (i = 0; i < max_count; ++i) {
207 if (umove(tcp, addr + i * sizeof(struct sembuf), &sb) < 0) {
212 tprintf("%#lx, %lu", addr, count);
218 tprintf("{%u, %d, ", sb.sem_num, sb.sem_op);
219 printflags(semop_flags, sb.sem_flg, "SEM_???");
224 if (i < max_count || max_count < count)
227 tprintf("}, %lu", count);
233 tprintf("%lu, ", tcp->u_arg[0]);
234 if (indirect_ipccall(tcp)) {
235 tprint_sembuf(tcp, tcp->u_arg[3], tcp->u_arg[1]);
237 tprint_sembuf(tcp, tcp->u_arg[1], tcp->u_arg[2]);
246 tprintf("%lu, ", tcp->u_arg[0]);
247 if (indirect_ipccall(tcp)) {
248 tprint_sembuf(tcp, tcp->u_arg[3], tcp->u_arg[1]);
250 #if defined(S390) || defined(S390X)
251 printtv(tcp, tcp->u_arg[2]);
253 printtv(tcp, tcp->u_arg[4]);
256 tprint_sembuf(tcp, tcp->u_arg[1], tcp->u_arg[2]);
258 printtv(tcp, tcp->u_arg[3]);
268 tprintf("%#lx", tcp->u_arg[0]);
270 tprints("IPC_PRIVATE");
271 tprintf(", %lu, ", tcp->u_arg[1]);
272 if (printflags(resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
274 tprintf("%#lo", tcp->u_arg[2] & 0777);
282 tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
283 PRINTCTL(semctl_flags, tcp->u_arg[2], "SEM_???");
285 if (indirect_ipccall(tcp)) {
286 if (current_wordsize == sizeof(int)) {
287 printnum_int(tcp, tcp->u_arg[3], "%#x");
289 printnum_long(tcp, tcp->u_arg[3], "%#lx");
292 tprintf("%#lx", tcp->u_arg[3]);
302 tprintf("%#lx", tcp->u_arg[0]);
304 tprints("IPC_PRIVATE");
305 tprintf(", %lu, ", tcp->u_arg[1]);
306 if (printflags(shm_resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
308 tprintf("%#lo", tcp->u_arg[2] & 0777);
316 tprintf("%lu, ", tcp->u_arg[0]);
317 PRINTCTL(shmctl_flags, tcp->u_arg[1], "SHM_???");
318 if (indirect_ipccall(tcp)) {
319 tprintf(", %#lx", tcp->u_arg[3]);
321 tprintf(", %#lx", tcp->u_arg[2]);
330 tprintf("%lu", tcp->u_arg[0]);
331 if (indirect_ipccall(tcp)) {
332 tprintf(", %#lx, ", tcp->u_arg[3]);
333 printflags(shm_flags, tcp->u_arg[1], "SHM_???");
335 tprintf(", %#lx, ", tcp->u_arg[1]);
336 printflags(shm_flags, tcp->u_arg[2], "SHM_???");
340 if (indirect_ipccall(tcp)) {
342 if (umove(tcp, tcp->u_arg[2], &raddr) < 0)
354 if (indirect_ipccall(tcp)) {
355 tprintf("%#lx", tcp->u_arg[3]);
357 tprintf("%#lx", tcp->u_arg[0]);
366 printpath(tcp, tcp->u_arg[0]);
369 tprint_open_modes(tcp->u_arg[1]);
370 if (tcp->u_arg[1] & O_CREAT) {
371 # ifndef HAVE_MQUEUE_H
372 tprintf(", %lx", tcp->u_arg[2]);
376 tprintf(", %#lo, ", tcp->u_arg[2]);
377 if (umove(tcp, tcp->u_arg[3], &attr) < 0)
380 tprintf("{mq_maxmsg=%ld, mq_msgsize=%ld}",
381 (long) attr.mq_maxmsg,
382 (long) attr.mq_msgsize);
389 SYS_FUNC(mq_timedsend)
392 tprintf("%ld, ", tcp->u_arg[0]);
393 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
394 tprintf(", %lu, %ld, ", tcp->u_arg[2], tcp->u_arg[3]);
395 printtv(tcp, tcp->u_arg[4]);
400 SYS_FUNC(mq_timedreceive)
403 tprintf("%ld, ", tcp->u_arg[0]);
405 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
406 tprintf(", %lu, %ld, ", tcp->u_arg[2], tcp->u_arg[3]);
407 printtv(tcp, tcp->u_arg[4]);
415 tprintf("%ld, ", tcp->u_arg[0]);
416 printsigevent(tcp, tcp->u_arg[1]);
422 printmqattr(struct tcb *tcp, long addr)
427 # ifndef HAVE_MQUEUE_H
428 tprintf("%#lx", addr);
431 if (umove(tcp, addr, &attr) < 0) {
435 tprints("{mq_flags=");
436 tprint_open_modes(attr.mq_flags);
437 tprintf(", mq_maxmsg=%ld, mq_msgsize=%ld, mq_curmsg=%ld}",
438 (long) attr.mq_maxmsg, (long) attr.mq_msgsize,
439 (long) attr.mq_curmsgs);
444 SYS_FUNC(mq_getsetattr)
447 tprintf("%ld, ", tcp->u_arg[0]);
448 printmqattr(tcp, tcp->u_arg[1]);
451 printmqattr(tcp, tcp->u_arg[2]);
457 return printargs(tcp);