2 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
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.
34 #ifdef HAVE_SYS_EPOLL_H
35 # include <sys/epoll.h>
37 #ifdef HAVE_LINUX_PERF_EVENT_H
38 # include <linux/perf_event.h>
41 /* --- Copied from libaio-0.3.109/src/libaio.h ---
42 * Why keep a copy instead of using external libaio.h?
43 * Because we want to properly decode 32-bit aio calls
44 * by 64-bit strace. For that, we need more definitions than
45 * libaio.h provides. (TODO).
46 * Keeping our local 32-bit compat defs in sync with libaio.h
47 * _without seeing libaio structs_ is hard/more bug-prone.
48 * A smaller benefit is that we don't need libaio installed.
50 #define HAVE_LIBAIO_H 1
51 typedef enum io_iocb_cmd {
58 IO_CMD_POLL = 5, /* Never implemented in mainline, see io_prep_poll */
64 #if defined(__i386__) /* little endian, 32 bits */
65 #define PADDED(x, y) x; unsigned y
66 #define PADDEDptr(x, y) x; unsigned y
67 #define PADDEDul(x, y) unsigned long x; unsigned y
68 #elif defined(__ia64__) || defined(__x86_64__) || defined(__alpha__)
69 #define PADDED(x, y) x, y
70 #define PADDEDptr(x, y) x
71 #define PADDEDul(x, y) unsigned long x
72 #elif defined(__powerpc64__) /* big endian, 64 bits */
73 #define PADDED(x, y) unsigned y; x
74 #define PADDEDptr(x,y) x
75 #define PADDEDul(x, y) unsigned long x
76 #elif defined(__PPC__) /* big endian, 32 bits */
77 #define PADDED(x, y) unsigned y; x
78 #define PADDEDptr(x, y) unsigned y; x
79 #define PADDEDul(x, y) unsigned y; unsigned long x
80 #elif defined(__s390x__) /* big endian, 64 bits */
81 #define PADDED(x, y) unsigned y; x
82 #define PADDEDptr(x,y) x
83 #define PADDEDul(x, y) unsigned long x
84 #elif defined(__s390__) /* big endian, 32 bits */
85 #define PADDED(x, y) unsigned y; x
86 #define PADDEDptr(x, y) unsigned y; x
87 #define PADDEDul(x, y) unsigned y; unsigned long x
88 #elif defined(__arm__)
89 # if defined (__ARMEB__) /* big endian, 32 bits */
90 #define PADDED(x, y) unsigned y; x
91 #define PADDEDptr(x, y) unsigned y; x
92 #define PADDEDul(x, y) unsigned y; unsigned long x
93 # else /* little endian, 32 bits */
94 #define PADDED(x, y) x; unsigned y
95 #define PADDEDptr(x, y) x; unsigned y
96 #define PADDEDul(x, y) unsigned long x; unsigned y
99 # warning No AIO definitions for this architecture => no io_submit decoding
100 # undef HAVE_LIBAIO_H
104 struct io_iocb_poll {
105 PADDED(int events, __pad1);
106 }; /* result code is the set of result flags or -'ve errno */
108 struct io_iocb_sockaddr {
109 struct sockaddr *addr;
111 }; /* result code is the length of the sockaddr, or -'ve errno */
113 struct io_iocb_common {
114 PADDEDptr(void *buf, __pad1);
115 PADDEDul(nbytes, __pad2);
120 }; /* result code is the amount read or -'ve errno */
122 struct io_iocb_vector {
123 const struct iovec *vec;
126 }; /* result code is the amount read or -'ve errno */
129 PADDEDptr(void *data, __pad1); /* Return in the io completion event */
130 PADDED(unsigned key, __pad2); /* For use in identifying io requests */
132 short aio_lio_opcode;
137 struct io_iocb_common c;
138 struct io_iocb_vector v;
139 struct io_iocb_poll poll;
140 struct io_iocb_sockaddr saddr;
145 PADDEDptr(void *data, __pad1);
146 PADDEDptr(struct iocb *obj, __pad2);
147 PADDEDul(res, __pad3);
148 PADDEDul(res2, __pad4);
155 #endif /* HAVE_LIBAIO_H */
157 /* --- End of a chunk of libaio.h --- */
158 /* Not defined in libaio.h */
160 # define IOCB_RESFD (1 << 0)
164 static const struct xlat fcntlcmds[] = {
165 { F_DUPFD, "F_DUPFD" },
166 { F_GETFD, "F_GETFD" },
167 { F_SETFD, "F_SETFD" },
168 { F_GETFL, "F_GETFL" },
169 { F_SETFL, "F_SETFL" },
170 { F_GETLK, "F_GETLK" },
171 { F_SETLK, "F_SETLK" },
172 { F_SETLKW, "F_SETLKW" },
173 { F_GETOWN, "F_GETOWN" },
174 { F_SETOWN, "F_SETOWN" },
176 { F_RSETLK, "F_RSETLK" },
179 { F_RSETLKW, "F_RSETLKW" },
182 { F_RGETLK, "F_RGETLK" },
185 { F_CNVT, "F_CNVT" },
188 { F_SETSIG, "F_SETSIG" },
191 { F_GETSIG, "F_GETSIG" },
194 { F_CHKFL, "F_CHKFL" },
197 { F_DUP2FD, "F_DUP2FD" },
200 { F_ALLOCSP, "F_ALLOCSP" },
203 { F_ISSTREAM, "F_ISSTREAM" },
206 { F_PRIV, "F_PRIV" },
209 { F_NPRIV, "F_NPRIV" },
212 { F_QUOTACL, "F_QUOTACL" },
215 { F_BLOCKS, "F_BLOCKS" },
218 { F_BLKSIZE, "F_BLKSIZE" },
221 { F_GETOWN, "F_GETOWN" },
224 { F_SETOWN, "F_SETOWN" },
227 { F_REVOKE, "F_REVOKE" },
230 { F_SETLK, "F_SETLK" },
233 { F_SETLKW, "F_SETLKW" },
236 { F_FREESP, "F_FREESP" },
239 { F_GETLK, "F_GETLK" },
242 { F_SETLK64, "F_SETLK64" },
245 { F_SETLKW64, "F_SETLKW64" },
248 { F_FREESP64, "F_FREESP64" },
251 { F_GETLK64, "F_GETLK64" },
254 { F_SHARE, "F_SHARE" },
257 { F_UNSHARE, "F_UNSHARE" },
260 { F_SETLEASE, "F_SETLEASE" },
263 { F_GETLEASE, "F_GETLEASE" },
266 { F_NOTIFY, "F_NOTIFY" },
268 #ifdef F_DUPFD_CLOEXEC
269 { F_DUPFD_CLOEXEC,"F_DUPFD_CLOEXEC"},
274 static const struct xlat fdflags[] = {
276 { FD_CLOEXEC, "FD_CLOEXEC" },
283 static const struct xlat flockcmds[] = {
284 { LOCK_SH, "LOCK_SH" },
285 { LOCK_EX, "LOCK_EX" },
286 { LOCK_NB, "LOCK_NB" },
287 { LOCK_UN, "LOCK_UN" },
293 static const struct xlat lockfcmds[] = {
294 { F_RDLCK, "F_RDLCK" },
295 { F_WRLCK, "F_WRLCK" },
296 { F_UNLCK, "F_UNLCK" },
298 { F_EXLCK, "F_EXLCK" },
301 { F_SHLCK, "F_SHLCK" },
307 static const struct xlat notifyflags[] = {
309 { DN_ACCESS, "DN_ACCESS" },
312 { DN_MODIFY, "DN_MODIFY" },
315 { DN_CREATE, "DN_CREATE" },
318 { DN_DELETE, "DN_DELETE" },
321 { DN_RENAME, "DN_RENAME" },
324 { DN_ATTRIB, "DN_ATTRIB" },
327 { DN_MULTISHOT, "DN_MULTISHOT" },
333 static const struct xlat perf_event_open_flags[] = {
334 #ifdef PERF_FLAG_FD_NO_GROUP
335 { PERF_FLAG_FD_NO_GROUP, "PERF_FLAG_FD_NO_GROUP" },
337 #ifdef PERF_FLAG_FD_OUTPUT
338 { PERF_FLAG_FD_OUTPUT, "PERF_FLAG_FD_OUTPUT" },
340 #ifdef PERF_FLAG_PID_CGROUP
341 { PERF_FLAG_PID_CGROUP, "PERF_FLAG_PID_CGROUP" },
349 printflock64(struct tcb *tcp, long addr, int getlk)
353 if (umove(tcp, addr, &fl) < 0) {
358 printxval(lockfcmds, fl.l_type, "F_???");
359 tprints(", whence=");
360 printxval(whence_codes, fl.l_whence, "SEEK_???");
361 tprintf(", start=%lld, len=%lld", (long long) fl.l_start, (long long) fl.l_len);
363 tprintf(", pid=%lu}", (unsigned long) fl.l_pid);
371 printflock(struct tcb *tcp, long addr, int getlk)
375 #if SUPPORTED_PERSONALITIES > 1
377 if (current_personality == 0) {
378 printflock64(tcp, addr, getlk);
382 if (current_wordsize != sizeof(fl.l_start)) {
383 if (current_wordsize == 4) {
384 /* 32-bit x86 app on x86_64 and similar cases */
388 int32_t l_start; /* off_t */
389 int32_t l_len; /* off_t */
390 int32_t l_pid; /* pid_t */
392 if (umove(tcp, addr, &fl32) < 0) {
396 fl.l_type = fl32.l_type;
397 fl.l_whence = fl32.l_whence;
398 fl.l_start = fl32.l_start;
399 fl.l_len = fl32.l_len;
400 fl.l_pid = fl32.l_pid;
402 /* let people know we have a problem here */
403 tprintf("<decode error: unsupported wordsize %d>",
410 if (umove(tcp, addr, &fl) < 0) {
416 printxval(lockfcmds, fl.l_type, "F_???");
417 tprints(", whence=");
418 printxval(whence_codes, fl.l_whence, "SEEK_???");
420 tprintf(", start=%lld, len=%lld", fl.l_start, fl.l_len);
422 tprintf(", start=%ld, len=%ld", fl.l_start, fl.l_len);
425 tprintf(", pid=%lu}", (unsigned long) fl.l_pid);
431 sys_fcntl(struct tcb *tcp)
434 printfd(tcp, tcp->u_arg[0]);
436 printxval(fcntlcmds, tcp->u_arg[1], "F_???");
437 switch (tcp->u_arg[1]) {
440 printflags(fdflags, tcp->u_arg[2], "FD_???");
442 case F_SETOWN: case F_DUPFD:
443 #ifdef F_DUPFD_CLOEXEC
444 case F_DUPFD_CLOEXEC:
446 tprintf(", %ld", tcp->u_arg[2]);
450 tprint_open_modes(tcp->u_arg[2]);
452 case F_SETLK: case F_SETLKW:
457 printflock(tcp, tcp->u_arg[2], 0);
463 /* Linux glibc defines SETLK64 as SETLK,
464 even though the kernel has different values - as does Solaris. */
465 #if defined(F_SETLK64) && F_SETLK64 + 0 != F_SETLK
468 #if defined(F_SETLKW64) && F_SETLKW64 + 0 != F_SETLKW
472 printflock64(tcp, tcp->u_arg[2], 0);
478 printflags(notifyflags, tcp->u_arg[2], "DN_???");
484 printxval(lockfcmds, tcp->u_arg[2], "F_???");
490 switch (tcp->u_arg[1]) {
492 #ifdef F_DUPFD_CLOEXEC
493 case F_DUPFD_CLOEXEC:
495 case F_SETFD: case F_SETFL:
496 case F_SETLK: case F_SETLKW:
497 case F_SETOWN: case F_GETOWN:
506 if (syserror(tcp) || tcp->u_rval == 0)
508 tcp->auxstr = sprintflags("flags ", fdflags, tcp->u_rval);
509 return RVAL_HEX|RVAL_STR;
513 tcp->auxstr = sprint_open_modes(tcp->u_rval);
514 return RVAL_HEX|RVAL_STR;
517 printflock(tcp, tcp->u_arg[2], 1);
520 #if defined(F_GETLK64) && F_GETLK64+0 != F_GETLK
524 printflock64(tcp, tcp->u_arg[2], 1);
531 tcp->auxstr = xlookup(lockfcmds, tcp->u_rval);
532 return RVAL_HEX|RVAL_STR;
535 tprintf(", %#lx", tcp->u_arg[2]);
545 sys_flock(struct tcb *tcp)
548 printfd(tcp, tcp->u_arg[0]);
550 printflags(flockcmds, tcp->u_arg[1], "LOCK_???");
557 sys_close(struct tcb *tcp)
560 printfd(tcp, tcp->u_arg[0]);
566 do_dup2(struct tcb *tcp, int flags_arg)
569 printfd(tcp, tcp->u_arg[0]);
571 printfd(tcp, tcp->u_arg[1]);
572 if (flags_arg >= 0) {
574 printflags(open_mode_flags, tcp->u_arg[flags_arg], "O_???");
581 sys_dup2(struct tcb *tcp)
583 return do_dup2(tcp, -1);
587 sys_dup3(struct tcb *tcp)
589 return do_dup2(tcp, 2);
594 sys_getdtablesize(struct tcb *tcp)
601 decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
609 /* Kernel truncates arg[0] to int, we do the same. */
610 nfds = (int) args[0];
612 /* Kernel rejects negative nfds, so we don't parse it either. */
617 /* Beware of select(2^31-1, NULL, NULL, NULL) and similar... */
618 if (nfds > 1024*1024)
622 * We had bugs a-la "while (j < args[0])" and "umoven(args[0])" below.
623 * Instead of args[0], use nfds for fd count, fdsize for array lengths.
625 fdsize = (((nfds + 7) / 8) + current_wordsize-1) & -current_wordsize;
628 tprintf("%d", (int) args[0]);
631 fds = malloc(fdsize);
635 for (i = 0; i < 3; i++) {
641 if (!verbose(tcp) || !fds) {
642 tprintf(", %#lx", arg);
645 if (umoven(tcp, arg, fdsize, (char *) fds) < 0) {
650 for (j = 0, sep = "";; j++) {
651 j = next_set_bit(fds, j, nfds);
662 printtv_bitness(tcp, args[4], bitness, 0);
665 static char outstr[1024];
667 #define end_outstr (outstr + sizeof(outstr))
673 ready_fds = tcp->u_rval;
674 if (ready_fds == 0) {
675 tcp->auxstr = "Timeout";
679 fds = malloc(fdsize);
685 for (i = 0; i < 3 && ready_fds > 0; i++) {
689 if (!arg || umoven(tcp, arg, fdsize, (char *) fds) < 0)
692 j = next_set_bit(fds, j, nfds);
695 /* +2 chars needed at the end: ']',NUL */
696 if (outptr < end_outstr - (sizeof(", except [") + sizeof(int)*3 + 2)) {
698 outptr += sprintf(outptr, "%s%s [%u",
700 i == 0 ? "in" : i == 1 ? "out" : "except",
707 outptr += sprintf(outptr, " %u", j);
710 if (--ready_fds == 0)
713 if (outptr != outstr)
717 /* This contains no useful information on SunOS. */
719 if (outptr < end_outstr - (10 + TIMEVAL_TEXT_BUFSIZE)) {
720 outptr += sprintf(outptr, "%sleft ", sep);
721 outptr = sprinttv(outptr, tcp, args[4], bitness, /*special:*/ 0);
725 tcp->auxstr = outstr;
733 sys_oldselect(struct tcb *tcp)
737 if (umoven(tcp, tcp->u_arg[0], sizeof args, (char *) args) < 0) {
741 return decode_select(tcp, args, BITNESS_CURRENT);
746 sys_osf_select(struct tcb *tcp)
748 long *args = tcp->u_arg;
749 return decode_select(tcp, args, BITNESS_32);
753 static const struct xlat epollctls[] = {
755 { EPOLL_CTL_ADD, "EPOLL_CTL_ADD" },
758 { EPOLL_CTL_MOD, "EPOLL_CTL_MOD" },
761 { EPOLL_CTL_DEL, "EPOLL_CTL_DEL" },
766 static const struct xlat epollevents[] = {
768 { EPOLLIN, "EPOLLIN" },
771 { EPOLLPRI, "EPOLLPRI" },
774 { EPOLLOUT, "EPOLLOUT" },
777 { EPOLLRDNORM, "EPOLLRDNORM" },
780 { EPOLLRDBAND, "EPOLLRDBAND" },
783 { EPOLLWRNORM, "EPOLLWRNORM" },
786 { EPOLLWRBAND, "EPOLLWRBAND" },
789 { EPOLLMSG, "EPOLLMSG" },
792 { EPOLLERR, "EPOLLERR" },
795 { EPOLLHUP, "EPOLLHUP" },
798 { EPOLLRDHUP, "EPOLLRDHUP" },
801 { EPOLLONESHOT, "EPOLLONESHOT" },
804 { EPOLLET, "EPOLLET" },
809 /* Not aliased to printargs_ld: we want it to have a distinct address */
811 sys_epoll_create(struct tcb *tcp)
813 return printargs_ld(tcp);
816 static const struct xlat epollflags[] = {
818 { EPOLL_CLOEXEC, "EPOLL_CLOEXEC" },
820 #ifdef EPOLL_NONBLOCK
821 { EPOLL_NONBLOCK, "EPOLL_NONBLOCK" },
827 sys_epoll_create1(struct tcb *tcp)
830 printflags(epollflags, tcp->u_arg[0], "EPOLL_???");
834 #ifdef HAVE_SYS_EPOLL_H
836 print_epoll_event(struct epoll_event *ev)
839 printflags(epollevents, ev->events, "EPOLL???");
840 /* We cannot know what format the program uses, so print u32 and u64
841 which will cover every value. */
842 tprintf(", {u32=%" PRIu32 ", u64=%" PRIu64 "}}",
843 ev->data.u32, ev->data.u64);
848 sys_epoll_ctl(struct tcb *tcp)
851 printfd(tcp, tcp->u_arg[0]);
853 printxval(epollctls, tcp->u_arg[1], "EPOLL_CTL_???");
855 printfd(tcp, tcp->u_arg[2]);
857 if (tcp->u_arg[3] == 0)
860 #ifdef HAVE_SYS_EPOLL_H
861 struct epoll_event ev;
862 if (umove(tcp, tcp->u_arg[3], &ev) == 0)
863 print_epoll_event(&ev);
873 epoll_wait_common(struct tcb *tcp)
876 printfd(tcp, tcp->u_arg[0]);
880 tprintf("%lx", tcp->u_arg[1]);
881 else if (tcp->u_rval == 0)
884 #ifdef HAVE_SYS_EPOLL_H
885 struct epoll_event ev, *start, *cur, *end;
889 start = (struct epoll_event *) tcp->u_arg[1];
890 end = start + tcp->u_rval;
891 for (cur = start; cur < end; ++cur) {
894 if (umove(tcp, (long) cur, &ev) == 0)
895 print_epoll_event(&ev);
904 tprintf(" %#lx", (long) start);
909 tprintf(", %d, %d", (int) tcp->u_arg[2], (int) tcp->u_arg[3]);
914 sys_epoll_wait(struct tcb *tcp)
916 epoll_wait_common(tcp);
921 sys_epoll_pwait(struct tcb *tcp)
923 epoll_wait_common(tcp);
926 /* NB: kernel requires arg[5] == NSIG / 8 */
927 print_sigset_addr_len(tcp, tcp->u_arg[4], tcp->u_arg[5]);
928 tprintf(", %lu", tcp->u_arg[5]);
934 sys_io_setup(struct tcb *tcp)
937 tprintf("%ld, ", tcp->u_arg[0]);
940 tprintf("0x%0lx", tcp->u_arg[1]);
942 unsigned long user_id;
943 if (umove(tcp, tcp->u_arg[1], &user_id) == 0)
944 tprintf("{%lu}", user_id);
953 sys_io_destroy(struct tcb *tcp)
956 tprintf("%lu", tcp->u_arg[0]);
963 SUB_NONE, SUB_COMMON, SUB_POLL, SUB_VECTOR
967 tprint_lio_opcode(unsigned cmd)
969 static const struct {
973 { "pread", SUB_COMMON },
974 { "pwrite", SUB_COMMON },
975 { "fsync", SUB_NONE },
976 { "fdsync", SUB_NONE },
978 { "poll", SUB_POLL },
979 { "noop", SUB_NONE },
980 { "preadv", SUB_VECTOR },
981 { "pwritev", SUB_VECTOR },
984 if (cmd < ARRAY_SIZE(cmds)) {
985 tprints(cmds[cmd].name);
986 return cmds[cmd].sub;
988 tprintf("%u /* SUB_??? */", cmd);
993 print_common_flags(struct iocb *iocb)
995 if (iocb->u.c.flags & IOCB_RESFD)
996 tprintf(", resfd=%d", iocb->u.c.resfd);
997 if (iocb->u.c.flags & ~IOCB_RESFD)
998 tprintf(", flags=%x", iocb->u.c.flags);
1001 #endif /* HAVE_LIBAIO_H */
1004 sys_io_submit(struct tcb *tcp)
1006 if (entering(tcp)) {
1007 #ifdef HAVE_LIBAIO_H
1008 long nr = tcp->u_arg[1];
1009 /* if nr <= 0, we end up printing just "{}" */
1010 tprintf("%lu, %ld, {", tcp->u_arg[0], tcp->u_arg[1]);
1013 struct iocb **iocbs = (void *)tcp->u_arg[2];
1014 //FIXME: decoding of 32-bit call by 64-bit strace
1016 for (i = 0; i < nr; i++, iocbs++) {
1023 if (umove(tcp, (unsigned long)iocbs, &iocbp)) {
1024 tprintf("%#lx", (unsigned long)iocbs);
1025 /* No point in trying to read iocbs+1 etc */
1026 /* (nr can be ridiculously large): */
1029 if (umove(tcp, (unsigned long)iocbp, &iocb)) {
1030 tprintf("{%#lx}", (unsigned long)iocbp);
1035 tprintf("data:%p, ", iocb.data);
1037 tprintf("key:%u, ", iocb.key);
1038 sub = tprint_lio_opcode(iocb.aio_lio_opcode);
1039 if (iocb.aio_reqprio)
1040 tprintf(", reqprio:%d", iocb.aio_reqprio);
1041 tprintf(", filedes:%d", iocb.aio_fildes);
1044 if (iocb.aio_lio_opcode == IO_CMD_PWRITE) {
1046 printstr(tcp, (unsigned long)iocb.u.c.buf,
1049 tprintf(", buf:%p", iocb.u.c.buf);
1050 tprintf(", nbytes:%lu, offset:%lld",
1053 print_common_flags(&iocb);
1056 tprintf(", %lld", iocb.u.v.offset);
1057 print_common_flags(&iocb);
1059 tprint_iov(tcp, iocb.u.v.nr,
1060 (unsigned long)iocb.u.v.vec,
1061 iocb.aio_lio_opcode == IO_CMD_PWRITEV
1065 tprintf(", %x", iocb.u.poll.events);
1075 tprintf("%lu, %ld, %#lx", tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]);
1082 sys_io_cancel(struct tcb *tcp)
1084 if (entering(tcp)) {
1085 #ifdef HAVE_LIBAIO_H
1088 tprintf("%lu, ", tcp->u_arg[0]);
1089 #ifdef HAVE_LIBAIO_H
1090 if (umove(tcp, tcp->u_arg[1], &iocb) == 0) {
1091 tprintf("{%p, %u, %u, %u, %d}, ",
1092 iocb.data, iocb.key,
1093 (unsigned)iocb.aio_lio_opcode,
1094 (unsigned)iocb.aio_reqprio, iocb.aio_fildes);
1099 if (tcp->u_rval < 0)
1102 #ifdef HAVE_LIBAIO_H
1103 struct io_event event;
1104 if (umove(tcp, tcp->u_arg[2], &event) == 0)
1105 tprintf("{%p, %p, %ld, %ld}",
1106 event.data, event.obj,
1107 event.res, event.res2);
1117 sys_io_getevents(struct tcb *tcp)
1119 if (entering(tcp)) {
1120 tprintf("%ld, %ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1],
1123 if (tcp->u_rval == 0) {
1126 #ifdef HAVE_LIBAIO_H
1127 struct io_event *events = (void *)tcp->u_arg[3];
1128 long i, nr = tcp->u_rval;
1130 for (i = 0; i < nr; i++, events++) {
1131 struct io_event event;
1138 if (umove(tcp, (unsigned long)events, &event) != 0) {
1142 tprintf("{%p, %p, %ld, %ld}", event.data,
1143 event.obj, event.res, event.res2);
1151 print_timespec(tcp, tcp->u_arg[4]);
1157 sys_select(struct tcb *tcp)
1159 return decode_select(tcp, tcp->u_arg, BITNESS_CURRENT);
1163 sys_pselect6(struct tcb *tcp)
1165 int rc = decode_select(tcp, tcp->u_arg, BITNESS_CURRENT);
1166 if (entering(tcp)) {
1172 #if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
1173 if (current_wordsize == 4) {
1178 r = umove(tcp, tcp->u_arg[5], &data32);
1179 data.ptr = data32.ptr;
1180 data.len = data32.len;
1183 r = umove(tcp, tcp->u_arg[5], &data);
1185 tprintf(", %#lx", tcp->u_arg[5]);
1188 /* NB: kernel requires data.len == NSIG / 8 */
1189 print_sigset_addr_len(tcp, data.ptr, data.len);
1190 tprintf(", %lu}", data.len);
1197 do_eventfd(struct tcb *tcp, int flags_arg)
1199 if (entering(tcp)) {
1200 tprintf("%lu", tcp->u_arg[0]);
1201 if (flags_arg >= 0) {
1203 printflags(open_mode_flags, tcp->u_arg[flags_arg], "O_???");
1210 sys_eventfd(struct tcb *tcp)
1212 return do_eventfd(tcp, -1);
1216 sys_eventfd2(struct tcb *tcp)
1218 return do_eventfd(tcp, 1);
1222 sys_perf_event_open(struct tcb *tcp)
1224 if (entering(tcp)) {
1225 tprintf("%#lx, %d, %d, %d, ",
1227 (int) tcp->u_arg[1],
1228 (int) tcp->u_arg[2],
1229 (int) tcp->u_arg[3]);
1230 printflags(perf_event_open_flags, tcp->u_arg[4],