1 #include "qemu/osdep.h"
7 #include <sys/select.h>
10 #include <netinet/in.h>
11 #include <netinet/tcp.h>
12 #include <netinet/udp.h>
13 #include <linux/if_packet.h>
14 #include <linux/in6.h>
15 #include <linux/netlink.h>
18 #include "user-internals.h"
20 #include "signal-common.h"
21 #include "target_mman.h"
27 void (*call
)(CPUArchState
*, const struct syscallname
*,
28 abi_long
, abi_long
, abi_long
,
29 abi_long
, abi_long
, abi_long
);
30 void (*result
)(CPUArchState
*, const struct syscallname
*, abi_long
,
31 abi_long
, abi_long
, abi_long
,
32 abi_long
, abi_long
, abi_long
);
36 * It is possible that target doesn't have syscall that uses
37 * following flags but we don't want the compiler to warn
38 * us about them being unused. Same applies to utility print
39 * functions. It is ok to keep them while not used.
41 #define UNUSED __attribute__ ((unused))
44 * Structure used to translate flag values into strings. This is
45 * similar that is in the actual strace tool.
48 abi_long f_value
; /* flag */
49 const char *f_string
; /* stringified flag */
52 /* common flags for all architectures */
53 #define FLAG_GENERIC(name) { name, #name }
54 /* target specific flags (syscall_defs.h has TARGET_<flag>) */
55 #define FLAG_TARGET(name) { TARGET_ ## name, #name }
56 /* end of flags array */
57 #define FLAG_END { 0, NULL }
59 /* Structure used to translate enumerated values into strings */
61 abi_long e_value
; /* enum value */
62 const char *e_string
; /* stringified enum */
65 /* common enums for all architectures */
66 #define ENUM_GENERIC(name) { name, #name }
67 /* target specific enums */
68 #define ENUM_TARGET(name) { TARGET_ ## name, #name }
69 /* end of enums array */
70 #define ENUM_END { 0, NULL }
72 UNUSED
static const char *get_comma(int);
73 UNUSED
static void print_pointer(abi_long
, int);
74 UNUSED
static void print_flags(const struct flags
*, abi_long
, int);
75 UNUSED
static void print_enums(const struct enums
*, abi_long
, int);
76 UNUSED
static void print_at_dirfd(abi_long
, int);
77 UNUSED
static void print_file_mode(abi_long
, int);
78 UNUSED
static void print_open_flags(abi_long
, int);
79 UNUSED
static void print_syscall_prologue(const struct syscallname
*);
80 UNUSED
static void print_syscall_epilogue(const struct syscallname
*);
81 UNUSED
static void print_string(abi_long
, int);
82 UNUSED
static void print_buf(abi_long addr
, abi_long len
, int last
);
83 UNUSED
static void print_raw_param(const char *, abi_long
, int);
84 UNUSED
static void print_raw_param64(const char *, long long, int last
);
85 UNUSED
static void print_timeval(abi_ulong
, int);
86 UNUSED
static void print_timespec(abi_ulong
, int);
87 UNUSED
static void print_timespec64(abi_ulong
, int);
88 UNUSED
static void print_timezone(abi_ulong
, int);
89 UNUSED
static void print_itimerval(abi_ulong
, int);
90 UNUSED
static void print_number(abi_long
, int);
91 UNUSED
static void print_signal(abi_ulong
, int);
92 UNUSED
static void print_sockaddr(abi_ulong
, abi_long
, int);
93 UNUSED
static void print_socket_domain(int domain
);
94 UNUSED
static void print_socket_type(int type
);
95 UNUSED
static void print_socket_protocol(int domain
, int type
, int protocol
);
101 print_ipc_cmd(int cmd
)
103 #define output_cmd(val) \
111 /* General IPC commands */
112 output_cmd( IPC_RMID
);
113 output_cmd( IPC_SET
);
114 output_cmd( IPC_STAT
);
115 output_cmd( IPC_INFO
);
116 /* msgctl() commands */
117 output_cmd( MSG_STAT
);
118 output_cmd( MSG_INFO
);
119 /* shmctl() commands */
120 output_cmd( SHM_LOCK
);
121 output_cmd( SHM_UNLOCK
);
122 output_cmd( SHM_STAT
);
123 output_cmd( SHM_INFO
);
124 /* semctl() commands */
125 output_cmd( GETPID
);
126 output_cmd( GETVAL
);
127 output_cmd( GETALL
);
128 output_cmd( GETNCNT
);
129 output_cmd( GETZCNT
);
130 output_cmd( SETVAL
);
131 output_cmd( SETALL
);
132 output_cmd( SEM_STAT
);
133 output_cmd( SEM_INFO
);
134 output_cmd( IPC_RMID
);
135 output_cmd( IPC_RMID
);
136 output_cmd( IPC_RMID
);
137 output_cmd( IPC_RMID
);
138 output_cmd( IPC_RMID
);
139 output_cmd( IPC_RMID
);
140 output_cmd( IPC_RMID
);
141 output_cmd( IPC_RMID
);
142 output_cmd( IPC_RMID
);
144 /* Some value we don't recognize */
148 static const char * const target_signal_name
[] = {
149 #define MAKE_SIG_ENTRY(sig) [TARGET_##sig] = #sig,
151 #undef MAKE_SIG_ENTRY
155 print_signal(abi_ulong arg
, int last
)
157 const char *signal_name
= NULL
;
159 if (arg
< ARRAY_SIZE(target_signal_name
)) {
160 signal_name
= target_signal_name
[arg
];
163 if (signal_name
== NULL
) {
164 print_raw_param("%ld", arg
, last
);
167 qemu_log("%s%s", signal_name
, get_comma(last
));
170 static void print_si_code(int arg
)
172 const char *codename
= NULL
;
176 codename
= "SI_USER";
179 codename
= "SI_KERNEL";
182 codename
= "SI_QUEUE";
185 codename
= "SI_TIMER";
188 codename
= "SI_MESGQ";
191 codename
= "SI_ASYNCIO";
194 codename
= "SI_SIGIO";
197 codename
= "SI_TKILL";
203 qemu_log("%s", codename
);
206 static void get_target_siginfo(target_siginfo_t
*tinfo
,
207 const target_siginfo_t
*info
)
216 __get_user(sig
, &info
->si_signo
);
217 __get_user(si_errno
, &tinfo
->si_errno
);
218 __get_user(si_code
, &info
->si_code
);
220 tinfo
->si_signo
= sig
;
221 tinfo
->si_errno
= si_errno
;
222 tinfo
->si_code
= si_code
;
224 /* Ensure we don't leak random junk to the guest later */
225 memset(tinfo
->_sifields
._pad
, 0, sizeof(tinfo
->_sifields
._pad
));
227 /* This is awkward, because we have to use a combination of
228 * the si_code and si_signo to figure out which of the union's
229 * members are valid. (Within the host kernel it is always possible
230 * to tell, but the kernel carefully avoids giving userspace the
231 * high 16 bits of si_code, so we don't have the information to
232 * do this the easy way...) We therefore make our best guess,
233 * bearing in mind that a guest can spoof most of the si_codes
234 * via rt_sigqueueinfo() if it likes.
236 * Once we have made our guess, we record it in the top 16 bits of
237 * the si_code, so that print_siginfo() later can use it.
238 * print_siginfo() will strip these top bits out before printing
246 /* Sent via kill(), tkill() or tgkill(), or direct from the kernel.
247 * These are the only unspoofable si_code values.
249 __get_user(tinfo
->_sifields
._kill
._pid
, &info
->_sifields
._kill
._pid
);
250 __get_user(tinfo
->_sifields
._kill
._uid
, &info
->_sifields
._kill
._uid
);
251 si_type
= QEMU_SI_KILL
;
254 /* Everything else is spoofable. Make best guess based on signal */
257 __get_user(tinfo
->_sifields
._sigchld
._pid
,
258 &info
->_sifields
._sigchld
._pid
);
259 __get_user(tinfo
->_sifields
._sigchld
._uid
,
260 &info
->_sifields
._sigchld
._uid
);
261 __get_user(tinfo
->_sifields
._sigchld
._status
,
262 &info
->_sifields
._sigchld
._status
);
263 __get_user(tinfo
->_sifields
._sigchld
._utime
,
264 &info
->_sifields
._sigchld
._utime
);
265 __get_user(tinfo
->_sifields
._sigchld
._stime
,
266 &info
->_sifields
._sigchld
._stime
);
267 si_type
= QEMU_SI_CHLD
;
270 __get_user(tinfo
->_sifields
._sigpoll
._band
,
271 &info
->_sifields
._sigpoll
._band
);
272 __get_user(tinfo
->_sifields
._sigpoll
._fd
,
273 &info
->_sifields
._sigpoll
._fd
);
274 si_type
= QEMU_SI_POLL
;
277 /* Assume a sigqueue()/mq_notify()/rt_sigqueueinfo() source. */
278 __get_user(tinfo
->_sifields
._rt
._pid
, &info
->_sifields
._rt
._pid
);
279 __get_user(tinfo
->_sifields
._rt
._uid
, &info
->_sifields
._rt
._uid
);
280 /* XXX: potential problem if 64 bit */
281 __get_user(sival_ptr
, &info
->_sifields
._rt
._sigval
.sival_ptr
);
282 tinfo
->_sifields
._rt
._sigval
.sival_ptr
= sival_ptr
;
284 si_type
= QEMU_SI_RT
;
290 tinfo
->si_code
= deposit32(si_code
, 16, 16, si_type
);
293 static void print_siginfo(const target_siginfo_t
*tinfo
)
295 /* Print a target_siginfo_t in the format desired for printing
296 * signals being taken. We assume the target_siginfo_t is in the
297 * internal form where the top 16 bits of si_code indicate which
298 * part of the union is valid, rather than in the guest-visible
299 * form where the bottom 16 bits are sign-extended into the top 16.
301 int si_type
= extract32(tinfo
->si_code
, 16, 16);
302 int si_code
= sextract32(tinfo
->si_code
, 0, 16);
304 qemu_log("{si_signo=");
305 print_signal(tinfo
->si_signo
, 1);
306 qemu_log(", si_code=");
307 print_si_code(si_code
);
311 qemu_log(", si_pid=%u, si_uid=%u",
312 (unsigned int)tinfo
->_sifields
._kill
._pid
,
313 (unsigned int)tinfo
->_sifields
._kill
._uid
);
316 qemu_log(", si_timer1=%u, si_timer2=%u",
317 tinfo
->_sifields
._timer
._timer1
,
318 tinfo
->_sifields
._timer
._timer2
);
321 qemu_log(", si_band=%d, si_fd=%d",
322 tinfo
->_sifields
._sigpoll
._band
,
323 tinfo
->_sifields
._sigpoll
._fd
);
326 qemu_log(", si_addr=");
327 print_pointer(tinfo
->_sifields
._sigfault
._addr
, 1);
330 qemu_log(", si_pid=%u, si_uid=%u, si_status=%d"
331 ", si_utime=" TARGET_ABI_FMT_ld
332 ", si_stime=" TARGET_ABI_FMT_ld
,
333 (unsigned int)(tinfo
->_sifields
._sigchld
._pid
),
334 (unsigned int)(tinfo
->_sifields
._sigchld
._uid
),
335 tinfo
->_sifields
._sigchld
._status
,
336 tinfo
->_sifields
._sigchld
._utime
,
337 tinfo
->_sifields
._sigchld
._stime
);
340 qemu_log(", si_pid=%u, si_uid=%u, si_sigval=" TARGET_ABI_FMT_ld
,
341 (unsigned int)tinfo
->_sifields
._rt
._pid
,
342 (unsigned int)tinfo
->_sifields
._rt
._uid
,
343 tinfo
->_sifields
._rt
._sigval
.sival_ptr
);
346 g_assert_not_reached();
352 print_sockaddr(abi_ulong addr
, abi_long addrlen
, int last
)
354 struct target_sockaddr
*sa
;
358 sa
= lock_user(VERIFY_READ
, addr
, addrlen
, 1);
360 sa_family
= tswap16(sa
->sa_family
);
363 struct target_sockaddr_un
*un
= (struct target_sockaddr_un
*)sa
;
365 qemu_log("{sun_family=AF_UNIX,sun_path=\"");
366 for (i
= 0; i
< addrlen
-
367 offsetof(struct target_sockaddr_un
, sun_path
) &&
368 un
->sun_path
[i
]; i
++) {
369 qemu_log("%c", un
->sun_path
[i
]);
375 struct target_sockaddr_in
*in
= (struct target_sockaddr_in
*)sa
;
376 uint8_t *c
= (uint8_t *)&in
->sin_addr
.s_addr
;
377 qemu_log("{sin_family=AF_INET,sin_port=htons(%d),",
378 ntohs(in
->sin_port
));
379 qemu_log("sin_addr=inet_addr(\"%d.%d.%d.%d\")",
380 c
[0], c
[1], c
[2], c
[3]);
385 struct target_sockaddr_ll
*ll
= (struct target_sockaddr_ll
*)sa
;
386 uint8_t *c
= (uint8_t *)&ll
->sll_addr
;
387 qemu_log("{sll_family=AF_PACKET,"
388 "sll_protocol=htons(0x%04x),if%d,pkttype=",
389 ntohs(ll
->sll_protocol
), ll
->sll_ifindex
);
390 switch (ll
->sll_pkttype
) {
392 qemu_log("PACKET_HOST");
394 case PACKET_BROADCAST
:
395 qemu_log("PACKET_BROADCAST");
397 case PACKET_MULTICAST
:
398 qemu_log("PACKET_MULTICAST");
400 case PACKET_OTHERHOST
:
401 qemu_log("PACKET_OTHERHOST");
403 case PACKET_OUTGOING
:
404 qemu_log("PACKET_OUTGOING");
407 qemu_log("%d", ll
->sll_pkttype
);
410 qemu_log(",sll_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
411 c
[0], c
[1], c
[2], c
[3], c
[4], c
[5], c
[6], c
[7]);
416 struct target_sockaddr_nl
*nl
= (struct target_sockaddr_nl
*)sa
;
417 qemu_log("{nl_family=AF_NETLINK,nl_pid=%u,nl_groups=%u}",
418 tswap32(nl
->nl_pid
), tswap32(nl
->nl_groups
));
422 qemu_log("{sa_family=%d, sa_data={", sa
->sa_family
);
423 for (i
= 0; i
< 13; i
++) {
424 qemu_log("%02x, ", sa
->sa_data
[i
]);
426 qemu_log("%02x}", sa
->sa_data
[i
]);
430 unlock_user(sa
, addr
, 0);
432 print_raw_param("0x"TARGET_ABI_FMT_lx
, addr
, 0);
434 qemu_log(", "TARGET_ABI_FMT_ld
"%s", addrlen
, get_comma(last
));
438 print_socket_domain(int domain
)
448 qemu_log("PF_NETLINK");
451 qemu_log("PF_PACKET");
454 qemu_log("%d", domain
);
460 print_socket_type(int type
)
462 switch (type
& TARGET_SOCK_TYPE_MASK
) {
463 case TARGET_SOCK_DGRAM
:
464 qemu_log("SOCK_DGRAM");
466 case TARGET_SOCK_STREAM
:
467 qemu_log("SOCK_STREAM");
469 case TARGET_SOCK_RAW
:
470 qemu_log("SOCK_RAW");
472 case TARGET_SOCK_RDM
:
473 qemu_log("SOCK_RDM");
475 case TARGET_SOCK_SEQPACKET
:
476 qemu_log("SOCK_SEQPACKET");
478 case TARGET_SOCK_PACKET
:
479 qemu_log("SOCK_PACKET");
482 if (type
& TARGET_SOCK_CLOEXEC
) {
483 qemu_log("|SOCK_CLOEXEC");
485 if (type
& TARGET_SOCK_NONBLOCK
) {
486 qemu_log("|SOCK_NONBLOCK");
491 print_socket_protocol(int domain
, int type
, int protocol
)
493 if (domain
== AF_PACKET
||
494 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
497 qemu_log("ETH_P_ALL");
500 qemu_log("%d", protocol
);
505 if (domain
== PF_NETLINK
) {
508 qemu_log("NETLINK_ROUTE");
511 qemu_log("NETLINK_UNUSED");
513 case NETLINK_USERSOCK
:
514 qemu_log("NETLINK_USERSOCK");
516 case NETLINK_FIREWALL
:
517 qemu_log("NETLINK_FIREWALL");
519 case NETLINK_SOCK_DIAG
:
520 qemu_log("NETLINK_SOCK_DIAG");
523 qemu_log("NETLINK_NFLOG");
526 qemu_log("NETLINK_XFRM");
528 case NETLINK_SELINUX
:
529 qemu_log("NETLINK_SELINUX");
532 qemu_log("NETLINK_ISCSI");
535 qemu_log("NETLINK_AUDIT");
537 case NETLINK_FIB_LOOKUP
:
538 qemu_log("NETLINK_FIB_LOOKUP");
540 case NETLINK_CONNECTOR
:
541 qemu_log("NETLINK_CONNECTOR");
543 case NETLINK_NETFILTER
:
544 qemu_log("NETLINK_NETFILTER");
547 qemu_log("NETLINK_IP6_FW");
549 case NETLINK_DNRTMSG
:
550 qemu_log("NETLINK_DNRTMSG");
552 case NETLINK_KOBJECT_UEVENT
:
553 qemu_log("NETLINK_KOBJECT_UEVENT");
555 case NETLINK_GENERIC
:
556 qemu_log("NETLINK_GENERIC");
558 case NETLINK_SCSITRANSPORT
:
559 qemu_log("NETLINK_SCSITRANSPORT");
561 case NETLINK_ECRYPTFS
:
562 qemu_log("NETLINK_ECRYPTFS");
565 qemu_log("NETLINK_RDMA");
568 qemu_log("NETLINK_CRYPTO");
571 qemu_log("NETLINK_SMC");
574 qemu_log("%d", protocol
);
582 qemu_log("IPPROTO_IP");
585 qemu_log("IPPROTO_TCP");
588 qemu_log("IPPROTO_UDP");
591 qemu_log("IPPROTO_RAW");
594 qemu_log("%d", protocol
);
600 #ifdef TARGET_NR__newselect
602 print_fdset(int n
, abi_ulong target_fds_addr
)
608 if( target_fds_addr
) {
609 abi_long
*target_fds
;
611 target_fds
= lock_user(VERIFY_READ
,
613 sizeof(*target_fds
)*(n
/ TARGET_ABI_BITS
+ 1),
619 for (i
=n
; i
>=0; i
--) {
620 if ((tswapal(target_fds
[i
/ TARGET_ABI_BITS
]) >>
621 (i
& (TARGET_ABI_BITS
- 1))) & 1) {
622 qemu_log("%s%d", get_comma(first
), i
);
626 unlock_user(target_fds
, target_fds_addr
, 0);
633 * Sysycall specific output functions
637 #ifdef TARGET_NR__newselect
639 print_newselect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
640 abi_long arg1
, abi_long arg2
, abi_long arg3
,
641 abi_long arg4
, abi_long arg5
, abi_long arg6
)
643 print_syscall_prologue(name
);
644 print_fdset(arg1
, arg2
);
646 print_fdset(arg1
, arg3
);
648 print_fdset(arg1
, arg4
);
650 print_timeval(arg5
, 1);
651 print_syscall_epilogue(name
);
655 #ifdef TARGET_NR_semctl
657 print_semctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
658 abi_long arg1
, abi_long arg2
, abi_long arg3
,
659 abi_long arg4
, abi_long arg5
, abi_long arg6
)
661 qemu_log("%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
662 name
->name
, arg1
, arg2
);
664 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
670 print_ipc(CPUArchState
*cpu_env
, const struct syscallname
*name
,
671 abi_long arg1
, abi_long arg2
, abi_long arg3
,
672 abi_long arg4
, abi_long arg5
, abi_long arg6
)
676 qemu_log("semctl(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
679 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
683 TARGET_ABI_FMT_ld
","
684 TARGET_ABI_FMT_ld
","
685 TARGET_ABI_FMT_ld
","
688 name
->name
, arg1
, arg2
, arg3
, arg4
);
694 * Variants for the return value output function
698 print_syscall_err(abi_long ret
)
704 errstr
= target_strerror(-ret
);
706 qemu_log("-1 errno=%d (%s)", (int)-ret
, errstr
);
714 print_syscall_ret_addr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
715 abi_long ret
, abi_long arg0
, abi_long arg1
,
716 abi_long arg2
, abi_long arg3
, abi_long arg4
,
719 if (!print_syscall_err(ret
)) {
720 qemu_log("0x" TARGET_ABI_FMT_lx
, ret
);
725 #if 0 /* currently unused */
727 print_syscall_ret_raw(struct syscallname
*name
, abi_long ret
)
729 qemu_log(" = 0x" TARGET_ABI_FMT_lx
"\n", ret
);
733 #ifdef TARGET_NR__newselect
735 print_syscall_ret_newselect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
736 abi_long ret
, abi_long arg0
, abi_long arg1
,
737 abi_long arg2
, abi_long arg3
, abi_long arg4
,
740 if (!print_syscall_err(ret
)) {
741 qemu_log(" = 0x" TARGET_ABI_FMT_lx
" (", ret
);
742 print_fdset(arg0
, arg1
);
744 print_fdset(arg0
, arg2
);
746 print_fdset(arg0
, arg3
);
748 print_timeval(arg4
, 1);
756 /* special meanings of adjtimex()' non-negative return values */
757 #define TARGET_TIME_OK 0 /* clock synchronized, no leap second */
758 #define TARGET_TIME_INS 1 /* insert leap second */
759 #define TARGET_TIME_DEL 2 /* delete leap second */
760 #define TARGET_TIME_OOP 3 /* leap second in progress */
761 #define TARGET_TIME_WAIT 4 /* leap second has occurred */
762 #define TARGET_TIME_ERROR 5 /* clock not synchronized */
763 #ifdef TARGET_NR_adjtimex
765 print_syscall_ret_adjtimex(CPUArchState
*cpu_env
, const struct syscallname
*name
,
766 abi_long ret
, abi_long arg0
, abi_long arg1
,
767 abi_long arg2
, abi_long arg3
, abi_long arg4
,
770 if (!print_syscall_err(ret
)) {
771 qemu_log(TARGET_ABI_FMT_ld
, ret
);
774 qemu_log(" TIME_OK (clock synchronized, no leap second)");
776 case TARGET_TIME_INS
:
777 qemu_log(" TIME_INS (insert leap second)");
779 case TARGET_TIME_DEL
:
780 qemu_log(" TIME_DEL (delete leap second)");
782 case TARGET_TIME_OOP
:
783 qemu_log(" TIME_OOP (leap second in progress)");
785 case TARGET_TIME_WAIT
:
786 qemu_log(" TIME_WAIT (leap second has occurred)");
788 case TARGET_TIME_ERROR
:
789 qemu_log(" TIME_ERROR (clock not synchronized)");
798 #if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
800 print_syscall_ret_clock_gettime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
801 abi_long ret
, abi_long arg0
, abi_long arg1
,
802 abi_long arg2
, abi_long arg3
, abi_long arg4
,
805 if (!print_syscall_err(ret
)) {
806 qemu_log(TARGET_ABI_FMT_ld
, ret
);
808 print_timespec(arg1
, 1);
814 #define print_syscall_ret_clock_getres print_syscall_ret_clock_gettime
817 #if defined(TARGET_NR_clock_gettime64)
819 print_syscall_ret_clock_gettime64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
820 abi_long ret
, abi_long arg0
, abi_long arg1
,
821 abi_long arg2
, abi_long arg3
, abi_long arg4
,
824 if (!print_syscall_err(ret
)) {
825 qemu_log(TARGET_ABI_FMT_ld
, ret
);
827 print_timespec64(arg1
, 1);
835 #ifdef TARGET_NR_gettimeofday
837 print_syscall_ret_gettimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
838 abi_long ret
, abi_long arg0
, abi_long arg1
,
839 abi_long arg2
, abi_long arg3
, abi_long arg4
,
842 if (!print_syscall_err(ret
)) {
843 qemu_log(TARGET_ABI_FMT_ld
, ret
);
845 print_timeval(arg0
, 0);
846 print_timezone(arg1
, 1);
854 #ifdef TARGET_NR_getitimer
856 print_syscall_ret_getitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
857 abi_long ret
, abi_long arg0
, abi_long arg1
,
858 abi_long arg2
, abi_long arg3
, abi_long arg4
,
861 if (!print_syscall_err(ret
)) {
862 qemu_log(TARGET_ABI_FMT_ld
, ret
);
864 print_itimerval(arg1
, 1);
873 #ifdef TARGET_NR_getitimer
875 print_syscall_ret_setitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
876 abi_long ret
, abi_long arg0
, abi_long arg1
,
877 abi_long arg2
, abi_long arg3
, abi_long arg4
,
880 if (!print_syscall_err(ret
)) {
881 qemu_log(TARGET_ABI_FMT_ld
, ret
);
882 qemu_log(" (old_value = ");
883 print_itimerval(arg2
, 1);
891 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr) \
892 || defined(TARGGET_NR_flistxattr)
894 print_syscall_ret_listxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
895 abi_long ret
, abi_long arg0
, abi_long arg1
,
896 abi_long arg2
, abi_long arg3
, abi_long arg4
,
899 if (!print_syscall_err(ret
)) {
900 qemu_log(TARGET_ABI_FMT_ld
, ret
);
901 qemu_log(" (list = ");
903 abi_long attr
= arg1
;
908 print_string(attr
, 1);
909 ret
-= target_strlen(attr
) + 1;
910 attr
+= target_strlen(attr
) + 1;
920 #define print_syscall_ret_llistxattr print_syscall_ret_listxattr
921 #define print_syscall_ret_flistxattr print_syscall_ret_listxattr
924 #ifdef TARGET_NR_ioctl
926 print_syscall_ret_ioctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
927 abi_long ret
, abi_long arg0
, abi_long arg1
,
928 abi_long arg2
, abi_long arg3
, abi_long arg4
,
931 if (!print_syscall_err(ret
)) {
932 qemu_log(TARGET_ABI_FMT_ld
, ret
);
934 const IOCTLEntry
*ie
;
935 const argtype
*arg_type
;
939 for (ie
= ioctl_entries
; ie
->target_cmd
!= 0; ie
++) {
940 if (ie
->target_cmd
== arg1
) {
945 if (ie
->target_cmd
== arg1
&&
946 (ie
->access
== IOC_R
|| ie
->access
== IOC_RW
)) {
947 arg_type
= ie
->arg_type
;
950 target_size
= thunk_type_size(arg_type
, 0);
951 argptr
= lock_user(VERIFY_READ
, arg2
, target_size
, 1);
953 thunk_print(argptr
, arg_type
);
954 unlock_user(argptr
, arg2
, target_size
);
956 print_pointer(arg2
, 1);
965 UNUSED
static const struct flags access_flags
[] = {
973 UNUSED
static const struct flags at_file_flags
[] = {
975 FLAG_GENERIC(AT_EACCESS
),
977 #ifdef AT_SYMLINK_NOFOLLOW
978 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
983 UNUSED
static const struct flags unlinkat_flags
[] = {
985 FLAG_GENERIC(AT_REMOVEDIR
),
990 UNUSED
static const struct flags mode_flags
[] = {
991 FLAG_GENERIC(S_IFSOCK
),
992 FLAG_GENERIC(S_IFLNK
),
993 FLAG_GENERIC(S_IFREG
),
994 FLAG_GENERIC(S_IFBLK
),
995 FLAG_GENERIC(S_IFDIR
),
996 FLAG_GENERIC(S_IFCHR
),
997 FLAG_GENERIC(S_IFIFO
),
1001 UNUSED
static const struct flags open_access_flags
[] = {
1002 FLAG_TARGET(O_RDONLY
),
1003 FLAG_TARGET(O_WRONLY
),
1004 FLAG_TARGET(O_RDWR
),
1008 UNUSED
static const struct flags open_flags
[] = {
1009 FLAG_TARGET(O_APPEND
),
1010 FLAG_TARGET(O_CREAT
),
1011 FLAG_TARGET(O_DIRECTORY
),
1012 FLAG_TARGET(O_EXCL
),
1013 FLAG_TARGET(O_LARGEFILE
),
1014 FLAG_TARGET(O_NOCTTY
),
1015 FLAG_TARGET(O_NOFOLLOW
),
1016 FLAG_TARGET(O_NONBLOCK
), /* also O_NDELAY */
1017 FLAG_TARGET(O_DSYNC
),
1018 FLAG_TARGET(__O_SYNC
),
1019 FLAG_TARGET(O_TRUNC
),
1021 FLAG_TARGET(O_DIRECT
),
1024 FLAG_TARGET(O_NOATIME
),
1027 FLAG_TARGET(O_CLOEXEC
),
1030 FLAG_TARGET(O_PATH
),
1033 FLAG_TARGET(O_TMPFILE
),
1034 FLAG_TARGET(__O_TMPFILE
),
1039 UNUSED
static const struct flags mount_flags
[] = {
1041 FLAG_GENERIC(MS_BIND
),
1044 FLAG_GENERIC(MS_DIRSYNC
),
1046 FLAG_GENERIC(MS_MANDLOCK
),
1048 FLAG_GENERIC(MS_MOVE
),
1050 FLAG_GENERIC(MS_NOATIME
),
1051 FLAG_GENERIC(MS_NODEV
),
1052 FLAG_GENERIC(MS_NODIRATIME
),
1053 FLAG_GENERIC(MS_NOEXEC
),
1054 FLAG_GENERIC(MS_NOSUID
),
1055 FLAG_GENERIC(MS_RDONLY
),
1057 FLAG_GENERIC(MS_RELATIME
),
1059 FLAG_GENERIC(MS_REMOUNT
),
1060 FLAG_GENERIC(MS_SYNCHRONOUS
),
1064 UNUSED
static const struct flags umount2_flags
[] = {
1066 FLAG_GENERIC(MNT_FORCE
),
1069 FLAG_GENERIC(MNT_DETACH
),
1072 FLAG_GENERIC(MNT_EXPIRE
),
1077 UNUSED
static const struct flags mmap_prot_flags
[] = {
1078 FLAG_GENERIC(PROT_NONE
),
1079 FLAG_GENERIC(PROT_EXEC
),
1080 FLAG_GENERIC(PROT_READ
),
1081 FLAG_GENERIC(PROT_WRITE
),
1082 FLAG_TARGET(PROT_SEM
),
1083 FLAG_GENERIC(PROT_GROWSDOWN
),
1084 FLAG_GENERIC(PROT_GROWSUP
),
1088 UNUSED
static const struct flags mmap_flags
[] = {
1089 FLAG_TARGET(MAP_SHARED
),
1090 FLAG_TARGET(MAP_PRIVATE
),
1091 FLAG_TARGET(MAP_ANONYMOUS
),
1092 FLAG_TARGET(MAP_DENYWRITE
),
1093 FLAG_TARGET(MAP_FIXED
),
1094 FLAG_TARGET(MAP_GROWSDOWN
),
1095 FLAG_TARGET(MAP_EXECUTABLE
),
1097 FLAG_TARGET(MAP_LOCKED
),
1100 FLAG_TARGET(MAP_NONBLOCK
),
1102 FLAG_TARGET(MAP_NORESERVE
),
1104 FLAG_TARGET(MAP_POPULATE
),
1106 #ifdef TARGET_MAP_UNINITIALIZED
1107 FLAG_TARGET(MAP_UNINITIALIZED
),
1109 FLAG_TARGET(MAP_HUGETLB
),
1110 FLAG_TARGET(MAP_STACK
),
1115 # define CLONE_PIDFD 0x00001000
1118 UNUSED
static const struct flags clone_flags
[] = {
1119 FLAG_GENERIC(CLONE_VM
),
1120 FLAG_GENERIC(CLONE_FS
),
1121 FLAG_GENERIC(CLONE_FILES
),
1122 FLAG_GENERIC(CLONE_SIGHAND
),
1123 FLAG_GENERIC(CLONE_PIDFD
),
1124 FLAG_GENERIC(CLONE_PTRACE
),
1125 FLAG_GENERIC(CLONE_VFORK
),
1126 FLAG_GENERIC(CLONE_PARENT
),
1127 FLAG_GENERIC(CLONE_THREAD
),
1128 FLAG_GENERIC(CLONE_NEWNS
),
1129 FLAG_GENERIC(CLONE_SYSVSEM
),
1130 FLAG_GENERIC(CLONE_SETTLS
),
1131 FLAG_GENERIC(CLONE_PARENT_SETTID
),
1132 FLAG_GENERIC(CLONE_CHILD_CLEARTID
),
1133 FLAG_GENERIC(CLONE_DETACHED
),
1134 FLAG_GENERIC(CLONE_UNTRACED
),
1135 FLAG_GENERIC(CLONE_CHILD_SETTID
),
1136 #if defined(CLONE_NEWUTS)
1137 FLAG_GENERIC(CLONE_NEWUTS
),
1139 #if defined(CLONE_NEWIPC)
1140 FLAG_GENERIC(CLONE_NEWIPC
),
1142 #if defined(CLONE_NEWUSER)
1143 FLAG_GENERIC(CLONE_NEWUSER
),
1145 #if defined(CLONE_NEWPID)
1146 FLAG_GENERIC(CLONE_NEWPID
),
1148 #if defined(CLONE_NEWNET)
1149 FLAG_GENERIC(CLONE_NEWNET
),
1151 #if defined(CLONE_NEWCGROUP)
1152 FLAG_GENERIC(CLONE_NEWCGROUP
),
1154 #if defined(CLONE_NEWTIME)
1155 FLAG_GENERIC(CLONE_NEWTIME
),
1157 #if defined(CLONE_IO)
1158 FLAG_GENERIC(CLONE_IO
),
1163 UNUSED
static const struct flags execveat_flags
[] = {
1164 #ifdef AT_EMPTY_PATH
1165 FLAG_GENERIC(AT_EMPTY_PATH
),
1167 #ifdef AT_SYMLINK_NOFOLLOW
1168 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
1173 UNUSED
static const struct flags msg_flags
[] = {
1175 FLAG_GENERIC(MSG_CONFIRM
),
1176 FLAG_GENERIC(MSG_DONTROUTE
),
1177 FLAG_GENERIC(MSG_DONTWAIT
),
1178 FLAG_GENERIC(MSG_EOR
),
1179 FLAG_GENERIC(MSG_MORE
),
1180 FLAG_GENERIC(MSG_NOSIGNAL
),
1181 FLAG_GENERIC(MSG_OOB
),
1183 FLAG_GENERIC(MSG_CMSG_CLOEXEC
),
1184 FLAG_GENERIC(MSG_ERRQUEUE
),
1185 FLAG_GENERIC(MSG_PEEK
),
1186 FLAG_GENERIC(MSG_TRUNC
),
1187 FLAG_GENERIC(MSG_WAITALL
),
1189 FLAG_GENERIC(MSG_CTRUNC
),
1193 UNUSED
static const struct flags statx_flags
[] = {
1194 #ifdef AT_EMPTY_PATH
1195 FLAG_GENERIC(AT_EMPTY_PATH
),
1197 #ifdef AT_NO_AUTOMOUNT
1198 FLAG_GENERIC(AT_NO_AUTOMOUNT
),
1200 #ifdef AT_SYMLINK_NOFOLLOW
1201 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
1203 #ifdef AT_STATX_SYNC_AS_STAT
1204 FLAG_GENERIC(AT_STATX_SYNC_AS_STAT
),
1206 #ifdef AT_STATX_FORCE_SYNC
1207 FLAG_GENERIC(AT_STATX_FORCE_SYNC
),
1209 #ifdef AT_STATX_DONT_SYNC
1210 FLAG_GENERIC(AT_STATX_DONT_SYNC
),
1215 UNUSED
static const struct flags statx_mask
[] = {
1216 /* This must come first, because it includes everything. */
1218 FLAG_GENERIC(STATX_ALL
),
1220 /* This must come second; it includes everything except STATX_BTIME. */
1221 #ifdef STATX_BASIC_STATS
1222 FLAG_GENERIC(STATX_BASIC_STATS
),
1225 FLAG_GENERIC(STATX_TYPE
),
1228 FLAG_GENERIC(STATX_MODE
),
1231 FLAG_GENERIC(STATX_NLINK
),
1234 FLAG_GENERIC(STATX_UID
),
1237 FLAG_GENERIC(STATX_GID
),
1240 FLAG_GENERIC(STATX_ATIME
),
1243 FLAG_GENERIC(STATX_MTIME
),
1246 FLAG_GENERIC(STATX_CTIME
),
1249 FLAG_GENERIC(STATX_INO
),
1252 FLAG_GENERIC(STATX_SIZE
),
1255 FLAG_GENERIC(STATX_BLOCKS
),
1258 FLAG_GENERIC(STATX_BTIME
),
1263 UNUSED
static const struct flags falloc_flags
[] = {
1264 FLAG_GENERIC(FALLOC_FL_KEEP_SIZE
),
1265 FLAG_GENERIC(FALLOC_FL_PUNCH_HOLE
),
1266 #ifdef FALLOC_FL_NO_HIDE_STALE
1267 FLAG_GENERIC(FALLOC_FL_NO_HIDE_STALE
),
1269 #ifdef FALLOC_FL_COLLAPSE_RANGE
1270 FLAG_GENERIC(FALLOC_FL_COLLAPSE_RANGE
),
1272 #ifdef FALLOC_FL_ZERO_RANGE
1273 FLAG_GENERIC(FALLOC_FL_ZERO_RANGE
),
1275 #ifdef FALLOC_FL_INSERT_RANGE
1276 FLAG_GENERIC(FALLOC_FL_INSERT_RANGE
),
1278 #ifdef FALLOC_FL_UNSHARE_RANGE
1279 FLAG_GENERIC(FALLOC_FL_UNSHARE_RANGE
),
1283 UNUSED
static const struct flags termios_iflags
[] = {
1284 FLAG_TARGET(IGNBRK
),
1285 FLAG_TARGET(BRKINT
),
1286 FLAG_TARGET(IGNPAR
),
1287 FLAG_TARGET(PARMRK
),
1289 FLAG_TARGET(ISTRIP
),
1297 FLAG_TARGET(IMAXBEL
),
1302 UNUSED
static const struct flags termios_oflags
[] = {
1308 FLAG_TARGET(ONLRET
),
1314 UNUSED
static struct enums termios_oflags_NLDLY
[] = {
1320 UNUSED
static struct enums termios_oflags_CRDLY
[] = {
1328 UNUSED
static struct enums termios_oflags_TABDLY
[] = {
1336 UNUSED
static struct enums termios_oflags_VTDLY
[] = {
1342 UNUSED
static struct enums termios_oflags_FFDLY
[] = {
1348 UNUSED
static struct enums termios_oflags_BSDLY
[] = {
1354 UNUSED
static struct enums termios_cflags_CBAUD
[] = {
1369 ENUM_TARGET(B19200
),
1370 ENUM_TARGET(B38400
),
1371 ENUM_TARGET(B57600
),
1372 ENUM_TARGET(B115200
),
1373 ENUM_TARGET(B230400
),
1374 ENUM_TARGET(B460800
),
1378 UNUSED
static struct enums termios_cflags_CSIZE
[] = {
1386 UNUSED
static const struct flags termios_cflags
[] = {
1387 FLAG_TARGET(CSTOPB
),
1389 FLAG_TARGET(PARENB
),
1390 FLAG_TARGET(PARODD
),
1392 FLAG_TARGET(CLOCAL
),
1393 FLAG_TARGET(CRTSCTS
),
1397 UNUSED
static const struct flags termios_lflags
[] = {
1399 FLAG_TARGET(ICANON
),
1404 FLAG_TARGET(ECHONL
),
1405 FLAG_TARGET(NOFLSH
),
1406 FLAG_TARGET(TOSTOP
),
1407 FLAG_TARGET(ECHOCTL
),
1408 FLAG_TARGET(ECHOPRT
),
1409 FLAG_TARGET(ECHOKE
),
1410 FLAG_TARGET(FLUSHO
),
1411 FLAG_TARGET(PENDIN
),
1412 FLAG_TARGET(IEXTEN
),
1413 FLAG_TARGET(EXTPROC
),
1417 #ifdef TARGET_NR_mlockall
1418 static const struct flags mlockall_flags
[] = {
1419 FLAG_TARGET(MCL_CURRENT
),
1420 FLAG_TARGET(MCL_FUTURE
),
1422 FLAG_TARGET(MCL_ONFAULT
),
1428 /* IDs of the various system clocks */
1429 #define TARGET_CLOCK_REALTIME 0
1430 #define TARGET_CLOCK_MONOTONIC 1
1431 #define TARGET_CLOCK_PROCESS_CPUTIME_ID 2
1432 #define TARGET_CLOCK_THREAD_CPUTIME_ID 3
1433 #define TARGET_CLOCK_MONOTONIC_RAW 4
1434 #define TARGET_CLOCK_REALTIME_COARSE 5
1435 #define TARGET_CLOCK_MONOTONIC_COARSE 6
1436 #define TARGET_CLOCK_BOOTTIME 7
1437 #define TARGET_CLOCK_REALTIME_ALARM 8
1438 #define TARGET_CLOCK_BOOTTIME_ALARM 9
1439 #define TARGET_CLOCK_SGI_CYCLE 10
1440 #define TARGET_CLOCK_TAI 11
1442 UNUSED
static struct enums clockids
[] = {
1443 ENUM_TARGET(CLOCK_REALTIME
),
1444 ENUM_TARGET(CLOCK_MONOTONIC
),
1445 ENUM_TARGET(CLOCK_PROCESS_CPUTIME_ID
),
1446 ENUM_TARGET(CLOCK_THREAD_CPUTIME_ID
),
1447 ENUM_TARGET(CLOCK_MONOTONIC_RAW
),
1448 ENUM_TARGET(CLOCK_REALTIME_COARSE
),
1449 ENUM_TARGET(CLOCK_MONOTONIC_COARSE
),
1450 ENUM_TARGET(CLOCK_BOOTTIME
),
1451 ENUM_TARGET(CLOCK_REALTIME_ALARM
),
1452 ENUM_TARGET(CLOCK_BOOTTIME_ALARM
),
1453 ENUM_TARGET(CLOCK_SGI_CYCLE
),
1454 ENUM_TARGET(CLOCK_TAI
),
1458 UNUSED
static struct enums itimer_types
[] = {
1459 ENUM_GENERIC(ITIMER_REAL
),
1460 ENUM_GENERIC(ITIMER_VIRTUAL
),
1461 ENUM_GENERIC(ITIMER_PROF
),
1466 * print_xxx utility functions. These are used to print syscall
1467 * parameters in certain format. All of these have parameter
1468 * named 'last'. This parameter is used to add comma to output
1475 return ((last
) ? "" : ",");
1479 print_flags(const struct flags
*f
, abi_long flags
, int last
)
1481 const char *sep
= "";
1484 if ((flags
== 0) && (f
->f_value
== 0)) {
1485 qemu_log("%s%s", f
->f_string
, get_comma(last
));
1488 for (n
= 0; f
->f_string
!= NULL
; f
++) {
1489 if ((f
->f_value
!= 0) && ((flags
& f
->f_value
) == f
->f_value
)) {
1490 qemu_log("%s%s", sep
, f
->f_string
);
1491 flags
&= ~f
->f_value
;
1498 /* print rest of the flags as numeric */
1500 qemu_log("%s%#x%s", sep
, (unsigned int)flags
, get_comma(last
));
1502 qemu_log("%s", get_comma(last
));
1505 /* no string version of flags found, print them in hex then */
1506 qemu_log("%#x%s", (unsigned int)flags
, get_comma(last
));
1511 print_enums(const struct enums
*e
, abi_long enum_arg
, int last
)
1513 for (; e
->e_string
!= NULL
; e
++) {
1514 if (e
->e_value
== enum_arg
) {
1515 qemu_log("%s", e
->e_string
);
1520 if (e
->e_string
== NULL
) {
1521 qemu_log("%#x", (unsigned int)enum_arg
);
1524 qemu_log("%s", get_comma(last
));
1528 print_at_dirfd(abi_long dirfd
, int last
)
1531 if (dirfd
== AT_FDCWD
) {
1532 qemu_log("AT_FDCWD%s", get_comma(last
));
1536 qemu_log("%d%s", (int)dirfd
, get_comma(last
));
1540 print_file_mode(abi_long mode
, int last
)
1542 const char *sep
= "";
1543 const struct flags
*m
;
1546 qemu_log("000%s", get_comma(last
));
1550 for (m
= &mode_flags
[0]; m
->f_string
!= NULL
; m
++) {
1551 if ((m
->f_value
& mode
) == m
->f_value
) {
1552 qemu_log("%s%s", m
->f_string
, sep
);
1554 mode
&= ~m
->f_value
;
1560 /* print rest of the mode as octal */
1562 qemu_log("%s%#o", sep
, (unsigned int)mode
);
1564 qemu_log("%s", get_comma(last
));
1568 print_open_flags(abi_long flags
, int last
)
1570 print_flags(open_access_flags
, flags
& TARGET_O_ACCMODE
, 1);
1571 flags
&= ~TARGET_O_ACCMODE
;
1573 qemu_log("%s", get_comma(last
));
1577 print_flags(open_flags
, flags
, last
);
1581 print_syscall_prologue(const struct syscallname
*sc
)
1583 qemu_log("%s(", sc
->name
);
1588 print_syscall_epilogue(const struct syscallname
*sc
)
1595 print_string(abi_long addr
, int last
)
1599 if ((s
= lock_user_string(addr
)) != NULL
) {
1600 qemu_log("\"%s\"%s", s
, get_comma(last
));
1601 unlock_user(s
, addr
, 0);
1603 /* can't get string out of it, so print it as pointer */
1604 print_pointer(addr
, last
);
1608 #define MAX_PRINT_BUF 40
1610 print_buf(abi_long addr
, abi_long len
, int last
)
1615 s
= lock_user(VERIFY_READ
, addr
, len
, 1);
1618 for (i
= 0; i
< MAX_PRINT_BUF
&& i
< len
; i
++) {
1619 if (isprint(s
[i
])) {
1620 qemu_log("%c", s
[i
]);
1622 qemu_log("\\%o", s
[i
]);
1632 unlock_user(s
, addr
, 0);
1634 print_pointer(addr
, last
);
1639 * Prints out raw parameter using given format. Caller needs
1640 * to do byte swapping if needed.
1643 print_raw_param(const char *fmt
, abi_long param
, int last
)
1647 (void) snprintf(format
, sizeof (format
), "%s%s", fmt
, get_comma(last
));
1648 qemu_log(format
, param
);
1652 * Same as print_raw_param() but prints out raw 64-bit parameter.
1655 print_raw_param64(const char *fmt
, long long param
, int last
)
1659 (void)snprintf(format
, sizeof(format
), "%s%s", fmt
, get_comma(last
));
1660 qemu_log(format
, param
);
1665 print_pointer(abi_long p
, int last
)
1668 qemu_log("NULL%s", get_comma(last
));
1670 qemu_log("0x" TARGET_ABI_FMT_lx
"%s", p
, get_comma(last
));
1674 * Reads 32-bit (int) number from guest address space from
1675 * address 'addr' and prints it.
1678 print_number(abi_long addr
, int last
)
1681 qemu_log("NULL%s", get_comma(last
));
1685 get_user_s32(num
, addr
);
1686 qemu_log("[%d]%s", num
, get_comma(last
));
1691 print_timeval(abi_ulong tv_addr
, int last
)
1694 struct target_timeval
*tv
;
1696 tv
= lock_user(VERIFY_READ
, tv_addr
, sizeof(*tv
), 1);
1698 print_pointer(tv_addr
, last
);
1701 qemu_log("{tv_sec = " TARGET_ABI_FMT_ld
1702 ",tv_usec = " TARGET_ABI_FMT_ld
"}%s",
1703 tswapal(tv
->tv_sec
), tswapal(tv
->tv_usec
), get_comma(last
));
1704 unlock_user(tv
, tv_addr
, 0);
1706 qemu_log("NULL%s", get_comma(last
));
1710 print_timespec(abi_ulong ts_addr
, int last
)
1713 struct target_timespec
*ts
;
1715 ts
= lock_user(VERIFY_READ
, ts_addr
, sizeof(*ts
), 1);
1717 print_pointer(ts_addr
, last
);
1720 qemu_log("{tv_sec = " TARGET_ABI_FMT_ld
1721 ",tv_nsec = " TARGET_ABI_FMT_ld
"}%s",
1722 tswapal(ts
->tv_sec
), tswapal(ts
->tv_nsec
), get_comma(last
));
1723 unlock_user(ts
, ts_addr
, 0);
1725 qemu_log("NULL%s", get_comma(last
));
1730 print_timespec64(abi_ulong ts_addr
, int last
)
1733 struct target__kernel_timespec
*ts
;
1735 ts
= lock_user(VERIFY_READ
, ts_addr
, sizeof(*ts
), 1);
1737 print_pointer(ts_addr
, last
);
1740 print_raw_param64("{tv_sec=%" PRId64
, tswap64(ts
->tv_sec
), 0);
1741 print_raw_param64("tv_nsec=%" PRId64
"}", tswap64(ts
->tv_nsec
), last
);
1742 unlock_user(ts
, ts_addr
, 0);
1744 qemu_log("NULL%s", get_comma(last
));
1749 print_timezone(abi_ulong tz_addr
, int last
)
1752 struct target_timezone
*tz
;
1754 tz
= lock_user(VERIFY_READ
, tz_addr
, sizeof(*tz
), 1);
1756 print_pointer(tz_addr
, last
);
1759 qemu_log("{%d,%d}%s", tswap32(tz
->tz_minuteswest
),
1760 tswap32(tz
->tz_dsttime
), get_comma(last
));
1761 unlock_user(tz
, tz_addr
, 0);
1763 qemu_log("NULL%s", get_comma(last
));
1768 print_itimerval(abi_ulong it_addr
, int last
)
1771 qemu_log("{it_interval=");
1772 print_timeval(it_addr
+
1773 offsetof(struct target_itimerval
, it_interval
), 0);
1774 qemu_log("it_value=");
1775 print_timeval(it_addr
+
1776 offsetof(struct target_itimerval
, it_value
), 0);
1777 qemu_log("}%s", get_comma(last
));
1779 qemu_log("NULL%s", get_comma(last
));
1784 print_termios(void *arg
)
1786 const struct target_termios
*target
= arg
;
1788 target_tcflag_t iflags
= tswap32(target
->c_iflag
);
1789 target_tcflag_t oflags
= tswap32(target
->c_oflag
);
1790 target_tcflag_t cflags
= tswap32(target
->c_cflag
);
1791 target_tcflag_t lflags
= tswap32(target
->c_lflag
);
1795 qemu_log("c_iflag = ");
1796 print_flags(termios_iflags
, iflags
, 0);
1798 qemu_log("c_oflag = ");
1799 target_tcflag_t oflags_clean
= oflags
& ~(TARGET_NLDLY
| TARGET_CRDLY
|
1800 TARGET_TABDLY
| TARGET_BSDLY
|
1801 TARGET_VTDLY
| TARGET_FFDLY
);
1802 print_flags(termios_oflags
, oflags_clean
, 0);
1803 if (oflags
& TARGET_NLDLY
) {
1804 print_enums(termios_oflags_NLDLY
, oflags
& TARGET_NLDLY
, 0);
1806 if (oflags
& TARGET_CRDLY
) {
1807 print_enums(termios_oflags_CRDLY
, oflags
& TARGET_CRDLY
, 0);
1809 if (oflags
& TARGET_TABDLY
) {
1810 print_enums(termios_oflags_TABDLY
, oflags
& TARGET_TABDLY
, 0);
1812 if (oflags
& TARGET_BSDLY
) {
1813 print_enums(termios_oflags_BSDLY
, oflags
& TARGET_BSDLY
, 0);
1815 if (oflags
& TARGET_VTDLY
) {
1816 print_enums(termios_oflags_VTDLY
, oflags
& TARGET_VTDLY
, 0);
1818 if (oflags
& TARGET_FFDLY
) {
1819 print_enums(termios_oflags_FFDLY
, oflags
& TARGET_FFDLY
, 0);
1822 qemu_log("c_cflag = ");
1823 if (cflags
& TARGET_CBAUD
) {
1824 print_enums(termios_cflags_CBAUD
, cflags
& TARGET_CBAUD
, 0);
1826 if (cflags
& TARGET_CSIZE
) {
1827 print_enums(termios_cflags_CSIZE
, cflags
& TARGET_CSIZE
, 0);
1829 target_tcflag_t cflags_clean
= cflags
& ~(TARGET_CBAUD
| TARGET_CSIZE
);
1830 print_flags(termios_cflags
, cflags_clean
, 0);
1832 qemu_log("c_lflag = ");
1833 print_flags(termios_lflags
, lflags
, 0);
1835 qemu_log("c_cc = ");
1836 qemu_log("\"%s\",", target
->c_cc
);
1838 qemu_log("c_line = ");
1839 print_raw_param("\'%c\'", target
->c_line
, 1);
1846 #ifdef TARGET_NR_accept
1848 print_accept(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1849 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1850 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1852 print_syscall_prologue(name
);
1853 print_raw_param("%d", arg0
, 0);
1854 print_pointer(arg1
, 0);
1855 print_number(arg2
, 1);
1856 print_syscall_epilogue(name
);
1860 #ifdef TARGET_NR_access
1862 print_access(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1863 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1864 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1866 print_syscall_prologue(name
);
1867 print_string(arg0
, 0);
1868 print_flags(access_flags
, arg1
, 1);
1869 print_syscall_epilogue(name
);
1873 #ifdef TARGET_NR_acct
1875 print_acct(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1876 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1877 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1879 print_syscall_prologue(name
);
1880 print_string(arg0
, 1);
1881 print_syscall_epilogue(name
);
1885 #ifdef TARGET_NR_brk
1887 print_brk(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1888 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1889 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1891 print_syscall_prologue(name
);
1892 print_pointer(arg0
, 1);
1893 print_syscall_epilogue(name
);
1897 #ifdef TARGET_NR_chdir
1899 print_chdir(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1900 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1901 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1903 print_syscall_prologue(name
);
1904 print_string(arg0
, 1);
1905 print_syscall_epilogue(name
);
1909 #ifdef TARGET_NR_chroot
1911 print_chroot(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1912 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1913 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1915 print_syscall_prologue(name
);
1916 print_string(arg0
, 1);
1917 print_syscall_epilogue(name
);
1921 #ifdef TARGET_NR_chmod
1923 print_chmod(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1924 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1925 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1927 print_syscall_prologue(name
);
1928 print_string(arg0
, 0);
1929 print_file_mode(arg1
, 1);
1930 print_syscall_epilogue(name
);
1934 #if defined(TARGET_NR_chown) || defined(TARGET_NR_lchown)
1936 print_chown(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1937 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1938 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1940 print_syscall_prologue(name
);
1941 print_string(arg0
, 0);
1942 print_raw_param("%d", arg1
, 0);
1943 print_raw_param("%d", arg2
, 1);
1944 print_syscall_epilogue(name
);
1946 #define print_lchown print_chown
1949 #ifdef TARGET_NR_clock_adjtime
1951 print_clock_adjtime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1952 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1953 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1955 print_syscall_prologue(name
);
1956 print_enums(clockids
, arg0
, 0);
1957 print_pointer(arg1
, 1);
1958 print_syscall_epilogue(name
);
1962 #ifdef TARGET_NR_clone
1963 static void do_print_clone(unsigned int flags
, abi_ulong newsp
,
1964 abi_ulong parent_tidptr
, target_ulong newtls
,
1965 abi_ulong child_tidptr
)
1967 print_flags(clone_flags
, flags
, 0);
1968 print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx
, newsp
, 0);
1969 print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx
, parent_tidptr
, 0);
1970 print_raw_param("tls=0x" TARGET_ABI_FMT_lx
, newtls
, 0);
1971 print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx
, child_tidptr
, 1);
1975 print_clone(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1976 abi_long arg1
, abi_long arg2
, abi_long arg3
,
1977 abi_long arg4
, abi_long arg5
, abi_long arg6
)
1979 print_syscall_prologue(name
);
1980 #if defined(TARGET_MICROBLAZE)
1981 do_print_clone(arg1
, arg2
, arg4
, arg6
, arg5
);
1982 #elif defined(TARGET_CLONE_BACKWARDS)
1983 do_print_clone(arg1
, arg2
, arg3
, arg4
, arg5
);
1984 #elif defined(TARGET_CLONE_BACKWARDS2)
1985 do_print_clone(arg2
, arg1
, arg3
, arg5
, arg4
);
1987 do_print_clone(arg1
, arg2
, arg3
, arg5
, arg4
);
1989 print_syscall_epilogue(name
);
1993 #ifdef TARGET_NR_creat
1995 print_creat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1996 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1997 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1999 print_syscall_prologue(name
);
2000 print_string(arg0
, 0);
2001 print_file_mode(arg1
, 1);
2002 print_syscall_epilogue(name
);
2006 #ifdef TARGET_NR_execv
2008 print_execv(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2009 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2010 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2012 print_syscall_prologue(name
);
2013 print_string(arg0
, 0);
2014 print_raw_param("0x" TARGET_ABI_FMT_lx
, arg1
, 1);
2015 print_syscall_epilogue(name
);
2020 print_execve_argv(abi_long argv
, int last
)
2022 abi_ulong arg_ptr_addr
;
2026 for (arg_ptr_addr
= argv
; ; arg_ptr_addr
+= sizeof(abi_ulong
)) {
2027 abi_ulong
*arg_ptr
, arg_addr
;
2029 arg_ptr
= lock_user(VERIFY_READ
, arg_ptr_addr
, sizeof(abi_ulong
), 1);
2033 arg_addr
= tswapal(*arg_ptr
);
2034 unlock_user(arg_ptr
, arg_ptr_addr
, 0);
2038 s
= lock_user_string(arg_addr
);
2040 qemu_log("\"%s\",", s
);
2041 unlock_user(s
, arg_addr
, 0);
2044 qemu_log("NULL}%s", get_comma(last
));
2048 print_execve(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2049 abi_long arg1
, abi_long arg2
, abi_long arg3
,
2050 abi_long arg4
, abi_long arg5
, abi_long arg6
)
2052 print_syscall_prologue(name
);
2053 print_string(arg1
, 0);
2054 print_execve_argv(arg2
, 1);
2055 print_syscall_epilogue(name
);
2059 print_execveat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2060 abi_long arg1
, abi_long arg2
, abi_long arg3
,
2061 abi_long arg4
, abi_long arg5
, abi_long arg6
)
2063 print_syscall_prologue(name
);
2064 print_at_dirfd(arg1
, 0);
2065 print_string(arg2
, 0);
2066 print_execve_argv(arg3
, 0);
2067 print_flags(execveat_flags
, arg5
, 1);
2068 print_syscall_epilogue(name
);
2071 #if defined(TARGET_NR_faccessat) || defined(TARGET_NR_faccessat2)
2073 print_faccessat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2074 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2075 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2077 print_syscall_prologue(name
);
2078 print_at_dirfd(arg0
, 0);
2079 print_string(arg1
, 0);
2080 print_flags(access_flags
, arg2
, 0);
2081 print_flags(at_file_flags
, arg3
, 1);
2082 print_syscall_epilogue(name
);
2086 #ifdef TARGET_NR_fallocate
2088 print_fallocate(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2089 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2090 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2092 print_syscall_prologue(name
);
2093 print_raw_param("%d", arg0
, 0);
2094 print_flags(falloc_flags
, arg1
, 0);
2095 #if TARGET_ABI_BITS == 32
2096 print_raw_param("%" PRIu64
, target_offset64(arg2
, arg3
), 0);
2097 print_raw_param("%" PRIu64
, target_offset64(arg4
, arg5
), 1);
2099 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2100 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 1);
2102 print_syscall_epilogue(name
);
2106 #ifdef TARGET_NR_fchmodat
2108 print_fchmodat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2109 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2110 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2112 print_syscall_prologue(name
);
2113 print_at_dirfd(arg0
, 0);
2114 print_string(arg1
, 0);
2115 print_file_mode(arg2
, 0);
2116 print_flags(at_file_flags
, arg3
, 1);
2117 print_syscall_epilogue(name
);
2121 #ifdef TARGET_NR_fchownat
2123 print_fchownat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2124 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2125 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2127 print_syscall_prologue(name
);
2128 print_at_dirfd(arg0
, 0);
2129 print_string(arg1
, 0);
2130 print_raw_param("%d", arg2
, 0);
2131 print_raw_param("%d", arg3
, 0);
2132 print_flags(at_file_flags
, arg4
, 1);
2133 print_syscall_epilogue(name
);
2137 #if defined(TARGET_NR_fcntl) || defined(TARGET_NR_fcntl64)
2139 print_fcntl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2140 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2141 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2143 print_syscall_prologue(name
);
2144 print_raw_param("%d", arg0
, 0);
2146 case TARGET_F_DUPFD
:
2147 qemu_log("F_DUPFD,");
2148 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2150 case TARGET_F_GETFD
:
2151 qemu_log("F_GETFD");
2153 case TARGET_F_SETFD
:
2154 qemu_log("F_SETFD,");
2155 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2157 case TARGET_F_GETFL
:
2158 qemu_log("F_GETFL");
2160 case TARGET_F_SETFL
:
2161 qemu_log("F_SETFL,");
2162 print_open_flags(arg2
, 1);
2164 case TARGET_F_GETLK
:
2165 qemu_log("F_GETLK,");
2166 print_pointer(arg2
, 1);
2168 case TARGET_F_SETLK
:
2169 qemu_log("F_SETLK,");
2170 print_pointer(arg2
, 1);
2172 case TARGET_F_SETLKW
:
2173 qemu_log("F_SETLKW,");
2174 print_pointer(arg2
, 1);
2176 case TARGET_F_GETOWN
:
2177 qemu_log("F_GETOWN");
2179 case TARGET_F_SETOWN
:
2180 qemu_log("F_SETOWN,");
2181 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2183 case TARGET_F_GETSIG
:
2184 qemu_log("F_GETSIG");
2186 case TARGET_F_SETSIG
:
2187 qemu_log("F_SETSIG,");
2188 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2190 #if TARGET_ABI_BITS == 32
2191 case TARGET_F_GETLK64
:
2192 qemu_log("F_GETLK64,");
2193 print_pointer(arg2
, 1);
2195 case TARGET_F_SETLK64
:
2196 qemu_log("F_SETLK64,");
2197 print_pointer(arg2
, 1);
2199 case TARGET_F_SETLKW64
:
2200 qemu_log("F_SETLKW64,");
2201 print_pointer(arg2
, 1);
2204 case TARGET_F_OFD_GETLK
:
2205 qemu_log("F_OFD_GETLK,");
2206 print_pointer(arg2
, 1);
2208 case TARGET_F_OFD_SETLK
:
2209 qemu_log("F_OFD_SETLK,");
2210 print_pointer(arg2
, 1);
2212 case TARGET_F_OFD_SETLKW
:
2213 qemu_log("F_OFD_SETLKW,");
2214 print_pointer(arg2
, 1);
2216 case TARGET_F_SETLEASE
:
2217 qemu_log("F_SETLEASE,");
2218 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2220 case TARGET_F_GETLEASE
:
2221 qemu_log("F_GETLEASE");
2223 #ifdef F_DUPFD_CLOEXEC
2224 case TARGET_F_DUPFD_CLOEXEC
:
2225 qemu_log("F_DUPFD_CLOEXEC,");
2226 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2229 case TARGET_F_NOTIFY
:
2230 qemu_log("F_NOTIFY,");
2231 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2234 case TARGET_F_GETOWN_EX
:
2235 qemu_log("F_GETOWN_EX,");
2236 print_pointer(arg2
, 1);
2240 case TARGET_F_SETOWN_EX
:
2241 qemu_log("F_SETOWN_EX,");
2242 print_pointer(arg2
, 1);
2246 case TARGET_F_SETPIPE_SZ
:
2247 qemu_log("F_SETPIPE_SZ,");
2248 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2250 case TARGET_F_GETPIPE_SZ
:
2251 qemu_log("F_GETPIPE_SZ");
2255 case TARGET_F_ADD_SEALS
:
2256 qemu_log("F_ADD_SEALS,");
2257 print_raw_param("0x"TARGET_ABI_FMT_lx
, arg2
, 1);
2259 case TARGET_F_GET_SEALS
:
2260 qemu_log("F_GET_SEALS");
2264 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2265 print_pointer(arg2
, 1);
2268 print_syscall_epilogue(name
);
2270 #define print_fcntl64 print_fcntl
2273 #ifdef TARGET_NR_fgetxattr
2275 print_fgetxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2276 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2277 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2279 print_syscall_prologue(name
);
2280 print_raw_param("%d", arg0
, 0);
2281 print_string(arg1
, 0);
2282 print_pointer(arg2
, 0);
2283 print_raw_param(TARGET_FMT_lu
, arg3
, 1);
2284 print_syscall_epilogue(name
);
2288 #ifdef TARGET_NR_flistxattr
2290 print_flistxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2291 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2292 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2294 print_syscall_prologue(name
);
2295 print_raw_param("%d", arg0
, 0);
2296 print_pointer(arg1
, 0);
2297 print_raw_param(TARGET_FMT_lu
, arg2
, 1);
2298 print_syscall_epilogue(name
);
2302 #if defined(TARGET_NR_getxattr) || defined(TARGET_NR_lgetxattr)
2304 print_getxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2305 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2306 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2308 print_syscall_prologue(name
);
2309 print_string(arg0
, 0);
2310 print_string(arg1
, 0);
2311 print_pointer(arg2
, 0);
2312 print_raw_param(TARGET_FMT_lu
, arg3
, 1);
2313 print_syscall_epilogue(name
);
2315 #define print_lgetxattr print_getxattr
2318 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr)
2320 print_listxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2321 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2322 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2324 print_syscall_prologue(name
);
2325 print_string(arg0
, 0);
2326 print_pointer(arg1
, 0);
2327 print_raw_param(TARGET_FMT_lu
, arg2
, 1);
2328 print_syscall_epilogue(name
);
2330 #define print_llistxattr print_listxattr
2333 #if defined(TARGET_NR_fremovexattr)
2335 print_fremovexattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2336 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2337 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2339 print_syscall_prologue(name
);
2340 print_raw_param("%d", arg0
, 0);
2341 print_string(arg1
, 1);
2342 print_syscall_epilogue(name
);
2346 #if defined(TARGET_NR_removexattr) || defined(TARGET_NR_lremovexattr)
2348 print_removexattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2349 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2350 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2352 print_syscall_prologue(name
);
2353 print_string(arg0
, 0);
2354 print_string(arg1
, 1);
2355 print_syscall_epilogue(name
);
2357 #define print_lremovexattr print_removexattr
2360 #ifdef TARGET_NR_futimesat
2362 print_futimesat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2363 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2364 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2366 print_syscall_prologue(name
);
2367 print_at_dirfd(arg0
, 0);
2368 print_string(arg1
, 0);
2369 print_timeval(arg2
, 0);
2370 print_timeval(arg2
+ sizeof (struct target_timeval
), 1);
2371 print_syscall_epilogue(name
);
2375 #ifdef TARGET_NR_gettimeofday
2377 print_gettimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2378 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2379 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2381 print_syscall_prologue(name
);
2382 print_pointer(arg0
, 0);
2383 print_pointer(arg1
, 1);
2384 print_syscall_epilogue(name
);
2388 #ifdef TARGET_NR_settimeofday
2390 print_settimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2391 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2392 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2394 print_syscall_prologue(name
);
2395 print_timeval(arg0
, 0);
2396 print_timezone(arg1
, 1);
2397 print_syscall_epilogue(name
);
2401 #if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
2403 print_clock_gettime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2404 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2405 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2407 print_syscall_prologue(name
);
2408 print_enums(clockids
, arg0
, 0);
2409 print_pointer(arg1
, 1);
2410 print_syscall_epilogue(name
);
2412 #define print_clock_getres print_clock_gettime
2415 #if defined(TARGET_NR_clock_gettime64)
2417 print_clock_gettime64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2418 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2419 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2421 print_syscall_prologue(name
);
2422 print_enums(clockids
, arg0
, 0);
2423 print_pointer(arg1
, 1);
2424 print_syscall_epilogue(name
);
2428 #ifdef TARGET_NR_clock_settime
2430 print_clock_settime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2431 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2432 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2434 print_syscall_prologue(name
);
2435 print_enums(clockids
, arg0
, 0);
2436 print_timespec(arg1
, 1);
2437 print_syscall_epilogue(name
);
2441 #ifdef TARGET_NR_getitimer
2443 print_getitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2444 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2445 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2447 print_syscall_prologue(name
);
2448 print_enums(itimer_types
, arg0
, 0);
2449 print_pointer(arg1
, 1);
2450 print_syscall_epilogue(name
);
2454 #ifdef TARGET_NR_setitimer
2456 print_setitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2457 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2458 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2460 print_syscall_prologue(name
);
2461 print_enums(itimer_types
, arg0
, 0);
2462 print_itimerval(arg1
, 0);
2463 print_pointer(arg2
, 1);
2464 print_syscall_epilogue(name
);
2468 #ifdef TARGET_NR_link
2470 print_link(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2471 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2472 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2474 print_syscall_prologue(name
);
2475 print_string(arg0
, 0);
2476 print_string(arg1
, 1);
2477 print_syscall_epilogue(name
);
2481 #ifdef TARGET_NR_linkat
2483 print_linkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2484 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2485 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2487 print_syscall_prologue(name
);
2488 print_at_dirfd(arg0
, 0);
2489 print_string(arg1
, 0);
2490 print_at_dirfd(arg2
, 0);
2491 print_string(arg3
, 0);
2492 print_flags(at_file_flags
, arg4
, 1);
2493 print_syscall_epilogue(name
);
2497 #if defined(TARGET_NR__llseek) || defined(TARGET_NR_llseek)
2499 print__llseek(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2500 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2501 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2503 const char *whence
= "UNKNOWN";
2504 print_syscall_prologue(name
);
2505 print_raw_param("%d", arg0
, 0);
2506 print_raw_param("%ld", arg1
, 0);
2507 print_raw_param("%ld", arg2
, 0);
2508 print_pointer(arg3
, 0);
2510 case SEEK_SET
: whence
= "SEEK_SET"; break;
2511 case SEEK_CUR
: whence
= "SEEK_CUR"; break;
2512 case SEEK_END
: whence
= "SEEK_END"; break;
2514 qemu_log("%s", whence
);
2515 print_syscall_epilogue(name
);
2517 #define print_llseek print__llseek
2520 #ifdef TARGET_NR_lseek
2522 print_lseek(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2523 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2524 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2526 print_syscall_prologue(name
);
2527 print_raw_param("%d", arg0
, 0);
2528 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2531 qemu_log("SEEK_SET"); break;
2533 qemu_log("SEEK_CUR"); break;
2535 qemu_log("SEEK_END"); break;
2538 qemu_log("SEEK_DATA"); break;
2542 qemu_log("SEEK_HOLE"); break;
2545 print_raw_param("%#x", arg2
, 1);
2547 print_syscall_epilogue(name
);
2551 #ifdef TARGET_NR_truncate
2553 print_truncate(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2554 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2555 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2557 print_syscall_prologue(name
);
2558 print_string(arg0
, 0);
2559 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 1);
2560 print_syscall_epilogue(name
);
2564 #ifdef TARGET_NR_truncate64
2566 print_truncate64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2567 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2568 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2570 print_syscall_prologue(name
);
2571 print_string(arg0
, 0);
2572 if (regpairs_aligned(cpu_env
, TARGET_NR_truncate64
)) {
2576 print_raw_param("%" PRIu64
, target_offset64(arg1
, arg2
), 1);
2577 print_syscall_epilogue(name
);
2581 #ifdef TARGET_NR_ftruncate64
2583 print_ftruncate64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2584 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2585 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2587 print_syscall_prologue(name
);
2588 print_raw_param("%d", arg0
, 0);
2589 if (regpairs_aligned(cpu_env
, TARGET_NR_ftruncate64
)) {
2593 print_raw_param("%" PRIu64
, target_offset64(arg1
, arg2
), 1);
2594 print_syscall_epilogue(name
);
2598 #ifdef TARGET_NR_mlockall
2600 print_mlockall(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2601 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2602 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2604 print_syscall_prologue(name
);
2605 print_flags(mlockall_flags
, arg0
, 1);
2606 print_syscall_epilogue(name
);
2610 #if defined(TARGET_NR_socket)
2612 print_socket(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2613 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2614 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2616 abi_ulong domain
= arg0
, type
= arg1
, protocol
= arg2
;
2618 print_syscall_prologue(name
);
2619 print_socket_domain(domain
);
2621 print_socket_type(type
);
2623 if (domain
== AF_PACKET
||
2624 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
2625 protocol
= tswap16(protocol
);
2627 print_socket_protocol(domain
, type
, protocol
);
2628 print_syscall_epilogue(name
);
2633 #if defined(TARGET_NR_socketcall) || defined(TARGET_NR_bind)
2635 static void print_sockfd(abi_long sockfd
, int last
)
2637 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, last
);
2642 #if defined(TARGET_NR_socketcall)
2644 #define get_user_ualx(x, gaddr, idx) \
2645 get_user_ual(x, (gaddr) + (idx) * sizeof(abi_long))
2647 static void do_print_socket(const char *name
, abi_long arg1
)
2649 abi_ulong domain
, type
, protocol
;
2651 get_user_ualx(domain
, arg1
, 0);
2652 get_user_ualx(type
, arg1
, 1);
2653 get_user_ualx(protocol
, arg1
, 2);
2654 qemu_log("%s(", name
);
2655 print_socket_domain(domain
);
2657 print_socket_type(type
);
2659 if (domain
== AF_PACKET
||
2660 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
2661 protocol
= tswap16(protocol
);
2663 print_socket_protocol(domain
, type
, protocol
);
2667 static void do_print_sockaddr(const char *name
, abi_long arg1
)
2669 abi_ulong sockfd
, addr
, addrlen
;
2671 get_user_ualx(sockfd
, arg1
, 0);
2672 get_user_ualx(addr
, arg1
, 1);
2673 get_user_ualx(addrlen
, arg1
, 2);
2675 qemu_log("%s(", name
);
2676 print_sockfd(sockfd
, 0);
2677 print_sockaddr(addr
, addrlen
, 0);
2681 static void do_print_listen(const char *name
, abi_long arg1
)
2683 abi_ulong sockfd
, backlog
;
2685 get_user_ualx(sockfd
, arg1
, 0);
2686 get_user_ualx(backlog
, arg1
, 1);
2688 qemu_log("%s(", name
);
2689 print_sockfd(sockfd
, 0);
2690 print_raw_param(TARGET_ABI_FMT_ld
, backlog
, 1);
2694 static void do_print_socketpair(const char *name
, abi_long arg1
)
2696 abi_ulong domain
, type
, protocol
, tab
;
2698 get_user_ualx(domain
, arg1
, 0);
2699 get_user_ualx(type
, arg1
, 1);
2700 get_user_ualx(protocol
, arg1
, 2);
2701 get_user_ualx(tab
, arg1
, 3);
2703 qemu_log("%s(", name
);
2704 print_socket_domain(domain
);
2706 print_socket_type(type
);
2708 print_socket_protocol(domain
, type
, protocol
);
2710 print_raw_param(TARGET_ABI_FMT_lx
, tab
, 1);
2714 static void do_print_sendrecv(const char *name
, abi_long arg1
)
2716 abi_ulong sockfd
, msg
, len
, flags
;
2718 get_user_ualx(sockfd
, arg1
, 0);
2719 get_user_ualx(msg
, arg1
, 1);
2720 get_user_ualx(len
, arg1
, 2);
2721 get_user_ualx(flags
, arg1
, 3);
2723 qemu_log("%s(", name
);
2724 print_sockfd(sockfd
, 0);
2725 print_buf(msg
, len
, 0);
2726 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
2727 print_flags(msg_flags
, flags
, 1);
2731 static void do_print_msgaddr(const char *name
, abi_long arg1
)
2733 abi_ulong sockfd
, msg
, len
, flags
, addr
, addrlen
;
2735 get_user_ualx(sockfd
, arg1
, 0);
2736 get_user_ualx(msg
, arg1
, 1);
2737 get_user_ualx(len
, arg1
, 2);
2738 get_user_ualx(flags
, arg1
, 3);
2739 get_user_ualx(addr
, arg1
, 4);
2740 get_user_ualx(addrlen
, arg1
, 5);
2742 qemu_log("%s(", name
);
2743 print_sockfd(sockfd
, 0);
2744 print_buf(msg
, len
, 0);
2745 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
2746 print_flags(msg_flags
, flags
, 0);
2747 print_sockaddr(addr
, addrlen
, 0);
2751 static void do_print_shutdown(const char *name
, abi_long arg1
)
2753 abi_ulong sockfd
, how
;
2755 get_user_ualx(sockfd
, arg1
, 0);
2756 get_user_ualx(how
, arg1
, 1);
2758 qemu_log("shutdown(");
2759 print_sockfd(sockfd
, 0);
2762 qemu_log("SHUT_RD");
2765 qemu_log("SHUT_WR");
2768 qemu_log("SHUT_RDWR");
2771 print_raw_param(TARGET_ABI_FMT_ld
, how
, 1);
2777 static void do_print_msg(const char *name
, abi_long arg1
)
2779 abi_ulong sockfd
, msg
, flags
;
2781 get_user_ualx(sockfd
, arg1
, 0);
2782 get_user_ualx(msg
, arg1
, 1);
2783 get_user_ualx(flags
, arg1
, 2);
2785 qemu_log("%s(", name
);
2786 print_sockfd(sockfd
, 0);
2787 print_pointer(msg
, 0);
2788 print_flags(msg_flags
, flags
, 1);
2792 static void do_print_sockopt(const char *name
, abi_long arg1
)
2794 abi_ulong sockfd
, level
, optname
, optval
, optlen
;
2796 get_user_ualx(sockfd
, arg1
, 0);
2797 get_user_ualx(level
, arg1
, 1);
2798 get_user_ualx(optname
, arg1
, 2);
2799 get_user_ualx(optval
, arg1
, 3);
2800 get_user_ualx(optlen
, arg1
, 4);
2802 qemu_log("%s(", name
);
2803 print_sockfd(sockfd
, 0);
2806 qemu_log("SOL_TCP,");
2807 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2808 print_pointer(optval
, 0);
2811 qemu_log("SOL_UDP,");
2812 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2813 print_pointer(optval
, 0);
2816 qemu_log("SOL_IP,");
2817 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2818 print_pointer(optval
, 0);
2821 qemu_log("SOL_RAW,");
2822 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2823 print_pointer(optval
, 0);
2825 case TARGET_SOL_SOCKET
:
2826 qemu_log("SOL_SOCKET,");
2828 case TARGET_SO_DEBUG
:
2829 qemu_log("SO_DEBUG,");
2831 print_number(optval
, 0);
2833 case TARGET_SO_REUSEADDR
:
2834 qemu_log("SO_REUSEADDR,");
2836 case TARGET_SO_REUSEPORT
:
2837 qemu_log("SO_REUSEPORT,");
2839 case TARGET_SO_TYPE
:
2840 qemu_log("SO_TYPE,");
2842 case TARGET_SO_ERROR
:
2843 qemu_log("SO_ERROR,");
2845 case TARGET_SO_DONTROUTE
:
2846 qemu_log("SO_DONTROUTE,");
2848 case TARGET_SO_BROADCAST
:
2849 qemu_log("SO_BROADCAST,");
2851 case TARGET_SO_SNDBUF
:
2852 qemu_log("SO_SNDBUF,");
2854 case TARGET_SO_RCVBUF
:
2855 qemu_log("SO_RCVBUF,");
2857 case TARGET_SO_KEEPALIVE
:
2858 qemu_log("SO_KEEPALIVE,");
2860 case TARGET_SO_OOBINLINE
:
2861 qemu_log("SO_OOBINLINE,");
2863 case TARGET_SO_NO_CHECK
:
2864 qemu_log("SO_NO_CHECK,");
2866 case TARGET_SO_PRIORITY
:
2867 qemu_log("SO_PRIORITY,");
2869 case TARGET_SO_BSDCOMPAT
:
2870 qemu_log("SO_BSDCOMPAT,");
2872 case TARGET_SO_PASSCRED
:
2873 qemu_log("SO_PASSCRED,");
2875 case TARGET_SO_TIMESTAMP
:
2876 qemu_log("SO_TIMESTAMP,");
2878 case TARGET_SO_RCVLOWAT
:
2879 qemu_log("SO_RCVLOWAT,");
2881 case TARGET_SO_RCVTIMEO
:
2882 qemu_log("SO_RCVTIMEO,");
2883 print_timeval(optval
, 0);
2885 case TARGET_SO_SNDTIMEO
:
2886 qemu_log("SO_SNDTIMEO,");
2887 print_timeval(optval
, 0);
2889 case TARGET_SO_ATTACH_FILTER
: {
2890 struct target_sock_fprog
*fprog
;
2892 qemu_log("SO_ATTACH_FILTER,");
2894 if (lock_user_struct(VERIFY_READ
, fprog
, optval
, 0)) {
2895 struct target_sock_filter
*filter
;
2897 if (lock_user_struct(VERIFY_READ
, filter
,
2898 tswapal(fprog
->filter
), 0)) {
2900 for (i
= 0; i
< tswap16(fprog
->len
) - 1; i
++) {
2901 qemu_log("[%d]{0x%x,%d,%d,0x%x},",
2902 i
, tswap16(filter
[i
].code
),
2903 filter
[i
].jt
, filter
[i
].jf
,
2904 tswap32(filter
[i
].k
));
2906 qemu_log("[%d]{0x%x,%d,%d,0x%x}",
2907 i
, tswap16(filter
[i
].code
),
2908 filter
[i
].jt
, filter
[i
].jf
,
2909 tswap32(filter
[i
].k
));
2911 qemu_log(TARGET_ABI_FMT_lx
, tswapal(fprog
->filter
));
2913 qemu_log(",%d},", tswap16(fprog
->len
));
2914 unlock_user(fprog
, optval
, 0);
2916 print_pointer(optval
, 0);
2921 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2922 print_pointer(optval
, 0);
2927 qemu_log("SOL_IPV6,");
2929 case IPV6_MTU_DISCOVER
:
2930 qemu_log("IPV6_MTU_DISCOVER,");
2933 qemu_log("IPV6_MTU,");
2936 qemu_log("IPV6_V6ONLY,");
2938 case IPV6_RECVPKTINFO
:
2939 qemu_log("IPV6_RECVPKTINFO,");
2941 case IPV6_UNICAST_HOPS
:
2942 qemu_log("IPV6_UNICAST_HOPS,");
2944 case IPV6_MULTICAST_HOPS
:
2945 qemu_log("IPV6_MULTICAST_HOPS,");
2947 case IPV6_MULTICAST_LOOP
:
2948 qemu_log("IPV6_MULTICAST_LOOP,");
2951 qemu_log("IPV6_RECVERR,");
2953 case IPV6_RECVHOPLIMIT
:
2954 qemu_log("IPV6_RECVHOPLIMIT,");
2956 case IPV6_2292HOPLIMIT
:
2957 qemu_log("IPV6_2292HOPLIMIT,");
2960 qemu_log("IPV6_CHECKSUM,");
2963 qemu_log("IPV6_ADDRFORM,");
2965 case IPV6_2292PKTINFO
:
2966 qemu_log("IPV6_2292PKTINFO,");
2968 case IPV6_RECVTCLASS
:
2969 qemu_log("IPV6_RECVTCLASS,");
2971 case IPV6_RECVRTHDR
:
2972 qemu_log("IPV6_RECVRTHDR,");
2974 case IPV6_2292RTHDR
:
2975 qemu_log("IPV6_2292RTHDR,");
2977 case IPV6_RECVHOPOPTS
:
2978 qemu_log("IPV6_RECVHOPOPTS,");
2980 case IPV6_2292HOPOPTS
:
2981 qemu_log("IPV6_2292HOPOPTS,");
2983 case IPV6_RECVDSTOPTS
:
2984 qemu_log("IPV6_RECVDSTOPTS,");
2986 case IPV6_2292DSTOPTS
:
2987 qemu_log("IPV6_2292DSTOPTS,");
2990 qemu_log("IPV6_TCLASS,");
2992 case IPV6_ADDR_PREFERENCES
:
2993 qemu_log("IPV6_ADDR_PREFERENCES,");
2995 #ifdef IPV6_RECVPATHMTU
2996 case IPV6_RECVPATHMTU
:
2997 qemu_log("IPV6_RECVPATHMTU,");
3000 #ifdef IPV6_TRANSPARENT
3001 case IPV6_TRANSPARENT
:
3002 qemu_log("IPV6_TRANSPARENT,");
3005 #ifdef IPV6_FREEBIND
3007 qemu_log("IPV6_FREEBIND,");
3010 #ifdef IPV6_RECVORIGDSTADDR
3011 case IPV6_RECVORIGDSTADDR
:
3012 qemu_log("IPV6_RECVORIGDSTADDR,");
3016 qemu_log("IPV6_PKTINFO,");
3017 print_pointer(optval
, 0);
3019 case IPV6_ADD_MEMBERSHIP
:
3020 qemu_log("IPV6_ADD_MEMBERSHIP,");
3021 print_pointer(optval
, 0);
3023 case IPV6_DROP_MEMBERSHIP
:
3024 qemu_log("IPV6_DROP_MEMBERSHIP,");
3025 print_pointer(optval
, 0);
3028 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
3029 print_pointer(optval
, 0);
3034 print_raw_param(TARGET_ABI_FMT_ld
, level
, 0);
3035 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
3036 print_pointer(optval
, 0);
3039 print_raw_param(TARGET_ABI_FMT_ld
, optlen
, 1);
3043 #define PRINT_SOCKOP(name, func) \
3044 [TARGET_SYS_##name] = { #name, func }
3048 void (*print
)(const char *, abi_long
);
3050 PRINT_SOCKOP(SOCKET
, do_print_socket
),
3051 PRINT_SOCKOP(BIND
, do_print_sockaddr
),
3052 PRINT_SOCKOP(CONNECT
, do_print_sockaddr
),
3053 PRINT_SOCKOP(LISTEN
, do_print_listen
),
3054 PRINT_SOCKOP(ACCEPT
, do_print_sockaddr
),
3055 PRINT_SOCKOP(GETSOCKNAME
, do_print_sockaddr
),
3056 PRINT_SOCKOP(GETPEERNAME
, do_print_sockaddr
),
3057 PRINT_SOCKOP(SOCKETPAIR
, do_print_socketpair
),
3058 PRINT_SOCKOP(SEND
, do_print_sendrecv
),
3059 PRINT_SOCKOP(RECV
, do_print_sendrecv
),
3060 PRINT_SOCKOP(SENDTO
, do_print_msgaddr
),
3061 PRINT_SOCKOP(RECVFROM
, do_print_msgaddr
),
3062 PRINT_SOCKOP(SHUTDOWN
, do_print_shutdown
),
3063 PRINT_SOCKOP(SETSOCKOPT
, do_print_sockopt
),
3064 PRINT_SOCKOP(GETSOCKOPT
, do_print_sockopt
),
3065 PRINT_SOCKOP(SENDMSG
, do_print_msg
),
3066 PRINT_SOCKOP(RECVMSG
, do_print_msg
),
3067 PRINT_SOCKOP(ACCEPT4
, NULL
),
3068 PRINT_SOCKOP(RECVMMSG
, NULL
),
3069 PRINT_SOCKOP(SENDMMSG
, NULL
),
3073 print_socketcall(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3074 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3075 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3077 if (arg0
>= 0 && arg0
< ARRAY_SIZE(scall
) && scall
[arg0
].print
) {
3078 scall
[arg0
].print(scall
[arg0
].name
, arg1
);
3081 print_syscall_prologue(name
);
3082 print_raw_param(TARGET_ABI_FMT_ld
, arg0
, 0);
3083 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
3084 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
3085 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 0);
3086 print_raw_param(TARGET_ABI_FMT_ld
, arg4
, 0);
3087 print_raw_param(TARGET_ABI_FMT_ld
, arg5
, 0);
3088 print_syscall_epilogue(name
);
3092 #if defined(TARGET_NR_bind)
3094 print_bind(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3095 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3096 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3098 print_syscall_prologue(name
);
3099 print_sockfd(arg0
, 0);
3100 print_sockaddr(arg1
, arg2
, 1);
3101 print_syscall_epilogue(name
);
3105 #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \
3106 defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64)
3108 print_stat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3109 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3110 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3112 print_syscall_prologue(name
);
3113 print_string(arg0
, 0);
3114 print_pointer(arg1
, 1);
3115 print_syscall_epilogue(name
);
3117 #define print_lstat print_stat
3118 #define print_stat64 print_stat
3119 #define print_lstat64 print_stat
3122 #if defined(TARGET_NR_madvise)
3123 static struct enums madvise_advice
[] = {
3124 ENUM_TARGET(MADV_NORMAL
),
3125 ENUM_TARGET(MADV_RANDOM
),
3126 ENUM_TARGET(MADV_SEQUENTIAL
),
3127 ENUM_TARGET(MADV_WILLNEED
),
3128 ENUM_TARGET(MADV_DONTNEED
),
3129 ENUM_TARGET(MADV_FREE
),
3130 ENUM_TARGET(MADV_REMOVE
),
3131 ENUM_TARGET(MADV_DONTFORK
),
3132 ENUM_TARGET(MADV_DOFORK
),
3133 ENUM_TARGET(MADV_MERGEABLE
),
3134 ENUM_TARGET(MADV_UNMERGEABLE
),
3135 ENUM_TARGET(MADV_HUGEPAGE
),
3136 ENUM_TARGET(MADV_NOHUGEPAGE
),
3137 ENUM_TARGET(MADV_DONTDUMP
),
3138 ENUM_TARGET(MADV_DODUMP
),
3139 ENUM_TARGET(MADV_WIPEONFORK
),
3140 ENUM_TARGET(MADV_KEEPONFORK
),
3141 ENUM_TARGET(MADV_COLD
),
3142 ENUM_TARGET(MADV_PAGEOUT
),
3143 ENUM_TARGET(MADV_POPULATE_READ
),
3144 ENUM_TARGET(MADV_POPULATE_WRITE
),
3145 ENUM_TARGET(MADV_DONTNEED_LOCKED
),
3150 print_madvise(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3151 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3152 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3154 print_syscall_prologue(name
);
3155 print_pointer(arg0
, 0);
3156 print_raw_param("%d", arg1
, 0);
3157 print_enums(madvise_advice
, arg2
, 1);
3158 print_syscall_epilogue(name
);
3162 #if defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64)
3164 print_fstat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3165 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3166 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3168 print_syscall_prologue(name
);
3169 print_raw_param("%d", arg0
, 0);
3170 print_pointer(arg1
, 1);
3171 print_syscall_epilogue(name
);
3173 #define print_fstat64 print_fstat
3176 #ifdef TARGET_NR_mkdir
3178 print_mkdir(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3179 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3180 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3182 print_syscall_prologue(name
);
3183 print_string(arg0
, 0);
3184 print_file_mode(arg1
, 1);
3185 print_syscall_epilogue(name
);
3189 #ifdef TARGET_NR_mkdirat
3191 print_mkdirat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3192 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3193 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3195 print_syscall_prologue(name
);
3196 print_at_dirfd(arg0
, 0);
3197 print_string(arg1
, 0);
3198 print_file_mode(arg2
, 1);
3199 print_syscall_epilogue(name
);
3203 #ifdef TARGET_NR_rmdir
3205 print_rmdir(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3206 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3207 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3209 print_syscall_prologue(name
);
3210 print_string(arg0
, 0);
3211 print_syscall_epilogue(name
);
3215 #ifdef TARGET_NR_rt_sigaction
3217 print_rt_sigaction(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3218 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3219 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3221 print_syscall_prologue(name
);
3222 print_signal(arg0
, 0);
3223 print_pointer(arg1
, 0);
3224 print_pointer(arg2
, 1);
3225 print_syscall_epilogue(name
);
3229 #ifdef TARGET_NR_rt_sigprocmask
3231 print_rt_sigprocmask(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3232 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3233 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3235 const char *how
= "UNKNOWN";
3236 print_syscall_prologue(name
);
3238 case TARGET_SIG_BLOCK
: how
= "SIG_BLOCK"; break;
3239 case TARGET_SIG_UNBLOCK
: how
= "SIG_UNBLOCK"; break;
3240 case TARGET_SIG_SETMASK
: how
= "SIG_SETMASK"; break;
3242 qemu_log("%s,", how
);
3243 print_pointer(arg1
, 0);
3244 print_pointer(arg2
, 0);
3245 print_raw_param("%u", arg3
, 1);
3246 print_syscall_epilogue(name
);
3250 #ifdef TARGET_NR_rt_sigqueueinfo
3252 print_rt_sigqueueinfo(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3253 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3254 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3257 target_siginfo_t uinfo
;
3259 print_syscall_prologue(name
);
3260 print_raw_param("%d", arg0
, 0);
3261 print_signal(arg1
, 0);
3262 p
= lock_user(VERIFY_READ
, arg2
, sizeof(target_siginfo_t
), 1);
3264 get_target_siginfo(&uinfo
, p
);
3265 print_siginfo(&uinfo
);
3267 unlock_user(p
, arg2
, 0);
3269 print_pointer(arg2
, 1);
3271 print_syscall_epilogue(name
);
3275 #ifdef TARGET_NR_rt_tgsigqueueinfo
3277 print_rt_tgsigqueueinfo(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3278 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3279 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3282 target_siginfo_t uinfo
;
3284 print_syscall_prologue(name
);
3285 print_raw_param("%d", arg0
, 0);
3286 print_raw_param("%d", arg1
, 0);
3287 print_signal(arg2
, 0);
3288 p
= lock_user(VERIFY_READ
, arg3
, sizeof(target_siginfo_t
), 1);
3290 get_target_siginfo(&uinfo
, p
);
3291 print_siginfo(&uinfo
);
3293 unlock_user(p
, arg3
, 0);
3295 print_pointer(arg3
, 1);
3297 print_syscall_epilogue(name
);
3301 #ifdef TARGET_NR_syslog
3303 print_syslog_action(abi_ulong arg
, int last
)
3308 case TARGET_SYSLOG_ACTION_CLOSE
: {
3309 type
= "SYSLOG_ACTION_CLOSE";
3312 case TARGET_SYSLOG_ACTION_OPEN
: {
3313 type
= "SYSLOG_ACTION_OPEN";
3316 case TARGET_SYSLOG_ACTION_READ
: {
3317 type
= "SYSLOG_ACTION_READ";
3320 case TARGET_SYSLOG_ACTION_READ_ALL
: {
3321 type
= "SYSLOG_ACTION_READ_ALL";
3324 case TARGET_SYSLOG_ACTION_READ_CLEAR
: {
3325 type
= "SYSLOG_ACTION_READ_CLEAR";
3328 case TARGET_SYSLOG_ACTION_CLEAR
: {
3329 type
= "SYSLOG_ACTION_CLEAR";
3332 case TARGET_SYSLOG_ACTION_CONSOLE_OFF
: {
3333 type
= "SYSLOG_ACTION_CONSOLE_OFF";
3336 case TARGET_SYSLOG_ACTION_CONSOLE_ON
: {
3337 type
= "SYSLOG_ACTION_CONSOLE_ON";
3340 case TARGET_SYSLOG_ACTION_CONSOLE_LEVEL
: {
3341 type
= "SYSLOG_ACTION_CONSOLE_LEVEL";
3344 case TARGET_SYSLOG_ACTION_SIZE_UNREAD
: {
3345 type
= "SYSLOG_ACTION_SIZE_UNREAD";
3348 case TARGET_SYSLOG_ACTION_SIZE_BUFFER
: {
3349 type
= "SYSLOG_ACTION_SIZE_BUFFER";
3353 print_raw_param("%ld", arg
, last
);
3357 qemu_log("%s%s", type
, get_comma(last
));
3361 print_syslog(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3362 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3363 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3365 print_syscall_prologue(name
);
3366 print_syslog_action(arg0
, 0);
3367 print_pointer(arg1
, 0);
3368 print_raw_param("%d", arg2
, 1);
3369 print_syscall_epilogue(name
);
3373 #ifdef TARGET_NR_mknod
3375 print_mknod(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3376 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3377 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3379 int hasdev
= (arg1
& (S_IFCHR
|S_IFBLK
));
3381 print_syscall_prologue(name
);
3382 print_string(arg0
, 0);
3383 print_file_mode(arg1
, (hasdev
== 0));
3385 print_raw_param("makedev(%d", major(arg2
), 0);
3386 print_raw_param("%d)", minor(arg2
), 1);
3388 print_syscall_epilogue(name
);
3392 #ifdef TARGET_NR_mknodat
3394 print_mknodat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3395 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3396 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3398 int hasdev
= (arg2
& (S_IFCHR
|S_IFBLK
));
3400 print_syscall_prologue(name
);
3401 print_at_dirfd(arg0
, 0);
3402 print_string(arg1
, 0);
3403 print_file_mode(arg2
, (hasdev
== 0));
3405 print_raw_param("makedev(%d", major(arg3
), 0);
3406 print_raw_param("%d)", minor(arg3
), 1);
3408 print_syscall_epilogue(name
);
3412 #ifdef TARGET_NR_mq_open
3414 print_mq_open(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3415 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3416 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3418 int is_creat
= (arg1
& TARGET_O_CREAT
);
3420 print_syscall_prologue(name
);
3421 print_string(arg0
, 0);
3422 print_open_flags(arg1
, (is_creat
== 0));
3424 print_file_mode(arg2
, 0);
3425 print_pointer(arg3
, 1);
3427 print_syscall_epilogue(name
);
3431 #ifdef TARGET_NR_open
3433 print_open(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3434 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3435 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3437 int is_creat
= (arg1
& TARGET_O_CREAT
);
3439 print_syscall_prologue(name
);
3440 print_string(arg0
, 0);
3441 print_open_flags(arg1
, (is_creat
== 0));
3443 print_file_mode(arg2
, 1);
3444 print_syscall_epilogue(name
);
3448 #ifdef TARGET_NR_openat
3450 print_openat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3451 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3452 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3454 int is_creat
= (arg2
& TARGET_O_CREAT
);
3456 print_syscall_prologue(name
);
3457 print_at_dirfd(arg0
, 0);
3458 print_string(arg1
, 0);
3459 print_open_flags(arg2
, (is_creat
== 0));
3461 print_file_mode(arg3
, 1);
3462 print_syscall_epilogue(name
);
3466 #ifdef TARGET_NR_pidfd_send_signal
3468 print_pidfd_send_signal(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3469 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3470 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3473 target_siginfo_t uinfo
;
3475 print_syscall_prologue(name
);
3476 print_raw_param("%d", arg0
, 0);
3477 print_signal(arg1
, 0);
3479 p
= lock_user(VERIFY_READ
, arg2
, sizeof(target_siginfo_t
), 1);
3481 get_target_siginfo(&uinfo
, p
);
3482 print_siginfo(&uinfo
);
3484 unlock_user(p
, arg2
, 0);
3486 print_pointer(arg2
, 0);
3489 print_raw_param("%u", arg3
, 1);
3490 print_syscall_epilogue(name
);
3494 #ifdef TARGET_NR_mq_unlink
3496 print_mq_unlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3497 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3498 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3500 print_syscall_prologue(name
);
3501 print_string(arg0
, 1);
3502 print_syscall_epilogue(name
);
3506 #if defined(TARGET_NR_fstatat64) || defined(TARGET_NR_newfstatat)
3508 print_fstatat64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3509 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3510 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3512 print_syscall_prologue(name
);
3513 print_at_dirfd(arg0
, 0);
3514 print_string(arg1
, 0);
3515 print_pointer(arg2
, 0);
3516 print_flags(at_file_flags
, arg3
, 1);
3517 print_syscall_epilogue(name
);
3519 #define print_newfstatat print_fstatat64
3522 #ifdef TARGET_NR_readlink
3524 print_readlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3525 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3526 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3528 print_syscall_prologue(name
);
3529 print_string(arg0
, 0);
3530 print_pointer(arg1
, 0);
3531 print_raw_param("%u", arg2
, 1);
3532 print_syscall_epilogue(name
);
3536 #ifdef TARGET_NR_readlinkat
3538 print_readlinkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3539 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3540 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3542 print_syscall_prologue(name
);
3543 print_at_dirfd(arg0
, 0);
3544 print_string(arg1
, 0);
3545 print_pointer(arg2
, 0);
3546 print_raw_param("%u", arg3
, 1);
3547 print_syscall_epilogue(name
);
3551 #ifdef TARGET_NR_rename
3553 print_rename(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3554 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3555 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3557 print_syscall_prologue(name
);
3558 print_string(arg0
, 0);
3559 print_string(arg1
, 1);
3560 print_syscall_epilogue(name
);
3564 #ifdef TARGET_NR_renameat
3566 print_renameat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3567 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3568 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3570 print_syscall_prologue(name
);
3571 print_at_dirfd(arg0
, 0);
3572 print_string(arg1
, 0);
3573 print_at_dirfd(arg2
, 0);
3574 print_string(arg3
, 1);
3575 print_syscall_epilogue(name
);
3579 #ifdef TARGET_NR_statfs
3581 print_statfs(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3582 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3583 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3585 print_syscall_prologue(name
);
3586 print_string(arg0
, 0);
3587 print_pointer(arg1
, 1);
3588 print_syscall_epilogue(name
);
3592 #ifdef TARGET_NR_statfs64
3594 print_statfs64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3595 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3596 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3598 print_syscall_prologue(name
);
3599 print_string(arg0
, 0);
3600 print_pointer(arg1
, 1);
3601 print_syscall_epilogue(name
);
3605 #ifdef TARGET_NR_symlink
3607 print_symlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3608 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3609 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3611 print_syscall_prologue(name
);
3612 print_string(arg0
, 0);
3613 print_string(arg1
, 1);
3614 print_syscall_epilogue(name
);
3618 #ifdef TARGET_NR_symlinkat
3620 print_symlinkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3621 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3622 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3624 print_syscall_prologue(name
);
3625 print_string(arg0
, 0);
3626 print_at_dirfd(arg1
, 0);
3627 print_string(arg2
, 1);
3628 print_syscall_epilogue(name
);
3632 #ifdef TARGET_NR_mount
3634 print_mount(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3635 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3636 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3638 print_syscall_prologue(name
);
3639 print_string(arg0
, 0);
3640 print_string(arg1
, 0);
3641 print_string(arg2
, 0);
3642 print_flags(mount_flags
, arg3
, 0);
3643 print_pointer(arg4
, 1);
3644 print_syscall_epilogue(name
);
3648 #ifdef TARGET_NR_umount
3650 print_umount(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3651 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3652 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3654 print_syscall_prologue(name
);
3655 print_string(arg0
, 1);
3656 print_syscall_epilogue(name
);
3660 #ifdef TARGET_NR_umount2
3662 print_umount2(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3663 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3664 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3666 print_syscall_prologue(name
);
3667 print_string(arg0
, 0);
3668 print_flags(umount2_flags
, arg1
, 1);
3669 print_syscall_epilogue(name
);
3673 #ifdef TARGET_NR_unlink
3675 print_unlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3676 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3677 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3679 print_syscall_prologue(name
);
3680 print_string(arg0
, 1);
3681 print_syscall_epilogue(name
);
3685 #ifdef TARGET_NR_unlinkat
3687 print_unlinkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3688 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3689 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3691 print_syscall_prologue(name
);
3692 print_at_dirfd(arg0
, 0);
3693 print_string(arg1
, 0);
3694 print_flags(unlinkat_flags
, arg2
, 1);
3695 print_syscall_epilogue(name
);
3699 #ifdef TARGET_NR_unshare
3701 print_unshare(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3702 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3703 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3705 print_syscall_prologue(name
);
3706 print_flags(clone_flags
, arg0
, 1);
3707 print_syscall_epilogue(name
);
3711 #ifdef TARGET_NR_clock_nanosleep
3713 print_clock_nanosleep(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3714 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3715 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3717 print_syscall_prologue(name
);
3718 print_enums(clockids
, arg0
, 0);
3719 print_raw_param("%d", arg1
, 0);
3720 print_timespec(arg2
, 0);
3721 print_timespec(arg3
, 1);
3722 print_syscall_epilogue(name
);
3726 #ifdef TARGET_NR_utime
3728 print_utime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3729 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3730 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3732 print_syscall_prologue(name
);
3733 print_string(arg0
, 0);
3734 print_pointer(arg1
, 1);
3735 print_syscall_epilogue(name
);
3739 #ifdef TARGET_NR_utimes
3741 print_utimes(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3742 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3743 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3745 print_syscall_prologue(name
);
3746 print_string(arg0
, 0);
3747 print_pointer(arg1
, 1);
3748 print_syscall_epilogue(name
);
3752 #ifdef TARGET_NR_utimensat
3754 print_utimensat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3755 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3756 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3758 print_syscall_prologue(name
);
3759 print_at_dirfd(arg0
, 0);
3760 print_string(arg1
, 0);
3761 print_pointer(arg2
, 0);
3762 print_flags(at_file_flags
, arg3
, 1);
3763 print_syscall_epilogue(name
);
3767 #if defined(TARGET_NR_mmap) || defined(TARGET_NR_mmap2)
3769 print_mmap(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3770 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3771 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3773 print_syscall_prologue(name
);
3774 print_pointer(arg0
, 0);
3775 print_raw_param("%d", arg1
, 0);
3776 print_flags(mmap_prot_flags
, arg2
, 0);
3777 print_flags(mmap_flags
, arg3
, 0);
3778 print_raw_param("%d", arg4
, 0);
3779 print_raw_param("%#x", arg5
, 1);
3780 print_syscall_epilogue(name
);
3782 #define print_mmap2 print_mmap
3785 #ifdef TARGET_NR_mprotect
3787 print_mprotect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3788 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3789 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3791 print_syscall_prologue(name
);
3792 print_pointer(arg0
, 0);
3793 print_raw_param("%d", arg1
, 0);
3794 print_flags(mmap_prot_flags
, arg2
, 1);
3795 print_syscall_epilogue(name
);
3799 #ifdef TARGET_NR_munmap
3801 print_munmap(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3802 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3803 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3805 print_syscall_prologue(name
);
3806 print_pointer(arg0
, 0);
3807 print_raw_param("%d", arg1
, 1);
3808 print_syscall_epilogue(name
);
3812 #ifdef TARGET_NR_futex
3813 static void print_futex_op(int cmd
, int last
)
3815 static const char * const futex_names
[] = {
3816 #define NAME(X) [X] = #X
3820 NAME(FUTEX_REQUEUE
),
3821 NAME(FUTEX_CMP_REQUEUE
),
3822 NAME(FUTEX_WAKE_OP
),
3823 NAME(FUTEX_LOCK_PI
),
3824 NAME(FUTEX_UNLOCK_PI
),
3825 NAME(FUTEX_TRYLOCK_PI
),
3826 NAME(FUTEX_WAIT_BITSET
),
3827 NAME(FUTEX_WAKE_BITSET
),
3828 NAME(FUTEX_WAIT_REQUEUE_PI
),
3829 NAME(FUTEX_CMP_REQUEUE_PI
),
3830 NAME(FUTEX_LOCK_PI2
),
3834 unsigned base_cmd
= cmd
& FUTEX_CMD_MASK
;
3836 if (base_cmd
< ARRAY_SIZE(futex_names
)) {
3838 (cmd
& FUTEX_PRIVATE_FLAG
? "FUTEX_PRIVATE_FLAG|" : ""),
3839 (cmd
& FUTEX_CLOCK_REALTIME
? "FUTEX_CLOCK_REALTIME|" : ""),
3840 futex_names
[base_cmd
]);
3842 qemu_log("0x%x", cmd
);
3847 print_futex(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3848 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3849 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3851 abi_long op
= arg1
& FUTEX_CMD_MASK
;
3852 print_syscall_prologue(name
);
3853 print_pointer(arg0
, 0);
3854 print_futex_op(arg1
, 0);
3855 print_raw_param(",%d", arg2
, 0);
3858 case FUTEX_WAIT_BITSET
:
3860 case FUTEX_LOCK_PI2
:
3861 case FUTEX_WAIT_REQUEUE_PI
:
3862 print_timespec(arg3
, 0);
3865 print_pointer(arg3
, 0);
3868 print_pointer(arg4
, 0);
3869 print_raw_param("%d", arg4
, 1);
3870 print_syscall_epilogue(name
);
3874 #ifdef TARGET_NR_prlimit64
3875 static const char *target_ressource_string(abi_ulong r
)
3877 #define RET_RES_ENTRY(res) case TARGET_##res: return #res;
3879 RET_RES_ENTRY(RLIMIT_AS
);
3880 RET_RES_ENTRY(RLIMIT_CORE
);
3881 RET_RES_ENTRY(RLIMIT_CPU
);
3882 RET_RES_ENTRY(RLIMIT_DATA
);
3883 RET_RES_ENTRY(RLIMIT_FSIZE
);
3884 RET_RES_ENTRY(RLIMIT_LOCKS
);
3885 RET_RES_ENTRY(RLIMIT_MEMLOCK
);
3886 RET_RES_ENTRY(RLIMIT_MSGQUEUE
);
3887 RET_RES_ENTRY(RLIMIT_NICE
);
3888 RET_RES_ENTRY(RLIMIT_NOFILE
);
3889 RET_RES_ENTRY(RLIMIT_NPROC
);
3890 RET_RES_ENTRY(RLIMIT_RSS
);
3891 RET_RES_ENTRY(RLIMIT_RTPRIO
);
3892 #ifdef RLIMIT_RTTIME
3893 RET_RES_ENTRY(RLIMIT_RTTIME
);
3895 RET_RES_ENTRY(RLIMIT_SIGPENDING
);
3896 RET_RES_ENTRY(RLIMIT_STACK
);
3900 #undef RET_RES_ENTRY
3904 print_rlimit64(abi_ulong rlim_addr
, int last
)
3907 struct target_rlimit64
*rl
;
3909 rl
= lock_user(VERIFY_READ
, rlim_addr
, sizeof(*rl
), 1);
3911 print_pointer(rlim_addr
, last
);
3914 print_raw_param64("{rlim_cur=%" PRId64
, tswap64(rl
->rlim_cur
), 0);
3915 print_raw_param64("rlim_max=%" PRId64
"}", tswap64(rl
->rlim_max
),
3917 unlock_user(rl
, rlim_addr
, 0);
3919 qemu_log("NULL%s", get_comma(last
));
3924 print_prlimit64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3925 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3926 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3928 const char *rlim_name
;
3930 print_syscall_prologue(name
);
3931 print_raw_param("%d", arg0
, 0);
3932 rlim_name
= target_ressource_string(arg1
);
3934 qemu_log("%s,", rlim_name
);
3936 print_raw_param("%d", arg1
, 0);
3938 print_rlimit64(arg2
, 0);
3939 print_pointer(arg3
, 1);
3940 print_syscall_epilogue(name
);
3944 print_syscall_ret_prlimit64(CPUArchState
*cpu_env
,
3945 const struct syscallname
*name
,
3946 abi_long ret
, abi_long arg0
, abi_long arg1
,
3947 abi_long arg2
, abi_long arg3
, abi_long arg4
,
3950 if (!print_syscall_err(ret
)) {
3951 qemu_log(TARGET_ABI_FMT_ld
, ret
);
3954 print_rlimit64(arg3
, 1);
3962 #ifdef TARGET_NR_kill
3964 print_kill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3965 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3966 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3968 print_syscall_prologue(name
);
3969 print_raw_param("%d", arg0
, 0);
3970 print_signal(arg1
, 1);
3971 print_syscall_epilogue(name
);
3975 #ifdef TARGET_NR_tkill
3977 print_tkill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3978 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3979 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3981 print_syscall_prologue(name
);
3982 print_raw_param("%d", arg0
, 0);
3983 print_signal(arg1
, 1);
3984 print_syscall_epilogue(name
);
3988 #ifdef TARGET_NR_tgkill
3990 print_tgkill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3991 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3992 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3994 print_syscall_prologue(name
);
3995 print_raw_param("%d", arg0
, 0);
3996 print_raw_param("%d", arg1
, 0);
3997 print_signal(arg2
, 1);
3998 print_syscall_epilogue(name
);
4002 #ifdef TARGET_NR_statx
4004 print_statx(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4005 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4006 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4008 print_syscall_prologue(name
);
4009 print_at_dirfd(arg0
, 0);
4010 print_string(arg1
, 0);
4011 print_flags(statx_flags
, arg2
, 0);
4012 print_flags(statx_mask
, arg3
, 0);
4013 print_pointer(arg4
, 1);
4014 print_syscall_epilogue(name
);
4018 #ifdef TARGET_NR_ioctl
4020 print_ioctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4021 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4022 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4024 print_syscall_prologue(name
);
4025 print_raw_param("%d", arg0
, 0);
4027 const IOCTLEntry
*ie
;
4028 const argtype
*arg_type
;
4032 for (ie
= ioctl_entries
; ie
->target_cmd
!= 0; ie
++) {
4033 if (ie
->target_cmd
== arg1
) {
4038 if (ie
->target_cmd
== 0) {
4039 print_raw_param("%#x", arg1
, 0);
4040 print_raw_param("%#x", arg2
, 1);
4042 qemu_log("%s", ie
->name
);
4043 arg_type
= ie
->arg_type
;
4045 if (arg_type
[0] != TYPE_NULL
) {
4048 switch (arg_type
[0]) {
4050 print_pointer(arg2
, 1);
4055 print_raw_param("%d", arg2
, 1);
4058 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
4061 print_raw_param(TARGET_ABI_FMT_lu
, arg2
, 1);
4064 switch (ie
->access
) {
4066 print_pointer(arg2
, 1);
4071 target_size
= thunk_type_size(arg_type
, 0);
4072 argptr
= lock_user(VERIFY_READ
, arg2
, target_size
, 1);
4074 thunk_print(argptr
, arg_type
);
4075 unlock_user(argptr
, arg2
, target_size
);
4077 print_pointer(arg2
, 1);
4083 g_assert_not_reached();
4087 print_syscall_epilogue(name
);
4092 * An array of all of the syscalls we know about
4095 static const struct syscallname scnames
[] = {
4096 #include "strace.list"
4099 static int nsyscalls
= ARRAY_SIZE(scnames
);
4102 * The public interface to this module.
4105 print_syscall(CPUArchState
*cpu_env
, int num
,
4106 abi_long arg1
, abi_long arg2
, abi_long arg3
,
4107 abi_long arg4
, abi_long arg5
, abi_long arg6
)
4111 const char *format
= "%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
","
4112 TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
","
4113 TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
")";
4115 f
= qemu_log_trylock();
4119 fprintf(f
, "%d ", getpid());
4121 for (i
= 0; i
< nsyscalls
; i
++) {
4122 if (scnames
[i
].nr
== num
) {
4123 if (scnames
[i
].call
!= NULL
) {
4124 scnames
[i
].call(cpu_env
, &scnames
[i
], arg1
, arg2
, arg3
,
4127 /* XXX: this format system is broken because it uses
4128 host types and host pointers for strings */
4129 if (scnames
[i
].format
!= NULL
) {
4130 format
= scnames
[i
].format
;
4132 fprintf(f
, format
, scnames
[i
].name
, arg1
, arg2
,
4133 arg3
, arg4
, arg5
, arg6
);
4139 fprintf(f
, "Unknown syscall %d\n", num
);
4145 print_syscall_ret(CPUArchState
*cpu_env
, int num
, abi_long ret
,
4146 abi_long arg1
, abi_long arg2
, abi_long arg3
,
4147 abi_long arg4
, abi_long arg5
, abi_long arg6
)
4152 f
= qemu_log_trylock();
4157 for (i
= 0; i
< nsyscalls
; i
++) {
4158 if (scnames
[i
].nr
== num
) {
4159 if (scnames
[i
].result
!= NULL
) {
4160 scnames
[i
].result(cpu_env
, &scnames
[i
], ret
,
4164 if (!print_syscall_err(ret
)) {
4165 fprintf(f
, TARGET_ABI_FMT_ld
, ret
);
4175 void print_taken_signal(int target_signum
, const target_siginfo_t
*tinfo
)
4177 /* Print the strace output for a signal being taken:
4178 * --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
4182 f
= qemu_log_trylock();
4188 print_signal(target_signum
, 1);
4190 print_siginfo(tinfo
);
4191 fprintf(f
, " ---\n");