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.
45 extern void printsigevent(struct tcb *tcp, long arg);
47 #include "xlat/msgctl_flags.h"
48 #include "xlat/semctl_flags.h"
49 #include "xlat/shmctl_flags.h"
50 #include "xlat/resource_flags.h"
51 #include "xlat/shm_resource_flags.h"
52 #include "xlat/shm_flags.h"
53 #include "xlat/ipc_msg_flags.h"
54 #include "xlat/semop_flags.h"
59 tprintf("%#lx, ", tcp->u_arg[0]);
61 tprints("IPC_PRIVATE, ");
62 if (printflags(resource_flags, tcp->u_arg[1] & ~0777, NULL) != 0)
64 tprintf("%#lo", tcp->u_arg[1] & 0777);
69 # define PRINTCTL(flagset, arg, dflt) \
70 if ((arg) & IPC_64) tprints("IPC_64|"); \
71 printxval((flagset), (arg) &~ IPC_64, dflt)
73 # define PRINTCTL printxval
77 indirect_ipccall(struct tcb *tcp)
79 return tcp->s_ent->sys_flags & TRACE_INDIRECT_SUBCALL;
84 tprintf("%lu, ", tcp->u_arg[0]);
85 PRINTCTL(msgctl_flags, tcp->u_arg[1], "MSG_???");
87 printaddr(tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2]);
92 tprint_msgbuf(struct tcb *tcp, const long addr, const unsigned long count)
96 if (!umove_or_printaddr(tcp, addr, &mtype)) {
97 tprintf("{%lu, ", mtype);
98 printstr(tcp, addr + sizeof(mtype), count);
101 tprintf(", %lu, ", count);
105 tprint_msgsnd(struct tcb *tcp, const long addr, const unsigned long count,
106 const unsigned long flags)
108 tprint_msgbuf(tcp, addr, count);
109 printflags(ipc_msg_flags, flags, "MSG_???");
114 tprintf("%d, ", (int) tcp->u_arg[0]);
115 if (indirect_ipccall(tcp)) {
116 tprint_msgsnd(tcp, tcp->u_arg[3], tcp->u_arg[1],
119 tprint_msgsnd(tcp, tcp->u_arg[1], tcp->u_arg[2],
126 tprint_msgrcv(struct tcb *tcp, const long addr, const unsigned long count,
129 tprint_msgbuf(tcp, addr, count);
130 tprintf("%ld, ", msgtyp);
136 tprintf("%d, ", (int) tcp->u_arg[0]);
138 if (indirect_ipccall(tcp)) {
144 if (umove_or_printaddr(tcp, tcp->u_arg[3], &tmp))
145 tprintf(", %lu, ", tcp->u_arg[1]);
147 tprint_msgrcv(tcp, (long) tmp.msgp,
148 tcp->u_arg[1], tmp.msgtyp);
149 printflags(ipc_msg_flags, tcp->u_arg[2], "MSG_???");
151 tprint_msgrcv(tcp, tcp->u_arg[1],
152 tcp->u_arg[2], tcp->u_arg[3]);
153 printflags(ipc_msg_flags, tcp->u_arg[4], "MSG_???");
160 tprint_sembuf(const struct sembuf *sb)
162 tprintf("{%u, %d, ", sb->sem_num, sb->sem_op);
163 printflags(semop_flags, sb->sem_flg, "SEM_???");
168 tprint_sembuf_array(struct tcb *tcp, const long addr, const unsigned long count)
170 unsigned long max_count;
174 max_count = (max_strlen < count) ? max_strlen : count;
180 else if (!umove_or_printaddr(tcp, addr, &sb)) {
186 for (i = 1; i < max_count; ++i) {
188 if (umove_or_printaddr(tcp, addr + i * sizeof(sb), &sb))
194 if (i < max_count || max_count < count)
199 tprintf(", %lu", count);
204 tprintf("%lu, ", tcp->u_arg[0]);
205 if (indirect_ipccall(tcp)) {
206 tprint_sembuf_array(tcp, tcp->u_arg[3], tcp->u_arg[1]);
208 tprint_sembuf_array(tcp, tcp->u_arg[1], tcp->u_arg[2]);
215 tprintf("%lu, ", tcp->u_arg[0]);
216 if (indirect_ipccall(tcp)) {
217 tprint_sembuf_array(tcp, tcp->u_arg[3], tcp->u_arg[1]);
219 #if defined(S390) || defined(S390X)
220 printtv(tcp, tcp->u_arg[2]);
222 printtv(tcp, tcp->u_arg[4]);
225 tprint_sembuf_array(tcp, tcp->u_arg[1], tcp->u_arg[2]);
227 printtv(tcp, tcp->u_arg[3]);
235 tprintf("%#lx", tcp->u_arg[0]);
237 tprints("IPC_PRIVATE");
238 tprintf(", %lu, ", tcp->u_arg[1]);
239 if (printflags(resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
241 tprintf("%#lo", tcp->u_arg[2] & 0777);
247 tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
248 PRINTCTL(semctl_flags, tcp->u_arg[2], "SEM_???");
250 if (indirect_ipccall(tcp)) {
251 if (current_wordsize == sizeof(int))
252 printnum_int(tcp, tcp->u_arg[3], "%#x");
254 printnum_long(tcp, tcp->u_arg[3], "%#lx");
256 tprintf("%#lx", tcp->u_arg[3]);
264 tprintf("%#lx", tcp->u_arg[0]);
266 tprints("IPC_PRIVATE");
267 tprintf(", %lu, ", tcp->u_arg[1]);
268 if (printflags(shm_resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
270 tprintf("%#lo", tcp->u_arg[2] & 0777);
276 tprintf("%lu, ", tcp->u_arg[0]);
277 PRINTCTL(shmctl_flags, tcp->u_arg[1], "SHM_???");
279 printaddr(tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2]);
286 tprintf("%lu, ", tcp->u_arg[0]);
287 if (indirect_ipccall(tcp)) {
288 printaddr(tcp->u_arg[3]);
290 printflags(shm_flags, tcp->u_arg[1], "SHM_???");
292 printaddr(tcp->u_arg[1]);
294 printflags(shm_flags, tcp->u_arg[2], "SHM_???");
300 if (indirect_ipccall(tcp)) {
302 if (umove(tcp, tcp->u_arg[2], &raddr) < 0)
312 printaddr(tcp->u_arg[indirect_ipccall(tcp) ? 3 : 0]);
318 printpath(tcp, tcp->u_arg[0]);
321 tprint_open_modes(tcp->u_arg[1]);
322 if (tcp->u_arg[1] & O_CREAT) {
324 tprintf(", %#lo, ", tcp->u_arg[2]);
325 # ifndef HAVE_MQUEUE_H
326 printaddr(tcp->u_arg[3]);
330 if (!umove_or_printaddr(tcp, tcp->u_arg[3], &attr))
331 tprintf("{mq_maxmsg=%ld, mq_msgsize=%ld}",
332 (long) attr.mq_maxmsg,
333 (long) attr.mq_msgsize);
339 SYS_FUNC(mq_timedsend)
341 tprintf("%ld, ", tcp->u_arg[0]);
342 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
343 tprintf(", %lu, %ld, ", tcp->u_arg[2], tcp->u_arg[3]);
344 printtv(tcp, tcp->u_arg[4]);
348 SYS_FUNC(mq_timedreceive)
351 tprintf("%ld, ", tcp->u_arg[0]);
353 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
354 tprintf(", %lu, %ld, ", tcp->u_arg[2], tcp->u_arg[3]);
355 printtv(tcp, tcp->u_arg[4]);
362 tprintf("%ld, ", tcp->u_arg[0]);
363 printsigevent(tcp, tcp->u_arg[1]);
368 printmqattr(struct tcb *tcp, const long addr)
370 # ifndef HAVE_MQUEUE_H
374 if (umove_or_printaddr(tcp, addr, &attr))
376 tprints("{mq_flags=");
377 tprint_open_modes(attr.mq_flags);
378 tprintf(", mq_maxmsg=%ld, mq_msgsize=%ld, mq_curmsg=%ld}",
379 (long) attr.mq_maxmsg, (long) attr.mq_msgsize,
380 (long) attr.mq_curmsgs);
384 SYS_FUNC(mq_getsetattr)
387 tprintf("%ld, ", tcp->u_arg[0]);
388 printmqattr(tcp, tcp->u_arg[1]);
391 printmqattr(tcp, tcp->u_arg[2]);