1 #include "qemu/osdep.h"
6 #include <sys/select.h>
9 #include <netinet/tcp.h>
10 #include <linux/if_packet.h>
11 #include <linux/netlink.h>
19 void (*call
)(const struct syscallname
*,
20 abi_long
, abi_long
, abi_long
,
21 abi_long
, abi_long
, abi_long
);
22 void (*result
)(const struct syscallname
*, abi_long
,
23 abi_long
, abi_long
, abi_long
,
24 abi_long
, abi_long
, abi_long
);
29 * It is possible that target doesn't have syscall that uses
30 * following flags but we don't want the compiler to warn
31 * us about them being unused. Same applies to utility print
32 * functions. It is ok to keep them while not used.
34 #define UNUSED __attribute__ ((unused))
40 * Structure used to translate flag values into strings. This is
41 * similar that is in the actual strace tool.
44 abi_long f_value
; /* flag */
45 const char *f_string
; /* stringified flag */
48 /* common flags for all architectures */
49 #define FLAG_GENERIC(name) { name, #name }
50 /* target specific flags (syscall_defs.h has TARGET_<flag>) */
51 #define FLAG_TARGET(name) { TARGET_ ## name, #name }
52 /* end of flags array */
53 #define FLAG_END { 0, NULL }
55 UNUSED
static const char *get_comma(int);
56 UNUSED
static void print_pointer(abi_long
, int);
57 UNUSED
static void print_flags(const struct flags
*, abi_long
, int);
58 UNUSED
static void print_at_dirfd(abi_long
, int);
59 UNUSED
static void print_file_mode(abi_long
, int);
60 UNUSED
static void print_open_flags(abi_long
, int);
61 UNUSED
static void print_syscall_prologue(const struct syscallname
*);
62 UNUSED
static void print_syscall_epilogue(const struct syscallname
*);
63 UNUSED
static void print_string(abi_long
, int);
64 UNUSED
static void print_buf(abi_long addr
, abi_long len
, int last
);
65 UNUSED
static void print_raw_param(const char *, abi_long
, int);
66 UNUSED
static void print_timeval(abi_ulong
, int);
67 UNUSED
static void print_timezone(abi_ulong
, int);
68 UNUSED
static void print_number(abi_long
, int);
69 UNUSED
static void print_signal(abi_ulong
, int);
70 UNUSED
static void print_sockaddr(abi_ulong
, abi_long
, int);
71 UNUSED
static void print_socket_domain(int domain
);
72 UNUSED
static void print_socket_type(int type
);
73 UNUSED
static void print_socket_protocol(int domain
, int type
, int protocol
);
79 print_ipc_cmd(int cmd
)
81 #define output_cmd(val) \
89 /* General IPC commands */
90 output_cmd( IPC_RMID
);
91 output_cmd( IPC_SET
);
92 output_cmd( IPC_STAT
);
93 output_cmd( IPC_INFO
);
94 /* msgctl() commands */
95 output_cmd( MSG_STAT
);
96 output_cmd( MSG_INFO
);
97 /* shmctl() commands */
98 output_cmd( SHM_LOCK
);
99 output_cmd( SHM_UNLOCK
);
100 output_cmd( SHM_STAT
);
101 output_cmd( SHM_INFO
);
102 /* semctl() commands */
103 output_cmd( GETPID
);
104 output_cmd( GETVAL
);
105 output_cmd( GETALL
);
106 output_cmd( GETNCNT
);
107 output_cmd( GETZCNT
);
108 output_cmd( SETVAL
);
109 output_cmd( SETALL
);
110 output_cmd( SEM_STAT
);
111 output_cmd( SEM_INFO
);
112 output_cmd( IPC_RMID
);
113 output_cmd( IPC_RMID
);
114 output_cmd( IPC_RMID
);
115 output_cmd( IPC_RMID
);
116 output_cmd( IPC_RMID
);
117 output_cmd( IPC_RMID
);
118 output_cmd( IPC_RMID
);
119 output_cmd( IPC_RMID
);
120 output_cmd( IPC_RMID
);
122 /* Some value we don't recognize */
127 print_signal(abi_ulong arg
, int last
)
129 const char *signal_name
= NULL
;
131 case TARGET_SIGHUP
: signal_name
= "SIGHUP"; break;
132 case TARGET_SIGINT
: signal_name
= "SIGINT"; break;
133 case TARGET_SIGQUIT
: signal_name
= "SIGQUIT"; break;
134 case TARGET_SIGILL
: signal_name
= "SIGILL"; break;
135 case TARGET_SIGABRT
: signal_name
= "SIGABRT"; break;
136 case TARGET_SIGFPE
: signal_name
= "SIGFPE"; break;
137 case TARGET_SIGKILL
: signal_name
= "SIGKILL"; break;
138 case TARGET_SIGSEGV
: signal_name
= "SIGSEGV"; break;
139 case TARGET_SIGPIPE
: signal_name
= "SIGPIPE"; break;
140 case TARGET_SIGALRM
: signal_name
= "SIGALRM"; break;
141 case TARGET_SIGTERM
: signal_name
= "SIGTERM"; break;
142 case TARGET_SIGUSR1
: signal_name
= "SIGUSR1"; break;
143 case TARGET_SIGUSR2
: signal_name
= "SIGUSR2"; break;
144 case TARGET_SIGCHLD
: signal_name
= "SIGCHLD"; break;
145 case TARGET_SIGCONT
: signal_name
= "SIGCONT"; break;
146 case TARGET_SIGSTOP
: signal_name
= "SIGSTOP"; break;
147 case TARGET_SIGTTIN
: signal_name
= "SIGTTIN"; break;
148 case TARGET_SIGTTOU
: signal_name
= "SIGTTOU"; break;
150 if (signal_name
== NULL
) {
151 print_raw_param("%ld", arg
, last
);
154 qemu_log("%s%s", signal_name
, get_comma(last
));
157 static void print_si_code(int arg
)
159 const char *codename
= NULL
;
163 codename
= "SI_USER";
166 codename
= "SI_KERNEL";
169 codename
= "SI_QUEUE";
172 codename
= "SI_TIMER";
175 codename
= "SI_MESGQ";
178 codename
= "SI_ASYNCIO";
181 codename
= "SI_SIGIO";
184 codename
= "SI_TKILL";
190 qemu_log("%s", codename
);
193 static void get_target_siginfo(target_siginfo_t
*tinfo
,
194 const target_siginfo_t
*info
)
203 __get_user(sig
, &info
->si_signo
);
204 __get_user(si_errno
, &tinfo
->si_errno
);
205 __get_user(si_code
, &info
->si_code
);
207 tinfo
->si_signo
= sig
;
208 tinfo
->si_errno
= si_errno
;
209 tinfo
->si_code
= si_code
;
211 /* Ensure we don't leak random junk to the guest later */
212 memset(tinfo
->_sifields
._pad
, 0, sizeof(tinfo
->_sifields
._pad
));
214 /* This is awkward, because we have to use a combination of
215 * the si_code and si_signo to figure out which of the union's
216 * members are valid. (Within the host kernel it is always possible
217 * to tell, but the kernel carefully avoids giving userspace the
218 * high 16 bits of si_code, so we don't have the information to
219 * do this the easy way...) We therefore make our best guess,
220 * bearing in mind that a guest can spoof most of the si_codes
221 * via rt_sigqueueinfo() if it likes.
223 * Once we have made our guess, we record it in the top 16 bits of
224 * the si_code, so that print_siginfo() later can use it.
225 * print_siginfo() will strip these top bits out before printing
233 /* Sent via kill(), tkill() or tgkill(), or direct from the kernel.
234 * These are the only unspoofable si_code values.
236 __get_user(tinfo
->_sifields
._kill
._pid
, &info
->_sifields
._kill
._pid
);
237 __get_user(tinfo
->_sifields
._kill
._uid
, &info
->_sifields
._kill
._uid
);
238 si_type
= QEMU_SI_KILL
;
241 /* Everything else is spoofable. Make best guess based on signal */
244 __get_user(tinfo
->_sifields
._sigchld
._pid
,
245 &info
->_sifields
._sigchld
._pid
);
246 __get_user(tinfo
->_sifields
._sigchld
._uid
,
247 &info
->_sifields
._sigchld
._uid
);
248 __get_user(tinfo
->_sifields
._sigchld
._status
,
249 &info
->_sifields
._sigchld
._status
);
250 __get_user(tinfo
->_sifields
._sigchld
._utime
,
251 &info
->_sifields
._sigchld
._utime
);
252 __get_user(tinfo
->_sifields
._sigchld
._stime
,
253 &info
->_sifields
._sigchld
._stime
);
254 si_type
= QEMU_SI_CHLD
;
257 __get_user(tinfo
->_sifields
._sigpoll
._band
,
258 &info
->_sifields
._sigpoll
._band
);
259 __get_user(tinfo
->_sifields
._sigpoll
._fd
,
260 &info
->_sifields
._sigpoll
._fd
);
261 si_type
= QEMU_SI_POLL
;
264 /* Assume a sigqueue()/mq_notify()/rt_sigqueueinfo() source. */
265 __get_user(tinfo
->_sifields
._rt
._pid
, &info
->_sifields
._rt
._pid
);
266 __get_user(tinfo
->_sifields
._rt
._uid
, &info
->_sifields
._rt
._uid
);
267 /* XXX: potential problem if 64 bit */
268 __get_user(sival_ptr
, &info
->_sifields
._rt
._sigval
.sival_ptr
);
269 tinfo
->_sifields
._rt
._sigval
.sival_ptr
= sival_ptr
;
271 si_type
= QEMU_SI_RT
;
277 tinfo
->si_code
= deposit32(si_code
, 16, 16, si_type
);
280 static void print_siginfo(const target_siginfo_t
*tinfo
)
282 /* Print a target_siginfo_t in the format desired for printing
283 * signals being taken. We assume the target_siginfo_t is in the
284 * internal form where the top 16 bits of si_code indicate which
285 * part of the union is valid, rather than in the guest-visible
286 * form where the bottom 16 bits are sign-extended into the top 16.
288 int si_type
= extract32(tinfo
->si_code
, 16, 16);
289 int si_code
= sextract32(tinfo
->si_code
, 0, 16);
291 qemu_log("{si_signo=");
292 print_signal(tinfo
->si_signo
, 1);
293 qemu_log(", si_code=");
294 print_si_code(si_code
);
298 qemu_log(", si_pid=%u, si_uid=%u",
299 (unsigned int)tinfo
->_sifields
._kill
._pid
,
300 (unsigned int)tinfo
->_sifields
._kill
._uid
);
303 qemu_log(", si_timer1=%u, si_timer2=%u",
304 tinfo
->_sifields
._timer
._timer1
,
305 tinfo
->_sifields
._timer
._timer2
);
308 qemu_log(", si_band=%d, si_fd=%d",
309 tinfo
->_sifields
._sigpoll
._band
,
310 tinfo
->_sifields
._sigpoll
._fd
);
313 qemu_log(", si_addr=");
314 print_pointer(tinfo
->_sifields
._sigfault
._addr
, 1);
317 qemu_log(", si_pid=%u, si_uid=%u, si_status=%d"
318 ", si_utime=" TARGET_ABI_FMT_ld
319 ", si_stime=" TARGET_ABI_FMT_ld
,
320 (unsigned int)(tinfo
->_sifields
._sigchld
._pid
),
321 (unsigned int)(tinfo
->_sifields
._sigchld
._uid
),
322 tinfo
->_sifields
._sigchld
._status
,
323 tinfo
->_sifields
._sigchld
._utime
,
324 tinfo
->_sifields
._sigchld
._stime
);
327 qemu_log(", si_pid=%u, si_uid=%u, si_sigval=" TARGET_ABI_FMT_ld
,
328 (unsigned int)tinfo
->_sifields
._rt
._pid
,
329 (unsigned int)tinfo
->_sifields
._rt
._uid
,
330 tinfo
->_sifields
._rt
._sigval
.sival_ptr
);
333 g_assert_not_reached();
339 print_sockaddr(abi_ulong addr
, abi_long addrlen
, int last
)
341 struct target_sockaddr
*sa
;
345 sa
= lock_user(VERIFY_READ
, addr
, addrlen
, 1);
347 sa_family
= tswap16(sa
->sa_family
);
350 struct target_sockaddr_un
*un
= (struct target_sockaddr_un
*)sa
;
352 qemu_log("{sun_family=AF_UNIX,sun_path=\"");
353 for (i
= 0; i
< addrlen
-
354 offsetof(struct target_sockaddr_un
, sun_path
) &&
355 un
->sun_path
[i
]; i
++) {
356 qemu_log("%c", un
->sun_path
[i
]);
362 struct target_sockaddr_in
*in
= (struct target_sockaddr_in
*)sa
;
363 uint8_t *c
= (uint8_t *)&in
->sin_addr
.s_addr
;
364 qemu_log("{sin_family=AF_INET,sin_port=htons(%d),",
365 ntohs(in
->sin_port
));
366 qemu_log("sin_addr=inet_addr(\"%d.%d.%d.%d\")",
367 c
[0], c
[1], c
[2], c
[3]);
372 struct target_sockaddr_ll
*ll
= (struct target_sockaddr_ll
*)sa
;
373 uint8_t *c
= (uint8_t *)&ll
->sll_addr
;
374 qemu_log("{sll_family=AF_PACKET,"
375 "sll_protocol=htons(0x%04x),if%d,pkttype=",
376 ntohs(ll
->sll_protocol
), ll
->sll_ifindex
);
377 switch (ll
->sll_pkttype
) {
379 qemu_log("PACKET_HOST");
381 case PACKET_BROADCAST
:
382 qemu_log("PACKET_BROADCAST");
384 case PACKET_MULTICAST
:
385 qemu_log("PACKET_MULTICAST");
387 case PACKET_OTHERHOST
:
388 qemu_log("PACKET_OTHERHOST");
390 case PACKET_OUTGOING
:
391 qemu_log("PACKET_OUTGOING");
394 qemu_log("%d", ll
->sll_pkttype
);
397 qemu_log(",sll_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
398 c
[0], c
[1], c
[2], c
[3], c
[4], c
[5], c
[6], c
[7]);
403 struct target_sockaddr_nl
*nl
= (struct target_sockaddr_nl
*)sa
;
404 qemu_log("{nl_family=AF_NETLINK,nl_pid=%u,nl_groups=%u}",
405 tswap32(nl
->nl_pid
), tswap32(nl
->nl_groups
));
409 qemu_log("{sa_family=%d, sa_data={", sa
->sa_family
);
410 for (i
= 0; i
< 13; i
++) {
411 qemu_log("%02x, ", sa
->sa_data
[i
]);
413 qemu_log("%02x}", sa
->sa_data
[i
]);
417 unlock_user(sa
, addr
, 0);
419 print_raw_param("0x"TARGET_ABI_FMT_lx
, addr
, 0);
421 qemu_log(", "TARGET_ABI_FMT_ld
"%s", addrlen
, get_comma(last
));
425 print_socket_domain(int domain
)
435 qemu_log("PF_NETLINK");
438 qemu_log("PF_PACKET");
441 qemu_log("%d", domain
);
447 print_socket_type(int type
)
449 switch (type
& TARGET_SOCK_TYPE_MASK
) {
450 case TARGET_SOCK_DGRAM
:
451 qemu_log("SOCK_DGRAM");
453 case TARGET_SOCK_STREAM
:
454 qemu_log("SOCK_STREAM");
456 case TARGET_SOCK_RAW
:
457 qemu_log("SOCK_RAW");
459 case TARGET_SOCK_RDM
:
460 qemu_log("SOCK_RDM");
462 case TARGET_SOCK_SEQPACKET
:
463 qemu_log("SOCK_SEQPACKET");
465 case TARGET_SOCK_PACKET
:
466 qemu_log("SOCK_PACKET");
469 if (type
& TARGET_SOCK_CLOEXEC
) {
470 qemu_log("|SOCK_CLOEXEC");
472 if (type
& TARGET_SOCK_NONBLOCK
) {
473 qemu_log("|SOCK_NONBLOCK");
478 print_socket_protocol(int domain
, int type
, int protocol
)
480 if (domain
== AF_PACKET
||
481 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
484 qemu_log("ETH_P_ALL");
487 qemu_log("%d", protocol
);
492 if (domain
== PF_NETLINK
) {
495 qemu_log("NETLINK_ROUTE");
498 qemu_log("NETLINK_AUDIT");
500 case NETLINK_NETFILTER
:
501 qemu_log("NETLINK_NETFILTER");
503 case NETLINK_KOBJECT_UEVENT
:
504 qemu_log("NETLINK_KOBJECT_UEVENT");
507 qemu_log("NETLINK_RDMA");
510 qemu_log("NETLINK_CRYPTO");
513 qemu_log("%d", protocol
);
521 qemu_log("IPPROTO_IP");
524 qemu_log("IPPROTO_TCP");
527 qemu_log("IPPROTO_UDP");
530 qemu_log("IPPROTO_RAW");
533 qemu_log("%d", protocol
);
539 #ifdef TARGET_NR__newselect
541 print_fdset(int n
, abi_ulong target_fds_addr
)
546 if( target_fds_addr
) {
547 abi_long
*target_fds
;
549 target_fds
= lock_user(VERIFY_READ
,
551 sizeof(*target_fds
)*(n
/ TARGET_ABI_BITS
+ 1),
557 for (i
=n
; i
>=0; i
--) {
558 if ((tswapal(target_fds
[i
/ TARGET_ABI_BITS
]) >> (i
& (TARGET_ABI_BITS
- 1))) & 1)
561 unlock_user(target_fds
, target_fds_addr
, 0);
567 #ifdef TARGET_NR_clock_adjtime
568 /* IDs of the various system clocks */
569 #define TARGET_CLOCK_REALTIME 0
570 #define TARGET_CLOCK_MONOTONIC 1
571 #define TARGET_CLOCK_PROCESS_CPUTIME_ID 2
572 #define TARGET_CLOCK_THREAD_CPUTIME_ID 3
573 #define TARGET_CLOCK_MONOTONIC_RAW 4
574 #define TARGET_CLOCK_REALTIME_COARSE 5
575 #define TARGET_CLOCK_MONOTONIC_COARSE 6
576 #define TARGET_CLOCK_BOOTTIME 7
577 #define TARGET_CLOCK_REALTIME_ALARM 8
578 #define TARGET_CLOCK_BOOTTIME_ALARM 9
579 #define TARGET_CLOCK_SGI_CYCLE 10
580 #define TARGET_CLOCK_TAI 11
583 print_clockid(int clockid
, int last
)
586 case TARGET_CLOCK_REALTIME
:
587 qemu_log("CLOCK_REALTIME");
589 case TARGET_CLOCK_MONOTONIC
:
590 qemu_log("CLOCK_MONOTONIC");
592 case TARGET_CLOCK_PROCESS_CPUTIME_ID
:
593 qemu_log("CLOCK_PROCESS_CPUTIME_ID");
595 case TARGET_CLOCK_THREAD_CPUTIME_ID
:
596 qemu_log("CLOCK_THREAD_CPUTIME_ID");
598 case TARGET_CLOCK_MONOTONIC_RAW
:
599 qemu_log("CLOCK_MONOTONIC_RAW");
601 case TARGET_CLOCK_REALTIME_COARSE
:
602 qemu_log("CLOCK_REALTIME_COARSE");
604 case TARGET_CLOCK_MONOTONIC_COARSE
:
605 qemu_log("CLOCK_MONOTONIC_COARSE");
607 case TARGET_CLOCK_BOOTTIME
:
608 qemu_log("CLOCK_BOOTTIME");
610 case TARGET_CLOCK_REALTIME_ALARM
:
611 qemu_log("CLOCK_REALTIME_ALARM");
613 case TARGET_CLOCK_BOOTTIME_ALARM
:
614 qemu_log("CLOCK_BOOTTIME_ALARM");
616 case TARGET_CLOCK_SGI_CYCLE
:
617 qemu_log("CLOCK_SGI_CYCLE");
619 case TARGET_CLOCK_TAI
:
620 qemu_log("CLOCK_TAI");
623 qemu_log("%d", clockid
);
626 qemu_log("%s", get_comma(last
));
631 * Sysycall specific output functions
635 #ifdef TARGET_NR__newselect
637 print_newselect(const struct syscallname
*name
,
638 abi_long arg1
, abi_long arg2
, abi_long arg3
,
639 abi_long arg4
, abi_long arg5
, abi_long arg6
)
641 print_syscall_prologue(name
);
642 print_fdset(arg1
, arg2
);
644 print_fdset(arg1
, arg3
);
646 print_fdset(arg1
, arg4
);
648 print_timeval(arg5
, 1);
649 print_syscall_epilogue(name
);
653 #ifdef TARGET_NR_semctl
655 print_semctl(const struct syscallname
*name
,
656 abi_long arg1
, abi_long arg2
, abi_long arg3
,
657 abi_long arg4
, abi_long arg5
, abi_long arg6
)
659 qemu_log("%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
660 name
->name
, arg1
, arg2
);
662 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
667 print_execve(const struct syscallname
*name
,
668 abi_long arg1
, abi_long arg2
, abi_long arg3
,
669 abi_long arg4
, abi_long arg5
, abi_long arg6
)
671 abi_ulong arg_ptr_addr
;
674 if (!(s
= lock_user_string(arg1
)))
676 qemu_log("%s(\"%s\",{", name
->name
, s
);
677 unlock_user(s
, arg1
, 0);
679 for (arg_ptr_addr
= arg2
; ; arg_ptr_addr
+= sizeof(abi_ulong
)) {
680 abi_ulong
*arg_ptr
, arg_addr
;
682 arg_ptr
= lock_user(VERIFY_READ
, arg_ptr_addr
, sizeof(abi_ulong
), 1);
685 arg_addr
= tswapal(*arg_ptr
);
686 unlock_user(arg_ptr
, arg_ptr_addr
, 0);
689 if ((s
= lock_user_string(arg_addr
))) {
690 qemu_log("\"%s\",", s
);
691 unlock_user(s
, arg_addr
, 0);
700 print_ipc(const struct syscallname
*name
,
701 abi_long arg1
, abi_long arg2
, abi_long arg3
,
702 abi_long arg4
, abi_long arg5
, abi_long arg6
)
706 qemu_log("semctl(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
709 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
713 TARGET_ABI_FMT_ld
","
714 TARGET_ABI_FMT_ld
","
715 TARGET_ABI_FMT_ld
","
718 name
->name
, arg1
, arg2
, arg3
, arg4
);
724 * Variants for the return value output function
728 print_syscall_err(abi_long ret
)
730 const char *errstr
= NULL
;
734 qemu_log("-1 errno=%d", errno
);
735 errstr
= target_strerror(-ret
);
737 qemu_log(" (%s)", errstr
);
743 print_syscall_ret_addr(const struct syscallname
*name
, abi_long ret
,
744 abi_long arg0
, abi_long arg1
, abi_long arg2
,
745 abi_long arg3
, abi_long arg4
, abi_long arg5
)
747 print_syscall_err(ret
);
750 qemu_log("0x" TARGET_ABI_FMT_lx
"\n", ret
);
754 #if 0 /* currently unused */
756 print_syscall_ret_raw(struct syscallname
*name
, abi_long ret
)
758 qemu_log(" = 0x" TARGET_ABI_FMT_lx
"\n", ret
);
762 #ifdef TARGET_NR__newselect
764 print_syscall_ret_newselect(const struct syscallname
*name
, abi_long ret
,
765 abi_long arg0
, abi_long arg1
, abi_long arg2
,
766 abi_long arg3
, abi_long arg4
, abi_long arg5
)
768 print_syscall_err(ret
);
771 qemu_log(" = 0x" TARGET_ABI_FMT_lx
" (", ret
);
772 print_fdset(arg0
, arg1
);
774 print_fdset(arg0
, arg2
);
776 print_fdset(arg0
, arg3
);
778 print_timeval(arg4
, 1);
786 /* special meanings of adjtimex()' non-negative return values */
787 #define TARGET_TIME_OK 0 /* clock synchronized, no leap second */
788 #define TARGET_TIME_INS 1 /* insert leap second */
789 #define TARGET_TIME_DEL 2 /* delete leap second */
790 #define TARGET_TIME_OOP 3 /* leap second in progress */
791 #define TARGET_TIME_WAIT 4 /* leap second has occurred */
792 #define TARGET_TIME_ERROR 5 /* clock not synchronized */
793 #ifdef TARGET_NR_adjtimex
795 print_syscall_ret_adjtimex(const struct syscallname
*name
, abi_long ret
,
796 abi_long arg0
, abi_long arg1
, abi_long arg2
,
797 abi_long arg3
, abi_long arg4
, abi_long arg5
)
799 print_syscall_err(ret
);
802 qemu_log(TARGET_ABI_FMT_ld
, ret
);
805 qemu_log(" TIME_OK (clock synchronized, no leap second)");
807 case TARGET_TIME_INS
:
808 qemu_log(" TIME_INS (insert leap second)");
810 case TARGET_TIME_DEL
:
811 qemu_log(" TIME_DEL (delete leap second)");
813 case TARGET_TIME_OOP
:
814 qemu_log(" TIME_OOP (leap second in progress)");
816 case TARGET_TIME_WAIT
:
817 qemu_log(" TIME_WAIT (leap second has occurred)");
819 case TARGET_TIME_ERROR
:
820 qemu_log(" TIME_ERROR (clock not synchronized)");
829 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr) \
830 || defined(TARGGET_NR_flistxattr)
832 print_syscall_ret_listxattr(const struct syscallname
*name
, abi_long ret
,
833 abi_long arg0
, abi_long arg1
, abi_long arg2
,
834 abi_long arg3
, abi_long arg4
, abi_long arg5
)
836 print_syscall_err(ret
);
839 qemu_log(TARGET_ABI_FMT_ld
, ret
);
840 qemu_log(" (list = ");
842 abi_long attr
= arg1
;
847 print_string(attr
, 1);
848 ret
-= target_strlen(attr
) + 1;
849 attr
+= target_strlen(attr
) + 1;
859 #define print_syscall_ret_llistxattr print_syscall_ret_listxattr
860 #define print_syscall_ret_flistxattr print_syscall_ret_listxattr
863 UNUSED
static struct flags access_flags
[] = {
871 UNUSED
static struct flags at_file_flags
[] = {
873 FLAG_GENERIC(AT_EACCESS
),
875 #ifdef AT_SYMLINK_NOFOLLOW
876 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
881 UNUSED
static struct flags unlinkat_flags
[] = {
883 FLAG_GENERIC(AT_REMOVEDIR
),
888 UNUSED
static struct flags mode_flags
[] = {
889 FLAG_GENERIC(S_IFSOCK
),
890 FLAG_GENERIC(S_IFLNK
),
891 FLAG_GENERIC(S_IFREG
),
892 FLAG_GENERIC(S_IFBLK
),
893 FLAG_GENERIC(S_IFDIR
),
894 FLAG_GENERIC(S_IFCHR
),
895 FLAG_GENERIC(S_IFIFO
),
899 UNUSED
static struct flags open_access_flags
[] = {
900 FLAG_TARGET(O_RDONLY
),
901 FLAG_TARGET(O_WRONLY
),
906 UNUSED
static struct flags open_flags
[] = {
907 FLAG_TARGET(O_APPEND
),
908 FLAG_TARGET(O_CREAT
),
909 FLAG_TARGET(O_DIRECTORY
),
911 FLAG_TARGET(O_LARGEFILE
),
912 FLAG_TARGET(O_NOCTTY
),
913 FLAG_TARGET(O_NOFOLLOW
),
914 FLAG_TARGET(O_NONBLOCK
), /* also O_NDELAY */
915 FLAG_TARGET(O_DSYNC
),
916 FLAG_TARGET(__O_SYNC
),
917 FLAG_TARGET(O_TRUNC
),
919 FLAG_TARGET(O_DIRECT
),
922 FLAG_TARGET(O_NOATIME
),
925 FLAG_TARGET(O_CLOEXEC
),
931 FLAG_TARGET(O_TMPFILE
),
932 FLAG_TARGET(__O_TMPFILE
),
937 UNUSED
static struct flags mount_flags
[] = {
939 FLAG_GENERIC(MS_BIND
),
942 FLAG_GENERIC(MS_DIRSYNC
),
944 FLAG_GENERIC(MS_MANDLOCK
),
946 FLAG_GENERIC(MS_MOVE
),
948 FLAG_GENERIC(MS_NOATIME
),
949 FLAG_GENERIC(MS_NODEV
),
950 FLAG_GENERIC(MS_NODIRATIME
),
951 FLAG_GENERIC(MS_NOEXEC
),
952 FLAG_GENERIC(MS_NOSUID
),
953 FLAG_GENERIC(MS_RDONLY
),
955 FLAG_GENERIC(MS_RELATIME
),
957 FLAG_GENERIC(MS_REMOUNT
),
958 FLAG_GENERIC(MS_SYNCHRONOUS
),
962 UNUSED
static struct flags umount2_flags
[] = {
964 FLAG_GENERIC(MNT_FORCE
),
967 FLAG_GENERIC(MNT_DETACH
),
970 FLAG_GENERIC(MNT_EXPIRE
),
975 UNUSED
static struct flags mmap_prot_flags
[] = {
976 FLAG_GENERIC(PROT_NONE
),
977 FLAG_GENERIC(PROT_EXEC
),
978 FLAG_GENERIC(PROT_READ
),
979 FLAG_GENERIC(PROT_WRITE
),
980 FLAG_TARGET(PROT_SEM
),
981 FLAG_GENERIC(PROT_GROWSDOWN
),
982 FLAG_GENERIC(PROT_GROWSUP
),
986 UNUSED
static struct flags mmap_flags
[] = {
987 FLAG_TARGET(MAP_SHARED
),
988 FLAG_TARGET(MAP_PRIVATE
),
989 FLAG_TARGET(MAP_ANONYMOUS
),
990 FLAG_TARGET(MAP_DENYWRITE
),
991 FLAG_TARGET(MAP_FIXED
),
992 FLAG_TARGET(MAP_GROWSDOWN
),
993 FLAG_TARGET(MAP_EXECUTABLE
),
995 FLAG_TARGET(MAP_LOCKED
),
998 FLAG_TARGET(MAP_NONBLOCK
),
1000 FLAG_TARGET(MAP_NORESERVE
),
1002 FLAG_TARGET(MAP_POPULATE
),
1004 #ifdef TARGET_MAP_UNINITIALIZED
1005 FLAG_TARGET(MAP_UNINITIALIZED
),
1010 UNUSED
static struct flags clone_flags
[] = {
1011 FLAG_GENERIC(CLONE_VM
),
1012 FLAG_GENERIC(CLONE_FS
),
1013 FLAG_GENERIC(CLONE_FILES
),
1014 FLAG_GENERIC(CLONE_SIGHAND
),
1015 FLAG_GENERIC(CLONE_PTRACE
),
1016 FLAG_GENERIC(CLONE_VFORK
),
1017 FLAG_GENERIC(CLONE_PARENT
),
1018 FLAG_GENERIC(CLONE_THREAD
),
1019 FLAG_GENERIC(CLONE_NEWNS
),
1020 FLAG_GENERIC(CLONE_SYSVSEM
),
1021 FLAG_GENERIC(CLONE_SETTLS
),
1022 FLAG_GENERIC(CLONE_PARENT_SETTID
),
1023 FLAG_GENERIC(CLONE_CHILD_CLEARTID
),
1024 FLAG_GENERIC(CLONE_DETACHED
),
1025 FLAG_GENERIC(CLONE_UNTRACED
),
1026 FLAG_GENERIC(CLONE_CHILD_SETTID
),
1027 #if defined(CLONE_NEWUTS)
1028 FLAG_GENERIC(CLONE_NEWUTS
),
1030 #if defined(CLONE_NEWIPC)
1031 FLAG_GENERIC(CLONE_NEWIPC
),
1033 #if defined(CLONE_NEWUSER)
1034 FLAG_GENERIC(CLONE_NEWUSER
),
1036 #if defined(CLONE_NEWPID)
1037 FLAG_GENERIC(CLONE_NEWPID
),
1039 #if defined(CLONE_NEWNET)
1040 FLAG_GENERIC(CLONE_NEWNET
),
1042 #if defined(CLONE_IO)
1043 FLAG_GENERIC(CLONE_IO
),
1048 UNUSED
static struct flags msg_flags
[] = {
1050 FLAG_GENERIC(MSG_CONFIRM
),
1051 FLAG_GENERIC(MSG_DONTROUTE
),
1052 FLAG_GENERIC(MSG_DONTWAIT
),
1053 FLAG_GENERIC(MSG_EOR
),
1054 FLAG_GENERIC(MSG_MORE
),
1055 FLAG_GENERIC(MSG_NOSIGNAL
),
1056 FLAG_GENERIC(MSG_OOB
),
1058 FLAG_GENERIC(MSG_CMSG_CLOEXEC
),
1059 FLAG_GENERIC(MSG_ERRQUEUE
),
1060 FLAG_GENERIC(MSG_PEEK
),
1061 FLAG_GENERIC(MSG_TRUNC
),
1062 FLAG_GENERIC(MSG_WAITALL
),
1064 FLAG_GENERIC(MSG_CTRUNC
),
1068 UNUSED
static struct flags statx_flags
[] = {
1069 #ifdef AT_EMPTY_PATH
1070 FLAG_GENERIC(AT_EMPTY_PATH
),
1072 #ifdef AT_NO_AUTOMOUNT
1073 FLAG_GENERIC(AT_NO_AUTOMOUNT
),
1075 #ifdef AT_SYMLINK_NOFOLLOW
1076 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
1078 #ifdef AT_STATX_SYNC_AS_STAT
1079 FLAG_GENERIC(AT_STATX_SYNC_AS_STAT
),
1081 #ifdef AT_STATX_FORCE_SYNC
1082 FLAG_GENERIC(AT_STATX_FORCE_SYNC
),
1084 #ifdef AT_STATX_DONT_SYNC
1085 FLAG_GENERIC(AT_STATX_DONT_SYNC
),
1090 UNUSED
static struct flags statx_mask
[] = {
1091 /* This must come first, because it includes everything. */
1093 FLAG_GENERIC(STATX_ALL
),
1095 /* This must come second; it includes everything except STATX_BTIME. */
1096 #ifdef STATX_BASIC_STATS
1097 FLAG_GENERIC(STATX_BASIC_STATS
),
1100 FLAG_GENERIC(STATX_TYPE
),
1103 FLAG_GENERIC(STATX_MODE
),
1106 FLAG_GENERIC(STATX_NLINK
),
1109 FLAG_GENERIC(STATX_UID
),
1112 FLAG_GENERIC(STATX_GID
),
1115 FLAG_GENERIC(STATX_ATIME
),
1118 FLAG_GENERIC(STATX_MTIME
),
1121 FLAG_GENERIC(STATX_CTIME
),
1124 FLAG_GENERIC(STATX_INO
),
1127 FLAG_GENERIC(STATX_SIZE
),
1130 FLAG_GENERIC(STATX_BLOCKS
),
1133 FLAG_GENERIC(STATX_BTIME
),
1139 * print_xxx utility functions. These are used to print syscall
1140 * parameters in certain format. All of these have parameter
1141 * named 'last'. This parameter is used to add comma to output
1148 return ((last
) ? "" : ",");
1152 print_flags(const struct flags
*f
, abi_long flags
, int last
)
1154 const char *sep
= "";
1157 if ((flags
== 0) && (f
->f_value
== 0)) {
1158 qemu_log("%s%s", f
->f_string
, get_comma(last
));
1161 for (n
= 0; f
->f_string
!= NULL
; f
++) {
1162 if ((f
->f_value
!= 0) && ((flags
& f
->f_value
) == f
->f_value
)) {
1163 qemu_log("%s%s", sep
, f
->f_string
);
1164 flags
&= ~f
->f_value
;
1171 /* print rest of the flags as numeric */
1173 qemu_log("%s%#x%s", sep
, (unsigned int)flags
, get_comma(last
));
1175 qemu_log("%s", get_comma(last
));
1178 /* no string version of flags found, print them in hex then */
1179 qemu_log("%#x%s", (unsigned int)flags
, get_comma(last
));
1184 print_at_dirfd(abi_long dirfd
, int last
)
1187 if (dirfd
== AT_FDCWD
) {
1188 qemu_log("AT_FDCWD%s", get_comma(last
));
1192 qemu_log("%d%s", (int)dirfd
, get_comma(last
));
1196 print_file_mode(abi_long mode
, int last
)
1198 const char *sep
= "";
1199 const struct flags
*m
;
1201 for (m
= &mode_flags
[0]; m
->f_string
!= NULL
; m
++) {
1202 if ((m
->f_value
& mode
) == m
->f_value
) {
1203 qemu_log("%s%s", m
->f_string
, sep
);
1205 mode
&= ~m
->f_value
;
1211 /* print rest of the mode as octal */
1213 qemu_log("%s%#o", sep
, (unsigned int)mode
);
1215 qemu_log("%s", get_comma(last
));
1219 print_open_flags(abi_long flags
, int last
)
1221 print_flags(open_access_flags
, flags
& TARGET_O_ACCMODE
, 1);
1222 flags
&= ~TARGET_O_ACCMODE
;
1224 qemu_log("%s", get_comma(last
));
1228 print_flags(open_flags
, flags
, last
);
1232 print_syscall_prologue(const struct syscallname
*sc
)
1234 qemu_log("%s(", sc
->name
);
1239 print_syscall_epilogue(const struct syscallname
*sc
)
1246 print_string(abi_long addr
, int last
)
1250 if ((s
= lock_user_string(addr
)) != NULL
) {
1251 qemu_log("\"%s\"%s", s
, get_comma(last
));
1252 unlock_user(s
, addr
, 0);
1254 /* can't get string out of it, so print it as pointer */
1255 print_pointer(addr
, last
);
1259 #define MAX_PRINT_BUF 40
1261 print_buf(abi_long addr
, abi_long len
, int last
)
1266 s
= lock_user(VERIFY_READ
, addr
, len
, 1);
1269 for (i
= 0; i
< MAX_PRINT_BUF
&& i
< len
; i
++) {
1270 if (isprint(s
[i
])) {
1271 qemu_log("%c", s
[i
]);
1273 qemu_log("\\%o", s
[i
]);
1283 unlock_user(s
, addr
, 0);
1285 print_pointer(addr
, last
);
1290 * Prints out raw parameter using given format. Caller needs
1291 * to do byte swapping if needed.
1294 print_raw_param(const char *fmt
, abi_long param
, int last
)
1298 (void) snprintf(format
, sizeof (format
), "%s%s", fmt
, get_comma(last
));
1299 qemu_log(format
, param
);
1303 print_pointer(abi_long p
, int last
)
1306 qemu_log("NULL%s", get_comma(last
));
1308 qemu_log("0x" TARGET_ABI_FMT_lx
"%s", p
, get_comma(last
));
1312 * Reads 32-bit (int) number from guest address space from
1313 * address 'addr' and prints it.
1316 print_number(abi_long addr
, int last
)
1319 qemu_log("NULL%s", get_comma(last
));
1323 get_user_s32(num
, addr
);
1324 qemu_log("[%d]%s", num
, get_comma(last
));
1329 print_timeval(abi_ulong tv_addr
, int last
)
1332 struct target_timeval
*tv
;
1334 tv
= lock_user(VERIFY_READ
, tv_addr
, sizeof(*tv
), 1);
1336 print_pointer(tv_addr
, last
);
1339 qemu_log("{" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"}%s",
1340 tswapal(tv
->tv_sec
), tswapal(tv
->tv_usec
), get_comma(last
));
1341 unlock_user(tv
, tv_addr
, 0);
1343 qemu_log("NULL%s", get_comma(last
));
1347 print_timezone(abi_ulong tz_addr
, int last
)
1350 struct target_timezone
*tz
;
1352 tz
= lock_user(VERIFY_READ
, tz_addr
, sizeof(*tz
), 1);
1354 print_pointer(tz_addr
, last
);
1357 qemu_log("{%d,%d}%s", tswap32(tz
->tz_minuteswest
),
1358 tswap32(tz
->tz_dsttime
), get_comma(last
));
1359 unlock_user(tz
, tz_addr
, 0);
1361 qemu_log("NULL%s", get_comma(last
));
1367 #ifdef TARGET_NR_accept
1369 print_accept(const struct syscallname
*name
,
1370 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1371 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1373 print_syscall_prologue(name
);
1374 print_raw_param("%d", arg0
, 0);
1375 print_pointer(arg1
, 0);
1376 print_number(arg2
, 1);
1377 print_syscall_epilogue(name
);
1381 #ifdef TARGET_NR_access
1383 print_access(const struct syscallname
*name
,
1384 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1385 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1387 print_syscall_prologue(name
);
1388 print_string(arg0
, 0);
1389 print_flags(access_flags
, arg1
, 1);
1390 print_syscall_epilogue(name
);
1394 #ifdef TARGET_NR_acct
1396 print_acct(const struct syscallname
*name
,
1397 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1398 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1400 print_syscall_prologue(name
);
1401 print_string(arg0
, 1);
1402 print_syscall_epilogue(name
);
1406 #ifdef TARGET_NR_brk
1408 print_brk(const struct syscallname
*name
,
1409 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1410 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1412 print_syscall_prologue(name
);
1413 print_pointer(arg0
, 1);
1414 print_syscall_epilogue(name
);
1418 #ifdef TARGET_NR_chdir
1420 print_chdir(const struct syscallname
*name
,
1421 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1422 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1424 print_syscall_prologue(name
);
1425 print_string(arg0
, 1);
1426 print_syscall_epilogue(name
);
1430 #ifdef TARGET_NR_chroot
1432 print_chroot(const struct syscallname
*name
,
1433 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1434 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1436 print_syscall_prologue(name
);
1437 print_string(arg0
, 1);
1438 print_syscall_epilogue(name
);
1442 #ifdef TARGET_NR_chmod
1444 print_chmod(const struct syscallname
*name
,
1445 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1446 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1448 print_syscall_prologue(name
);
1449 print_string(arg0
, 0);
1450 print_file_mode(arg1
, 1);
1451 print_syscall_epilogue(name
);
1455 #if defined(TARGET_NR_chown) || defined(TARGET_NR_lchown)
1457 print_chown(const struct syscallname
*name
,
1458 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1459 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1461 print_syscall_prologue(name
);
1462 print_string(arg0
, 0);
1463 print_raw_param("%d", arg1
, 0);
1464 print_raw_param("%d", arg2
, 1);
1465 print_syscall_epilogue(name
);
1467 #define print_lchown print_chown
1470 #ifdef TARGET_NR_clock_adjtime
1472 print_clock_adjtime(const struct syscallname
*name
,
1473 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1474 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1476 print_syscall_prologue(name
);
1477 print_clockid(arg0
, 0);
1478 print_pointer(arg1
, 1);
1479 print_syscall_epilogue(name
);
1483 #ifdef TARGET_NR_clone
1484 static void do_print_clone(unsigned int flags
, abi_ulong newsp
,
1485 abi_ulong parent_tidptr
, target_ulong newtls
,
1486 abi_ulong child_tidptr
)
1488 print_flags(clone_flags
, flags
, 0);
1489 print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx
, newsp
, 0);
1490 print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx
, parent_tidptr
, 0);
1491 print_raw_param("tls=0x" TARGET_ABI_FMT_lx
, newtls
, 0);
1492 print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx
, child_tidptr
, 1);
1496 print_clone(const struct syscallname
*name
,
1497 abi_long arg1
, abi_long arg2
, abi_long arg3
,
1498 abi_long arg4
, abi_long arg5
, abi_long arg6
)
1500 print_syscall_prologue(name
);
1501 #if defined(TARGET_MICROBLAZE)
1502 do_print_clone(arg1
, arg2
, arg4
, arg6
, arg5
);
1503 #elif defined(TARGET_CLONE_BACKWARDS)
1504 do_print_clone(arg1
, arg2
, arg3
, arg4
, arg5
);
1505 #elif defined(TARGET_CLONE_BACKWARDS2)
1506 do_print_clone(arg2
, arg1
, arg3
, arg5
, arg4
);
1508 do_print_clone(arg1
, arg2
, arg3
, arg5
, arg4
);
1510 print_syscall_epilogue(name
);
1514 #ifdef TARGET_NR_creat
1516 print_creat(const struct syscallname
*name
,
1517 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1518 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1520 print_syscall_prologue(name
);
1521 print_string(arg0
, 0);
1522 print_file_mode(arg1
, 1);
1523 print_syscall_epilogue(name
);
1527 #ifdef TARGET_NR_execv
1529 print_execv(const struct syscallname
*name
,
1530 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1531 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1533 print_syscall_prologue(name
);
1534 print_string(arg0
, 0);
1535 print_raw_param("0x" TARGET_ABI_FMT_lx
, arg1
, 1);
1536 print_syscall_epilogue(name
);
1540 #ifdef TARGET_NR_faccessat
1542 print_faccessat(const struct syscallname
*name
,
1543 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1544 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1546 print_syscall_prologue(name
);
1547 print_at_dirfd(arg0
, 0);
1548 print_string(arg1
, 0);
1549 print_flags(access_flags
, arg2
, 0);
1550 print_flags(at_file_flags
, arg3
, 1);
1551 print_syscall_epilogue(name
);
1555 #ifdef TARGET_NR_fchmodat
1557 print_fchmodat(const struct syscallname
*name
,
1558 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1559 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1561 print_syscall_prologue(name
);
1562 print_at_dirfd(arg0
, 0);
1563 print_string(arg1
, 0);
1564 print_file_mode(arg2
, 0);
1565 print_flags(at_file_flags
, arg3
, 1);
1566 print_syscall_epilogue(name
);
1570 #ifdef TARGET_NR_fchownat
1572 print_fchownat(const struct syscallname
*name
,
1573 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1574 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1576 print_syscall_prologue(name
);
1577 print_at_dirfd(arg0
, 0);
1578 print_string(arg1
, 0);
1579 print_raw_param("%d", arg2
, 0);
1580 print_raw_param("%d", arg3
, 0);
1581 print_flags(at_file_flags
, arg4
, 1);
1582 print_syscall_epilogue(name
);
1586 #if defined(TARGET_NR_fcntl) || defined(TARGET_NR_fcntl64)
1588 print_fcntl(const struct syscallname
*name
,
1589 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1590 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1592 print_syscall_prologue(name
);
1593 print_raw_param("%d", arg0
, 0);
1595 case TARGET_F_DUPFD
:
1596 qemu_log("F_DUPFD,");
1597 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
1599 case TARGET_F_GETFD
:
1600 qemu_log("F_GETFD");
1602 case TARGET_F_SETFD
:
1603 qemu_log("F_SETFD,");
1604 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
1606 case TARGET_F_GETFL
:
1607 qemu_log("F_GETFL");
1609 case TARGET_F_SETFL
:
1610 qemu_log("F_SETFL,");
1611 print_open_flags(arg2
, 1);
1613 case TARGET_F_GETLK
:
1614 qemu_log("F_GETLK,");
1615 print_pointer(arg2
, 1);
1617 case TARGET_F_SETLK
:
1618 qemu_log("F_SETLK,");
1619 print_pointer(arg2
, 1);
1621 case TARGET_F_SETLKW
:
1622 qemu_log("F_SETLKW,");
1623 print_pointer(arg2
, 1);
1625 case TARGET_F_GETOWN
:
1626 qemu_log("F_GETOWN");
1628 case TARGET_F_SETOWN
:
1629 qemu_log("F_SETOWN,");
1630 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
1632 case TARGET_F_GETSIG
:
1633 qemu_log("F_GETSIG");
1635 case TARGET_F_SETSIG
:
1636 qemu_log("F_SETSIG,");
1637 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
1639 #if TARGET_ABI_BITS == 32
1640 case TARGET_F_GETLK64
:
1641 qemu_log("F_GETLK64,");
1642 print_pointer(arg2
, 1);
1644 case TARGET_F_SETLK64
:
1645 qemu_log("F_SETLK64,");
1646 print_pointer(arg2
, 1);
1648 case TARGET_F_SETLKW64
:
1649 qemu_log("F_SETLKW64,");
1650 print_pointer(arg2
, 1);
1653 case TARGET_F_SETLEASE
:
1654 qemu_log("F_SETLEASE,");
1655 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
1657 case TARGET_F_GETLEASE
:
1658 qemu_log("F_GETLEASE");
1660 case TARGET_F_SETPIPE_SZ
:
1661 qemu_log("F_SETPIPE_SZ,");
1662 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
1664 case TARGET_F_GETPIPE_SZ
:
1665 qemu_log("F_GETPIPE_SZ");
1667 case TARGET_F_DUPFD_CLOEXEC
:
1668 qemu_log("F_DUPFD_CLOEXEC,");
1669 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
1671 case TARGET_F_NOTIFY
:
1672 qemu_log("F_NOTIFY,");
1673 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
1676 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
1677 print_pointer(arg2
, 1);
1680 print_syscall_epilogue(name
);
1682 #define print_fcntl64 print_fcntl
1685 #ifdef TARGET_NR_fgetxattr
1687 print_fgetxattr(const struct syscallname
*name
,
1688 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1689 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1691 print_syscall_prologue(name
);
1692 print_raw_param("%d", arg0
, 0);
1693 print_string(arg1
, 0);
1694 print_pointer(arg2
, 0);
1695 print_raw_param(TARGET_FMT_lu
, arg3
, 1);
1696 print_syscall_epilogue(name
);
1700 #ifdef TARGET_NR_flistxattr
1702 print_flistxattr(const struct syscallname
*name
,
1703 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1704 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1706 print_syscall_prologue(name
);
1707 print_raw_param("%d", arg0
, 0);
1708 print_pointer(arg1
, 0);
1709 print_raw_param(TARGET_FMT_lu
, arg2
, 1);
1710 print_syscall_epilogue(name
);
1714 #if defined(TARGET_NR_getxattr) || defined(TARGET_NR_lgetxattr)
1716 print_getxattr(const struct syscallname
*name
,
1717 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1718 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1720 print_syscall_prologue(name
);
1721 print_string(arg0
, 0);
1722 print_string(arg1
, 0);
1723 print_pointer(arg2
, 0);
1724 print_raw_param(TARGET_FMT_lu
, arg3
, 1);
1725 print_syscall_epilogue(name
);
1727 #define print_lgetxattr print_getxattr
1730 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr)
1732 print_listxattr(const struct syscallname
*name
,
1733 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1734 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1736 print_syscall_prologue(name
);
1737 print_string(arg0
, 0);
1738 print_pointer(arg1
, 0);
1739 print_raw_param(TARGET_FMT_lu
, arg2
, 1);
1740 print_syscall_epilogue(name
);
1742 #define print_llistxattr print_listxattr
1745 #if defined(TARGET_NR_fremovexattr)
1747 print_fremovexattr(const struct syscallname
*name
,
1748 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1749 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1751 print_syscall_prologue(name
);
1752 print_raw_param("%d", arg0
, 0);
1753 print_string(arg1
, 1);
1754 print_syscall_epilogue(name
);
1758 #if defined(TARGET_NR_removexattr) || defined(TARGET_NR_lremovexattr)
1760 print_removexattr(const struct syscallname
*name
,
1761 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1762 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1764 print_syscall_prologue(name
);
1765 print_string(arg0
, 0);
1766 print_string(arg1
, 1);
1767 print_syscall_epilogue(name
);
1769 #define print_lremovexattr print_removexattr
1772 #ifdef TARGET_NR_futimesat
1774 print_futimesat(const struct syscallname
*name
,
1775 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1776 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1778 print_syscall_prologue(name
);
1779 print_at_dirfd(arg0
, 0);
1780 print_string(arg1
, 0);
1781 print_timeval(arg2
, 0);
1782 print_timeval(arg2
+ sizeof (struct target_timeval
), 1);
1783 print_syscall_epilogue(name
);
1787 #ifdef TARGET_NR_settimeofday
1789 print_settimeofday(const struct syscallname
*name
,
1790 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1791 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1793 print_syscall_prologue(name
);
1794 print_timeval(arg0
, 0);
1795 print_timezone(arg1
, 1);
1796 print_syscall_epilogue(name
);
1800 #ifdef TARGET_NR_link
1802 print_link(const struct syscallname
*name
,
1803 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1804 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1806 print_syscall_prologue(name
);
1807 print_string(arg0
, 0);
1808 print_string(arg1
, 1);
1809 print_syscall_epilogue(name
);
1813 #ifdef TARGET_NR_linkat
1815 print_linkat(const struct syscallname
*name
,
1816 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1817 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1819 print_syscall_prologue(name
);
1820 print_at_dirfd(arg0
, 0);
1821 print_string(arg1
, 0);
1822 print_at_dirfd(arg2
, 0);
1823 print_string(arg3
, 0);
1824 print_flags(at_file_flags
, arg4
, 1);
1825 print_syscall_epilogue(name
);
1829 #ifdef TARGET_NR__llseek
1831 print__llseek(const struct syscallname
*name
,
1832 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1833 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1835 const char *whence
= "UNKNOWN";
1836 print_syscall_prologue(name
);
1837 print_raw_param("%d", arg0
, 0);
1838 print_raw_param("%ld", arg1
, 0);
1839 print_raw_param("%ld", arg2
, 0);
1840 print_pointer(arg3
, 0);
1842 case SEEK_SET
: whence
= "SEEK_SET"; break;
1843 case SEEK_CUR
: whence
= "SEEK_CUR"; break;
1844 case SEEK_END
: whence
= "SEEK_END"; break;
1846 qemu_log("%s", whence
);
1847 print_syscall_epilogue(name
);
1851 #ifdef TARGET_NR_lseek
1853 print_lseek(const struct syscallname
*name
,
1854 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1855 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1857 print_syscall_prologue(name
);
1858 print_raw_param("%d", arg0
, 0);
1859 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
1862 qemu_log("SEEK_SET"); break;
1864 qemu_log("SEEK_CUR"); break;
1866 qemu_log("SEEK_END"); break;
1869 qemu_log("SEEK_DATA"); break;
1873 qemu_log("SEEK_HOLE"); break;
1876 print_raw_param("%#x", arg2
, 1);
1878 print_syscall_epilogue(name
);
1882 #if defined(TARGET_NR_socket)
1884 print_socket(const struct syscallname
*name
,
1885 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1886 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1888 abi_ulong domain
= arg0
, type
= arg1
, protocol
= arg2
;
1890 print_syscall_prologue(name
);
1891 print_socket_domain(domain
);
1893 print_socket_type(type
);
1895 if (domain
== AF_PACKET
||
1896 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
1897 protocol
= tswap16(protocol
);
1899 print_socket_protocol(domain
, type
, protocol
);
1900 print_syscall_epilogue(name
);
1905 #if defined(TARGET_NR_socketcall) || defined(TARGET_NR_bind)
1907 static void print_sockfd(abi_long sockfd
, int last
)
1909 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, last
);
1914 #if defined(TARGET_NR_socketcall)
1916 #define get_user_ualx(x, gaddr, idx) \
1917 get_user_ual(x, (gaddr) + (idx) * sizeof(abi_long))
1919 static void do_print_socket(const char *name
, abi_long arg1
)
1921 abi_ulong domain
, type
, protocol
;
1923 get_user_ualx(domain
, arg1
, 0);
1924 get_user_ualx(type
, arg1
, 1);
1925 get_user_ualx(protocol
, arg1
, 2);
1926 qemu_log("%s(", name
);
1927 print_socket_domain(domain
);
1929 print_socket_type(type
);
1931 if (domain
== AF_PACKET
||
1932 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
1933 protocol
= tswap16(protocol
);
1935 print_socket_protocol(domain
, type
, protocol
);
1939 static void do_print_sockaddr(const char *name
, abi_long arg1
)
1941 abi_ulong sockfd
, addr
, addrlen
;
1943 get_user_ualx(sockfd
, arg1
, 0);
1944 get_user_ualx(addr
, arg1
, 1);
1945 get_user_ualx(addrlen
, arg1
, 2);
1947 qemu_log("%s(", name
);
1948 print_sockfd(sockfd
, 0);
1949 print_sockaddr(addr
, addrlen
, 0);
1953 static void do_print_listen(const char *name
, abi_long arg1
)
1955 abi_ulong sockfd
, backlog
;
1957 get_user_ualx(sockfd
, arg1
, 0);
1958 get_user_ualx(backlog
, arg1
, 1);
1960 qemu_log("%s(", name
);
1961 print_sockfd(sockfd
, 0);
1962 print_raw_param(TARGET_ABI_FMT_ld
, backlog
, 1);
1966 static void do_print_socketpair(const char *name
, abi_long arg1
)
1968 abi_ulong domain
, type
, protocol
, tab
;
1970 get_user_ualx(domain
, arg1
, 0);
1971 get_user_ualx(type
, arg1
, 1);
1972 get_user_ualx(protocol
, arg1
, 2);
1973 get_user_ualx(tab
, arg1
, 3);
1975 qemu_log("%s(", name
);
1976 print_socket_domain(domain
);
1978 print_socket_type(type
);
1980 print_socket_protocol(domain
, type
, protocol
);
1982 print_raw_param(TARGET_ABI_FMT_lx
, tab
, 1);
1986 static void do_print_sendrecv(const char *name
, abi_long arg1
)
1988 abi_ulong sockfd
, msg
, len
, flags
;
1990 get_user_ualx(sockfd
, arg1
, 0);
1991 get_user_ualx(msg
, arg1
, 1);
1992 get_user_ualx(len
, arg1
, 2);
1993 get_user_ualx(flags
, arg1
, 3);
1995 qemu_log("%s(", name
);
1996 print_sockfd(sockfd
, 0);
1997 print_buf(msg
, len
, 0);
1998 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
1999 print_flags(msg_flags
, flags
, 1);
2003 static void do_print_msgaddr(const char *name
, abi_long arg1
)
2005 abi_ulong sockfd
, msg
, len
, flags
, addr
, addrlen
;
2007 get_user_ualx(sockfd
, arg1
, 0);
2008 get_user_ualx(msg
, arg1
, 1);
2009 get_user_ualx(len
, arg1
, 2);
2010 get_user_ualx(flags
, arg1
, 3);
2011 get_user_ualx(addr
, arg1
, 4);
2012 get_user_ualx(addrlen
, arg1
, 5);
2014 qemu_log("%s(", name
);
2015 print_sockfd(sockfd
, 0);
2016 print_buf(msg
, len
, 0);
2017 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
2018 print_flags(msg_flags
, flags
, 0);
2019 print_sockaddr(addr
, addrlen
, 0);
2023 static void do_print_shutdown(const char *name
, abi_long arg1
)
2025 abi_ulong sockfd
, how
;
2027 get_user_ualx(sockfd
, arg1
, 0);
2028 get_user_ualx(how
, arg1
, 1);
2030 qemu_log("shutdown(");
2031 print_sockfd(sockfd
, 0);
2034 qemu_log("SHUT_RD");
2037 qemu_log("SHUT_WR");
2040 qemu_log("SHUT_RDWR");
2043 print_raw_param(TARGET_ABI_FMT_ld
, how
, 1);
2049 static void do_print_msg(const char *name
, abi_long arg1
)
2051 abi_ulong sockfd
, msg
, flags
;
2053 get_user_ualx(sockfd
, arg1
, 0);
2054 get_user_ualx(msg
, arg1
, 1);
2055 get_user_ualx(flags
, arg1
, 2);
2057 qemu_log("%s(", name
);
2058 print_sockfd(sockfd
, 0);
2059 print_pointer(msg
, 0);
2060 print_flags(msg_flags
, flags
, 1);
2064 static void do_print_sockopt(const char *name
, abi_long arg1
)
2066 abi_ulong sockfd
, level
, optname
, optval
, optlen
;
2068 get_user_ualx(sockfd
, arg1
, 0);
2069 get_user_ualx(level
, arg1
, 1);
2070 get_user_ualx(optname
, arg1
, 2);
2071 get_user_ualx(optval
, arg1
, 3);
2072 get_user_ualx(optlen
, arg1
, 4);
2074 qemu_log("%s(", name
);
2075 print_sockfd(sockfd
, 0);
2078 qemu_log("SOL_TCP,");
2079 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2080 print_pointer(optval
, 0);
2083 qemu_log("SOL_IP,");
2084 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2085 print_pointer(optval
, 0);
2088 qemu_log("SOL_RAW,");
2089 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2090 print_pointer(optval
, 0);
2092 case TARGET_SOL_SOCKET
:
2093 qemu_log("SOL_SOCKET,");
2095 case TARGET_SO_DEBUG
:
2096 qemu_log("SO_DEBUG,");
2098 print_number(optval
, 0);
2100 case TARGET_SO_REUSEADDR
:
2101 qemu_log("SO_REUSEADDR,");
2103 case TARGET_SO_REUSEPORT
:
2104 qemu_log("SO_REUSEPORT,");
2106 case TARGET_SO_TYPE
:
2107 qemu_log("SO_TYPE,");
2109 case TARGET_SO_ERROR
:
2110 qemu_log("SO_ERROR,");
2112 case TARGET_SO_DONTROUTE
:
2113 qemu_log("SO_DONTROUTE,");
2115 case TARGET_SO_BROADCAST
:
2116 qemu_log("SO_BROADCAST,");
2118 case TARGET_SO_SNDBUF
:
2119 qemu_log("SO_SNDBUF,");
2121 case TARGET_SO_RCVBUF
:
2122 qemu_log("SO_RCVBUF,");
2124 case TARGET_SO_KEEPALIVE
:
2125 qemu_log("SO_KEEPALIVE,");
2127 case TARGET_SO_OOBINLINE
:
2128 qemu_log("SO_OOBINLINE,");
2130 case TARGET_SO_NO_CHECK
:
2131 qemu_log("SO_NO_CHECK,");
2133 case TARGET_SO_PRIORITY
:
2134 qemu_log("SO_PRIORITY,");
2136 case TARGET_SO_BSDCOMPAT
:
2137 qemu_log("SO_BSDCOMPAT,");
2139 case TARGET_SO_PASSCRED
:
2140 qemu_log("SO_PASSCRED,");
2142 case TARGET_SO_TIMESTAMP
:
2143 qemu_log("SO_TIMESTAMP,");
2145 case TARGET_SO_RCVLOWAT
:
2146 qemu_log("SO_RCVLOWAT,");
2148 case TARGET_SO_RCVTIMEO
:
2149 qemu_log("SO_RCVTIMEO,");
2150 print_timeval(optval
, 0);
2152 case TARGET_SO_SNDTIMEO
:
2153 qemu_log("SO_SNDTIMEO,");
2154 print_timeval(optval
, 0);
2156 case TARGET_SO_ATTACH_FILTER
: {
2157 struct target_sock_fprog
*fprog
;
2159 qemu_log("SO_ATTACH_FILTER,");
2161 if (lock_user_struct(VERIFY_READ
, fprog
, optval
, 0)) {
2162 struct target_sock_filter
*filter
;
2164 if (lock_user_struct(VERIFY_READ
, filter
,
2165 tswapal(fprog
->filter
), 0)) {
2167 for (i
= 0; i
< tswap16(fprog
->len
) - 1; i
++) {
2168 qemu_log("[%d]{0x%x,%d,%d,0x%x},",
2169 i
, tswap16(filter
[i
].code
),
2170 filter
[i
].jt
, filter
[i
].jf
,
2171 tswap32(filter
[i
].k
));
2173 qemu_log("[%d]{0x%x,%d,%d,0x%x}",
2174 i
, tswap16(filter
[i
].code
),
2175 filter
[i
].jt
, filter
[i
].jf
,
2176 tswap32(filter
[i
].k
));
2178 qemu_log(TARGET_ABI_FMT_lx
, tswapal(fprog
->filter
));
2180 qemu_log(",%d},", tswap16(fprog
->len
));
2181 unlock_user(fprog
, optval
, 0);
2183 print_pointer(optval
, 0);
2188 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2189 print_pointer(optval
, 0);
2194 print_raw_param(TARGET_ABI_FMT_ld
, level
, 0);
2195 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2196 print_pointer(optval
, 0);
2199 print_raw_param(TARGET_ABI_FMT_ld
, optlen
, 1);
2203 #define PRINT_SOCKOP(name, func) \
2204 [TARGET_SYS_##name] = { #name, func }
2208 void (*print
)(const char *, abi_long
);
2210 PRINT_SOCKOP(SOCKET
, do_print_socket
),
2211 PRINT_SOCKOP(BIND
, do_print_sockaddr
),
2212 PRINT_SOCKOP(CONNECT
, do_print_sockaddr
),
2213 PRINT_SOCKOP(LISTEN
, do_print_listen
),
2214 PRINT_SOCKOP(ACCEPT
, do_print_sockaddr
),
2215 PRINT_SOCKOP(GETSOCKNAME
, do_print_sockaddr
),
2216 PRINT_SOCKOP(GETPEERNAME
, do_print_sockaddr
),
2217 PRINT_SOCKOP(SOCKETPAIR
, do_print_socketpair
),
2218 PRINT_SOCKOP(SEND
, do_print_sendrecv
),
2219 PRINT_SOCKOP(RECV
, do_print_sendrecv
),
2220 PRINT_SOCKOP(SENDTO
, do_print_msgaddr
),
2221 PRINT_SOCKOP(RECVFROM
, do_print_msgaddr
),
2222 PRINT_SOCKOP(SHUTDOWN
, do_print_shutdown
),
2223 PRINT_SOCKOP(SETSOCKOPT
, do_print_sockopt
),
2224 PRINT_SOCKOP(GETSOCKOPT
, do_print_sockopt
),
2225 PRINT_SOCKOP(SENDMSG
, do_print_msg
),
2226 PRINT_SOCKOP(RECVMSG
, do_print_msg
),
2227 PRINT_SOCKOP(ACCEPT4
, NULL
),
2228 PRINT_SOCKOP(RECVMMSG
, NULL
),
2229 PRINT_SOCKOP(SENDMMSG
, NULL
),
2233 print_socketcall(const struct syscallname
*name
,
2234 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2235 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2237 if (arg0
>= 0 && arg0
< ARRAY_SIZE(scall
) && scall
[arg0
].print
) {
2238 scall
[arg0
].print(scall
[arg0
].name
, arg1
);
2241 print_syscall_prologue(name
);
2242 print_raw_param(TARGET_ABI_FMT_ld
, arg0
, 0);
2243 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2244 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2245 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 0);
2246 print_raw_param(TARGET_ABI_FMT_ld
, arg4
, 0);
2247 print_raw_param(TARGET_ABI_FMT_ld
, arg5
, 0);
2248 print_syscall_epilogue(name
);
2252 #if defined(TARGET_NR_bind)
2254 print_bind(const struct syscallname
*name
,
2255 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2256 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2258 print_syscall_prologue(name
);
2259 print_sockfd(arg0
, 0);
2260 print_sockaddr(arg1
, arg2
, 1);
2261 print_syscall_epilogue(name
);
2265 #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \
2266 defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64)
2268 print_stat(const struct syscallname
*name
,
2269 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2270 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2272 print_syscall_prologue(name
);
2273 print_string(arg0
, 0);
2274 print_pointer(arg1
, 1);
2275 print_syscall_epilogue(name
);
2277 #define print_lstat print_stat
2278 #define print_stat64 print_stat
2279 #define print_lstat64 print_stat
2282 #if defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64)
2284 print_fstat(const struct syscallname
*name
,
2285 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2286 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2288 print_syscall_prologue(name
);
2289 print_raw_param("%d", arg0
, 0);
2290 print_pointer(arg1
, 1);
2291 print_syscall_epilogue(name
);
2293 #define print_fstat64 print_fstat
2296 #ifdef TARGET_NR_mkdir
2298 print_mkdir(const struct syscallname
*name
,
2299 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2300 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2302 print_syscall_prologue(name
);
2303 print_string(arg0
, 0);
2304 print_file_mode(arg1
, 1);
2305 print_syscall_epilogue(name
);
2309 #ifdef TARGET_NR_mkdirat
2311 print_mkdirat(const struct syscallname
*name
,
2312 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2313 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2315 print_syscall_prologue(name
);
2316 print_at_dirfd(arg0
, 0);
2317 print_string(arg1
, 0);
2318 print_file_mode(arg2
, 1);
2319 print_syscall_epilogue(name
);
2323 #ifdef TARGET_NR_rmdir
2325 print_rmdir(const struct syscallname
*name
,
2326 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2327 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2329 print_syscall_prologue(name
);
2330 print_string(arg0
, 0);
2331 print_syscall_epilogue(name
);
2335 #ifdef TARGET_NR_rt_sigaction
2337 print_rt_sigaction(const struct syscallname
*name
,
2338 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2339 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2341 print_syscall_prologue(name
);
2342 print_signal(arg0
, 0);
2343 print_pointer(arg1
, 0);
2344 print_pointer(arg2
, 1);
2345 print_syscall_epilogue(name
);
2349 #ifdef TARGET_NR_rt_sigprocmask
2351 print_rt_sigprocmask(const struct syscallname
*name
,
2352 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2353 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2355 const char *how
= "UNKNOWN";
2356 print_syscall_prologue(name
);
2358 case TARGET_SIG_BLOCK
: how
= "SIG_BLOCK"; break;
2359 case TARGET_SIG_UNBLOCK
: how
= "SIG_UNBLOCK"; break;
2360 case TARGET_SIG_SETMASK
: how
= "SIG_SETMASK"; break;
2362 qemu_log("%s,", how
);
2363 print_pointer(arg1
, 0);
2364 print_pointer(arg2
, 1);
2365 print_syscall_epilogue(name
);
2369 #ifdef TARGET_NR_rt_sigqueueinfo
2371 print_rt_sigqueueinfo(const struct syscallname
*name
,
2372 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2373 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2376 target_siginfo_t uinfo
;
2378 print_syscall_prologue(name
);
2379 print_raw_param("%d", arg0
, 0);
2380 print_signal(arg1
, 0);
2381 p
= lock_user(VERIFY_READ
, arg2
, sizeof(target_siginfo_t
), 1);
2383 get_target_siginfo(&uinfo
, p
);
2384 print_siginfo(&uinfo
);
2386 unlock_user(p
, arg2
, 0);
2388 print_pointer(arg2
, 1);
2390 print_syscall_epilogue(name
);
2394 #ifdef TARGET_NR_rt_tgsigqueueinfo
2396 print_rt_tgsigqueueinfo(const struct syscallname
*name
,
2397 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2398 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2401 target_siginfo_t uinfo
;
2403 print_syscall_prologue(name
);
2404 print_raw_param("%d", arg0
, 0);
2405 print_raw_param("%d", arg1
, 0);
2406 print_signal(arg2
, 0);
2407 p
= lock_user(VERIFY_READ
, arg3
, sizeof(target_siginfo_t
), 1);
2409 get_target_siginfo(&uinfo
, p
);
2410 print_siginfo(&uinfo
);
2412 unlock_user(p
, arg3
, 0);
2414 print_pointer(arg3
, 1);
2416 print_syscall_epilogue(name
);
2420 #ifdef TARGET_NR_syslog
2422 print_syslog_action(abi_ulong arg
, int last
)
2427 case TARGET_SYSLOG_ACTION_CLOSE
: {
2428 type
= "SYSLOG_ACTION_CLOSE";
2431 case TARGET_SYSLOG_ACTION_OPEN
: {
2432 type
= "SYSLOG_ACTION_OPEN";
2435 case TARGET_SYSLOG_ACTION_READ
: {
2436 type
= "SYSLOG_ACTION_READ";
2439 case TARGET_SYSLOG_ACTION_READ_ALL
: {
2440 type
= "SYSLOG_ACTION_READ_ALL";
2443 case TARGET_SYSLOG_ACTION_READ_CLEAR
: {
2444 type
= "SYSLOG_ACTION_READ_CLEAR";
2447 case TARGET_SYSLOG_ACTION_CLEAR
: {
2448 type
= "SYSLOG_ACTION_CLEAR";
2451 case TARGET_SYSLOG_ACTION_CONSOLE_OFF
: {
2452 type
= "SYSLOG_ACTION_CONSOLE_OFF";
2455 case TARGET_SYSLOG_ACTION_CONSOLE_ON
: {
2456 type
= "SYSLOG_ACTION_CONSOLE_ON";
2459 case TARGET_SYSLOG_ACTION_CONSOLE_LEVEL
: {
2460 type
= "SYSLOG_ACTION_CONSOLE_LEVEL";
2463 case TARGET_SYSLOG_ACTION_SIZE_UNREAD
: {
2464 type
= "SYSLOG_ACTION_SIZE_UNREAD";
2467 case TARGET_SYSLOG_ACTION_SIZE_BUFFER
: {
2468 type
= "SYSLOG_ACTION_SIZE_BUFFER";
2472 print_raw_param("%ld", arg
, last
);
2476 qemu_log("%s%s", type
, get_comma(last
));
2480 print_syslog(const struct syscallname
*name
,
2481 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2482 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2484 print_syscall_prologue(name
);
2485 print_syslog_action(arg0
, 0);
2486 print_pointer(arg1
, 0);
2487 print_raw_param("%d", arg2
, 1);
2488 print_syscall_epilogue(name
);
2492 #ifdef TARGET_NR_mknod
2494 print_mknod(const struct syscallname
*name
,
2495 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2496 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2498 int hasdev
= (arg1
& (S_IFCHR
|S_IFBLK
));
2500 print_syscall_prologue(name
);
2501 print_string(arg0
, 0);
2502 print_file_mode(arg1
, (hasdev
== 0));
2504 print_raw_param("makedev(%d", major(arg2
), 0);
2505 print_raw_param("%d)", minor(arg2
), 1);
2507 print_syscall_epilogue(name
);
2511 #ifdef TARGET_NR_mknodat
2513 print_mknodat(const struct syscallname
*name
,
2514 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2515 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2517 int hasdev
= (arg2
& (S_IFCHR
|S_IFBLK
));
2519 print_syscall_prologue(name
);
2520 print_at_dirfd(arg0
, 0);
2521 print_string(arg1
, 0);
2522 print_file_mode(arg2
, (hasdev
== 0));
2524 print_raw_param("makedev(%d", major(arg3
), 0);
2525 print_raw_param("%d)", minor(arg3
), 1);
2527 print_syscall_epilogue(name
);
2531 #ifdef TARGET_NR_mq_open
2533 print_mq_open(const struct syscallname
*name
,
2534 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2535 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2537 int is_creat
= (arg1
& TARGET_O_CREAT
);
2539 print_syscall_prologue(name
);
2540 print_string(arg0
, 0);
2541 print_open_flags(arg1
, (is_creat
== 0));
2543 print_file_mode(arg2
, 0);
2544 print_pointer(arg3
, 1);
2546 print_syscall_epilogue(name
);
2550 #ifdef TARGET_NR_open
2552 print_open(const struct syscallname
*name
,
2553 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2554 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2556 int is_creat
= (arg1
& TARGET_O_CREAT
);
2558 print_syscall_prologue(name
);
2559 print_string(arg0
, 0);
2560 print_open_flags(arg1
, (is_creat
== 0));
2562 print_file_mode(arg2
, 1);
2563 print_syscall_epilogue(name
);
2567 #ifdef TARGET_NR_openat
2569 print_openat(const struct syscallname
*name
,
2570 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2571 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2573 int is_creat
= (arg2
& TARGET_O_CREAT
);
2575 print_syscall_prologue(name
);
2576 print_at_dirfd(arg0
, 0);
2577 print_string(arg1
, 0);
2578 print_open_flags(arg2
, (is_creat
== 0));
2580 print_file_mode(arg3
, 1);
2581 print_syscall_epilogue(name
);
2585 #ifdef TARGET_NR_mq_unlink
2587 print_mq_unlink(const struct syscallname
*name
,
2588 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2589 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2591 print_syscall_prologue(name
);
2592 print_string(arg0
, 1);
2593 print_syscall_epilogue(name
);
2597 #if defined(TARGET_NR_fstatat64) || defined(TARGET_NR_newfstatat)
2599 print_fstatat64(const struct syscallname
*name
,
2600 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2601 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2603 print_syscall_prologue(name
);
2604 print_at_dirfd(arg0
, 0);
2605 print_string(arg1
, 0);
2606 print_pointer(arg2
, 0);
2607 print_flags(at_file_flags
, arg3
, 1);
2608 print_syscall_epilogue(name
);
2610 #define print_newfstatat print_fstatat64
2613 #ifdef TARGET_NR_readlink
2615 print_readlink(const struct syscallname
*name
,
2616 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2617 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2619 print_syscall_prologue(name
);
2620 print_string(arg0
, 0);
2621 print_pointer(arg1
, 0);
2622 print_raw_param("%u", arg2
, 1);
2623 print_syscall_epilogue(name
);
2627 #ifdef TARGET_NR_readlinkat
2629 print_readlinkat(const struct syscallname
*name
,
2630 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2631 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2633 print_syscall_prologue(name
);
2634 print_at_dirfd(arg0
, 0);
2635 print_string(arg1
, 0);
2636 print_pointer(arg2
, 0);
2637 print_raw_param("%u", arg3
, 1);
2638 print_syscall_epilogue(name
);
2642 #ifdef TARGET_NR_rename
2644 print_rename(const struct syscallname
*name
,
2645 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2646 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2648 print_syscall_prologue(name
);
2649 print_string(arg0
, 0);
2650 print_string(arg1
, 1);
2651 print_syscall_epilogue(name
);
2655 #ifdef TARGET_NR_renameat
2657 print_renameat(const struct syscallname
*name
,
2658 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2659 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2661 print_syscall_prologue(name
);
2662 print_at_dirfd(arg0
, 0);
2663 print_string(arg1
, 0);
2664 print_at_dirfd(arg2
, 0);
2665 print_string(arg3
, 1);
2666 print_syscall_epilogue(name
);
2670 #ifdef TARGET_NR_statfs
2672 print_statfs(const struct syscallname
*name
,
2673 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2674 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2676 print_syscall_prologue(name
);
2677 print_string(arg0
, 0);
2678 print_pointer(arg1
, 1);
2679 print_syscall_epilogue(name
);
2683 #ifdef TARGET_NR_statfs64
2685 print_statfs64(const struct syscallname
*name
,
2686 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2687 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2689 print_syscall_prologue(name
);
2690 print_string(arg0
, 0);
2691 print_pointer(arg1
, 1);
2692 print_syscall_epilogue(name
);
2696 #ifdef TARGET_NR_symlink
2698 print_symlink(const struct syscallname
*name
,
2699 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2700 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2702 print_syscall_prologue(name
);
2703 print_string(arg0
, 0);
2704 print_string(arg1
, 1);
2705 print_syscall_epilogue(name
);
2709 #ifdef TARGET_NR_symlinkat
2711 print_symlinkat(const struct syscallname
*name
,
2712 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2713 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2715 print_syscall_prologue(name
);
2716 print_string(arg0
, 0);
2717 print_at_dirfd(arg1
, 0);
2718 print_string(arg2
, 1);
2719 print_syscall_epilogue(name
);
2723 #ifdef TARGET_NR_mount
2725 print_mount(const struct syscallname
*name
,
2726 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2727 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2729 print_syscall_prologue(name
);
2730 print_string(arg0
, 0);
2731 print_string(arg1
, 0);
2732 print_string(arg2
, 0);
2733 print_flags(mount_flags
, arg3
, 0);
2734 print_pointer(arg4
, 1);
2735 print_syscall_epilogue(name
);
2739 #ifdef TARGET_NR_umount
2741 print_umount(const struct syscallname
*name
,
2742 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2743 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2745 print_syscall_prologue(name
);
2746 print_string(arg0
, 1);
2747 print_syscall_epilogue(name
);
2751 #ifdef TARGET_NR_umount2
2753 print_umount2(const struct syscallname
*name
,
2754 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2755 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2757 print_syscall_prologue(name
);
2758 print_string(arg0
, 0);
2759 print_flags(umount2_flags
, arg1
, 1);
2760 print_syscall_epilogue(name
);
2764 #ifdef TARGET_NR_unlink
2766 print_unlink(const struct syscallname
*name
,
2767 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2768 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2770 print_syscall_prologue(name
);
2771 print_string(arg0
, 1);
2772 print_syscall_epilogue(name
);
2776 #ifdef TARGET_NR_unlinkat
2778 print_unlinkat(const struct syscallname
*name
,
2779 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2780 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2782 print_syscall_prologue(name
);
2783 print_at_dirfd(arg0
, 0);
2784 print_string(arg1
, 0);
2785 print_flags(unlinkat_flags
, arg2
, 1);
2786 print_syscall_epilogue(name
);
2790 #ifdef TARGET_NR_utime
2792 print_utime(const struct syscallname
*name
,
2793 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2794 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2796 print_syscall_prologue(name
);
2797 print_string(arg0
, 0);
2798 print_pointer(arg1
, 1);
2799 print_syscall_epilogue(name
);
2803 #ifdef TARGET_NR_utimes
2805 print_utimes(const struct syscallname
*name
,
2806 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2807 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2809 print_syscall_prologue(name
);
2810 print_string(arg0
, 0);
2811 print_pointer(arg1
, 1);
2812 print_syscall_epilogue(name
);
2816 #ifdef TARGET_NR_utimensat
2818 print_utimensat(const struct syscallname
*name
,
2819 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2820 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2822 print_syscall_prologue(name
);
2823 print_at_dirfd(arg0
, 0);
2824 print_string(arg1
, 0);
2825 print_pointer(arg2
, 0);
2826 print_flags(at_file_flags
, arg3
, 1);
2827 print_syscall_epilogue(name
);
2831 #if defined(TARGET_NR_mmap) || defined(TARGET_NR_mmap2)
2833 print_mmap(const struct syscallname
*name
,
2834 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2835 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2837 print_syscall_prologue(name
);
2838 print_pointer(arg0
, 0);
2839 print_raw_param("%d", arg1
, 0);
2840 print_flags(mmap_prot_flags
, arg2
, 0);
2841 print_flags(mmap_flags
, arg3
, 0);
2842 print_raw_param("%d", arg4
, 0);
2843 print_raw_param("%#x", arg5
, 1);
2844 print_syscall_epilogue(name
);
2846 #define print_mmap2 print_mmap
2849 #ifdef TARGET_NR_mprotect
2851 print_mprotect(const struct syscallname
*name
,
2852 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2853 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2855 print_syscall_prologue(name
);
2856 print_pointer(arg0
, 0);
2857 print_raw_param("%d", arg1
, 0);
2858 print_flags(mmap_prot_flags
, arg2
, 1);
2859 print_syscall_epilogue(name
);
2863 #ifdef TARGET_NR_munmap
2865 print_munmap(const struct syscallname
*name
,
2866 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2867 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2869 print_syscall_prologue(name
);
2870 print_pointer(arg0
, 0);
2871 print_raw_param("%d", arg1
, 1);
2872 print_syscall_epilogue(name
);
2876 #ifdef TARGET_NR_futex
2877 static void print_futex_op(abi_long tflag
, int last
)
2879 #define print_op(val) \
2880 if( cmd == val ) { \
2885 int cmd
= (int)tflag
;
2886 #ifdef FUTEX_PRIVATE_FLAG
2887 if (cmd
& FUTEX_PRIVATE_FLAG
) {
2888 qemu_log("FUTEX_PRIVATE_FLAG|");
2889 cmd
&= ~FUTEX_PRIVATE_FLAG
;
2892 #ifdef FUTEX_CLOCK_REALTIME
2893 if (cmd
& FUTEX_CLOCK_REALTIME
) {
2894 qemu_log("FUTEX_CLOCK_REALTIME|");
2895 cmd
&= ~FUTEX_CLOCK_REALTIME
;
2898 print_op(FUTEX_WAIT
)
2899 print_op(FUTEX_WAKE
)
2901 print_op(FUTEX_REQUEUE
)
2902 print_op(FUTEX_CMP_REQUEUE
)
2903 print_op(FUTEX_WAKE_OP
)
2904 print_op(FUTEX_LOCK_PI
)
2905 print_op(FUTEX_UNLOCK_PI
)
2906 print_op(FUTEX_TRYLOCK_PI
)
2907 #ifdef FUTEX_WAIT_BITSET
2908 print_op(FUTEX_WAIT_BITSET
)
2910 #ifdef FUTEX_WAKE_BITSET
2911 print_op(FUTEX_WAKE_BITSET
)
2913 /* unknown values */
2914 qemu_log("%d", cmd
);
2918 print_futex(const struct syscallname
*name
,
2919 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2920 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2922 print_syscall_prologue(name
);
2923 print_pointer(arg0
, 0);
2924 print_futex_op(arg1
, 0);
2925 print_raw_param(",%d", arg2
, 0);
2926 print_pointer(arg3
, 0); /* struct timespec */
2927 print_pointer(arg4
, 0);
2928 print_raw_param("%d", arg4
, 1);
2929 print_syscall_epilogue(name
);
2933 #ifdef TARGET_NR_kill
2935 print_kill(const struct syscallname
*name
,
2936 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2937 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2939 print_syscall_prologue(name
);
2940 print_raw_param("%d", arg0
, 0);
2941 print_signal(arg1
, 1);
2942 print_syscall_epilogue(name
);
2946 #ifdef TARGET_NR_tkill
2948 print_tkill(const struct syscallname
*name
,
2949 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2950 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2952 print_syscall_prologue(name
);
2953 print_raw_param("%d", arg0
, 0);
2954 print_signal(arg1
, 1);
2955 print_syscall_epilogue(name
);
2959 #ifdef TARGET_NR_tgkill
2961 print_tgkill(const struct syscallname
*name
,
2962 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2963 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2965 print_syscall_prologue(name
);
2966 print_raw_param("%d", arg0
, 0);
2967 print_raw_param("%d", arg1
, 0);
2968 print_signal(arg2
, 1);
2969 print_syscall_epilogue(name
);
2973 #ifdef TARGET_NR_statx
2975 print_statx(const struct syscallname
*name
,
2976 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2977 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2979 print_syscall_prologue(name
);
2980 print_at_dirfd(arg0
, 0);
2981 print_string(arg1
, 0);
2982 print_flags(statx_flags
, arg2
, 0);
2983 print_flags(statx_mask
, arg3
, 0);
2984 print_pointer(arg4
, 1);
2985 print_syscall_epilogue(name
);
2990 * An array of all of the syscalls we know about
2993 static const struct syscallname scnames
[] = {
2994 #include "strace.list"
2997 static int nsyscalls
= ARRAY_SIZE(scnames
);
3000 * The public interface to this module.
3003 print_syscall(int num
,
3004 abi_long arg1
, abi_long arg2
, abi_long arg3
,
3005 abi_long arg4
, abi_long arg5
, abi_long arg6
)
3008 const char *format
="%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
")";
3010 qemu_log("%d ", getpid());
3012 for(i
=0;i
<nsyscalls
;i
++)
3013 if( scnames
[i
].nr
== num
) {
3014 if( scnames
[i
].call
!= NULL
) {
3016 &scnames
[i
], arg1
, arg2
, arg3
, arg4
, arg5
, arg6
);
3018 /* XXX: this format system is broken because it uses
3019 host types and host pointers for strings */
3020 if( scnames
[i
].format
!= NULL
)
3021 format
= scnames
[i
].format
;
3023 scnames
[i
].name
, arg1
, arg2
, arg3
, arg4
, arg5
, arg6
);
3027 qemu_log("Unknown syscall %d\n", num
);
3032 print_syscall_ret(int num
, abi_long ret
,
3033 abi_long arg1
, abi_long arg2
, abi_long arg3
,
3034 abi_long arg4
, abi_long arg5
, abi_long arg6
)
3038 for(i
=0;i
<nsyscalls
;i
++)
3039 if( scnames
[i
].nr
== num
) {
3040 if( scnames
[i
].result
!= NULL
) {
3041 scnames
[i
].result(&scnames
[i
], ret
,
3045 print_syscall_err(ret
);
3048 qemu_log(TARGET_ABI_FMT_ld
, ret
);
3056 void print_taken_signal(int target_signum
, const target_siginfo_t
*tinfo
)
3058 /* Print the strace output for a signal being taken:
3059 * --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
3062 print_signal(target_signum
, 1);
3064 print_siginfo(tinfo
);