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"
78 tprintf("%#lx, ", tcp->u_arg[0]);
80 tprints("IPC_PRIVATE, ");
81 if (printflags(resource_flags, tcp->u_arg[1] & ~0777, NULL) != 0)
83 tprintf("%#lo", tcp->u_arg[1] & 0777);
88 # define PRINTCTL(flagset, arg, dflt) \
89 if ((arg) & IPC_64) tprints("IPC_64|"); \
90 printxval((flagset), (arg) &~ IPC_64, dflt)
92 # define PRINTCTL printxval
96 indirect_ipccall(struct tcb *tcp)
98 return tcp->s_ent->sys_flags & TRACE_INDIRECT_SUBCALL;
103 tprintf("%lu, ", tcp->u_arg[0]);
104 PRINTCTL(msgctl_flags, tcp->u_arg[1], "MSG_???");
105 tprintf(", %#lx", tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2]);
110 tprint_msgsnd(struct tcb *tcp, long addr, unsigned long count,
115 if (umove(tcp, addr, &mtype) < 0) {
116 tprintf("%#lx", addr);
118 tprintf("{%lu, ", mtype);
119 printstr(tcp, addr + sizeof(mtype), count);
122 tprintf(", %lu, ", count);
123 printflags(ipc_msg_flags, flags, "MSG_???");
128 tprintf("%d, ", (int) tcp->u_arg[0]);
129 if (indirect_ipccall(tcp)) {
130 tprint_msgsnd(tcp, tcp->u_arg[3], tcp->u_arg[1],
133 tprint_msgsnd(tcp, tcp->u_arg[1], tcp->u_arg[2],
140 tprint_msgrcv(struct tcb *tcp, long addr, unsigned long count, long msgtyp)
144 if (syserror(tcp) || umove(tcp, addr, &mtype) < 0) {
145 tprintf("%#lx", addr);
147 tprintf("{%lu, ", mtype);
148 printstr(tcp, addr + sizeof(mtype), count);
151 tprintf(", %lu, %ld, ", count, msgtyp);
157 tprintf("%d, ", (int) tcp->u_arg[0]);
159 if (indirect_ipccall(tcp)) {
165 if (umove(tcp, tcp->u_arg[3], &tmp) < 0) {
166 tprintf("%#lx, %lu, ",
167 tcp->u_arg[3], tcp->u_arg[1]);
169 tprint_msgrcv(tcp, (long) tmp.msgp,
170 tcp->u_arg[1], tmp.msgtyp);
172 printflags(ipc_msg_flags, tcp->u_arg[2], "MSG_???");
174 tprint_msgrcv(tcp, tcp->u_arg[1],
175 tcp->u_arg[2], tcp->u_arg[3]);
176 printflags(ipc_msg_flags, tcp->u_arg[4], "MSG_???");
183 tprint_sembuf(struct tcb *tcp, long addr, unsigned long count)
185 unsigned long i, max_count;
188 max_count = (max_strlen < count) ? max_strlen : count;
193 tprintf("%#lx, %lu", addr, count);
197 for (i = 0; i < max_count; ++i) {
201 if (umove(tcp, addr + i * sizeof(struct sembuf), &sb) < 0) {
206 tprintf("%#lx, %lu", addr, count);
212 tprintf("{%u, %d, ", sb.sem_num, sb.sem_op);
213 printflags(semop_flags, sb.sem_flg, "SEM_???");
218 if (i < max_count || max_count < count)
221 tprintf("}, %lu", count);
226 tprintf("%lu, ", tcp->u_arg[0]);
227 if (indirect_ipccall(tcp)) {
228 tprint_sembuf(tcp, tcp->u_arg[3], tcp->u_arg[1]);
230 tprint_sembuf(tcp, tcp->u_arg[1], tcp->u_arg[2]);
237 tprintf("%lu, ", tcp->u_arg[0]);
238 if (indirect_ipccall(tcp)) {
239 tprint_sembuf(tcp, tcp->u_arg[3], tcp->u_arg[1]);
241 #if defined(S390) || defined(S390X)
242 printtv(tcp, tcp->u_arg[2]);
244 printtv(tcp, tcp->u_arg[4]);
247 tprint_sembuf(tcp, tcp->u_arg[1], tcp->u_arg[2]);
249 printtv(tcp, tcp->u_arg[3]);
257 tprintf("%#lx", tcp->u_arg[0]);
259 tprints("IPC_PRIVATE");
260 tprintf(", %lu, ", tcp->u_arg[1]);
261 if (printflags(resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
263 tprintf("%#lo", tcp->u_arg[2] & 0777);
269 tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
270 PRINTCTL(semctl_flags, tcp->u_arg[2], "SEM_???");
272 if (indirect_ipccall(tcp)) {
273 if (current_wordsize == sizeof(int)) {
274 printnum_int(tcp, tcp->u_arg[3], "%#x");
276 printnum_long(tcp, tcp->u_arg[3], "%#lx");
279 tprintf("%#lx", tcp->u_arg[3]);
287 tprintf("%#lx", tcp->u_arg[0]);
289 tprints("IPC_PRIVATE");
290 tprintf(", %lu, ", tcp->u_arg[1]);
291 if (printflags(shm_resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
293 tprintf("%#lo", tcp->u_arg[2] & 0777);
299 tprintf("%lu, ", tcp->u_arg[0]);
300 PRINTCTL(shmctl_flags, tcp->u_arg[1], "SHM_???");
301 tprintf(", %#lx", tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2]);
308 tprintf("%lu", tcp->u_arg[0]);
309 if (indirect_ipccall(tcp)) {
310 tprintf(", %#lx, ", tcp->u_arg[3]);
311 printflags(shm_flags, tcp->u_arg[1], "SHM_???");
313 tprintf(", %#lx, ", tcp->u_arg[1]);
314 printflags(shm_flags, tcp->u_arg[2], "SHM_???");
320 if (indirect_ipccall(tcp)) {
322 if (umove(tcp, tcp->u_arg[2], &raddr) < 0)
332 tprintf("%#lx", tcp->u_arg[indirect_ipccall(tcp) ? 3 : 0]);
338 printpath(tcp, tcp->u_arg[0]);
341 tprint_open_modes(tcp->u_arg[1]);
342 if (tcp->u_arg[1] & O_CREAT) {
343 # ifndef HAVE_MQUEUE_H
344 tprintf(", %lx", tcp->u_arg[2]);
348 tprintf(", %#lo, ", tcp->u_arg[2]);
349 if (umove(tcp, tcp->u_arg[3], &attr) < 0)
352 tprintf("{mq_maxmsg=%ld, mq_msgsize=%ld}",
353 (long) attr.mq_maxmsg,
354 (long) attr.mq_msgsize);
360 SYS_FUNC(mq_timedsend)
362 tprintf("%ld, ", tcp->u_arg[0]);
363 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
364 tprintf(", %lu, %ld, ", tcp->u_arg[2], tcp->u_arg[3]);
365 printtv(tcp, tcp->u_arg[4]);
369 SYS_FUNC(mq_timedreceive)
372 tprintf("%ld, ", tcp->u_arg[0]);
374 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
375 tprintf(", %lu, %ld, ", tcp->u_arg[2], tcp->u_arg[3]);
376 printtv(tcp, tcp->u_arg[4]);
383 tprintf("%ld, ", tcp->u_arg[0]);
384 printsigevent(tcp, tcp->u_arg[1]);
389 printmqattr(struct tcb *tcp, long addr)
394 # ifndef HAVE_MQUEUE_H
395 tprintf("%#lx", addr);
398 if (umove(tcp, addr, &attr) < 0) {
402 tprints("{mq_flags=");
403 tprint_open_modes(attr.mq_flags);
404 tprintf(", mq_maxmsg=%ld, mq_msgsize=%ld, mq_curmsg=%ld}",
405 (long) attr.mq_maxmsg, (long) attr.mq_msgsize,
406 (long) attr.mq_curmsgs);
411 SYS_FUNC(mq_getsetattr)
414 tprintf("%ld, ", tcp->u_arg[0]);
415 printmqattr(tcp, tcp->u_arg[1]);
418 printmqattr(tcp, tcp->u_arg[2]);