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 abi_long f_mask
; /* mask */
50 const char *f_string
; /* stringified flag */
53 /* No 'struct flags' element should have a zero mask. */
54 #define FLAG_BASIC(V, M, N) { V, M | QEMU_BUILD_BUG_ON_ZERO(!(M)), N }
56 /* common flags for all architectures */
57 #define FLAG_GENERIC_MASK(V, M) FLAG_BASIC(V, M, #V)
58 #define FLAG_GENERIC(V) FLAG_BASIC(V, V, #V)
59 /* target specific flags (syscall_defs.h has TARGET_<flag>) */
60 #define FLAG_TARGET_MASK(V, M) FLAG_BASIC(TARGET_##V, TARGET_##M, #V)
61 #define FLAG_TARGET(V) FLAG_BASIC(TARGET_##V, TARGET_##V, #V)
62 /* end of flags array */
63 #define FLAG_END { 0, 0, NULL }
65 /* Structure used to translate enumerated values into strings */
67 abi_long e_value
; /* enum value */
68 const char *e_string
; /* stringified enum */
71 /* common enums for all architectures */
72 #define ENUM_GENERIC(name) { name, #name }
73 /* target specific enums */
74 #define ENUM_TARGET(name) { TARGET_ ## name, #name }
75 /* end of enums array */
76 #define ENUM_END { 0, NULL }
78 UNUSED
static const char *get_comma(int);
79 UNUSED
static void print_pointer(abi_long
, int);
80 UNUSED
static void print_flags(const struct flags
*, abi_long
, int);
81 UNUSED
static void print_enums(const struct enums
*, abi_long
, int);
82 UNUSED
static void print_at_dirfd(abi_long
, int);
83 UNUSED
static void print_file_mode(abi_long
, int);
84 UNUSED
static void print_open_flags(abi_long
, int);
85 UNUSED
static void print_syscall_prologue(const struct syscallname
*);
86 UNUSED
static void print_syscall_epilogue(const struct syscallname
*);
87 UNUSED
static void print_string(abi_long
, int);
88 UNUSED
static void print_buf(abi_long addr
, abi_long len
, int last
);
89 UNUSED
static void print_raw_param(const char *, abi_long
, int);
90 UNUSED
static void print_raw_param64(const char *, long long, int last
);
91 UNUSED
static void print_timeval(abi_ulong
, int);
92 UNUSED
static void print_timespec(abi_ulong
, int);
93 UNUSED
static void print_timespec64(abi_ulong
, int);
94 UNUSED
static void print_timezone(abi_ulong
, int);
95 UNUSED
static void print_itimerval(abi_ulong
, int);
96 UNUSED
static void print_number(abi_long
, int);
97 UNUSED
static void print_signal(abi_ulong
, int);
98 UNUSED
static void print_sockaddr(abi_ulong
, abi_long
, int);
99 UNUSED
static void print_socket_domain(int domain
);
100 UNUSED
static void print_socket_type(int type
);
101 UNUSED
static void print_socket_protocol(int domain
, int type
, int protocol
);
107 print_ipc_cmd(int cmd
)
109 #define output_cmd(val) \
117 /* General IPC commands */
118 output_cmd( IPC_RMID
);
119 output_cmd( IPC_SET
);
120 output_cmd( IPC_STAT
);
121 output_cmd( IPC_INFO
);
122 /* msgctl() commands */
123 output_cmd( MSG_STAT
);
124 output_cmd( MSG_INFO
);
125 /* shmctl() commands */
126 output_cmd( SHM_LOCK
);
127 output_cmd( SHM_UNLOCK
);
128 output_cmd( SHM_STAT
);
129 output_cmd( SHM_INFO
);
130 /* semctl() commands */
131 output_cmd( GETPID
);
132 output_cmd( GETVAL
);
133 output_cmd( GETALL
);
134 output_cmd( GETNCNT
);
135 output_cmd( GETZCNT
);
136 output_cmd( SETVAL
);
137 output_cmd( SETALL
);
138 output_cmd( SEM_STAT
);
139 output_cmd( SEM_INFO
);
140 output_cmd( IPC_RMID
);
141 output_cmd( IPC_RMID
);
142 output_cmd( IPC_RMID
);
143 output_cmd( IPC_RMID
);
144 output_cmd( IPC_RMID
);
145 output_cmd( IPC_RMID
);
146 output_cmd( IPC_RMID
);
147 output_cmd( IPC_RMID
);
148 output_cmd( IPC_RMID
);
150 /* Some value we don't recognize */
154 static const char * const target_signal_name
[] = {
155 #define MAKE_SIG_ENTRY(sig) [TARGET_##sig] = #sig,
157 #undef MAKE_SIG_ENTRY
161 print_signal(abi_ulong arg
, int last
)
163 const char *signal_name
= NULL
;
165 if (arg
< ARRAY_SIZE(target_signal_name
)) {
166 signal_name
= target_signal_name
[arg
];
169 if (signal_name
== NULL
) {
170 print_raw_param("%ld", arg
, last
);
173 qemu_log("%s%s", signal_name
, get_comma(last
));
176 static void print_si_code(int arg
)
178 const char *codename
= NULL
;
182 codename
= "SI_USER";
185 codename
= "SI_KERNEL";
188 codename
= "SI_QUEUE";
191 codename
= "SI_TIMER";
194 codename
= "SI_MESGQ";
197 codename
= "SI_ASYNCIO";
200 codename
= "SI_SIGIO";
203 codename
= "SI_TKILL";
209 qemu_log("%s", codename
);
212 static void get_target_siginfo(target_siginfo_t
*tinfo
,
213 const target_siginfo_t
*info
)
222 __get_user(sig
, &info
->si_signo
);
223 __get_user(si_errno
, &tinfo
->si_errno
);
224 __get_user(si_code
, &info
->si_code
);
226 tinfo
->si_signo
= sig
;
227 tinfo
->si_errno
= si_errno
;
228 tinfo
->si_code
= si_code
;
230 /* Ensure we don't leak random junk to the guest later */
231 memset(tinfo
->_sifields
._pad
, 0, sizeof(tinfo
->_sifields
._pad
));
233 /* This is awkward, because we have to use a combination of
234 * the si_code and si_signo to figure out which of the union's
235 * members are valid. (Within the host kernel it is always possible
236 * to tell, but the kernel carefully avoids giving userspace the
237 * high 16 bits of si_code, so we don't have the information to
238 * do this the easy way...) We therefore make our best guess,
239 * bearing in mind that a guest can spoof most of the si_codes
240 * via rt_sigqueueinfo() if it likes.
242 * Once we have made our guess, we record it in the top 16 bits of
243 * the si_code, so that print_siginfo() later can use it.
244 * print_siginfo() will strip these top bits out before printing
252 /* Sent via kill(), tkill() or tgkill(), or direct from the kernel.
253 * These are the only unspoofable si_code values.
255 __get_user(tinfo
->_sifields
._kill
._pid
, &info
->_sifields
._kill
._pid
);
256 __get_user(tinfo
->_sifields
._kill
._uid
, &info
->_sifields
._kill
._uid
);
257 si_type
= QEMU_SI_KILL
;
260 /* Everything else is spoofable. Make best guess based on signal */
263 __get_user(tinfo
->_sifields
._sigchld
._pid
,
264 &info
->_sifields
._sigchld
._pid
);
265 __get_user(tinfo
->_sifields
._sigchld
._uid
,
266 &info
->_sifields
._sigchld
._uid
);
267 __get_user(tinfo
->_sifields
._sigchld
._status
,
268 &info
->_sifields
._sigchld
._status
);
269 __get_user(tinfo
->_sifields
._sigchld
._utime
,
270 &info
->_sifields
._sigchld
._utime
);
271 __get_user(tinfo
->_sifields
._sigchld
._stime
,
272 &info
->_sifields
._sigchld
._stime
);
273 si_type
= QEMU_SI_CHLD
;
276 __get_user(tinfo
->_sifields
._sigpoll
._band
,
277 &info
->_sifields
._sigpoll
._band
);
278 __get_user(tinfo
->_sifields
._sigpoll
._fd
,
279 &info
->_sifields
._sigpoll
._fd
);
280 si_type
= QEMU_SI_POLL
;
283 /* Assume a sigqueue()/mq_notify()/rt_sigqueueinfo() source. */
284 __get_user(tinfo
->_sifields
._rt
._pid
, &info
->_sifields
._rt
._pid
);
285 __get_user(tinfo
->_sifields
._rt
._uid
, &info
->_sifields
._rt
._uid
);
286 /* XXX: potential problem if 64 bit */
287 __get_user(sival_ptr
, &info
->_sifields
._rt
._sigval
.sival_ptr
);
288 tinfo
->_sifields
._rt
._sigval
.sival_ptr
= sival_ptr
;
290 si_type
= QEMU_SI_RT
;
296 tinfo
->si_code
= deposit32(si_code
, 16, 16, si_type
);
299 static void print_siginfo(const target_siginfo_t
*tinfo
)
301 /* Print a target_siginfo_t in the format desired for printing
302 * signals being taken. We assume the target_siginfo_t is in the
303 * internal form where the top 16 bits of si_code indicate which
304 * part of the union is valid, rather than in the guest-visible
305 * form where the bottom 16 bits are sign-extended into the top 16.
307 int si_type
= extract32(tinfo
->si_code
, 16, 16);
308 int si_code
= sextract32(tinfo
->si_code
, 0, 16);
310 qemu_log("{si_signo=");
311 print_signal(tinfo
->si_signo
, 1);
312 qemu_log(", si_code=");
313 print_si_code(si_code
);
317 qemu_log(", si_pid=%u, si_uid=%u",
318 (unsigned int)tinfo
->_sifields
._kill
._pid
,
319 (unsigned int)tinfo
->_sifields
._kill
._uid
);
322 qemu_log(", si_timer1=%u, si_timer2=%u",
323 tinfo
->_sifields
._timer
._timer1
,
324 tinfo
->_sifields
._timer
._timer2
);
327 qemu_log(", si_band=%d, si_fd=%d",
328 tinfo
->_sifields
._sigpoll
._band
,
329 tinfo
->_sifields
._sigpoll
._fd
);
332 qemu_log(", si_addr=");
333 print_pointer(tinfo
->_sifields
._sigfault
._addr
, 1);
336 qemu_log(", si_pid=%u, si_uid=%u, si_status=%d"
337 ", si_utime=" TARGET_ABI_FMT_ld
338 ", si_stime=" TARGET_ABI_FMT_ld
,
339 (unsigned int)(tinfo
->_sifields
._sigchld
._pid
),
340 (unsigned int)(tinfo
->_sifields
._sigchld
._uid
),
341 tinfo
->_sifields
._sigchld
._status
,
342 tinfo
->_sifields
._sigchld
._utime
,
343 tinfo
->_sifields
._sigchld
._stime
);
346 qemu_log(", si_pid=%u, si_uid=%u, si_sigval=" TARGET_ABI_FMT_ld
,
347 (unsigned int)tinfo
->_sifields
._rt
._pid
,
348 (unsigned int)tinfo
->_sifields
._rt
._uid
,
349 tinfo
->_sifields
._rt
._sigval
.sival_ptr
);
352 g_assert_not_reached();
358 print_sockaddr(abi_ulong addr
, abi_long addrlen
, int last
)
360 struct target_sockaddr
*sa
;
364 sa
= lock_user(VERIFY_READ
, addr
, addrlen
, 1);
366 sa_family
= tswap16(sa
->sa_family
);
369 struct target_sockaddr_un
*un
= (struct target_sockaddr_un
*)sa
;
370 qemu_log("{sun_family=AF_UNIX,sun_path=\"");
371 for (i
= 0; i
< addrlen
-
372 offsetof(struct target_sockaddr_un
, sun_path
) &&
373 un
->sun_path
[i
]; i
++) {
374 qemu_log("%c", un
->sun_path
[i
]);
380 struct target_sockaddr_in
*in
= (struct target_sockaddr_in
*)sa
;
381 uint8_t *c
= (uint8_t *)&in
->sin_addr
.s_addr
;
382 qemu_log("{sin_family=AF_INET,sin_port=htons(%d),",
383 ntohs(in
->sin_port
));
384 qemu_log("sin_addr=inet_addr(\"%d.%d.%d.%d\")",
385 c
[0], c
[1], c
[2], c
[3]);
390 struct target_sockaddr_ll
*ll
= (struct target_sockaddr_ll
*)sa
;
391 uint8_t *c
= (uint8_t *)&ll
->sll_addr
;
392 qemu_log("{sll_family=AF_PACKET,"
393 "sll_protocol=htons(0x%04x),if%d,pkttype=",
394 ntohs(ll
->sll_protocol
), ll
->sll_ifindex
);
395 switch (ll
->sll_pkttype
) {
397 qemu_log("PACKET_HOST");
399 case PACKET_BROADCAST
:
400 qemu_log("PACKET_BROADCAST");
402 case PACKET_MULTICAST
:
403 qemu_log("PACKET_MULTICAST");
405 case PACKET_OTHERHOST
:
406 qemu_log("PACKET_OTHERHOST");
408 case PACKET_OUTGOING
:
409 qemu_log("PACKET_OUTGOING");
412 qemu_log("%d", ll
->sll_pkttype
);
415 qemu_log(",sll_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
416 c
[0], c
[1], c
[2], c
[3], c
[4], c
[5], c
[6], c
[7]);
421 struct target_sockaddr_nl
*nl
= (struct target_sockaddr_nl
*)sa
;
422 qemu_log("{nl_family=AF_NETLINK,nl_pid=%u,nl_groups=%u}",
423 tswap32(nl
->nl_pid
), tswap32(nl
->nl_groups
));
427 qemu_log("{sa_family=%d, sa_data={", sa
->sa_family
);
428 for (i
= 0; i
< 13; i
++) {
429 qemu_log("%02x, ", sa
->sa_data
[i
]);
431 qemu_log("%02x}", sa
->sa_data
[i
]);
435 unlock_user(sa
, addr
, 0);
437 print_raw_param("0x"TARGET_ABI_FMT_lx
, addr
, 0);
439 qemu_log(", "TARGET_ABI_FMT_ld
"%s", addrlen
, get_comma(last
));
443 print_socket_domain(int domain
)
453 qemu_log("PF_NETLINK");
456 qemu_log("PF_PACKET");
459 qemu_log("%d", domain
);
465 print_socket_type(int type
)
467 switch (type
& TARGET_SOCK_TYPE_MASK
) {
468 case TARGET_SOCK_DGRAM
:
469 qemu_log("SOCK_DGRAM");
471 case TARGET_SOCK_STREAM
:
472 qemu_log("SOCK_STREAM");
474 case TARGET_SOCK_RAW
:
475 qemu_log("SOCK_RAW");
477 case TARGET_SOCK_RDM
:
478 qemu_log("SOCK_RDM");
480 case TARGET_SOCK_SEQPACKET
:
481 qemu_log("SOCK_SEQPACKET");
483 case TARGET_SOCK_PACKET
:
484 qemu_log("SOCK_PACKET");
487 if (type
& TARGET_SOCK_CLOEXEC
) {
488 qemu_log("|SOCK_CLOEXEC");
490 if (type
& TARGET_SOCK_NONBLOCK
) {
491 qemu_log("|SOCK_NONBLOCK");
496 print_socket_protocol(int domain
, int type
, int protocol
)
498 if (domain
== AF_PACKET
||
499 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
502 qemu_log("ETH_P_ALL");
505 qemu_log("%d", protocol
);
510 if (domain
== PF_NETLINK
) {
513 qemu_log("NETLINK_ROUTE");
516 qemu_log("NETLINK_UNUSED");
518 case NETLINK_USERSOCK
:
519 qemu_log("NETLINK_USERSOCK");
521 case NETLINK_FIREWALL
:
522 qemu_log("NETLINK_FIREWALL");
524 case NETLINK_SOCK_DIAG
:
525 qemu_log("NETLINK_SOCK_DIAG");
528 qemu_log("NETLINK_NFLOG");
531 qemu_log("NETLINK_XFRM");
533 case NETLINK_SELINUX
:
534 qemu_log("NETLINK_SELINUX");
537 qemu_log("NETLINK_ISCSI");
540 qemu_log("NETLINK_AUDIT");
542 case NETLINK_FIB_LOOKUP
:
543 qemu_log("NETLINK_FIB_LOOKUP");
545 case NETLINK_CONNECTOR
:
546 qemu_log("NETLINK_CONNECTOR");
548 case NETLINK_NETFILTER
:
549 qemu_log("NETLINK_NETFILTER");
552 qemu_log("NETLINK_IP6_FW");
554 case NETLINK_DNRTMSG
:
555 qemu_log("NETLINK_DNRTMSG");
557 case NETLINK_KOBJECT_UEVENT
:
558 qemu_log("NETLINK_KOBJECT_UEVENT");
560 case NETLINK_GENERIC
:
561 qemu_log("NETLINK_GENERIC");
563 case NETLINK_SCSITRANSPORT
:
564 qemu_log("NETLINK_SCSITRANSPORT");
566 case NETLINK_ECRYPTFS
:
567 qemu_log("NETLINK_ECRYPTFS");
570 qemu_log("NETLINK_RDMA");
573 qemu_log("NETLINK_CRYPTO");
576 qemu_log("NETLINK_SMC");
579 qemu_log("%d", protocol
);
587 qemu_log("IPPROTO_IP");
590 qemu_log("IPPROTO_TCP");
593 qemu_log("IPPROTO_UDP");
596 qemu_log("IPPROTO_RAW");
599 qemu_log("%d", protocol
);
605 #ifdef TARGET_NR__newselect
607 print_fdset(int n
, abi_ulong target_fds_addr
)
613 if( target_fds_addr
) {
614 abi_long
*target_fds
;
616 target_fds
= lock_user(VERIFY_READ
,
618 sizeof(*target_fds
)*(n
/ TARGET_ABI_BITS
+ 1),
624 for (i
=n
; i
>=0; i
--) {
625 if ((tswapal(target_fds
[i
/ TARGET_ABI_BITS
]) >>
626 (i
& (TARGET_ABI_BITS
- 1))) & 1) {
627 qemu_log("%s%d", get_comma(first
), i
);
631 unlock_user(target_fds
, target_fds_addr
, 0);
638 * Sysycall specific output functions
642 #ifdef TARGET_NR__newselect
644 print_newselect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
645 abi_long arg1
, abi_long arg2
, abi_long arg3
,
646 abi_long arg4
, abi_long arg5
, abi_long arg6
)
648 print_syscall_prologue(name
);
649 print_fdset(arg1
, arg2
);
651 print_fdset(arg1
, arg3
);
653 print_fdset(arg1
, arg4
);
655 print_timeval(arg5
, 1);
656 print_syscall_epilogue(name
);
660 #ifdef TARGET_NR_semctl
662 print_semctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
663 abi_long arg1
, abi_long arg2
, abi_long arg3
,
664 abi_long arg4
, abi_long arg5
, abi_long arg6
)
666 qemu_log("%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
667 name
->name
, arg1
, arg2
);
669 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
675 print_ipc(CPUArchState
*cpu_env
, const struct syscallname
*name
,
676 abi_long arg1
, abi_long arg2
, abi_long arg3
,
677 abi_long arg4
, abi_long arg5
, abi_long arg6
)
681 qemu_log("semctl(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
684 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
688 TARGET_ABI_FMT_ld
","
689 TARGET_ABI_FMT_ld
","
690 TARGET_ABI_FMT_ld
","
693 name
->name
, arg1
, arg2
, arg3
, arg4
);
699 * Variants for the return value output function
703 print_syscall_err(abi_long ret
)
709 errstr
= target_strerror(-ret
);
711 qemu_log("-1 errno=%d (%s)", (int)-ret
, errstr
);
719 print_syscall_ret_addr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
720 abi_long ret
, abi_long arg0
, abi_long arg1
,
721 abi_long arg2
, abi_long arg3
, abi_long arg4
,
724 if (!print_syscall_err(ret
)) {
725 qemu_log("0x" TARGET_ABI_FMT_lx
, ret
);
730 #if 0 /* currently unused */
732 print_syscall_ret_raw(struct syscallname
*name
, abi_long ret
)
734 qemu_log(" = 0x" TARGET_ABI_FMT_lx
"\n", ret
);
738 #ifdef TARGET_NR__newselect
740 print_syscall_ret_newselect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
741 abi_long ret
, abi_long arg0
, abi_long arg1
,
742 abi_long arg2
, abi_long arg3
, abi_long arg4
,
745 if (!print_syscall_err(ret
)) {
746 qemu_log(" = 0x" TARGET_ABI_FMT_lx
" (", ret
);
747 print_fdset(arg0
, arg1
);
749 print_fdset(arg0
, arg2
);
751 print_fdset(arg0
, arg3
);
753 print_timeval(arg4
, 1);
761 /* special meanings of adjtimex()' non-negative return values */
762 #define TARGET_TIME_OK 0 /* clock synchronized, no leap second */
763 #define TARGET_TIME_INS 1 /* insert leap second */
764 #define TARGET_TIME_DEL 2 /* delete leap second */
765 #define TARGET_TIME_OOP 3 /* leap second in progress */
766 #define TARGET_TIME_WAIT 4 /* leap second has occurred */
767 #define TARGET_TIME_ERROR 5 /* clock not synchronized */
768 #ifdef TARGET_NR_adjtimex
770 print_syscall_ret_adjtimex(CPUArchState
*cpu_env
, const struct syscallname
*name
,
771 abi_long ret
, abi_long arg0
, abi_long arg1
,
772 abi_long arg2
, abi_long arg3
, abi_long arg4
,
775 if (!print_syscall_err(ret
)) {
776 qemu_log(TARGET_ABI_FMT_ld
, ret
);
779 qemu_log(" TIME_OK (clock synchronized, no leap second)");
781 case TARGET_TIME_INS
:
782 qemu_log(" TIME_INS (insert leap second)");
784 case TARGET_TIME_DEL
:
785 qemu_log(" TIME_DEL (delete leap second)");
787 case TARGET_TIME_OOP
:
788 qemu_log(" TIME_OOP (leap second in progress)");
790 case TARGET_TIME_WAIT
:
791 qemu_log(" TIME_WAIT (leap second has occurred)");
793 case TARGET_TIME_ERROR
:
794 qemu_log(" TIME_ERROR (clock not synchronized)");
803 #if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
805 print_syscall_ret_clock_gettime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
806 abi_long ret
, abi_long arg0
, abi_long arg1
,
807 abi_long arg2
, abi_long arg3
, abi_long arg4
,
810 if (!print_syscall_err(ret
)) {
811 qemu_log(TARGET_ABI_FMT_ld
, ret
);
813 print_timespec(arg1
, 1);
819 #define print_syscall_ret_clock_getres print_syscall_ret_clock_gettime
822 #if defined(TARGET_NR_clock_gettime64)
824 print_syscall_ret_clock_gettime64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
825 abi_long ret
, abi_long arg0
, abi_long arg1
,
826 abi_long arg2
, abi_long arg3
, abi_long arg4
,
829 if (!print_syscall_err(ret
)) {
830 qemu_log(TARGET_ABI_FMT_ld
, ret
);
832 print_timespec64(arg1
, 1);
840 #ifdef TARGET_NR_gettimeofday
842 print_syscall_ret_gettimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
843 abi_long ret
, abi_long arg0
, abi_long arg1
,
844 abi_long arg2
, abi_long arg3
, abi_long arg4
,
847 if (!print_syscall_err(ret
)) {
848 qemu_log(TARGET_ABI_FMT_ld
, ret
);
850 print_timeval(arg0
, 0);
851 print_timezone(arg1
, 1);
859 #ifdef TARGET_NR_getitimer
861 print_syscall_ret_getitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
862 abi_long ret
, abi_long arg0
, abi_long arg1
,
863 abi_long arg2
, abi_long arg3
, abi_long arg4
,
866 if (!print_syscall_err(ret
)) {
867 qemu_log(TARGET_ABI_FMT_ld
, ret
);
869 print_itimerval(arg1
, 1);
878 #ifdef TARGET_NR_getitimer
880 print_syscall_ret_setitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
881 abi_long ret
, abi_long arg0
, abi_long arg1
,
882 abi_long arg2
, abi_long arg3
, abi_long arg4
,
885 if (!print_syscall_err(ret
)) {
886 qemu_log(TARGET_ABI_FMT_ld
, ret
);
887 qemu_log(" (old_value = ");
888 print_itimerval(arg2
, 1);
896 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr) \
897 || defined(TARGGET_NR_flistxattr)
899 print_syscall_ret_listxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
900 abi_long ret
, abi_long arg0
, abi_long arg1
,
901 abi_long arg2
, abi_long arg3
, abi_long arg4
,
904 if (!print_syscall_err(ret
)) {
905 qemu_log(TARGET_ABI_FMT_ld
, ret
);
906 qemu_log(" (list = ");
908 abi_long attr
= arg1
;
913 print_string(attr
, 1);
914 ret
-= target_strlen(attr
) + 1;
915 attr
+= target_strlen(attr
) + 1;
925 #define print_syscall_ret_llistxattr print_syscall_ret_listxattr
926 #define print_syscall_ret_flistxattr print_syscall_ret_listxattr
929 #ifdef TARGET_NR_ioctl
931 print_syscall_ret_ioctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
932 abi_long ret
, abi_long arg0
, abi_long arg1
,
933 abi_long arg2
, abi_long arg3
, abi_long arg4
,
936 if (!print_syscall_err(ret
)) {
937 qemu_log(TARGET_ABI_FMT_ld
, ret
);
939 const IOCTLEntry
*ie
;
940 const argtype
*arg_type
;
944 for (ie
= ioctl_entries
; ie
->target_cmd
!= 0; ie
++) {
945 if (ie
->target_cmd
== arg1
) {
950 if (ie
->target_cmd
== arg1
&&
951 (ie
->access
== IOC_R
|| ie
->access
== IOC_RW
)) {
952 arg_type
= ie
->arg_type
;
955 target_size
= thunk_type_size(arg_type
, 0);
956 argptr
= lock_user(VERIFY_READ
, arg2
, target_size
, 1);
958 thunk_print(argptr
, arg_type
);
959 unlock_user(argptr
, arg2
, target_size
);
961 print_pointer(arg2
, 1);
970 UNUSED
static const struct flags access_flags
[] = {
971 FLAG_GENERIC_MASK(F_OK
, R_OK
| W_OK
| X_OK
),
978 UNUSED
static const struct flags at_file_flags
[] = {
980 FLAG_GENERIC(AT_EACCESS
),
982 #ifdef AT_SYMLINK_NOFOLLOW
983 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
988 UNUSED
static const struct flags unlinkat_flags
[] = {
990 FLAG_GENERIC(AT_REMOVEDIR
),
995 UNUSED
static const struct flags mode_flags
[] = {
996 FLAG_GENERIC(S_IFSOCK
),
997 FLAG_GENERIC(S_IFLNK
),
998 FLAG_GENERIC(S_IFREG
),
999 FLAG_GENERIC(S_IFBLK
),
1000 FLAG_GENERIC(S_IFDIR
),
1001 FLAG_GENERIC(S_IFCHR
),
1002 FLAG_GENERIC(S_IFIFO
),
1006 UNUSED
static const struct flags open_access_flags
[] = {
1007 FLAG_TARGET_MASK(O_RDONLY
, O_ACCMODE
),
1008 FLAG_TARGET_MASK(O_WRONLY
, O_ACCMODE
),
1009 FLAG_TARGET_MASK(O_RDWR
, O_ACCMODE
),
1013 UNUSED
static const struct flags open_flags
[] = {
1014 FLAG_TARGET(O_APPEND
),
1015 FLAG_TARGET(O_CREAT
),
1016 FLAG_TARGET(O_DIRECTORY
),
1017 FLAG_TARGET(O_EXCL
),
1018 #if TARGET_O_LARGEFILE != 0
1019 FLAG_TARGET(O_LARGEFILE
),
1021 FLAG_TARGET(O_NOCTTY
),
1022 FLAG_TARGET(O_NOFOLLOW
),
1023 FLAG_TARGET(O_NONBLOCK
), /* also O_NDELAY */
1024 FLAG_TARGET(O_DSYNC
),
1025 FLAG_TARGET(__O_SYNC
),
1026 FLAG_TARGET(O_TRUNC
),
1028 FLAG_TARGET(O_DIRECT
),
1031 FLAG_TARGET(O_NOATIME
),
1034 FLAG_TARGET(O_CLOEXEC
),
1037 FLAG_TARGET(O_PATH
),
1040 FLAG_TARGET(O_TMPFILE
),
1041 FLAG_TARGET(__O_TMPFILE
),
1046 UNUSED
static const struct flags mount_flags
[] = {
1048 FLAG_GENERIC(MS_BIND
),
1051 FLAG_GENERIC(MS_DIRSYNC
),
1053 FLAG_GENERIC(MS_MANDLOCK
),
1055 FLAG_GENERIC(MS_MOVE
),
1057 FLAG_GENERIC(MS_NOATIME
),
1058 FLAG_GENERIC(MS_NODEV
),
1059 FLAG_GENERIC(MS_NODIRATIME
),
1060 FLAG_GENERIC(MS_NOEXEC
),
1061 FLAG_GENERIC(MS_NOSUID
),
1062 FLAG_GENERIC(MS_RDONLY
),
1064 FLAG_GENERIC(MS_RELATIME
),
1066 FLAG_GENERIC(MS_REMOUNT
),
1067 FLAG_GENERIC(MS_SYNCHRONOUS
),
1071 UNUSED
static const struct flags umount2_flags
[] = {
1073 FLAG_GENERIC(MNT_FORCE
),
1076 FLAG_GENERIC(MNT_DETACH
),
1079 FLAG_GENERIC(MNT_EXPIRE
),
1084 UNUSED
static const struct flags mmap_prot_flags
[] = {
1085 FLAG_GENERIC_MASK(PROT_NONE
, PROT_READ
| PROT_WRITE
| PROT_EXEC
),
1086 FLAG_GENERIC(PROT_EXEC
),
1087 FLAG_GENERIC(PROT_READ
),
1088 FLAG_GENERIC(PROT_WRITE
),
1089 FLAG_TARGET(PROT_SEM
),
1090 FLAG_GENERIC(PROT_GROWSDOWN
),
1091 FLAG_GENERIC(PROT_GROWSUP
),
1095 UNUSED
static const struct flags mmap_flags
[] = {
1096 FLAG_TARGET_MASK(MAP_SHARED
, MAP_TYPE
),
1097 FLAG_TARGET_MASK(MAP_PRIVATE
, MAP_TYPE
),
1098 FLAG_TARGET_MASK(MAP_SHARED_VALIDATE
, MAP_TYPE
),
1099 FLAG_TARGET(MAP_ANONYMOUS
),
1100 FLAG_TARGET(MAP_DENYWRITE
),
1101 FLAG_TARGET(MAP_EXECUTABLE
),
1102 FLAG_TARGET(MAP_FIXED
),
1103 FLAG_TARGET(MAP_FIXED_NOREPLACE
),
1104 FLAG_TARGET(MAP_GROWSDOWN
),
1105 FLAG_TARGET(MAP_HUGETLB
),
1106 FLAG_TARGET(MAP_LOCKED
),
1107 FLAG_TARGET(MAP_NONBLOCK
),
1108 FLAG_TARGET(MAP_NORESERVE
),
1109 FLAG_TARGET(MAP_POPULATE
),
1110 FLAG_TARGET(MAP_STACK
),
1111 FLAG_TARGET(MAP_SYNC
),
1112 #if TARGET_MAP_UNINITIALIZED != 0
1113 FLAG_TARGET(MAP_UNINITIALIZED
),
1119 # define CLONE_PIDFD 0x00001000
1122 UNUSED
static const struct flags clone_flags
[] = {
1123 FLAG_GENERIC(CLONE_VM
),
1124 FLAG_GENERIC(CLONE_FS
),
1125 FLAG_GENERIC(CLONE_FILES
),
1126 FLAG_GENERIC(CLONE_SIGHAND
),
1127 FLAG_GENERIC(CLONE_PIDFD
),
1128 FLAG_GENERIC(CLONE_PTRACE
),
1129 FLAG_GENERIC(CLONE_VFORK
),
1130 FLAG_GENERIC(CLONE_PARENT
),
1131 FLAG_GENERIC(CLONE_THREAD
),
1132 FLAG_GENERIC(CLONE_NEWNS
),
1133 FLAG_GENERIC(CLONE_SYSVSEM
),
1134 FLAG_GENERIC(CLONE_SETTLS
),
1135 FLAG_GENERIC(CLONE_PARENT_SETTID
),
1136 FLAG_GENERIC(CLONE_CHILD_CLEARTID
),
1137 FLAG_GENERIC(CLONE_DETACHED
),
1138 FLAG_GENERIC(CLONE_UNTRACED
),
1139 FLAG_GENERIC(CLONE_CHILD_SETTID
),
1140 #if defined(CLONE_NEWUTS)
1141 FLAG_GENERIC(CLONE_NEWUTS
),
1143 #if defined(CLONE_NEWIPC)
1144 FLAG_GENERIC(CLONE_NEWIPC
),
1146 #if defined(CLONE_NEWUSER)
1147 FLAG_GENERIC(CLONE_NEWUSER
),
1149 #if defined(CLONE_NEWPID)
1150 FLAG_GENERIC(CLONE_NEWPID
),
1152 #if defined(CLONE_NEWNET)
1153 FLAG_GENERIC(CLONE_NEWNET
),
1155 #if defined(CLONE_NEWCGROUP)
1156 FLAG_GENERIC(CLONE_NEWCGROUP
),
1158 #if defined(CLONE_NEWTIME)
1159 FLAG_GENERIC(CLONE_NEWTIME
),
1161 #if defined(CLONE_IO)
1162 FLAG_GENERIC(CLONE_IO
),
1167 UNUSED
static const struct flags execveat_flags
[] = {
1168 #ifdef AT_EMPTY_PATH
1169 FLAG_GENERIC(AT_EMPTY_PATH
),
1171 #ifdef AT_SYMLINK_NOFOLLOW
1172 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
1177 UNUSED
static const struct flags msg_flags
[] = {
1179 FLAG_GENERIC(MSG_CONFIRM
),
1180 FLAG_GENERIC(MSG_DONTROUTE
),
1181 FLAG_GENERIC(MSG_DONTWAIT
),
1182 FLAG_GENERIC(MSG_EOR
),
1183 FLAG_GENERIC(MSG_MORE
),
1184 FLAG_GENERIC(MSG_NOSIGNAL
),
1185 FLAG_GENERIC(MSG_OOB
),
1187 FLAG_GENERIC(MSG_CMSG_CLOEXEC
),
1188 FLAG_GENERIC(MSG_ERRQUEUE
),
1189 FLAG_GENERIC(MSG_PEEK
),
1190 FLAG_GENERIC(MSG_TRUNC
),
1191 FLAG_GENERIC(MSG_WAITALL
),
1193 FLAG_GENERIC(MSG_CTRUNC
),
1197 UNUSED
static const struct flags statx_flags
[] = {
1198 #ifdef AT_EMPTY_PATH
1199 FLAG_GENERIC(AT_EMPTY_PATH
),
1201 #ifdef AT_NO_AUTOMOUNT
1202 FLAG_GENERIC(AT_NO_AUTOMOUNT
),
1204 #ifdef AT_SYMLINK_NOFOLLOW
1205 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
1207 #ifdef AT_STATX_SYNC_AS_STAT
1208 FLAG_GENERIC_MASK(AT_STATX_SYNC_AS_STAT
, AT_STATX_SYNC_TYPE
),
1210 #ifdef AT_STATX_FORCE_SYNC
1211 FLAG_GENERIC_MASK(AT_STATX_FORCE_SYNC
, AT_STATX_SYNC_TYPE
),
1213 #ifdef AT_STATX_DONT_SYNC
1214 FLAG_GENERIC_MASK(AT_STATX_DONT_SYNC
, AT_STATX_SYNC_TYPE
),
1219 UNUSED
static const struct flags statx_mask
[] = {
1220 /* This must come first, because it includes everything. */
1222 FLAG_GENERIC(STATX_ALL
),
1224 /* This must come second; it includes everything except STATX_BTIME. */
1225 #ifdef STATX_BASIC_STATS
1226 FLAG_GENERIC(STATX_BASIC_STATS
),
1229 FLAG_GENERIC(STATX_TYPE
),
1232 FLAG_GENERIC(STATX_MODE
),
1235 FLAG_GENERIC(STATX_NLINK
),
1238 FLAG_GENERIC(STATX_UID
),
1241 FLAG_GENERIC(STATX_GID
),
1244 FLAG_GENERIC(STATX_ATIME
),
1247 FLAG_GENERIC(STATX_MTIME
),
1250 FLAG_GENERIC(STATX_CTIME
),
1253 FLAG_GENERIC(STATX_INO
),
1256 FLAG_GENERIC(STATX_SIZE
),
1259 FLAG_GENERIC(STATX_BLOCKS
),
1262 FLAG_GENERIC(STATX_BTIME
),
1267 UNUSED
static const struct flags falloc_flags
[] = {
1268 FLAG_GENERIC(FALLOC_FL_KEEP_SIZE
),
1269 FLAG_GENERIC(FALLOC_FL_PUNCH_HOLE
),
1270 #ifdef FALLOC_FL_NO_HIDE_STALE
1271 FLAG_GENERIC(FALLOC_FL_NO_HIDE_STALE
),
1273 #ifdef FALLOC_FL_COLLAPSE_RANGE
1274 FLAG_GENERIC(FALLOC_FL_COLLAPSE_RANGE
),
1276 #ifdef FALLOC_FL_ZERO_RANGE
1277 FLAG_GENERIC(FALLOC_FL_ZERO_RANGE
),
1279 #ifdef FALLOC_FL_INSERT_RANGE
1280 FLAG_GENERIC(FALLOC_FL_INSERT_RANGE
),
1282 #ifdef FALLOC_FL_UNSHARE_RANGE
1283 FLAG_GENERIC(FALLOC_FL_UNSHARE_RANGE
),
1287 UNUSED
static const struct flags termios_iflags
[] = {
1288 FLAG_TARGET(IGNBRK
),
1289 FLAG_TARGET(BRKINT
),
1290 FLAG_TARGET(IGNPAR
),
1291 FLAG_TARGET(PARMRK
),
1293 FLAG_TARGET(ISTRIP
),
1301 FLAG_TARGET(IMAXBEL
),
1306 UNUSED
static const struct flags termios_oflags
[] = {
1312 FLAG_TARGET(ONLRET
),
1318 UNUSED
static struct enums termios_oflags_NLDLY
[] = {
1324 UNUSED
static struct enums termios_oflags_CRDLY
[] = {
1332 UNUSED
static struct enums termios_oflags_TABDLY
[] = {
1340 UNUSED
static struct enums termios_oflags_VTDLY
[] = {
1346 UNUSED
static struct enums termios_oflags_FFDLY
[] = {
1352 UNUSED
static struct enums termios_oflags_BSDLY
[] = {
1358 UNUSED
static struct enums termios_cflags_CBAUD
[] = {
1373 ENUM_TARGET(B19200
),
1374 ENUM_TARGET(B38400
),
1375 ENUM_TARGET(B57600
),
1376 ENUM_TARGET(B115200
),
1377 ENUM_TARGET(B230400
),
1378 ENUM_TARGET(B460800
),
1382 UNUSED
static struct enums termios_cflags_CSIZE
[] = {
1390 UNUSED
static const struct flags termios_cflags
[] = {
1391 FLAG_TARGET(CSTOPB
),
1393 FLAG_TARGET(PARENB
),
1394 FLAG_TARGET(PARODD
),
1396 FLAG_TARGET(CLOCAL
),
1397 FLAG_TARGET(CRTSCTS
),
1401 UNUSED
static const struct flags termios_lflags
[] = {
1403 FLAG_TARGET(ICANON
),
1408 FLAG_TARGET(ECHONL
),
1409 FLAG_TARGET(NOFLSH
),
1410 FLAG_TARGET(TOSTOP
),
1411 FLAG_TARGET(ECHOCTL
),
1412 FLAG_TARGET(ECHOPRT
),
1413 FLAG_TARGET(ECHOKE
),
1414 FLAG_TARGET(FLUSHO
),
1415 FLAG_TARGET(PENDIN
),
1416 FLAG_TARGET(IEXTEN
),
1417 FLAG_TARGET(EXTPROC
),
1421 #ifdef TARGET_NR_mlockall
1422 static const struct flags mlockall_flags
[] = {
1423 FLAG_TARGET(MCL_CURRENT
),
1424 FLAG_TARGET(MCL_FUTURE
),
1426 FLAG_TARGET(MCL_ONFAULT
),
1432 /* IDs of the various system clocks */
1433 #define TARGET_CLOCK_REALTIME 0
1434 #define TARGET_CLOCK_MONOTONIC 1
1435 #define TARGET_CLOCK_PROCESS_CPUTIME_ID 2
1436 #define TARGET_CLOCK_THREAD_CPUTIME_ID 3
1437 #define TARGET_CLOCK_MONOTONIC_RAW 4
1438 #define TARGET_CLOCK_REALTIME_COARSE 5
1439 #define TARGET_CLOCK_MONOTONIC_COARSE 6
1440 #define TARGET_CLOCK_BOOTTIME 7
1441 #define TARGET_CLOCK_REALTIME_ALARM 8
1442 #define TARGET_CLOCK_BOOTTIME_ALARM 9
1443 #define TARGET_CLOCK_SGI_CYCLE 10
1444 #define TARGET_CLOCK_TAI 11
1446 UNUSED
static struct enums clockids
[] = {
1447 ENUM_TARGET(CLOCK_REALTIME
),
1448 ENUM_TARGET(CLOCK_MONOTONIC
),
1449 ENUM_TARGET(CLOCK_PROCESS_CPUTIME_ID
),
1450 ENUM_TARGET(CLOCK_THREAD_CPUTIME_ID
),
1451 ENUM_TARGET(CLOCK_MONOTONIC_RAW
),
1452 ENUM_TARGET(CLOCK_REALTIME_COARSE
),
1453 ENUM_TARGET(CLOCK_MONOTONIC_COARSE
),
1454 ENUM_TARGET(CLOCK_BOOTTIME
),
1455 ENUM_TARGET(CLOCK_REALTIME_ALARM
),
1456 ENUM_TARGET(CLOCK_BOOTTIME_ALARM
),
1457 ENUM_TARGET(CLOCK_SGI_CYCLE
),
1458 ENUM_TARGET(CLOCK_TAI
),
1462 UNUSED
static struct enums itimer_types
[] = {
1463 ENUM_GENERIC(ITIMER_REAL
),
1464 ENUM_GENERIC(ITIMER_VIRTUAL
),
1465 ENUM_GENERIC(ITIMER_PROF
),
1470 * print_xxx utility functions. These are used to print syscall
1471 * parameters in certain format. All of these have parameter
1472 * named 'last'. This parameter is used to add comma to output
1479 return ((last
) ? "" : ",");
1483 print_flags(const struct flags
*f
, abi_long flags
, int last
)
1485 const char *sep
= "";
1488 for (n
= 0; f
->f_string
!= NULL
; f
++) {
1489 if ((flags
& f
->f_mask
) == f
->f_value
) {
1490 qemu_log("%s%s", sep
, f
->f_string
);
1491 flags
&= ~f
->f_mask
;
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_both(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
,
3776 abi_ulong argp
= arg0
;
3777 if (!(v
= lock_user(VERIFY_READ
, argp
, 6 * sizeof(abi_ulong
), 1)))
3779 arg0
= tswapal(v
[0]);
3780 arg1
= tswapal(v
[1]);
3781 arg2
= tswapal(v
[2]);
3782 arg3
= tswapal(v
[3]);
3783 arg4
= tswapal(v
[4]);
3784 arg5
= tswapal(v
[5]);
3785 unlock_user(v
, argp
, 0);
3787 print_syscall_prologue(name
);
3788 print_pointer(arg0
, 0);
3789 print_raw_param("%d", arg1
, 0);
3790 print_flags(mmap_prot_flags
, arg2
, 0);
3791 print_flags(mmap_flags
, arg3
, 0);
3792 print_raw_param("%d", arg4
, 0);
3793 print_raw_param("%#x", arg5
, 1);
3794 print_syscall_epilogue(name
);
3798 #if defined(TARGET_NR_mmap)
3800 print_mmap(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3801 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3802 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3804 return print_mmap_both(cpu_env
, name
, arg0
, arg1
, arg2
, arg3
,
3806 #if defined(TARGET_NR_mmap2)
3815 #if defined(TARGET_NR_mmap2)
3817 print_mmap2(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3818 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3819 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3821 return print_mmap_both(cpu_env
, name
, arg0
, arg1
, arg2
, arg3
,
3826 #ifdef TARGET_NR_mprotect
3828 print_mprotect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3829 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3830 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3832 print_syscall_prologue(name
);
3833 print_pointer(arg0
, 0);
3834 print_raw_param("%d", arg1
, 0);
3835 print_flags(mmap_prot_flags
, arg2
, 1);
3836 print_syscall_epilogue(name
);
3840 #ifdef TARGET_NR_munmap
3842 print_munmap(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3843 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3844 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3846 print_syscall_prologue(name
);
3847 print_pointer(arg0
, 0);
3848 print_raw_param("%d", arg1
, 1);
3849 print_syscall_epilogue(name
);
3853 #ifdef TARGET_NR_futex
3854 static void print_futex_op(int cmd
, int last
)
3856 static const char * const futex_names
[] = {
3857 #define NAME(X) [X] = #X
3861 NAME(FUTEX_REQUEUE
),
3862 NAME(FUTEX_CMP_REQUEUE
),
3863 NAME(FUTEX_WAKE_OP
),
3864 NAME(FUTEX_LOCK_PI
),
3865 NAME(FUTEX_UNLOCK_PI
),
3866 NAME(FUTEX_TRYLOCK_PI
),
3867 NAME(FUTEX_WAIT_BITSET
),
3868 NAME(FUTEX_WAKE_BITSET
),
3869 NAME(FUTEX_WAIT_REQUEUE_PI
),
3870 NAME(FUTEX_CMP_REQUEUE_PI
),
3871 NAME(FUTEX_LOCK_PI2
),
3875 unsigned base_cmd
= cmd
& FUTEX_CMD_MASK
;
3877 if (base_cmd
< ARRAY_SIZE(futex_names
)) {
3879 (cmd
& FUTEX_PRIVATE_FLAG
? "FUTEX_PRIVATE_FLAG|" : ""),
3880 (cmd
& FUTEX_CLOCK_REALTIME
? "FUTEX_CLOCK_REALTIME|" : ""),
3881 futex_names
[base_cmd
]);
3883 qemu_log("0x%x", cmd
);
3888 print_futex(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3889 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3890 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3892 abi_long op
= arg1
& FUTEX_CMD_MASK
;
3893 print_syscall_prologue(name
);
3894 print_pointer(arg0
, 0);
3895 print_futex_op(arg1
, 0);
3896 print_raw_param(",%d", arg2
, 0);
3899 case FUTEX_WAIT_BITSET
:
3901 case FUTEX_LOCK_PI2
:
3902 case FUTEX_WAIT_REQUEUE_PI
:
3903 print_timespec(arg3
, 0);
3906 print_pointer(arg3
, 0);
3909 print_pointer(arg4
, 0);
3910 print_raw_param("%d", arg4
, 1);
3911 print_syscall_epilogue(name
);
3915 #ifdef TARGET_NR_prlimit64
3916 static const char *target_ressource_string(abi_ulong r
)
3918 #define RET_RES_ENTRY(res) case TARGET_##res: return #res;
3920 RET_RES_ENTRY(RLIMIT_AS
);
3921 RET_RES_ENTRY(RLIMIT_CORE
);
3922 RET_RES_ENTRY(RLIMIT_CPU
);
3923 RET_RES_ENTRY(RLIMIT_DATA
);
3924 RET_RES_ENTRY(RLIMIT_FSIZE
);
3925 RET_RES_ENTRY(RLIMIT_LOCKS
);
3926 RET_RES_ENTRY(RLIMIT_MEMLOCK
);
3927 RET_RES_ENTRY(RLIMIT_MSGQUEUE
);
3928 RET_RES_ENTRY(RLIMIT_NICE
);
3929 RET_RES_ENTRY(RLIMIT_NOFILE
);
3930 RET_RES_ENTRY(RLIMIT_NPROC
);
3931 RET_RES_ENTRY(RLIMIT_RSS
);
3932 RET_RES_ENTRY(RLIMIT_RTPRIO
);
3933 #ifdef RLIMIT_RTTIME
3934 RET_RES_ENTRY(RLIMIT_RTTIME
);
3936 RET_RES_ENTRY(RLIMIT_SIGPENDING
);
3937 RET_RES_ENTRY(RLIMIT_STACK
);
3941 #undef RET_RES_ENTRY
3945 print_rlimit64(abi_ulong rlim_addr
, int last
)
3948 struct target_rlimit64
*rl
;
3950 rl
= lock_user(VERIFY_READ
, rlim_addr
, sizeof(*rl
), 1);
3952 print_pointer(rlim_addr
, last
);
3955 print_raw_param64("{rlim_cur=%" PRId64
, tswap64(rl
->rlim_cur
), 0);
3956 print_raw_param64("rlim_max=%" PRId64
"}", tswap64(rl
->rlim_max
),
3958 unlock_user(rl
, rlim_addr
, 0);
3960 qemu_log("NULL%s", get_comma(last
));
3965 print_prlimit64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3966 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3967 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3969 const char *rlim_name
;
3971 print_syscall_prologue(name
);
3972 print_raw_param("%d", arg0
, 0);
3973 rlim_name
= target_ressource_string(arg1
);
3975 qemu_log("%s,", rlim_name
);
3977 print_raw_param("%d", arg1
, 0);
3979 print_rlimit64(arg2
, 0);
3980 print_pointer(arg3
, 1);
3981 print_syscall_epilogue(name
);
3985 print_syscall_ret_prlimit64(CPUArchState
*cpu_env
,
3986 const struct syscallname
*name
,
3987 abi_long ret
, abi_long arg0
, abi_long arg1
,
3988 abi_long arg2
, abi_long arg3
, abi_long arg4
,
3991 if (!print_syscall_err(ret
)) {
3992 qemu_log(TARGET_ABI_FMT_ld
, ret
);
3995 print_rlimit64(arg3
, 1);
4003 #ifdef TARGET_NR_kill
4005 print_kill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4006 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4007 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4009 print_syscall_prologue(name
);
4010 print_raw_param("%d", arg0
, 0);
4011 print_signal(arg1
, 1);
4012 print_syscall_epilogue(name
);
4016 #ifdef TARGET_NR_tkill
4018 print_tkill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4019 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4020 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4022 print_syscall_prologue(name
);
4023 print_raw_param("%d", arg0
, 0);
4024 print_signal(arg1
, 1);
4025 print_syscall_epilogue(name
);
4029 #ifdef TARGET_NR_tgkill
4031 print_tgkill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4032 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4033 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4035 print_syscall_prologue(name
);
4036 print_raw_param("%d", arg0
, 0);
4037 print_raw_param("%d", arg1
, 0);
4038 print_signal(arg2
, 1);
4039 print_syscall_epilogue(name
);
4043 #if defined(TARGET_NR_pread64) || defined(TARGET_NR_pwrite64)
4045 print_pread64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4046 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4047 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4049 if (regpairs_aligned(cpu_env
, TARGET_NR_pread64
)) {
4053 print_syscall_prologue(name
);
4054 print_raw_param("%d", arg0
, 0);
4055 print_pointer(arg1
, 0);
4056 print_raw_param("%d", arg2
, 0);
4057 print_raw_param("%" PRIu64
, target_offset64(arg3
, arg4
), 1);
4058 print_syscall_epilogue(name
);
4062 #ifdef TARGET_NR_statx
4064 print_statx(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4065 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4066 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4068 print_syscall_prologue(name
);
4069 print_at_dirfd(arg0
, 0);
4070 print_string(arg1
, 0);
4071 print_flags(statx_flags
, arg2
, 0);
4072 print_flags(statx_mask
, arg3
, 0);
4073 print_pointer(arg4
, 1);
4074 print_syscall_epilogue(name
);
4078 #ifdef TARGET_NR_ioctl
4080 print_ioctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4081 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4082 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4084 print_syscall_prologue(name
);
4085 print_raw_param("%d", arg0
, 0);
4087 const IOCTLEntry
*ie
;
4088 const argtype
*arg_type
;
4092 for (ie
= ioctl_entries
; ie
->target_cmd
!= 0; ie
++) {
4093 if (ie
->target_cmd
== arg1
) {
4098 if (ie
->target_cmd
== 0) {
4099 print_raw_param("%#x", arg1
, 0);
4100 print_raw_param("%#x", arg2
, 1);
4102 qemu_log("%s", ie
->name
);
4103 arg_type
= ie
->arg_type
;
4105 if (arg_type
[0] != TYPE_NULL
) {
4108 switch (arg_type
[0]) {
4110 print_pointer(arg2
, 1);
4115 print_raw_param("%d", arg2
, 1);
4118 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
4121 print_raw_param(TARGET_ABI_FMT_lu
, arg2
, 1);
4124 switch (ie
->access
) {
4126 print_pointer(arg2
, 1);
4131 target_size
= thunk_type_size(arg_type
, 0);
4132 argptr
= lock_user(VERIFY_READ
, arg2
, target_size
, 1);
4134 thunk_print(argptr
, arg_type
);
4135 unlock_user(argptr
, arg2
, target_size
);
4137 print_pointer(arg2
, 1);
4143 g_assert_not_reached();
4147 print_syscall_epilogue(name
);
4152 * An array of all of the syscalls we know about
4155 static const struct syscallname scnames
[] = {
4156 #include "strace.list"
4159 static int nsyscalls
= ARRAY_SIZE(scnames
);
4162 * The public interface to this module.
4165 print_syscall(CPUArchState
*cpu_env
, int num
,
4166 abi_long arg1
, abi_long arg2
, abi_long arg3
,
4167 abi_long arg4
, abi_long arg5
, abi_long arg6
)
4171 const char *format
= "%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
","
4172 TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
","
4173 TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
")";
4175 f
= qemu_log_trylock();
4179 fprintf(f
, "%d ", getpid());
4181 for (i
= 0; i
< nsyscalls
; i
++) {
4182 if (scnames
[i
].nr
== num
) {
4183 if (scnames
[i
].call
!= NULL
) {
4184 scnames
[i
].call(cpu_env
, &scnames
[i
], arg1
, arg2
, arg3
,
4187 /* XXX: this format system is broken because it uses
4188 host types and host pointers for strings */
4189 if (scnames
[i
].format
!= NULL
) {
4190 format
= scnames
[i
].format
;
4192 fprintf(f
, format
, scnames
[i
].name
, arg1
, arg2
,
4193 arg3
, arg4
, arg5
, arg6
);
4199 fprintf(f
, "Unknown syscall %d\n", num
);
4205 print_syscall_ret(CPUArchState
*cpu_env
, int num
, abi_long ret
,
4206 abi_long arg1
, abi_long arg2
, abi_long arg3
,
4207 abi_long arg4
, abi_long arg5
, abi_long arg6
)
4212 f
= qemu_log_trylock();
4217 for (i
= 0; i
< nsyscalls
; i
++) {
4218 if (scnames
[i
].nr
== num
) {
4219 if (scnames
[i
].result
!= NULL
) {
4220 scnames
[i
].result(cpu_env
, &scnames
[i
], ret
,
4224 if (!print_syscall_err(ret
)) {
4225 fprintf(f
, TARGET_ABI_FMT_ld
, ret
);
4235 void print_taken_signal(int target_signum
, const target_siginfo_t
*tinfo
)
4237 /* Print the strace output for a signal being taken:
4238 * --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
4242 f
= qemu_log_trylock();
4248 print_signal(target_signum
, 1);
4250 print_siginfo(tinfo
);
4251 fprintf(f
, " ---\n");