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
);
661 print_semctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
662 abi_long arg1
, abi_long arg2
, abi_long arg3
,
663 abi_long arg4
, abi_long arg5
, abi_long arg6
)
665 qemu_log("%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
666 name
->name
, arg1
, arg2
);
668 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
672 print_shmat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
673 abi_long arg0
, abi_long arg1
, abi_long arg2
,
674 abi_long arg3
, abi_long arg4
, abi_long arg5
)
676 static const struct flags shmat_flags
[] = {
677 FLAG_GENERIC(SHM_RND
),
678 FLAG_GENERIC(SHM_REMAP
),
679 FLAG_GENERIC(SHM_RDONLY
),
680 FLAG_GENERIC(SHM_EXEC
),
684 print_syscall_prologue(name
);
685 print_raw_param(TARGET_ABI_FMT_ld
, arg0
, 0);
686 print_pointer(arg1
, 0);
687 print_flags(shmat_flags
, arg2
, 1);
688 print_syscall_epilogue(name
);
693 print_ipc(CPUArchState
*cpu_env
, const struct syscallname
*name
,
694 abi_long arg1
, abi_long arg2
, abi_long arg3
,
695 abi_long arg4
, abi_long arg5
, abi_long arg6
)
699 print_semctl(cpu_env
, &(const struct syscallname
){ .name
= "semctl" },
700 arg2
, arg3
, arg4
, arg5
, 0, 0);
703 print_shmat(cpu_env
, &(const struct syscallname
){ .name
= "shmat" },
704 arg2
, arg5
, arg3
, 0, 0, 0);
708 TARGET_ABI_FMT_ld
","
709 TARGET_ABI_FMT_ld
","
710 TARGET_ABI_FMT_ld
","
713 name
->name
, arg1
, arg2
, arg3
, arg4
);
719 * Variants for the return value output function
723 print_syscall_err(abi_long ret
)
729 errstr
= target_strerror(-ret
);
731 qemu_log("-1 errno=%d (%s)", (int)-ret
, errstr
);
739 print_syscall_ret_addr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
740 abi_long ret
, abi_long arg0
, abi_long arg1
,
741 abi_long arg2
, abi_long arg3
, abi_long arg4
,
744 if (!print_syscall_err(ret
)) {
745 qemu_log("0x" TARGET_ABI_FMT_lx
, ret
);
750 #if 0 /* currently unused */
752 print_syscall_ret_raw(struct syscallname
*name
, abi_long ret
)
754 qemu_log(" = 0x" TARGET_ABI_FMT_lx
"\n", ret
);
758 #ifdef TARGET_NR__newselect
760 print_syscall_ret_newselect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
761 abi_long ret
, abi_long arg0
, abi_long arg1
,
762 abi_long arg2
, abi_long arg3
, abi_long arg4
,
765 if (!print_syscall_err(ret
)) {
766 qemu_log(" = 0x" TARGET_ABI_FMT_lx
" (", ret
);
767 print_fdset(arg0
, arg1
);
769 print_fdset(arg0
, arg2
);
771 print_fdset(arg0
, arg3
);
773 print_timeval(arg4
, 1);
781 /* special meanings of adjtimex()' non-negative return values */
782 #define TARGET_TIME_OK 0 /* clock synchronized, no leap second */
783 #define TARGET_TIME_INS 1 /* insert leap second */
784 #define TARGET_TIME_DEL 2 /* delete leap second */
785 #define TARGET_TIME_OOP 3 /* leap second in progress */
786 #define TARGET_TIME_WAIT 4 /* leap second has occurred */
787 #define TARGET_TIME_ERROR 5 /* clock not synchronized */
788 #ifdef TARGET_NR_adjtimex
790 print_syscall_ret_adjtimex(CPUArchState
*cpu_env
, const struct syscallname
*name
,
791 abi_long ret
, abi_long arg0
, abi_long arg1
,
792 abi_long arg2
, abi_long arg3
, abi_long arg4
,
795 if (!print_syscall_err(ret
)) {
796 qemu_log(TARGET_ABI_FMT_ld
, ret
);
799 qemu_log(" TIME_OK (clock synchronized, no leap second)");
801 case TARGET_TIME_INS
:
802 qemu_log(" TIME_INS (insert leap second)");
804 case TARGET_TIME_DEL
:
805 qemu_log(" TIME_DEL (delete leap second)");
807 case TARGET_TIME_OOP
:
808 qemu_log(" TIME_OOP (leap second in progress)");
810 case TARGET_TIME_WAIT
:
811 qemu_log(" TIME_WAIT (leap second has occurred)");
813 case TARGET_TIME_ERROR
:
814 qemu_log(" TIME_ERROR (clock not synchronized)");
823 #if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
825 print_syscall_ret_clock_gettime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
826 abi_long ret
, abi_long arg0
, abi_long arg1
,
827 abi_long arg2
, abi_long arg3
, abi_long arg4
,
830 if (!print_syscall_err(ret
)) {
831 qemu_log(TARGET_ABI_FMT_ld
, ret
);
833 print_timespec(arg1
, 1);
839 #define print_syscall_ret_clock_getres print_syscall_ret_clock_gettime
842 #if defined(TARGET_NR_clock_gettime64)
844 print_syscall_ret_clock_gettime64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
845 abi_long ret
, abi_long arg0
, abi_long arg1
,
846 abi_long arg2
, abi_long arg3
, abi_long arg4
,
849 if (!print_syscall_err(ret
)) {
850 qemu_log(TARGET_ABI_FMT_ld
, ret
);
852 print_timespec64(arg1
, 1);
860 #ifdef TARGET_NR_gettimeofday
862 print_syscall_ret_gettimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
863 abi_long ret
, abi_long arg0
, abi_long arg1
,
864 abi_long arg2
, abi_long arg3
, abi_long arg4
,
867 if (!print_syscall_err(ret
)) {
868 qemu_log(TARGET_ABI_FMT_ld
, ret
);
870 print_timeval(arg0
, 0);
871 print_timezone(arg1
, 1);
879 #ifdef TARGET_NR_getitimer
881 print_syscall_ret_getitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
882 abi_long ret
, abi_long arg0
, abi_long arg1
,
883 abi_long arg2
, abi_long arg3
, abi_long arg4
,
886 if (!print_syscall_err(ret
)) {
887 qemu_log(TARGET_ABI_FMT_ld
, ret
);
889 print_itimerval(arg1
, 1);
898 #ifdef TARGET_NR_getitimer
900 print_syscall_ret_setitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
901 abi_long ret
, abi_long arg0
, abi_long arg1
,
902 abi_long arg2
, abi_long arg3
, abi_long arg4
,
905 if (!print_syscall_err(ret
)) {
906 qemu_log(TARGET_ABI_FMT_ld
, ret
);
907 qemu_log(" (old_value = ");
908 print_itimerval(arg2
, 1);
916 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr) \
917 || defined(TARGGET_NR_flistxattr)
919 print_syscall_ret_listxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
920 abi_long ret
, abi_long arg0
, abi_long arg1
,
921 abi_long arg2
, abi_long arg3
, abi_long arg4
,
924 if (!print_syscall_err(ret
)) {
925 qemu_log(TARGET_ABI_FMT_ld
, ret
);
926 qemu_log(" (list = ");
928 abi_long attr
= arg1
;
933 print_string(attr
, 1);
934 ret
-= target_strlen(attr
) + 1;
935 attr
+= target_strlen(attr
) + 1;
945 #define print_syscall_ret_llistxattr print_syscall_ret_listxattr
946 #define print_syscall_ret_flistxattr print_syscall_ret_listxattr
949 #ifdef TARGET_NR_ioctl
951 print_syscall_ret_ioctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
952 abi_long ret
, abi_long arg0
, abi_long arg1
,
953 abi_long arg2
, abi_long arg3
, abi_long arg4
,
956 if (!print_syscall_err(ret
)) {
957 qemu_log(TARGET_ABI_FMT_ld
, ret
);
959 const IOCTLEntry
*ie
;
960 const argtype
*arg_type
;
964 for (ie
= ioctl_entries
; ie
->target_cmd
!= 0; ie
++) {
965 if (ie
->target_cmd
== arg1
) {
970 if (ie
->target_cmd
== arg1
&&
971 (ie
->access
== IOC_R
|| ie
->access
== IOC_RW
)) {
972 arg_type
= ie
->arg_type
;
975 target_size
= thunk_type_size(arg_type
, 0);
976 argptr
= lock_user(VERIFY_READ
, arg2
, target_size
, 1);
978 thunk_print(argptr
, arg_type
);
979 unlock_user(argptr
, arg2
, target_size
);
981 print_pointer(arg2
, 1);
990 UNUSED
static const struct flags access_flags
[] = {
991 FLAG_GENERIC_MASK(F_OK
, R_OK
| W_OK
| X_OK
),
998 UNUSED
static const struct flags at_file_flags
[] = {
1000 FLAG_GENERIC(AT_EACCESS
),
1002 #ifdef AT_SYMLINK_NOFOLLOW
1003 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
1008 UNUSED
static const struct flags unlinkat_flags
[] = {
1010 FLAG_GENERIC(AT_REMOVEDIR
),
1015 UNUSED
static const struct flags mode_flags
[] = {
1016 FLAG_GENERIC(S_IFSOCK
),
1017 FLAG_GENERIC(S_IFLNK
),
1018 FLAG_GENERIC(S_IFREG
),
1019 FLAG_GENERIC(S_IFBLK
),
1020 FLAG_GENERIC(S_IFDIR
),
1021 FLAG_GENERIC(S_IFCHR
),
1022 FLAG_GENERIC(S_IFIFO
),
1026 UNUSED
static const struct flags open_access_flags
[] = {
1027 FLAG_TARGET_MASK(O_RDONLY
, O_ACCMODE
),
1028 FLAG_TARGET_MASK(O_WRONLY
, O_ACCMODE
),
1029 FLAG_TARGET_MASK(O_RDWR
, O_ACCMODE
),
1033 UNUSED
static const struct flags open_flags
[] = {
1034 FLAG_TARGET(O_APPEND
),
1035 FLAG_TARGET(O_CREAT
),
1036 FLAG_TARGET(O_DIRECTORY
),
1037 FLAG_TARGET(O_EXCL
),
1038 #if TARGET_O_LARGEFILE != 0
1039 FLAG_TARGET(O_LARGEFILE
),
1041 FLAG_TARGET(O_NOCTTY
),
1042 FLAG_TARGET(O_NOFOLLOW
),
1043 FLAG_TARGET(O_NONBLOCK
), /* also O_NDELAY */
1044 FLAG_TARGET(O_DSYNC
),
1045 FLAG_TARGET(__O_SYNC
),
1046 FLAG_TARGET(O_TRUNC
),
1048 FLAG_TARGET(O_DIRECT
),
1051 FLAG_TARGET(O_NOATIME
),
1054 FLAG_TARGET(O_CLOEXEC
),
1057 FLAG_TARGET(O_PATH
),
1060 FLAG_TARGET(O_TMPFILE
),
1061 FLAG_TARGET(__O_TMPFILE
),
1066 UNUSED
static const struct flags mount_flags
[] = {
1068 FLAG_GENERIC(MS_BIND
),
1071 FLAG_GENERIC(MS_DIRSYNC
),
1073 FLAG_GENERIC(MS_MANDLOCK
),
1075 FLAG_GENERIC(MS_MOVE
),
1077 FLAG_GENERIC(MS_NOATIME
),
1078 FLAG_GENERIC(MS_NODEV
),
1079 FLAG_GENERIC(MS_NODIRATIME
),
1080 FLAG_GENERIC(MS_NOEXEC
),
1081 FLAG_GENERIC(MS_NOSUID
),
1082 FLAG_GENERIC(MS_RDONLY
),
1084 FLAG_GENERIC(MS_RELATIME
),
1086 FLAG_GENERIC(MS_REMOUNT
),
1087 FLAG_GENERIC(MS_SYNCHRONOUS
),
1091 UNUSED
static const struct flags umount2_flags
[] = {
1093 FLAG_GENERIC(MNT_FORCE
),
1096 FLAG_GENERIC(MNT_DETACH
),
1099 FLAG_GENERIC(MNT_EXPIRE
),
1104 UNUSED
static const struct flags mmap_prot_flags
[] = {
1105 FLAG_GENERIC_MASK(PROT_NONE
, PROT_READ
| PROT_WRITE
| PROT_EXEC
),
1106 FLAG_GENERIC(PROT_EXEC
),
1107 FLAG_GENERIC(PROT_READ
),
1108 FLAG_GENERIC(PROT_WRITE
),
1109 FLAG_TARGET(PROT_SEM
),
1110 FLAG_GENERIC(PROT_GROWSDOWN
),
1111 FLAG_GENERIC(PROT_GROWSUP
),
1115 UNUSED
static const struct flags mmap_flags
[] = {
1116 FLAG_TARGET_MASK(MAP_SHARED
, MAP_TYPE
),
1117 FLAG_TARGET_MASK(MAP_PRIVATE
, MAP_TYPE
),
1118 FLAG_TARGET_MASK(MAP_SHARED_VALIDATE
, MAP_TYPE
),
1119 FLAG_TARGET(MAP_ANONYMOUS
),
1120 FLAG_TARGET(MAP_DENYWRITE
),
1121 FLAG_TARGET(MAP_EXECUTABLE
),
1122 FLAG_TARGET(MAP_FIXED
),
1123 FLAG_TARGET(MAP_FIXED_NOREPLACE
),
1124 FLAG_TARGET(MAP_GROWSDOWN
),
1125 FLAG_TARGET(MAP_HUGETLB
),
1126 FLAG_TARGET(MAP_LOCKED
),
1127 FLAG_TARGET(MAP_NONBLOCK
),
1128 FLAG_TARGET(MAP_NORESERVE
),
1129 FLAG_TARGET(MAP_POPULATE
),
1130 FLAG_TARGET(MAP_STACK
),
1131 FLAG_TARGET(MAP_SYNC
),
1132 #if TARGET_MAP_UNINITIALIZED != 0
1133 FLAG_TARGET(MAP_UNINITIALIZED
),
1139 # define CLONE_PIDFD 0x00001000
1142 UNUSED
static const struct flags clone_flags
[] = {
1143 FLAG_GENERIC(CLONE_VM
),
1144 FLAG_GENERIC(CLONE_FS
),
1145 FLAG_GENERIC(CLONE_FILES
),
1146 FLAG_GENERIC(CLONE_SIGHAND
),
1147 FLAG_GENERIC(CLONE_PIDFD
),
1148 FLAG_GENERIC(CLONE_PTRACE
),
1149 FLAG_GENERIC(CLONE_VFORK
),
1150 FLAG_GENERIC(CLONE_PARENT
),
1151 FLAG_GENERIC(CLONE_THREAD
),
1152 FLAG_GENERIC(CLONE_NEWNS
),
1153 FLAG_GENERIC(CLONE_SYSVSEM
),
1154 FLAG_GENERIC(CLONE_SETTLS
),
1155 FLAG_GENERIC(CLONE_PARENT_SETTID
),
1156 FLAG_GENERIC(CLONE_CHILD_CLEARTID
),
1157 FLAG_GENERIC(CLONE_DETACHED
),
1158 FLAG_GENERIC(CLONE_UNTRACED
),
1159 FLAG_GENERIC(CLONE_CHILD_SETTID
),
1160 #if defined(CLONE_NEWUTS)
1161 FLAG_GENERIC(CLONE_NEWUTS
),
1163 #if defined(CLONE_NEWIPC)
1164 FLAG_GENERIC(CLONE_NEWIPC
),
1166 #if defined(CLONE_NEWUSER)
1167 FLAG_GENERIC(CLONE_NEWUSER
),
1169 #if defined(CLONE_NEWPID)
1170 FLAG_GENERIC(CLONE_NEWPID
),
1172 #if defined(CLONE_NEWNET)
1173 FLAG_GENERIC(CLONE_NEWNET
),
1175 #if defined(CLONE_NEWCGROUP)
1176 FLAG_GENERIC(CLONE_NEWCGROUP
),
1178 #if defined(CLONE_NEWTIME)
1179 FLAG_GENERIC(CLONE_NEWTIME
),
1181 #if defined(CLONE_IO)
1182 FLAG_GENERIC(CLONE_IO
),
1187 UNUSED
static const struct flags execveat_flags
[] = {
1188 #ifdef AT_EMPTY_PATH
1189 FLAG_GENERIC(AT_EMPTY_PATH
),
1191 #ifdef AT_SYMLINK_NOFOLLOW
1192 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
1197 UNUSED
static const struct flags msg_flags
[] = {
1199 FLAG_GENERIC(MSG_CONFIRM
),
1200 FLAG_GENERIC(MSG_DONTROUTE
),
1201 FLAG_GENERIC(MSG_DONTWAIT
),
1202 FLAG_GENERIC(MSG_EOR
),
1203 FLAG_GENERIC(MSG_MORE
),
1204 FLAG_GENERIC(MSG_NOSIGNAL
),
1205 FLAG_GENERIC(MSG_OOB
),
1207 FLAG_GENERIC(MSG_CMSG_CLOEXEC
),
1208 FLAG_GENERIC(MSG_ERRQUEUE
),
1209 FLAG_GENERIC(MSG_PEEK
),
1210 FLAG_GENERIC(MSG_TRUNC
),
1211 FLAG_GENERIC(MSG_WAITALL
),
1213 FLAG_GENERIC(MSG_CTRUNC
),
1217 UNUSED
static const struct flags statx_flags
[] = {
1218 #ifdef AT_EMPTY_PATH
1219 FLAG_GENERIC(AT_EMPTY_PATH
),
1221 #ifdef AT_NO_AUTOMOUNT
1222 FLAG_GENERIC(AT_NO_AUTOMOUNT
),
1224 #ifdef AT_SYMLINK_NOFOLLOW
1225 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
1227 #ifdef AT_STATX_SYNC_AS_STAT
1228 FLAG_GENERIC_MASK(AT_STATX_SYNC_AS_STAT
, AT_STATX_SYNC_TYPE
),
1230 #ifdef AT_STATX_FORCE_SYNC
1231 FLAG_GENERIC_MASK(AT_STATX_FORCE_SYNC
, AT_STATX_SYNC_TYPE
),
1233 #ifdef AT_STATX_DONT_SYNC
1234 FLAG_GENERIC_MASK(AT_STATX_DONT_SYNC
, AT_STATX_SYNC_TYPE
),
1239 UNUSED
static const struct flags statx_mask
[] = {
1240 /* This must come first, because it includes everything. */
1242 FLAG_GENERIC(STATX_ALL
),
1244 /* This must come second; it includes everything except STATX_BTIME. */
1245 #ifdef STATX_BASIC_STATS
1246 FLAG_GENERIC(STATX_BASIC_STATS
),
1249 FLAG_GENERIC(STATX_TYPE
),
1252 FLAG_GENERIC(STATX_MODE
),
1255 FLAG_GENERIC(STATX_NLINK
),
1258 FLAG_GENERIC(STATX_UID
),
1261 FLAG_GENERIC(STATX_GID
),
1264 FLAG_GENERIC(STATX_ATIME
),
1267 FLAG_GENERIC(STATX_MTIME
),
1270 FLAG_GENERIC(STATX_CTIME
),
1273 FLAG_GENERIC(STATX_INO
),
1276 FLAG_GENERIC(STATX_SIZE
),
1279 FLAG_GENERIC(STATX_BLOCKS
),
1282 FLAG_GENERIC(STATX_BTIME
),
1287 UNUSED
static const struct flags falloc_flags
[] = {
1288 FLAG_GENERIC(FALLOC_FL_KEEP_SIZE
),
1289 FLAG_GENERIC(FALLOC_FL_PUNCH_HOLE
),
1290 #ifdef FALLOC_FL_NO_HIDE_STALE
1291 FLAG_GENERIC(FALLOC_FL_NO_HIDE_STALE
),
1293 #ifdef FALLOC_FL_COLLAPSE_RANGE
1294 FLAG_GENERIC(FALLOC_FL_COLLAPSE_RANGE
),
1296 #ifdef FALLOC_FL_ZERO_RANGE
1297 FLAG_GENERIC(FALLOC_FL_ZERO_RANGE
),
1299 #ifdef FALLOC_FL_INSERT_RANGE
1300 FLAG_GENERIC(FALLOC_FL_INSERT_RANGE
),
1302 #ifdef FALLOC_FL_UNSHARE_RANGE
1303 FLAG_GENERIC(FALLOC_FL_UNSHARE_RANGE
),
1307 UNUSED
static const struct flags termios_iflags
[] = {
1308 FLAG_TARGET(IGNBRK
),
1309 FLAG_TARGET(BRKINT
),
1310 FLAG_TARGET(IGNPAR
),
1311 FLAG_TARGET(PARMRK
),
1313 FLAG_TARGET(ISTRIP
),
1321 FLAG_TARGET(IMAXBEL
),
1326 UNUSED
static const struct flags termios_oflags
[] = {
1332 FLAG_TARGET(ONLRET
),
1338 UNUSED
static struct enums termios_oflags_NLDLY
[] = {
1344 UNUSED
static struct enums termios_oflags_CRDLY
[] = {
1352 UNUSED
static struct enums termios_oflags_TABDLY
[] = {
1360 UNUSED
static struct enums termios_oflags_VTDLY
[] = {
1366 UNUSED
static struct enums termios_oflags_FFDLY
[] = {
1372 UNUSED
static struct enums termios_oflags_BSDLY
[] = {
1378 UNUSED
static struct enums termios_cflags_CBAUD
[] = {
1393 ENUM_TARGET(B19200
),
1394 ENUM_TARGET(B38400
),
1395 ENUM_TARGET(B57600
),
1396 ENUM_TARGET(B115200
),
1397 ENUM_TARGET(B230400
),
1398 ENUM_TARGET(B460800
),
1402 UNUSED
static struct enums termios_cflags_CSIZE
[] = {
1410 UNUSED
static const struct flags termios_cflags
[] = {
1411 FLAG_TARGET(CSTOPB
),
1413 FLAG_TARGET(PARENB
),
1414 FLAG_TARGET(PARODD
),
1416 FLAG_TARGET(CLOCAL
),
1417 FLAG_TARGET(CRTSCTS
),
1421 UNUSED
static const struct flags termios_lflags
[] = {
1423 FLAG_TARGET(ICANON
),
1428 FLAG_TARGET(ECHONL
),
1429 FLAG_TARGET(NOFLSH
),
1430 FLAG_TARGET(TOSTOP
),
1431 FLAG_TARGET(ECHOCTL
),
1432 FLAG_TARGET(ECHOPRT
),
1433 FLAG_TARGET(ECHOKE
),
1434 FLAG_TARGET(FLUSHO
),
1435 FLAG_TARGET(PENDIN
),
1436 FLAG_TARGET(IEXTEN
),
1437 FLAG_TARGET(EXTPROC
),
1441 #ifdef TARGET_NR_mlockall
1442 static const struct flags mlockall_flags
[] = {
1443 FLAG_TARGET(MCL_CURRENT
),
1444 FLAG_TARGET(MCL_FUTURE
),
1446 FLAG_TARGET(MCL_ONFAULT
),
1452 /* IDs of the various system clocks */
1453 #define TARGET_CLOCK_REALTIME 0
1454 #define TARGET_CLOCK_MONOTONIC 1
1455 #define TARGET_CLOCK_PROCESS_CPUTIME_ID 2
1456 #define TARGET_CLOCK_THREAD_CPUTIME_ID 3
1457 #define TARGET_CLOCK_MONOTONIC_RAW 4
1458 #define TARGET_CLOCK_REALTIME_COARSE 5
1459 #define TARGET_CLOCK_MONOTONIC_COARSE 6
1460 #define TARGET_CLOCK_BOOTTIME 7
1461 #define TARGET_CLOCK_REALTIME_ALARM 8
1462 #define TARGET_CLOCK_BOOTTIME_ALARM 9
1463 #define TARGET_CLOCK_SGI_CYCLE 10
1464 #define TARGET_CLOCK_TAI 11
1466 UNUSED
static struct enums clockids
[] = {
1467 ENUM_TARGET(CLOCK_REALTIME
),
1468 ENUM_TARGET(CLOCK_MONOTONIC
),
1469 ENUM_TARGET(CLOCK_PROCESS_CPUTIME_ID
),
1470 ENUM_TARGET(CLOCK_THREAD_CPUTIME_ID
),
1471 ENUM_TARGET(CLOCK_MONOTONIC_RAW
),
1472 ENUM_TARGET(CLOCK_REALTIME_COARSE
),
1473 ENUM_TARGET(CLOCK_MONOTONIC_COARSE
),
1474 ENUM_TARGET(CLOCK_BOOTTIME
),
1475 ENUM_TARGET(CLOCK_REALTIME_ALARM
),
1476 ENUM_TARGET(CLOCK_BOOTTIME_ALARM
),
1477 ENUM_TARGET(CLOCK_SGI_CYCLE
),
1478 ENUM_TARGET(CLOCK_TAI
),
1482 UNUSED
static struct enums itimer_types
[] = {
1483 ENUM_GENERIC(ITIMER_REAL
),
1484 ENUM_GENERIC(ITIMER_VIRTUAL
),
1485 ENUM_GENERIC(ITIMER_PROF
),
1490 * print_xxx utility functions. These are used to print syscall
1491 * parameters in certain format. All of these have parameter
1492 * named 'last'. This parameter is used to add comma to output
1499 return ((last
) ? "" : ",");
1503 print_flags(const struct flags
*f
, abi_long flags
, int last
)
1505 const char *sep
= "";
1508 for (n
= 0; f
->f_string
!= NULL
; f
++) {
1509 if ((flags
& f
->f_mask
) == f
->f_value
) {
1510 qemu_log("%s%s", sep
, f
->f_string
);
1511 flags
&= ~f
->f_mask
;
1518 /* print rest of the flags as numeric */
1520 qemu_log("%s%#x%s", sep
, (unsigned int)flags
, get_comma(last
));
1522 qemu_log("%s", get_comma(last
));
1525 /* no string version of flags found, print them in hex then */
1526 qemu_log("%#x%s", (unsigned int)flags
, get_comma(last
));
1531 print_enums(const struct enums
*e
, abi_long enum_arg
, int last
)
1533 for (; e
->e_string
!= NULL
; e
++) {
1534 if (e
->e_value
== enum_arg
) {
1535 qemu_log("%s", e
->e_string
);
1540 if (e
->e_string
== NULL
) {
1541 qemu_log("%#x", (unsigned int)enum_arg
);
1544 qemu_log("%s", get_comma(last
));
1548 print_at_dirfd(abi_long dirfd
, int last
)
1551 if (dirfd
== AT_FDCWD
) {
1552 qemu_log("AT_FDCWD%s", get_comma(last
));
1556 qemu_log("%d%s", (int)dirfd
, get_comma(last
));
1560 print_file_mode(abi_long mode
, int last
)
1562 const char *sep
= "";
1563 const struct flags
*m
;
1566 qemu_log("000%s", get_comma(last
));
1570 for (m
= &mode_flags
[0]; m
->f_string
!= NULL
; m
++) {
1571 if ((m
->f_value
& mode
) == m
->f_value
) {
1572 qemu_log("%s%s", m
->f_string
, sep
);
1574 mode
&= ~m
->f_value
;
1580 /* print rest of the mode as octal */
1582 qemu_log("%s%#o", sep
, (unsigned int)mode
);
1584 qemu_log("%s", get_comma(last
));
1588 print_open_flags(abi_long flags
, int last
)
1590 print_flags(open_access_flags
, flags
& TARGET_O_ACCMODE
, 1);
1591 flags
&= ~TARGET_O_ACCMODE
;
1593 qemu_log("%s", get_comma(last
));
1597 print_flags(open_flags
, flags
, last
);
1601 print_syscall_prologue(const struct syscallname
*sc
)
1603 qemu_log("%s(", sc
->name
);
1608 print_syscall_epilogue(const struct syscallname
*sc
)
1615 print_string(abi_long addr
, int last
)
1619 if ((s
= lock_user_string(addr
)) != NULL
) {
1620 qemu_log("\"%s\"%s", s
, get_comma(last
));
1621 unlock_user(s
, addr
, 0);
1623 /* can't get string out of it, so print it as pointer */
1624 print_pointer(addr
, last
);
1628 #define MAX_PRINT_BUF 40
1630 print_buf(abi_long addr
, abi_long len
, int last
)
1635 s
= lock_user(VERIFY_READ
, addr
, len
, 1);
1638 for (i
= 0; i
< MAX_PRINT_BUF
&& i
< len
; i
++) {
1639 if (isprint(s
[i
])) {
1640 qemu_log("%c", s
[i
]);
1642 qemu_log("\\%o", s
[i
]);
1652 unlock_user(s
, addr
, 0);
1654 print_pointer(addr
, last
);
1659 * Prints out raw parameter using given format. Caller needs
1660 * to do byte swapping if needed.
1663 print_raw_param(const char *fmt
, abi_long param
, int last
)
1667 (void) snprintf(format
, sizeof (format
), "%s%s", fmt
, get_comma(last
));
1668 qemu_log(format
, param
);
1672 * Same as print_raw_param() but prints out raw 64-bit parameter.
1675 print_raw_param64(const char *fmt
, long long param
, int last
)
1679 (void)snprintf(format
, sizeof(format
), "%s%s", fmt
, get_comma(last
));
1680 qemu_log(format
, param
);
1685 print_pointer(abi_long p
, int last
)
1688 qemu_log("NULL%s", get_comma(last
));
1690 qemu_log("0x" TARGET_ABI_FMT_lx
"%s", p
, get_comma(last
));
1694 * Reads 32-bit (int) number from guest address space from
1695 * address 'addr' and prints it.
1698 print_number(abi_long addr
, int last
)
1701 qemu_log("NULL%s", get_comma(last
));
1705 get_user_s32(num
, addr
);
1706 qemu_log("[%d]%s", num
, get_comma(last
));
1711 print_timeval(abi_ulong tv_addr
, int last
)
1714 struct target_timeval
*tv
;
1716 tv
= lock_user(VERIFY_READ
, tv_addr
, sizeof(*tv
), 1);
1718 print_pointer(tv_addr
, last
);
1721 qemu_log("{tv_sec = " TARGET_ABI_FMT_ld
1722 ",tv_usec = " TARGET_ABI_FMT_ld
"}%s",
1723 tswapal(tv
->tv_sec
), tswapal(tv
->tv_usec
), get_comma(last
));
1724 unlock_user(tv
, tv_addr
, 0);
1726 qemu_log("NULL%s", get_comma(last
));
1730 print_timespec(abi_ulong ts_addr
, int last
)
1733 struct target_timespec
*ts
;
1735 ts
= lock_user(VERIFY_READ
, ts_addr
, sizeof(*ts
), 1);
1737 print_pointer(ts_addr
, last
);
1740 qemu_log("{tv_sec = " TARGET_ABI_FMT_ld
1741 ",tv_nsec = " TARGET_ABI_FMT_ld
"}%s",
1742 tswapal(ts
->tv_sec
), tswapal(ts
->tv_nsec
), get_comma(last
));
1743 unlock_user(ts
, ts_addr
, 0);
1745 qemu_log("NULL%s", get_comma(last
));
1750 print_timespec64(abi_ulong ts_addr
, int last
)
1753 struct target__kernel_timespec
*ts
;
1755 ts
= lock_user(VERIFY_READ
, ts_addr
, sizeof(*ts
), 1);
1757 print_pointer(ts_addr
, last
);
1760 print_raw_param64("{tv_sec=%" PRId64
, tswap64(ts
->tv_sec
), 0);
1761 print_raw_param64("tv_nsec=%" PRId64
"}", tswap64(ts
->tv_nsec
), last
);
1762 unlock_user(ts
, ts_addr
, 0);
1764 qemu_log("NULL%s", get_comma(last
));
1769 print_timezone(abi_ulong tz_addr
, int last
)
1772 struct target_timezone
*tz
;
1774 tz
= lock_user(VERIFY_READ
, tz_addr
, sizeof(*tz
), 1);
1776 print_pointer(tz_addr
, last
);
1779 qemu_log("{%d,%d}%s", tswap32(tz
->tz_minuteswest
),
1780 tswap32(tz
->tz_dsttime
), get_comma(last
));
1781 unlock_user(tz
, tz_addr
, 0);
1783 qemu_log("NULL%s", get_comma(last
));
1788 print_itimerval(abi_ulong it_addr
, int last
)
1791 qemu_log("{it_interval=");
1792 print_timeval(it_addr
+
1793 offsetof(struct target_itimerval
, it_interval
), 0);
1794 qemu_log("it_value=");
1795 print_timeval(it_addr
+
1796 offsetof(struct target_itimerval
, it_value
), 0);
1797 qemu_log("}%s", get_comma(last
));
1799 qemu_log("NULL%s", get_comma(last
));
1804 print_termios(void *arg
)
1806 const struct target_termios
*target
= arg
;
1808 target_tcflag_t iflags
= tswap32(target
->c_iflag
);
1809 target_tcflag_t oflags
= tswap32(target
->c_oflag
);
1810 target_tcflag_t cflags
= tswap32(target
->c_cflag
);
1811 target_tcflag_t lflags
= tswap32(target
->c_lflag
);
1815 qemu_log("c_iflag = ");
1816 print_flags(termios_iflags
, iflags
, 0);
1818 qemu_log("c_oflag = ");
1819 target_tcflag_t oflags_clean
= oflags
& ~(TARGET_NLDLY
| TARGET_CRDLY
|
1820 TARGET_TABDLY
| TARGET_BSDLY
|
1821 TARGET_VTDLY
| TARGET_FFDLY
);
1822 print_flags(termios_oflags
, oflags_clean
, 0);
1823 if (oflags
& TARGET_NLDLY
) {
1824 print_enums(termios_oflags_NLDLY
, oflags
& TARGET_NLDLY
, 0);
1826 if (oflags
& TARGET_CRDLY
) {
1827 print_enums(termios_oflags_CRDLY
, oflags
& TARGET_CRDLY
, 0);
1829 if (oflags
& TARGET_TABDLY
) {
1830 print_enums(termios_oflags_TABDLY
, oflags
& TARGET_TABDLY
, 0);
1832 if (oflags
& TARGET_BSDLY
) {
1833 print_enums(termios_oflags_BSDLY
, oflags
& TARGET_BSDLY
, 0);
1835 if (oflags
& TARGET_VTDLY
) {
1836 print_enums(termios_oflags_VTDLY
, oflags
& TARGET_VTDLY
, 0);
1838 if (oflags
& TARGET_FFDLY
) {
1839 print_enums(termios_oflags_FFDLY
, oflags
& TARGET_FFDLY
, 0);
1842 qemu_log("c_cflag = ");
1843 if (cflags
& TARGET_CBAUD
) {
1844 print_enums(termios_cflags_CBAUD
, cflags
& TARGET_CBAUD
, 0);
1846 if (cflags
& TARGET_CSIZE
) {
1847 print_enums(termios_cflags_CSIZE
, cflags
& TARGET_CSIZE
, 0);
1849 target_tcflag_t cflags_clean
= cflags
& ~(TARGET_CBAUD
| TARGET_CSIZE
);
1850 print_flags(termios_cflags
, cflags_clean
, 0);
1852 qemu_log("c_lflag = ");
1853 print_flags(termios_lflags
, lflags
, 0);
1855 qemu_log("c_cc = ");
1856 qemu_log("\"%s\",", target
->c_cc
);
1858 qemu_log("c_line = ");
1859 print_raw_param("\'%c\'", target
->c_line
, 1);
1866 #ifdef TARGET_NR_accept
1868 print_accept(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1869 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1870 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1872 print_syscall_prologue(name
);
1873 print_raw_param("%d", arg0
, 0);
1874 print_pointer(arg1
, 0);
1875 print_number(arg2
, 1);
1876 print_syscall_epilogue(name
);
1880 #ifdef TARGET_NR_access
1882 print_access(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1883 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1884 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1886 print_syscall_prologue(name
);
1887 print_string(arg0
, 0);
1888 print_flags(access_flags
, arg1
, 1);
1889 print_syscall_epilogue(name
);
1893 #ifdef TARGET_NR_acct
1895 print_acct(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1896 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1897 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1899 print_syscall_prologue(name
);
1900 print_string(arg0
, 1);
1901 print_syscall_epilogue(name
);
1905 #ifdef TARGET_NR_brk
1907 print_brk(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1908 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1909 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1911 print_syscall_prologue(name
);
1912 print_pointer(arg0
, 1);
1913 print_syscall_epilogue(name
);
1917 #ifdef TARGET_NR_chdir
1919 print_chdir(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1920 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1921 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1923 print_syscall_prologue(name
);
1924 print_string(arg0
, 1);
1925 print_syscall_epilogue(name
);
1929 #ifdef TARGET_NR_chroot
1931 print_chroot(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1932 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1933 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1935 print_syscall_prologue(name
);
1936 print_string(arg0
, 1);
1937 print_syscall_epilogue(name
);
1941 #ifdef TARGET_NR_chmod
1943 print_chmod(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1944 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1945 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1947 print_syscall_prologue(name
);
1948 print_string(arg0
, 0);
1949 print_file_mode(arg1
, 1);
1950 print_syscall_epilogue(name
);
1954 #if defined(TARGET_NR_chown) || defined(TARGET_NR_lchown)
1956 print_chown(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1957 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1958 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1960 print_syscall_prologue(name
);
1961 print_string(arg0
, 0);
1962 print_raw_param("%d", arg1
, 0);
1963 print_raw_param("%d", arg2
, 1);
1964 print_syscall_epilogue(name
);
1966 #define print_lchown print_chown
1969 #ifdef TARGET_NR_clock_adjtime
1971 print_clock_adjtime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1972 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1973 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1975 print_syscall_prologue(name
);
1976 print_enums(clockids
, arg0
, 0);
1977 print_pointer(arg1
, 1);
1978 print_syscall_epilogue(name
);
1982 #ifdef TARGET_NR_clone
1983 static void do_print_clone(unsigned int flags
, abi_ulong newsp
,
1984 abi_ulong parent_tidptr
, target_ulong newtls
,
1985 abi_ulong child_tidptr
)
1987 print_flags(clone_flags
, flags
, 0);
1988 print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx
, newsp
, 0);
1989 print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx
, parent_tidptr
, 0);
1990 print_raw_param("tls=0x" TARGET_ABI_FMT_lx
, newtls
, 0);
1991 print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx
, child_tidptr
, 1);
1995 print_clone(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1996 abi_long arg1
, abi_long arg2
, abi_long arg3
,
1997 abi_long arg4
, abi_long arg5
, abi_long arg6
)
1999 print_syscall_prologue(name
);
2000 #if defined(TARGET_MICROBLAZE)
2001 do_print_clone(arg1
, arg2
, arg4
, arg6
, arg5
);
2002 #elif defined(TARGET_CLONE_BACKWARDS)
2003 do_print_clone(arg1
, arg2
, arg3
, arg4
, arg5
);
2004 #elif defined(TARGET_CLONE_BACKWARDS2)
2005 do_print_clone(arg2
, arg1
, arg3
, arg5
, arg4
);
2007 do_print_clone(arg1
, arg2
, arg3
, arg5
, arg4
);
2009 print_syscall_epilogue(name
);
2013 #ifdef TARGET_NR_creat
2015 print_creat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2016 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2017 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2019 print_syscall_prologue(name
);
2020 print_string(arg0
, 0);
2021 print_file_mode(arg1
, 1);
2022 print_syscall_epilogue(name
);
2026 #ifdef TARGET_NR_execv
2028 print_execv(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2029 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2030 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2032 print_syscall_prologue(name
);
2033 print_string(arg0
, 0);
2034 print_raw_param("0x" TARGET_ABI_FMT_lx
, arg1
, 1);
2035 print_syscall_epilogue(name
);
2040 print_execve_argv(abi_long argv
, int last
)
2042 abi_ulong arg_ptr_addr
;
2046 for (arg_ptr_addr
= argv
; ; arg_ptr_addr
+= sizeof(abi_ulong
)) {
2047 abi_ulong
*arg_ptr
, arg_addr
;
2049 arg_ptr
= lock_user(VERIFY_READ
, arg_ptr_addr
, sizeof(abi_ulong
), 1);
2053 arg_addr
= tswapal(*arg_ptr
);
2054 unlock_user(arg_ptr
, arg_ptr_addr
, 0);
2058 s
= lock_user_string(arg_addr
);
2060 qemu_log("\"%s\",", s
);
2061 unlock_user(s
, arg_addr
, 0);
2064 qemu_log("NULL}%s", get_comma(last
));
2068 print_execve(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2069 abi_long arg1
, abi_long arg2
, abi_long arg3
,
2070 abi_long arg4
, abi_long arg5
, abi_long arg6
)
2072 print_syscall_prologue(name
);
2073 print_string(arg1
, 0);
2074 print_execve_argv(arg2
, 1);
2075 print_syscall_epilogue(name
);
2079 print_execveat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2080 abi_long arg1
, abi_long arg2
, abi_long arg3
,
2081 abi_long arg4
, abi_long arg5
, abi_long arg6
)
2083 print_syscall_prologue(name
);
2084 print_at_dirfd(arg1
, 0);
2085 print_string(arg2
, 0);
2086 print_execve_argv(arg3
, 0);
2087 print_flags(execveat_flags
, arg5
, 1);
2088 print_syscall_epilogue(name
);
2091 #if defined(TARGET_NR_faccessat) || defined(TARGET_NR_faccessat2)
2093 print_faccessat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2094 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2095 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2097 print_syscall_prologue(name
);
2098 print_at_dirfd(arg0
, 0);
2099 print_string(arg1
, 0);
2100 print_flags(access_flags
, arg2
, 0);
2101 print_flags(at_file_flags
, arg3
, 1);
2102 print_syscall_epilogue(name
);
2106 #ifdef TARGET_NR_fallocate
2108 print_fallocate(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_raw_param("%d", arg0
, 0);
2114 print_flags(falloc_flags
, arg1
, 0);
2115 #if TARGET_ABI_BITS == 32
2116 print_raw_param("%" PRIu64
, target_offset64(arg2
, arg3
), 0);
2117 print_raw_param("%" PRIu64
, target_offset64(arg4
, arg5
), 1);
2119 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2120 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 1);
2122 print_syscall_epilogue(name
);
2126 #ifdef TARGET_NR_fchmodat
2128 print_fchmodat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2129 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2130 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2132 print_syscall_prologue(name
);
2133 print_at_dirfd(arg0
, 0);
2134 print_string(arg1
, 0);
2135 print_file_mode(arg2
, 0);
2136 print_flags(at_file_flags
, arg3
, 1);
2137 print_syscall_epilogue(name
);
2141 #ifdef TARGET_NR_fchownat
2143 print_fchownat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2144 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2145 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2147 print_syscall_prologue(name
);
2148 print_at_dirfd(arg0
, 0);
2149 print_string(arg1
, 0);
2150 print_raw_param("%d", arg2
, 0);
2151 print_raw_param("%d", arg3
, 0);
2152 print_flags(at_file_flags
, arg4
, 1);
2153 print_syscall_epilogue(name
);
2157 #if defined(TARGET_NR_fcntl) || defined(TARGET_NR_fcntl64)
2159 print_fcntl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2160 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2161 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2163 print_syscall_prologue(name
);
2164 print_raw_param("%d", arg0
, 0);
2166 case TARGET_F_DUPFD
:
2167 qemu_log("F_DUPFD,");
2168 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2170 case TARGET_F_GETFD
:
2171 qemu_log("F_GETFD");
2173 case TARGET_F_SETFD
:
2174 qemu_log("F_SETFD,");
2175 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2177 case TARGET_F_GETFL
:
2178 qemu_log("F_GETFL");
2180 case TARGET_F_SETFL
:
2181 qemu_log("F_SETFL,");
2182 print_open_flags(arg2
, 1);
2184 case TARGET_F_GETLK
:
2185 qemu_log("F_GETLK,");
2186 print_pointer(arg2
, 1);
2188 case TARGET_F_SETLK
:
2189 qemu_log("F_SETLK,");
2190 print_pointer(arg2
, 1);
2192 case TARGET_F_SETLKW
:
2193 qemu_log("F_SETLKW,");
2194 print_pointer(arg2
, 1);
2196 case TARGET_F_GETOWN
:
2197 qemu_log("F_GETOWN");
2199 case TARGET_F_SETOWN
:
2200 qemu_log("F_SETOWN,");
2201 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2203 case TARGET_F_GETSIG
:
2204 qemu_log("F_GETSIG");
2206 case TARGET_F_SETSIG
:
2207 qemu_log("F_SETSIG,");
2208 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2210 #if TARGET_ABI_BITS == 32
2211 case TARGET_F_GETLK64
:
2212 qemu_log("F_GETLK64,");
2213 print_pointer(arg2
, 1);
2215 case TARGET_F_SETLK64
:
2216 qemu_log("F_SETLK64,");
2217 print_pointer(arg2
, 1);
2219 case TARGET_F_SETLKW64
:
2220 qemu_log("F_SETLKW64,");
2221 print_pointer(arg2
, 1);
2224 case TARGET_F_OFD_GETLK
:
2225 qemu_log("F_OFD_GETLK,");
2226 print_pointer(arg2
, 1);
2228 case TARGET_F_OFD_SETLK
:
2229 qemu_log("F_OFD_SETLK,");
2230 print_pointer(arg2
, 1);
2232 case TARGET_F_OFD_SETLKW
:
2233 qemu_log("F_OFD_SETLKW,");
2234 print_pointer(arg2
, 1);
2236 case TARGET_F_SETLEASE
:
2237 qemu_log("F_SETLEASE,");
2238 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2240 case TARGET_F_GETLEASE
:
2241 qemu_log("F_GETLEASE");
2243 #ifdef F_DUPFD_CLOEXEC
2244 case TARGET_F_DUPFD_CLOEXEC
:
2245 qemu_log("F_DUPFD_CLOEXEC,");
2246 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2249 case TARGET_F_NOTIFY
:
2250 qemu_log("F_NOTIFY,");
2251 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2254 case TARGET_F_GETOWN_EX
:
2255 qemu_log("F_GETOWN_EX,");
2256 print_pointer(arg2
, 1);
2260 case TARGET_F_SETOWN_EX
:
2261 qemu_log("F_SETOWN_EX,");
2262 print_pointer(arg2
, 1);
2266 case TARGET_F_SETPIPE_SZ
:
2267 qemu_log("F_SETPIPE_SZ,");
2268 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2270 case TARGET_F_GETPIPE_SZ
:
2271 qemu_log("F_GETPIPE_SZ");
2275 case TARGET_F_ADD_SEALS
:
2276 qemu_log("F_ADD_SEALS,");
2277 print_raw_param("0x"TARGET_ABI_FMT_lx
, arg2
, 1);
2279 case TARGET_F_GET_SEALS
:
2280 qemu_log("F_GET_SEALS");
2284 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2285 print_pointer(arg2
, 1);
2288 print_syscall_epilogue(name
);
2290 #define print_fcntl64 print_fcntl
2293 #ifdef TARGET_NR_fgetxattr
2295 print_fgetxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2296 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2297 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2299 print_syscall_prologue(name
);
2300 print_raw_param("%d", arg0
, 0);
2301 print_string(arg1
, 0);
2302 print_pointer(arg2
, 0);
2303 print_raw_param(TARGET_FMT_lu
, arg3
, 1);
2304 print_syscall_epilogue(name
);
2308 #ifdef TARGET_NR_flistxattr
2310 print_flistxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2311 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2312 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2314 print_syscall_prologue(name
);
2315 print_raw_param("%d", arg0
, 0);
2316 print_pointer(arg1
, 0);
2317 print_raw_param(TARGET_FMT_lu
, arg2
, 1);
2318 print_syscall_epilogue(name
);
2322 #if defined(TARGET_NR_getxattr) || defined(TARGET_NR_lgetxattr)
2324 print_getxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2325 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2326 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2328 print_syscall_prologue(name
);
2329 print_string(arg0
, 0);
2330 print_string(arg1
, 0);
2331 print_pointer(arg2
, 0);
2332 print_raw_param(TARGET_FMT_lu
, arg3
, 1);
2333 print_syscall_epilogue(name
);
2335 #define print_lgetxattr print_getxattr
2338 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr)
2340 print_listxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2341 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2342 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2344 print_syscall_prologue(name
);
2345 print_string(arg0
, 0);
2346 print_pointer(arg1
, 0);
2347 print_raw_param(TARGET_FMT_lu
, arg2
, 1);
2348 print_syscall_epilogue(name
);
2350 #define print_llistxattr print_listxattr
2353 #if defined(TARGET_NR_fremovexattr)
2355 print_fremovexattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2356 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2357 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2359 print_syscall_prologue(name
);
2360 print_raw_param("%d", arg0
, 0);
2361 print_string(arg1
, 1);
2362 print_syscall_epilogue(name
);
2366 #if defined(TARGET_NR_removexattr) || defined(TARGET_NR_lremovexattr)
2368 print_removexattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2369 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2370 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2372 print_syscall_prologue(name
);
2373 print_string(arg0
, 0);
2374 print_string(arg1
, 1);
2375 print_syscall_epilogue(name
);
2377 #define print_lremovexattr print_removexattr
2380 #ifdef TARGET_NR_futimesat
2382 print_futimesat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2383 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2384 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2386 print_syscall_prologue(name
);
2387 print_at_dirfd(arg0
, 0);
2388 print_string(arg1
, 0);
2389 print_timeval(arg2
, 0);
2390 print_timeval(arg2
+ sizeof (struct target_timeval
), 1);
2391 print_syscall_epilogue(name
);
2395 #ifdef TARGET_NR_gettimeofday
2397 print_gettimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2398 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2399 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2401 print_syscall_prologue(name
);
2402 print_pointer(arg0
, 0);
2403 print_pointer(arg1
, 1);
2404 print_syscall_epilogue(name
);
2408 #ifdef TARGET_NR_settimeofday
2410 print_settimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2411 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2412 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2414 print_syscall_prologue(name
);
2415 print_timeval(arg0
, 0);
2416 print_timezone(arg1
, 1);
2417 print_syscall_epilogue(name
);
2421 #if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
2423 print_clock_gettime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2424 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2425 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2427 print_syscall_prologue(name
);
2428 print_enums(clockids
, arg0
, 0);
2429 print_pointer(arg1
, 1);
2430 print_syscall_epilogue(name
);
2432 #define print_clock_getres print_clock_gettime
2435 #if defined(TARGET_NR_clock_gettime64)
2437 print_clock_gettime64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2438 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2439 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2441 print_syscall_prologue(name
);
2442 print_enums(clockids
, arg0
, 0);
2443 print_pointer(arg1
, 1);
2444 print_syscall_epilogue(name
);
2448 #ifdef TARGET_NR_clock_settime
2450 print_clock_settime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2451 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2452 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2454 print_syscall_prologue(name
);
2455 print_enums(clockids
, arg0
, 0);
2456 print_timespec(arg1
, 1);
2457 print_syscall_epilogue(name
);
2461 #ifdef TARGET_NR_getitimer
2463 print_getitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2464 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2465 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2467 print_syscall_prologue(name
);
2468 print_enums(itimer_types
, arg0
, 0);
2469 print_pointer(arg1
, 1);
2470 print_syscall_epilogue(name
);
2474 #ifdef TARGET_NR_setitimer
2476 print_setitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2477 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2478 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2480 print_syscall_prologue(name
);
2481 print_enums(itimer_types
, arg0
, 0);
2482 print_itimerval(arg1
, 0);
2483 print_pointer(arg2
, 1);
2484 print_syscall_epilogue(name
);
2488 #ifdef TARGET_NR_link
2490 print_link(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2491 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2492 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2494 print_syscall_prologue(name
);
2495 print_string(arg0
, 0);
2496 print_string(arg1
, 1);
2497 print_syscall_epilogue(name
);
2501 #ifdef TARGET_NR_linkat
2503 print_linkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2504 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2505 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2507 print_syscall_prologue(name
);
2508 print_at_dirfd(arg0
, 0);
2509 print_string(arg1
, 0);
2510 print_at_dirfd(arg2
, 0);
2511 print_string(arg3
, 0);
2512 print_flags(at_file_flags
, arg4
, 1);
2513 print_syscall_epilogue(name
);
2517 #if defined(TARGET_NR__llseek) || defined(TARGET_NR_llseek)
2519 print__llseek(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2520 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2521 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2523 const char *whence
= "UNKNOWN";
2524 print_syscall_prologue(name
);
2525 print_raw_param("%d", arg0
, 0);
2526 print_raw_param("%ld", arg1
, 0);
2527 print_raw_param("%ld", arg2
, 0);
2528 print_pointer(arg3
, 0);
2530 case SEEK_SET
: whence
= "SEEK_SET"; break;
2531 case SEEK_CUR
: whence
= "SEEK_CUR"; break;
2532 case SEEK_END
: whence
= "SEEK_END"; break;
2534 qemu_log("%s", whence
);
2535 print_syscall_epilogue(name
);
2537 #define print_llseek print__llseek
2540 #ifdef TARGET_NR_lseek
2542 print_lseek(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2543 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2544 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2546 print_syscall_prologue(name
);
2547 print_raw_param("%d", arg0
, 0);
2548 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2551 qemu_log("SEEK_SET"); break;
2553 qemu_log("SEEK_CUR"); break;
2555 qemu_log("SEEK_END"); break;
2558 qemu_log("SEEK_DATA"); break;
2562 qemu_log("SEEK_HOLE"); break;
2565 print_raw_param("%#x", arg2
, 1);
2567 print_syscall_epilogue(name
);
2571 #ifdef TARGET_NR_truncate
2573 print_truncate(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2574 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2575 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2577 print_syscall_prologue(name
);
2578 print_string(arg0
, 0);
2579 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 1);
2580 print_syscall_epilogue(name
);
2584 #ifdef TARGET_NR_truncate64
2586 print_truncate64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2587 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2588 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2590 print_syscall_prologue(name
);
2591 print_string(arg0
, 0);
2592 if (regpairs_aligned(cpu_env
, TARGET_NR_truncate64
)) {
2596 print_raw_param("%" PRIu64
, target_offset64(arg1
, arg2
), 1);
2597 print_syscall_epilogue(name
);
2601 #ifdef TARGET_NR_ftruncate64
2603 print_ftruncate64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2604 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2605 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2607 print_syscall_prologue(name
);
2608 print_raw_param("%d", arg0
, 0);
2609 if (regpairs_aligned(cpu_env
, TARGET_NR_ftruncate64
)) {
2613 print_raw_param("%" PRIu64
, target_offset64(arg1
, arg2
), 1);
2614 print_syscall_epilogue(name
);
2618 #ifdef TARGET_NR_mlockall
2620 print_mlockall(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2621 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2622 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2624 print_syscall_prologue(name
);
2625 print_flags(mlockall_flags
, arg0
, 1);
2626 print_syscall_epilogue(name
);
2630 #if defined(TARGET_NR_socket)
2632 print_socket(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2633 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2634 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2636 abi_ulong domain
= arg0
, type
= arg1
, protocol
= arg2
;
2638 print_syscall_prologue(name
);
2639 print_socket_domain(domain
);
2641 print_socket_type(type
);
2643 if (domain
== AF_PACKET
||
2644 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
2645 protocol
= tswap16(protocol
);
2647 print_socket_protocol(domain
, type
, protocol
);
2648 print_syscall_epilogue(name
);
2653 #if defined(TARGET_NR_socketcall) || defined(TARGET_NR_bind)
2655 static void print_sockfd(abi_long sockfd
, int last
)
2657 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, last
);
2662 #if defined(TARGET_NR_socketcall)
2664 #define get_user_ualx(x, gaddr, idx) \
2665 get_user_ual(x, (gaddr) + (idx) * sizeof(abi_long))
2667 static void do_print_socket(const char *name
, abi_long arg1
)
2669 abi_ulong domain
, type
, protocol
;
2671 get_user_ualx(domain
, arg1
, 0);
2672 get_user_ualx(type
, arg1
, 1);
2673 get_user_ualx(protocol
, arg1
, 2);
2674 qemu_log("%s(", name
);
2675 print_socket_domain(domain
);
2677 print_socket_type(type
);
2679 if (domain
== AF_PACKET
||
2680 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
2681 protocol
= tswap16(protocol
);
2683 print_socket_protocol(domain
, type
, protocol
);
2687 static void do_print_sockaddr(const char *name
, abi_long arg1
)
2689 abi_ulong sockfd
, addr
, addrlen
;
2691 get_user_ualx(sockfd
, arg1
, 0);
2692 get_user_ualx(addr
, arg1
, 1);
2693 get_user_ualx(addrlen
, arg1
, 2);
2695 qemu_log("%s(", name
);
2696 print_sockfd(sockfd
, 0);
2697 print_sockaddr(addr
, addrlen
, 0);
2701 static void do_print_listen(const char *name
, abi_long arg1
)
2703 abi_ulong sockfd
, backlog
;
2705 get_user_ualx(sockfd
, arg1
, 0);
2706 get_user_ualx(backlog
, arg1
, 1);
2708 qemu_log("%s(", name
);
2709 print_sockfd(sockfd
, 0);
2710 print_raw_param(TARGET_ABI_FMT_ld
, backlog
, 1);
2714 static void do_print_socketpair(const char *name
, abi_long arg1
)
2716 abi_ulong domain
, type
, protocol
, tab
;
2718 get_user_ualx(domain
, arg1
, 0);
2719 get_user_ualx(type
, arg1
, 1);
2720 get_user_ualx(protocol
, arg1
, 2);
2721 get_user_ualx(tab
, arg1
, 3);
2723 qemu_log("%s(", name
);
2724 print_socket_domain(domain
);
2726 print_socket_type(type
);
2728 print_socket_protocol(domain
, type
, protocol
);
2730 print_raw_param(TARGET_ABI_FMT_lx
, tab
, 1);
2734 static void do_print_sendrecv(const char *name
, abi_long arg1
)
2736 abi_ulong sockfd
, msg
, len
, flags
;
2738 get_user_ualx(sockfd
, arg1
, 0);
2739 get_user_ualx(msg
, arg1
, 1);
2740 get_user_ualx(len
, arg1
, 2);
2741 get_user_ualx(flags
, arg1
, 3);
2743 qemu_log("%s(", name
);
2744 print_sockfd(sockfd
, 0);
2745 print_buf(msg
, len
, 0);
2746 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
2747 print_flags(msg_flags
, flags
, 1);
2751 static void do_print_msgaddr(const char *name
, abi_long arg1
)
2753 abi_ulong sockfd
, msg
, len
, flags
, addr
, addrlen
;
2755 get_user_ualx(sockfd
, arg1
, 0);
2756 get_user_ualx(msg
, arg1
, 1);
2757 get_user_ualx(len
, arg1
, 2);
2758 get_user_ualx(flags
, arg1
, 3);
2759 get_user_ualx(addr
, arg1
, 4);
2760 get_user_ualx(addrlen
, arg1
, 5);
2762 qemu_log("%s(", name
);
2763 print_sockfd(sockfd
, 0);
2764 print_buf(msg
, len
, 0);
2765 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
2766 print_flags(msg_flags
, flags
, 0);
2767 print_sockaddr(addr
, addrlen
, 0);
2771 static void do_print_shutdown(const char *name
, abi_long arg1
)
2773 abi_ulong sockfd
, how
;
2775 get_user_ualx(sockfd
, arg1
, 0);
2776 get_user_ualx(how
, arg1
, 1);
2778 qemu_log("shutdown(");
2779 print_sockfd(sockfd
, 0);
2782 qemu_log("SHUT_RD");
2785 qemu_log("SHUT_WR");
2788 qemu_log("SHUT_RDWR");
2791 print_raw_param(TARGET_ABI_FMT_ld
, how
, 1);
2797 static void do_print_msg(const char *name
, abi_long arg1
)
2799 abi_ulong sockfd
, msg
, flags
;
2801 get_user_ualx(sockfd
, arg1
, 0);
2802 get_user_ualx(msg
, arg1
, 1);
2803 get_user_ualx(flags
, arg1
, 2);
2805 qemu_log("%s(", name
);
2806 print_sockfd(sockfd
, 0);
2807 print_pointer(msg
, 0);
2808 print_flags(msg_flags
, flags
, 1);
2812 static void do_print_sockopt(const char *name
, abi_long arg1
)
2814 abi_ulong sockfd
, level
, optname
, optval
, optlen
;
2816 get_user_ualx(sockfd
, arg1
, 0);
2817 get_user_ualx(level
, arg1
, 1);
2818 get_user_ualx(optname
, arg1
, 2);
2819 get_user_ualx(optval
, arg1
, 3);
2820 get_user_ualx(optlen
, arg1
, 4);
2822 qemu_log("%s(", name
);
2823 print_sockfd(sockfd
, 0);
2826 qemu_log("SOL_TCP,");
2827 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2828 print_pointer(optval
, 0);
2831 qemu_log("SOL_UDP,");
2832 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2833 print_pointer(optval
, 0);
2836 qemu_log("SOL_IP,");
2837 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2838 print_pointer(optval
, 0);
2841 qemu_log("SOL_RAW,");
2842 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2843 print_pointer(optval
, 0);
2845 case TARGET_SOL_SOCKET
:
2846 qemu_log("SOL_SOCKET,");
2848 case TARGET_SO_DEBUG
:
2849 qemu_log("SO_DEBUG,");
2851 print_number(optval
, 0);
2853 case TARGET_SO_REUSEADDR
:
2854 qemu_log("SO_REUSEADDR,");
2856 case TARGET_SO_REUSEPORT
:
2857 qemu_log("SO_REUSEPORT,");
2859 case TARGET_SO_TYPE
:
2860 qemu_log("SO_TYPE,");
2862 case TARGET_SO_ERROR
:
2863 qemu_log("SO_ERROR,");
2865 case TARGET_SO_DONTROUTE
:
2866 qemu_log("SO_DONTROUTE,");
2868 case TARGET_SO_BROADCAST
:
2869 qemu_log("SO_BROADCAST,");
2871 case TARGET_SO_SNDBUF
:
2872 qemu_log("SO_SNDBUF,");
2874 case TARGET_SO_RCVBUF
:
2875 qemu_log("SO_RCVBUF,");
2877 case TARGET_SO_KEEPALIVE
:
2878 qemu_log("SO_KEEPALIVE,");
2880 case TARGET_SO_OOBINLINE
:
2881 qemu_log("SO_OOBINLINE,");
2883 case TARGET_SO_NO_CHECK
:
2884 qemu_log("SO_NO_CHECK,");
2886 case TARGET_SO_PRIORITY
:
2887 qemu_log("SO_PRIORITY,");
2889 case TARGET_SO_BSDCOMPAT
:
2890 qemu_log("SO_BSDCOMPAT,");
2892 case TARGET_SO_PASSCRED
:
2893 qemu_log("SO_PASSCRED,");
2895 case TARGET_SO_TIMESTAMP
:
2896 qemu_log("SO_TIMESTAMP,");
2898 case TARGET_SO_RCVLOWAT
:
2899 qemu_log("SO_RCVLOWAT,");
2901 case TARGET_SO_RCVTIMEO
:
2902 qemu_log("SO_RCVTIMEO,");
2903 print_timeval(optval
, 0);
2905 case TARGET_SO_SNDTIMEO
:
2906 qemu_log("SO_SNDTIMEO,");
2907 print_timeval(optval
, 0);
2909 case TARGET_SO_ATTACH_FILTER
: {
2910 struct target_sock_fprog
*fprog
;
2912 qemu_log("SO_ATTACH_FILTER,");
2914 if (lock_user_struct(VERIFY_READ
, fprog
, optval
, 0)) {
2915 struct target_sock_filter
*filter
;
2917 if (lock_user_struct(VERIFY_READ
, filter
,
2918 tswapal(fprog
->filter
), 0)) {
2920 for (i
= 0; i
< tswap16(fprog
->len
) - 1; i
++) {
2921 qemu_log("[%d]{0x%x,%d,%d,0x%x},",
2922 i
, tswap16(filter
[i
].code
),
2923 filter
[i
].jt
, filter
[i
].jf
,
2924 tswap32(filter
[i
].k
));
2926 qemu_log("[%d]{0x%x,%d,%d,0x%x}",
2927 i
, tswap16(filter
[i
].code
),
2928 filter
[i
].jt
, filter
[i
].jf
,
2929 tswap32(filter
[i
].k
));
2931 qemu_log(TARGET_ABI_FMT_lx
, tswapal(fprog
->filter
));
2933 qemu_log(",%d},", tswap16(fprog
->len
));
2934 unlock_user(fprog
, optval
, 0);
2936 print_pointer(optval
, 0);
2941 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2942 print_pointer(optval
, 0);
2947 qemu_log("SOL_IPV6,");
2949 case IPV6_MTU_DISCOVER
:
2950 qemu_log("IPV6_MTU_DISCOVER,");
2953 qemu_log("IPV6_MTU,");
2956 qemu_log("IPV6_V6ONLY,");
2958 case IPV6_RECVPKTINFO
:
2959 qemu_log("IPV6_RECVPKTINFO,");
2961 case IPV6_UNICAST_HOPS
:
2962 qemu_log("IPV6_UNICAST_HOPS,");
2964 case IPV6_MULTICAST_HOPS
:
2965 qemu_log("IPV6_MULTICAST_HOPS,");
2967 case IPV6_MULTICAST_LOOP
:
2968 qemu_log("IPV6_MULTICAST_LOOP,");
2971 qemu_log("IPV6_RECVERR,");
2973 case IPV6_RECVHOPLIMIT
:
2974 qemu_log("IPV6_RECVHOPLIMIT,");
2976 case IPV6_2292HOPLIMIT
:
2977 qemu_log("IPV6_2292HOPLIMIT,");
2980 qemu_log("IPV6_CHECKSUM,");
2983 qemu_log("IPV6_ADDRFORM,");
2985 case IPV6_2292PKTINFO
:
2986 qemu_log("IPV6_2292PKTINFO,");
2988 case IPV6_RECVTCLASS
:
2989 qemu_log("IPV6_RECVTCLASS,");
2991 case IPV6_RECVRTHDR
:
2992 qemu_log("IPV6_RECVRTHDR,");
2994 case IPV6_2292RTHDR
:
2995 qemu_log("IPV6_2292RTHDR,");
2997 case IPV6_RECVHOPOPTS
:
2998 qemu_log("IPV6_RECVHOPOPTS,");
3000 case IPV6_2292HOPOPTS
:
3001 qemu_log("IPV6_2292HOPOPTS,");
3003 case IPV6_RECVDSTOPTS
:
3004 qemu_log("IPV6_RECVDSTOPTS,");
3006 case IPV6_2292DSTOPTS
:
3007 qemu_log("IPV6_2292DSTOPTS,");
3010 qemu_log("IPV6_TCLASS,");
3012 case IPV6_ADDR_PREFERENCES
:
3013 qemu_log("IPV6_ADDR_PREFERENCES,");
3015 #ifdef IPV6_RECVPATHMTU
3016 case IPV6_RECVPATHMTU
:
3017 qemu_log("IPV6_RECVPATHMTU,");
3020 #ifdef IPV6_TRANSPARENT
3021 case IPV6_TRANSPARENT
:
3022 qemu_log("IPV6_TRANSPARENT,");
3025 #ifdef IPV6_FREEBIND
3027 qemu_log("IPV6_FREEBIND,");
3030 #ifdef IPV6_RECVORIGDSTADDR
3031 case IPV6_RECVORIGDSTADDR
:
3032 qemu_log("IPV6_RECVORIGDSTADDR,");
3036 qemu_log("IPV6_PKTINFO,");
3037 print_pointer(optval
, 0);
3039 case IPV6_ADD_MEMBERSHIP
:
3040 qemu_log("IPV6_ADD_MEMBERSHIP,");
3041 print_pointer(optval
, 0);
3043 case IPV6_DROP_MEMBERSHIP
:
3044 qemu_log("IPV6_DROP_MEMBERSHIP,");
3045 print_pointer(optval
, 0);
3048 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
3049 print_pointer(optval
, 0);
3054 print_raw_param(TARGET_ABI_FMT_ld
, level
, 0);
3055 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
3056 print_pointer(optval
, 0);
3059 print_raw_param(TARGET_ABI_FMT_ld
, optlen
, 1);
3063 #define PRINT_SOCKOP(name, func) \
3064 [TARGET_SYS_##name] = { #name, func }
3068 void (*print
)(const char *, abi_long
);
3070 PRINT_SOCKOP(SOCKET
, do_print_socket
),
3071 PRINT_SOCKOP(BIND
, do_print_sockaddr
),
3072 PRINT_SOCKOP(CONNECT
, do_print_sockaddr
),
3073 PRINT_SOCKOP(LISTEN
, do_print_listen
),
3074 PRINT_SOCKOP(ACCEPT
, do_print_sockaddr
),
3075 PRINT_SOCKOP(GETSOCKNAME
, do_print_sockaddr
),
3076 PRINT_SOCKOP(GETPEERNAME
, do_print_sockaddr
),
3077 PRINT_SOCKOP(SOCKETPAIR
, do_print_socketpair
),
3078 PRINT_SOCKOP(SEND
, do_print_sendrecv
),
3079 PRINT_SOCKOP(RECV
, do_print_sendrecv
),
3080 PRINT_SOCKOP(SENDTO
, do_print_msgaddr
),
3081 PRINT_SOCKOP(RECVFROM
, do_print_msgaddr
),
3082 PRINT_SOCKOP(SHUTDOWN
, do_print_shutdown
),
3083 PRINT_SOCKOP(SETSOCKOPT
, do_print_sockopt
),
3084 PRINT_SOCKOP(GETSOCKOPT
, do_print_sockopt
),
3085 PRINT_SOCKOP(SENDMSG
, do_print_msg
),
3086 PRINT_SOCKOP(RECVMSG
, do_print_msg
),
3087 PRINT_SOCKOP(ACCEPT4
, NULL
),
3088 PRINT_SOCKOP(RECVMMSG
, NULL
),
3089 PRINT_SOCKOP(SENDMMSG
, NULL
),
3093 print_socketcall(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3094 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3095 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3097 if (arg0
>= 0 && arg0
< ARRAY_SIZE(scall
) && scall
[arg0
].print
) {
3098 scall
[arg0
].print(scall
[arg0
].name
, arg1
);
3101 print_syscall_prologue(name
);
3102 print_raw_param(TARGET_ABI_FMT_ld
, arg0
, 0);
3103 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
3104 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
3105 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 0);
3106 print_raw_param(TARGET_ABI_FMT_ld
, arg4
, 0);
3107 print_raw_param(TARGET_ABI_FMT_ld
, arg5
, 0);
3108 print_syscall_epilogue(name
);
3112 #if defined(TARGET_NR_bind)
3114 print_bind(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3115 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3116 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3118 print_syscall_prologue(name
);
3119 print_sockfd(arg0
, 0);
3120 print_sockaddr(arg1
, arg2
, 1);
3121 print_syscall_epilogue(name
);
3125 #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \
3126 defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64)
3128 print_stat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3129 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3130 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3132 print_syscall_prologue(name
);
3133 print_string(arg0
, 0);
3134 print_pointer(arg1
, 1);
3135 print_syscall_epilogue(name
);
3137 #define print_lstat print_stat
3138 #define print_stat64 print_stat
3139 #define print_lstat64 print_stat
3142 #if defined(TARGET_NR_madvise)
3143 static struct enums madvise_advice
[] = {
3144 ENUM_TARGET(MADV_NORMAL
),
3145 ENUM_TARGET(MADV_RANDOM
),
3146 ENUM_TARGET(MADV_SEQUENTIAL
),
3147 ENUM_TARGET(MADV_WILLNEED
),
3148 ENUM_TARGET(MADV_DONTNEED
),
3149 ENUM_TARGET(MADV_FREE
),
3150 ENUM_TARGET(MADV_REMOVE
),
3151 ENUM_TARGET(MADV_DONTFORK
),
3152 ENUM_TARGET(MADV_DOFORK
),
3153 ENUM_TARGET(MADV_MERGEABLE
),
3154 ENUM_TARGET(MADV_UNMERGEABLE
),
3155 ENUM_TARGET(MADV_HUGEPAGE
),
3156 ENUM_TARGET(MADV_NOHUGEPAGE
),
3157 ENUM_TARGET(MADV_DONTDUMP
),
3158 ENUM_TARGET(MADV_DODUMP
),
3159 ENUM_TARGET(MADV_WIPEONFORK
),
3160 ENUM_TARGET(MADV_KEEPONFORK
),
3161 ENUM_TARGET(MADV_COLD
),
3162 ENUM_TARGET(MADV_PAGEOUT
),
3163 ENUM_TARGET(MADV_POPULATE_READ
),
3164 ENUM_TARGET(MADV_POPULATE_WRITE
),
3165 ENUM_TARGET(MADV_DONTNEED_LOCKED
),
3170 print_madvise(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3171 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3172 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3174 print_syscall_prologue(name
);
3175 print_pointer(arg0
, 0);
3176 print_raw_param("%d", arg1
, 0);
3177 print_enums(madvise_advice
, arg2
, 1);
3178 print_syscall_epilogue(name
);
3182 #if defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64)
3184 print_fstat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3185 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3186 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3188 print_syscall_prologue(name
);
3189 print_raw_param("%d", arg0
, 0);
3190 print_pointer(arg1
, 1);
3191 print_syscall_epilogue(name
);
3193 #define print_fstat64 print_fstat
3196 #ifdef TARGET_NR_mkdir
3198 print_mkdir(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3199 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3200 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3202 print_syscall_prologue(name
);
3203 print_string(arg0
, 0);
3204 print_file_mode(arg1
, 1);
3205 print_syscall_epilogue(name
);
3209 #ifdef TARGET_NR_mkdirat
3211 print_mkdirat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3212 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3213 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3215 print_syscall_prologue(name
);
3216 print_at_dirfd(arg0
, 0);
3217 print_string(arg1
, 0);
3218 print_file_mode(arg2
, 1);
3219 print_syscall_epilogue(name
);
3223 #ifdef TARGET_NR_rmdir
3225 print_rmdir(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3226 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3227 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3229 print_syscall_prologue(name
);
3230 print_string(arg0
, 0);
3231 print_syscall_epilogue(name
);
3235 #ifdef TARGET_NR_rt_sigaction
3237 print_rt_sigaction(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3238 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3239 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3241 print_syscall_prologue(name
);
3242 print_signal(arg0
, 0);
3243 print_pointer(arg1
, 0);
3244 print_pointer(arg2
, 1);
3245 print_syscall_epilogue(name
);
3249 #ifdef TARGET_NR_rt_sigprocmask
3251 print_rt_sigprocmask(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3252 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3253 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3255 const char *how
= "UNKNOWN";
3256 print_syscall_prologue(name
);
3258 case TARGET_SIG_BLOCK
: how
= "SIG_BLOCK"; break;
3259 case TARGET_SIG_UNBLOCK
: how
= "SIG_UNBLOCK"; break;
3260 case TARGET_SIG_SETMASK
: how
= "SIG_SETMASK"; break;
3262 qemu_log("%s,", how
);
3263 print_pointer(arg1
, 0);
3264 print_pointer(arg2
, 0);
3265 print_raw_param("%u", arg3
, 1);
3266 print_syscall_epilogue(name
);
3270 #ifdef TARGET_NR_rt_sigqueueinfo
3272 print_rt_sigqueueinfo(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3273 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3274 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3277 target_siginfo_t uinfo
;
3279 print_syscall_prologue(name
);
3280 print_raw_param("%d", arg0
, 0);
3281 print_signal(arg1
, 0);
3282 p
= lock_user(VERIFY_READ
, arg2
, sizeof(target_siginfo_t
), 1);
3284 get_target_siginfo(&uinfo
, p
);
3285 print_siginfo(&uinfo
);
3287 unlock_user(p
, arg2
, 0);
3289 print_pointer(arg2
, 1);
3291 print_syscall_epilogue(name
);
3295 #ifdef TARGET_NR_rt_tgsigqueueinfo
3297 print_rt_tgsigqueueinfo(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3298 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3299 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3302 target_siginfo_t uinfo
;
3304 print_syscall_prologue(name
);
3305 print_raw_param("%d", arg0
, 0);
3306 print_raw_param("%d", arg1
, 0);
3307 print_signal(arg2
, 0);
3308 p
= lock_user(VERIFY_READ
, arg3
, sizeof(target_siginfo_t
), 1);
3310 get_target_siginfo(&uinfo
, p
);
3311 print_siginfo(&uinfo
);
3313 unlock_user(p
, arg3
, 0);
3315 print_pointer(arg3
, 1);
3317 print_syscall_epilogue(name
);
3321 #ifdef TARGET_NR_syslog
3323 print_syslog_action(abi_ulong arg
, int last
)
3328 case TARGET_SYSLOG_ACTION_CLOSE
: {
3329 type
= "SYSLOG_ACTION_CLOSE";
3332 case TARGET_SYSLOG_ACTION_OPEN
: {
3333 type
= "SYSLOG_ACTION_OPEN";
3336 case TARGET_SYSLOG_ACTION_READ
: {
3337 type
= "SYSLOG_ACTION_READ";
3340 case TARGET_SYSLOG_ACTION_READ_ALL
: {
3341 type
= "SYSLOG_ACTION_READ_ALL";
3344 case TARGET_SYSLOG_ACTION_READ_CLEAR
: {
3345 type
= "SYSLOG_ACTION_READ_CLEAR";
3348 case TARGET_SYSLOG_ACTION_CLEAR
: {
3349 type
= "SYSLOG_ACTION_CLEAR";
3352 case TARGET_SYSLOG_ACTION_CONSOLE_OFF
: {
3353 type
= "SYSLOG_ACTION_CONSOLE_OFF";
3356 case TARGET_SYSLOG_ACTION_CONSOLE_ON
: {
3357 type
= "SYSLOG_ACTION_CONSOLE_ON";
3360 case TARGET_SYSLOG_ACTION_CONSOLE_LEVEL
: {
3361 type
= "SYSLOG_ACTION_CONSOLE_LEVEL";
3364 case TARGET_SYSLOG_ACTION_SIZE_UNREAD
: {
3365 type
= "SYSLOG_ACTION_SIZE_UNREAD";
3368 case TARGET_SYSLOG_ACTION_SIZE_BUFFER
: {
3369 type
= "SYSLOG_ACTION_SIZE_BUFFER";
3373 print_raw_param("%ld", arg
, last
);
3377 qemu_log("%s%s", type
, get_comma(last
));
3381 print_syslog(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3382 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3383 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3385 print_syscall_prologue(name
);
3386 print_syslog_action(arg0
, 0);
3387 print_pointer(arg1
, 0);
3388 print_raw_param("%d", arg2
, 1);
3389 print_syscall_epilogue(name
);
3393 #ifdef TARGET_NR_mknod
3395 print_mknod(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3396 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3397 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3399 int hasdev
= (arg1
& (S_IFCHR
|S_IFBLK
));
3401 print_syscall_prologue(name
);
3402 print_string(arg0
, 0);
3403 print_file_mode(arg1
, (hasdev
== 0));
3405 print_raw_param("makedev(%d", major(arg2
), 0);
3406 print_raw_param("%d)", minor(arg2
), 1);
3408 print_syscall_epilogue(name
);
3412 #ifdef TARGET_NR_mknodat
3414 print_mknodat(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 hasdev
= (arg2
& (S_IFCHR
|S_IFBLK
));
3420 print_syscall_prologue(name
);
3421 print_at_dirfd(arg0
, 0);
3422 print_string(arg1
, 0);
3423 print_file_mode(arg2
, (hasdev
== 0));
3425 print_raw_param("makedev(%d", major(arg3
), 0);
3426 print_raw_param("%d)", minor(arg3
), 1);
3428 print_syscall_epilogue(name
);
3432 #ifdef TARGET_NR_mq_open
3434 print_mq_open(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3435 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3436 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3438 int is_creat
= (arg1
& TARGET_O_CREAT
);
3440 print_syscall_prologue(name
);
3441 print_string(arg0
, 0);
3442 print_open_flags(arg1
, (is_creat
== 0));
3444 print_file_mode(arg2
, 0);
3445 print_pointer(arg3
, 1);
3447 print_syscall_epilogue(name
);
3451 #ifdef TARGET_NR_open
3453 print_open(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3454 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3455 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3457 int is_creat
= (arg1
& TARGET_O_CREAT
);
3459 print_syscall_prologue(name
);
3460 print_string(arg0
, 0);
3461 print_open_flags(arg1
, (is_creat
== 0));
3463 print_file_mode(arg2
, 1);
3464 print_syscall_epilogue(name
);
3468 #ifdef TARGET_NR_openat
3470 print_openat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3471 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3472 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3474 int is_creat
= (arg2
& TARGET_O_CREAT
);
3476 print_syscall_prologue(name
);
3477 print_at_dirfd(arg0
, 0);
3478 print_string(arg1
, 0);
3479 print_open_flags(arg2
, (is_creat
== 0));
3481 print_file_mode(arg3
, 1);
3482 print_syscall_epilogue(name
);
3486 #ifdef TARGET_NR_pidfd_send_signal
3488 print_pidfd_send_signal(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3489 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3490 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3493 target_siginfo_t uinfo
;
3495 print_syscall_prologue(name
);
3496 print_raw_param("%d", arg0
, 0);
3497 print_signal(arg1
, 0);
3499 p
= lock_user(VERIFY_READ
, arg2
, sizeof(target_siginfo_t
), 1);
3501 get_target_siginfo(&uinfo
, p
);
3502 print_siginfo(&uinfo
);
3504 unlock_user(p
, arg2
, 0);
3506 print_pointer(arg2
, 0);
3509 print_raw_param("%u", arg3
, 1);
3510 print_syscall_epilogue(name
);
3514 #ifdef TARGET_NR_mq_unlink
3516 print_mq_unlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3517 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3518 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3520 print_syscall_prologue(name
);
3521 print_string(arg0
, 1);
3522 print_syscall_epilogue(name
);
3526 #if defined(TARGET_NR_fstatat64) || defined(TARGET_NR_newfstatat)
3528 print_fstatat64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3529 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3530 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3532 print_syscall_prologue(name
);
3533 print_at_dirfd(arg0
, 0);
3534 print_string(arg1
, 0);
3535 print_pointer(arg2
, 0);
3536 print_flags(at_file_flags
, arg3
, 1);
3537 print_syscall_epilogue(name
);
3539 #define print_newfstatat print_fstatat64
3542 #ifdef TARGET_NR_readlink
3544 print_readlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3545 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3546 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3548 print_syscall_prologue(name
);
3549 print_string(arg0
, 0);
3550 print_pointer(arg1
, 0);
3551 print_raw_param("%u", arg2
, 1);
3552 print_syscall_epilogue(name
);
3556 #ifdef TARGET_NR_readlinkat
3558 print_readlinkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3559 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3560 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3562 print_syscall_prologue(name
);
3563 print_at_dirfd(arg0
, 0);
3564 print_string(arg1
, 0);
3565 print_pointer(arg2
, 0);
3566 print_raw_param("%u", arg3
, 1);
3567 print_syscall_epilogue(name
);
3571 #ifdef TARGET_NR_rename
3573 print_rename(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3574 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3575 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3577 print_syscall_prologue(name
);
3578 print_string(arg0
, 0);
3579 print_string(arg1
, 1);
3580 print_syscall_epilogue(name
);
3584 #ifdef TARGET_NR_renameat
3586 print_renameat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3587 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3588 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3590 print_syscall_prologue(name
);
3591 print_at_dirfd(arg0
, 0);
3592 print_string(arg1
, 0);
3593 print_at_dirfd(arg2
, 0);
3594 print_string(arg3
, 1);
3595 print_syscall_epilogue(name
);
3599 #ifdef TARGET_NR_statfs
3601 print_statfs(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3602 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3603 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3605 print_syscall_prologue(name
);
3606 print_string(arg0
, 0);
3607 print_pointer(arg1
, 1);
3608 print_syscall_epilogue(name
);
3612 #ifdef TARGET_NR_statfs64
3614 print_statfs64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3615 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3616 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3618 print_syscall_prologue(name
);
3619 print_string(arg0
, 0);
3620 print_pointer(arg1
, 1);
3621 print_syscall_epilogue(name
);
3625 #ifdef TARGET_NR_symlink
3627 print_symlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3628 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3629 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3631 print_syscall_prologue(name
);
3632 print_string(arg0
, 0);
3633 print_string(arg1
, 1);
3634 print_syscall_epilogue(name
);
3638 #ifdef TARGET_NR_symlinkat
3640 print_symlinkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3641 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3642 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3644 print_syscall_prologue(name
);
3645 print_string(arg0
, 0);
3646 print_at_dirfd(arg1
, 0);
3647 print_string(arg2
, 1);
3648 print_syscall_epilogue(name
);
3652 #ifdef TARGET_NR_mount
3654 print_mount(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3655 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3656 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3658 print_syscall_prologue(name
);
3659 print_string(arg0
, 0);
3660 print_string(arg1
, 0);
3661 print_string(arg2
, 0);
3662 print_flags(mount_flags
, arg3
, 0);
3663 print_pointer(arg4
, 1);
3664 print_syscall_epilogue(name
);
3668 #ifdef TARGET_NR_umount
3670 print_umount(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3671 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3672 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3674 print_syscall_prologue(name
);
3675 print_string(arg0
, 1);
3676 print_syscall_epilogue(name
);
3680 #ifdef TARGET_NR_umount2
3682 print_umount2(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3683 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3684 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3686 print_syscall_prologue(name
);
3687 print_string(arg0
, 0);
3688 print_flags(umount2_flags
, arg1
, 1);
3689 print_syscall_epilogue(name
);
3693 #ifdef TARGET_NR_unlink
3695 print_unlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3696 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3697 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3699 print_syscall_prologue(name
);
3700 print_string(arg0
, 1);
3701 print_syscall_epilogue(name
);
3705 #ifdef TARGET_NR_unlinkat
3707 print_unlinkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3708 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3709 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3711 print_syscall_prologue(name
);
3712 print_at_dirfd(arg0
, 0);
3713 print_string(arg1
, 0);
3714 print_flags(unlinkat_flags
, arg2
, 1);
3715 print_syscall_epilogue(name
);
3719 #ifdef TARGET_NR_unshare
3721 print_unshare(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3722 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3723 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3725 print_syscall_prologue(name
);
3726 print_flags(clone_flags
, arg0
, 1);
3727 print_syscall_epilogue(name
);
3731 #ifdef TARGET_NR_clock_nanosleep
3733 print_clock_nanosleep(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3734 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3735 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3737 print_syscall_prologue(name
);
3738 print_enums(clockids
, arg0
, 0);
3739 print_raw_param("%d", arg1
, 0);
3740 print_timespec(arg2
, 0);
3741 print_timespec(arg3
, 1);
3742 print_syscall_epilogue(name
);
3746 #ifdef TARGET_NR_utime
3748 print_utime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3749 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3750 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3752 print_syscall_prologue(name
);
3753 print_string(arg0
, 0);
3754 print_pointer(arg1
, 1);
3755 print_syscall_epilogue(name
);
3759 #ifdef TARGET_NR_utimes
3761 print_utimes(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3762 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3763 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3765 print_syscall_prologue(name
);
3766 print_string(arg0
, 0);
3767 print_pointer(arg1
, 1);
3768 print_syscall_epilogue(name
);
3772 #ifdef TARGET_NR_utimensat
3774 print_utimensat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3775 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3776 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3778 print_syscall_prologue(name
);
3779 print_at_dirfd(arg0
, 0);
3780 print_string(arg1
, 0);
3781 print_pointer(arg2
, 0);
3782 print_flags(at_file_flags
, arg3
, 1);
3783 print_syscall_epilogue(name
);
3787 #if defined(TARGET_NR_mmap) || defined(TARGET_NR_mmap2)
3789 print_mmap_both(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3790 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3791 abi_long arg3
, abi_long arg4
, abi_long arg5
,
3796 abi_ulong argp
= arg0
;
3797 if (!(v
= lock_user(VERIFY_READ
, argp
, 6 * sizeof(abi_ulong
), 1)))
3799 arg0
= tswapal(v
[0]);
3800 arg1
= tswapal(v
[1]);
3801 arg2
= tswapal(v
[2]);
3802 arg3
= tswapal(v
[3]);
3803 arg4
= tswapal(v
[4]);
3804 arg5
= tswapal(v
[5]);
3805 unlock_user(v
, argp
, 0);
3807 print_syscall_prologue(name
);
3808 print_pointer(arg0
, 0);
3809 print_raw_param("%d", arg1
, 0);
3810 print_flags(mmap_prot_flags
, arg2
, 0);
3811 print_flags(mmap_flags
, arg3
, 0);
3812 print_raw_param("%d", arg4
, 0);
3813 print_raw_param("%#x", arg5
, 1);
3814 print_syscall_epilogue(name
);
3818 #if defined(TARGET_NR_mmap)
3820 print_mmap(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3821 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3822 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3824 return print_mmap_both(cpu_env
, name
, arg0
, arg1
, arg2
, arg3
,
3826 #if defined(TARGET_NR_mmap2)
3835 #if defined(TARGET_NR_mmap2)
3837 print_mmap2(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3838 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3839 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3841 return print_mmap_both(cpu_env
, name
, arg0
, arg1
, arg2
, arg3
,
3846 #ifdef TARGET_NR_mprotect
3848 print_mprotect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3849 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3850 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3852 print_syscall_prologue(name
);
3853 print_pointer(arg0
, 0);
3854 print_raw_param("%d", arg1
, 0);
3855 print_flags(mmap_prot_flags
, arg2
, 1);
3856 print_syscall_epilogue(name
);
3860 #ifdef TARGET_NR_munmap
3862 print_munmap(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3863 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3864 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3866 print_syscall_prologue(name
);
3867 print_pointer(arg0
, 0);
3868 print_raw_param("%d", arg1
, 1);
3869 print_syscall_epilogue(name
);
3873 #ifdef TARGET_NR_futex
3874 static void print_futex_op(int cmd
, int last
)
3876 static const char * const futex_names
[] = {
3877 #define NAME(X) [X] = #X
3881 NAME(FUTEX_REQUEUE
),
3882 NAME(FUTEX_CMP_REQUEUE
),
3883 NAME(FUTEX_WAKE_OP
),
3884 NAME(FUTEX_LOCK_PI
),
3885 NAME(FUTEX_UNLOCK_PI
),
3886 NAME(FUTEX_TRYLOCK_PI
),
3887 NAME(FUTEX_WAIT_BITSET
),
3888 NAME(FUTEX_WAKE_BITSET
),
3889 NAME(FUTEX_WAIT_REQUEUE_PI
),
3890 NAME(FUTEX_CMP_REQUEUE_PI
),
3891 NAME(FUTEX_LOCK_PI2
),
3895 unsigned base_cmd
= cmd
& FUTEX_CMD_MASK
;
3897 if (base_cmd
< ARRAY_SIZE(futex_names
)) {
3899 (cmd
& FUTEX_PRIVATE_FLAG
? "FUTEX_PRIVATE_FLAG|" : ""),
3900 (cmd
& FUTEX_CLOCK_REALTIME
? "FUTEX_CLOCK_REALTIME|" : ""),
3901 futex_names
[base_cmd
]);
3903 qemu_log("0x%x", cmd
);
3908 print_futex(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3909 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3910 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3912 abi_long op
= arg1
& FUTEX_CMD_MASK
;
3913 print_syscall_prologue(name
);
3914 print_pointer(arg0
, 0);
3915 print_futex_op(arg1
, 0);
3916 print_raw_param(",%d", arg2
, 0);
3919 case FUTEX_WAIT_BITSET
:
3921 case FUTEX_LOCK_PI2
:
3922 case FUTEX_WAIT_REQUEUE_PI
:
3923 print_timespec(arg3
, 0);
3926 print_pointer(arg3
, 0);
3929 print_pointer(arg4
, 0);
3930 print_raw_param("%d", arg4
, 1);
3931 print_syscall_epilogue(name
);
3935 #ifdef TARGET_NR_prlimit64
3936 static const char *target_ressource_string(abi_ulong r
)
3938 #define RET_RES_ENTRY(res) case TARGET_##res: return #res;
3940 RET_RES_ENTRY(RLIMIT_AS
);
3941 RET_RES_ENTRY(RLIMIT_CORE
);
3942 RET_RES_ENTRY(RLIMIT_CPU
);
3943 RET_RES_ENTRY(RLIMIT_DATA
);
3944 RET_RES_ENTRY(RLIMIT_FSIZE
);
3945 RET_RES_ENTRY(RLIMIT_LOCKS
);
3946 RET_RES_ENTRY(RLIMIT_MEMLOCK
);
3947 RET_RES_ENTRY(RLIMIT_MSGQUEUE
);
3948 RET_RES_ENTRY(RLIMIT_NICE
);
3949 RET_RES_ENTRY(RLIMIT_NOFILE
);
3950 RET_RES_ENTRY(RLIMIT_NPROC
);
3951 RET_RES_ENTRY(RLIMIT_RSS
);
3952 RET_RES_ENTRY(RLIMIT_RTPRIO
);
3953 #ifdef RLIMIT_RTTIME
3954 RET_RES_ENTRY(RLIMIT_RTTIME
);
3956 RET_RES_ENTRY(RLIMIT_SIGPENDING
);
3957 RET_RES_ENTRY(RLIMIT_STACK
);
3961 #undef RET_RES_ENTRY
3965 print_rlimit64(abi_ulong rlim_addr
, int last
)
3968 struct target_rlimit64
*rl
;
3970 rl
= lock_user(VERIFY_READ
, rlim_addr
, sizeof(*rl
), 1);
3972 print_pointer(rlim_addr
, last
);
3975 print_raw_param64("{rlim_cur=%" PRId64
, tswap64(rl
->rlim_cur
), 0);
3976 print_raw_param64("rlim_max=%" PRId64
"}", tswap64(rl
->rlim_max
),
3978 unlock_user(rl
, rlim_addr
, 0);
3980 qemu_log("NULL%s", get_comma(last
));
3985 print_prlimit64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3986 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3987 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3989 const char *rlim_name
;
3991 print_syscall_prologue(name
);
3992 print_raw_param("%d", arg0
, 0);
3993 rlim_name
= target_ressource_string(arg1
);
3995 qemu_log("%s,", rlim_name
);
3997 print_raw_param("%d", arg1
, 0);
3999 print_rlimit64(arg2
, 0);
4000 print_pointer(arg3
, 1);
4001 print_syscall_epilogue(name
);
4005 print_syscall_ret_prlimit64(CPUArchState
*cpu_env
,
4006 const struct syscallname
*name
,
4007 abi_long ret
, abi_long arg0
, abi_long arg1
,
4008 abi_long arg2
, abi_long arg3
, abi_long arg4
,
4011 if (!print_syscall_err(ret
)) {
4012 qemu_log(TARGET_ABI_FMT_ld
, ret
);
4015 print_rlimit64(arg3
, 1);
4023 #ifdef TARGET_NR_kill
4025 print_kill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4026 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4027 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4029 print_syscall_prologue(name
);
4030 print_raw_param("%d", arg0
, 0);
4031 print_signal(arg1
, 1);
4032 print_syscall_epilogue(name
);
4036 #ifdef TARGET_NR_tkill
4038 print_tkill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4039 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4040 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4042 print_syscall_prologue(name
);
4043 print_raw_param("%d", arg0
, 0);
4044 print_signal(arg1
, 1);
4045 print_syscall_epilogue(name
);
4049 #ifdef TARGET_NR_tgkill
4051 print_tgkill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4052 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4053 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4055 print_syscall_prologue(name
);
4056 print_raw_param("%d", arg0
, 0);
4057 print_raw_param("%d", arg1
, 0);
4058 print_signal(arg2
, 1);
4059 print_syscall_epilogue(name
);
4063 #if defined(TARGET_NR_pread64) || defined(TARGET_NR_pwrite64)
4065 print_pread64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4066 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4067 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4069 if (regpairs_aligned(cpu_env
, TARGET_NR_pread64
)) {
4073 print_syscall_prologue(name
);
4074 print_raw_param("%d", arg0
, 0);
4075 print_pointer(arg1
, 0);
4076 print_raw_param("%d", arg2
, 0);
4077 print_raw_param("%" PRIu64
, target_offset64(arg3
, arg4
), 1);
4078 print_syscall_epilogue(name
);
4082 #ifdef TARGET_NR_statx
4084 print_statx(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4085 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4086 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4088 print_syscall_prologue(name
);
4089 print_at_dirfd(arg0
, 0);
4090 print_string(arg1
, 0);
4091 print_flags(statx_flags
, arg2
, 0);
4092 print_flags(statx_mask
, arg3
, 0);
4093 print_pointer(arg4
, 1);
4094 print_syscall_epilogue(name
);
4098 #ifdef TARGET_NR_ioctl
4100 print_ioctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4101 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4102 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4104 print_syscall_prologue(name
);
4105 print_raw_param("%d", arg0
, 0);
4107 const IOCTLEntry
*ie
;
4108 const argtype
*arg_type
;
4112 for (ie
= ioctl_entries
; ie
->target_cmd
!= 0; ie
++) {
4113 if (ie
->target_cmd
== arg1
) {
4118 if (ie
->target_cmd
== 0) {
4119 print_raw_param("%#x", arg1
, 0);
4120 print_raw_param("%#x", arg2
, 1);
4122 qemu_log("%s", ie
->name
);
4123 arg_type
= ie
->arg_type
;
4125 if (arg_type
[0] != TYPE_NULL
) {
4128 switch (arg_type
[0]) {
4130 print_pointer(arg2
, 1);
4135 print_raw_param("%d", arg2
, 1);
4138 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
4141 print_raw_param(TARGET_ABI_FMT_lu
, arg2
, 1);
4144 switch (ie
->access
) {
4146 print_pointer(arg2
, 1);
4151 target_size
= thunk_type_size(arg_type
, 0);
4152 argptr
= lock_user(VERIFY_READ
, arg2
, target_size
, 1);
4154 thunk_print(argptr
, arg_type
);
4155 unlock_user(argptr
, arg2
, target_size
);
4157 print_pointer(arg2
, 1);
4163 g_assert_not_reached();
4167 print_syscall_epilogue(name
);
4172 * An array of all of the syscalls we know about
4175 static const struct syscallname scnames
[] = {
4176 #include "strace.list"
4179 static int nsyscalls
= ARRAY_SIZE(scnames
);
4182 * The public interface to this module.
4185 print_syscall(CPUArchState
*cpu_env
, int num
,
4186 abi_long arg1
, abi_long arg2
, abi_long arg3
,
4187 abi_long arg4
, abi_long arg5
, abi_long arg6
)
4191 const char *format
= "%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
","
4192 TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
","
4193 TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
")";
4195 f
= qemu_log_trylock();
4199 fprintf(f
, "%d ", getpid());
4201 for (i
= 0; i
< nsyscalls
; i
++) {
4202 if (scnames
[i
].nr
== num
) {
4203 if (scnames
[i
].call
!= NULL
) {
4204 scnames
[i
].call(cpu_env
, &scnames
[i
], arg1
, arg2
, arg3
,
4207 /* XXX: this format system is broken because it uses
4208 host types and host pointers for strings */
4209 if (scnames
[i
].format
!= NULL
) {
4210 format
= scnames
[i
].format
;
4212 fprintf(f
, format
, scnames
[i
].name
, arg1
, arg2
,
4213 arg3
, arg4
, arg5
, arg6
);
4219 fprintf(f
, "Unknown syscall %d\n", num
);
4225 print_syscall_ret(CPUArchState
*cpu_env
, int num
, abi_long ret
,
4226 abi_long arg1
, abi_long arg2
, abi_long arg3
,
4227 abi_long arg4
, abi_long arg5
, abi_long arg6
)
4232 f
= qemu_log_trylock();
4237 for (i
= 0; i
< nsyscalls
; i
++) {
4238 if (scnames
[i
].nr
== num
) {
4239 if (scnames
[i
].result
!= NULL
) {
4240 scnames
[i
].result(cpu_env
, &scnames
[i
], ret
,
4244 if (!print_syscall_err(ret
)) {
4245 fprintf(f
, TARGET_ABI_FMT_ld
, ret
);
4255 void print_taken_signal(int target_signum
, const target_siginfo_t
*tinfo
)
4257 /* Print the strace output for a signal being taken:
4258 * --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
4262 f
= qemu_log_trylock();
4268 print_signal(target_signum
, 1);
4270 print_siginfo(tinfo
);
4271 fprintf(f
, " ---\n");