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);
68 #define PRINTCTL(flagset, arg, dflt) \
69 if ((arg) & IPC_64) tprints("IPC_64|"); \
70 printxval((flagset), (arg) &~ IPC_64, dflt)
73 indirect_ipccall(struct tcb *tcp)
75 return tcp->s_ent->sys_flags & TRACE_INDIRECT_SUBCALL;
80 tprintf("%lu, ", tcp->u_arg[0]);
81 PRINTCTL(msgctl_flags, tcp->u_arg[1], "MSG_???");
83 printaddr(tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2]);
88 tprint_msgbuf(struct tcb *tcp, const long addr, const unsigned long count)
92 if (!umove_or_printaddr(tcp, addr, &mtype)) {
93 tprintf("{%lu, ", mtype);
94 printstr(tcp, addr + sizeof(mtype), count);
97 tprintf(", %lu, ", count);
101 tprint_msgsnd(struct tcb *tcp, const long addr, const unsigned long count,
102 const unsigned long flags)
104 tprint_msgbuf(tcp, addr, count);
105 printflags(ipc_msg_flags, flags, "MSG_???");
110 tprintf("%d, ", (int) tcp->u_arg[0]);
111 if (indirect_ipccall(tcp)) {
112 tprint_msgsnd(tcp, tcp->u_arg[3], tcp->u_arg[1],
115 tprint_msgsnd(tcp, tcp->u_arg[1], tcp->u_arg[2],
122 tprint_msgrcv(struct tcb *tcp, const long addr, const unsigned long count,
125 tprint_msgbuf(tcp, addr, count);
126 tprintf("%ld, ", msgtyp);
132 tprintf("%d, ", (int) tcp->u_arg[0]);
134 if (indirect_ipccall(tcp)) {
140 if (umove_or_printaddr(tcp, tcp->u_arg[3], &tmp))
141 tprintf(", %lu, ", tcp->u_arg[1]);
143 tprint_msgrcv(tcp, (long) tmp.msgp,
144 tcp->u_arg[1], tmp.msgtyp);
145 printflags(ipc_msg_flags, tcp->u_arg[2], "MSG_???");
147 tprint_msgrcv(tcp, tcp->u_arg[1],
148 tcp->u_arg[2], tcp->u_arg[3]);
149 printflags(ipc_msg_flags, tcp->u_arg[4], "MSG_???");
156 tprint_sembuf(const struct sembuf *sb)
158 tprintf("{%u, %d, ", sb->sem_num, sb->sem_op);
159 printflags(semop_flags, sb->sem_flg, "SEM_???");
164 tprint_sembuf_array(struct tcb *tcp, const long addr, const unsigned long count)
166 unsigned long max_count;
170 max_count = (max_strlen < count) ? max_strlen : count;
176 else if (!umove_or_printaddr(tcp, addr, &sb)) {
182 for (i = 1; i < max_count; ++i) {
184 if (umove_or_printaddr(tcp, addr + i * sizeof(sb), &sb))
190 if (i < max_count || max_count < count)
195 tprintf(", %lu", count);
200 tprintf("%lu, ", tcp->u_arg[0]);
201 if (indirect_ipccall(tcp)) {
202 tprint_sembuf_array(tcp, tcp->u_arg[3], tcp->u_arg[1]);
204 tprint_sembuf_array(tcp, tcp->u_arg[1], tcp->u_arg[2]);
211 tprintf("%lu, ", tcp->u_arg[0]);
212 if (indirect_ipccall(tcp)) {
213 tprint_sembuf_array(tcp, tcp->u_arg[3], tcp->u_arg[1]);
215 #if defined(S390) || defined(S390X)
216 printtv(tcp, tcp->u_arg[2]);
218 printtv(tcp, tcp->u_arg[4]);
221 tprint_sembuf_array(tcp, tcp->u_arg[1], tcp->u_arg[2]);
223 printtv(tcp, tcp->u_arg[3]);
231 tprintf("%#lx", tcp->u_arg[0]);
233 tprints("IPC_PRIVATE");
234 tprintf(", %lu, ", tcp->u_arg[1]);
235 if (printflags(resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
237 tprintf("%#lo", tcp->u_arg[2] & 0777);
243 tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
244 PRINTCTL(semctl_flags, tcp->u_arg[2], "SEM_???");
246 if (indirect_ipccall(tcp)) {
247 if (current_wordsize == sizeof(int))
248 printnum_int(tcp, tcp->u_arg[3], "%#x");
250 printnum_long(tcp, tcp->u_arg[3], "%#lx");
252 tprintf("%#lx", tcp->u_arg[3]);
260 tprintf("%#lx", tcp->u_arg[0]);
262 tprints("IPC_PRIVATE");
263 tprintf(", %lu, ", tcp->u_arg[1]);
264 if (printflags(shm_resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
266 tprintf("%#lo", tcp->u_arg[2] & 0777);
272 tprintf("%lu, ", tcp->u_arg[0]);
273 PRINTCTL(shmctl_flags, tcp->u_arg[1], "SHM_???");
275 printaddr(tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2]);
282 tprintf("%lu, ", tcp->u_arg[0]);
283 if (indirect_ipccall(tcp)) {
284 printaddr(tcp->u_arg[3]);
286 printflags(shm_flags, tcp->u_arg[1], "SHM_???");
288 printaddr(tcp->u_arg[1]);
290 printflags(shm_flags, tcp->u_arg[2], "SHM_???");
296 if (indirect_ipccall(tcp)) {
298 if (umove(tcp, tcp->u_arg[2], &raddr) < 0)
308 printaddr(tcp->u_arg[indirect_ipccall(tcp) ? 3 : 0]);
314 printpath(tcp, tcp->u_arg[0]);
317 tprint_open_modes(tcp->u_arg[1]);
318 if (tcp->u_arg[1] & O_CREAT) {
320 tprintf(", %#lo, ", tcp->u_arg[2]);
321 # ifndef HAVE_MQUEUE_H
322 printaddr(tcp->u_arg[3]);
326 if (!umove_or_printaddr(tcp, tcp->u_arg[3], &attr))
327 tprintf("{mq_maxmsg=%ld, mq_msgsize=%ld}",
328 (long) attr.mq_maxmsg,
329 (long) attr.mq_msgsize);
335 SYS_FUNC(mq_timedsend)
337 tprintf("%ld, ", tcp->u_arg[0]);
338 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
339 tprintf(", %lu, %ld, ", tcp->u_arg[2], tcp->u_arg[3]);
340 printtv(tcp, tcp->u_arg[4]);
344 SYS_FUNC(mq_timedreceive)
347 tprintf("%ld, ", tcp->u_arg[0]);
349 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
350 tprintf(", %lu, %ld, ", tcp->u_arg[2], tcp->u_arg[3]);
351 printtv(tcp, tcp->u_arg[4]);
358 tprintf("%ld, ", tcp->u_arg[0]);
359 printsigevent(tcp, tcp->u_arg[1]);
364 printmqattr(struct tcb *tcp, const long addr)
366 # ifndef HAVE_MQUEUE_H
370 if (umove_or_printaddr(tcp, addr, &attr))
372 tprints("{mq_flags=");
373 tprint_open_modes(attr.mq_flags);
374 tprintf(", mq_maxmsg=%ld, mq_msgsize=%ld, mq_curmsg=%ld}",
375 (long) attr.mq_maxmsg, (long) attr.mq_msgsize,
376 (long) attr.mq_curmsgs);
380 SYS_FUNC(mq_getsetattr)
383 tprintf("%ld, ", tcp->u_arg[0]);
384 printmqattr(tcp, tcp->u_arg[1]);
387 printmqattr(tcp, tcp->u_arg[2]);