1 #include "qemu/osdep.h"
6 #include <sys/select.h>
9 #include <netinet/tcp.h>
10 #include <netinet/udp.h>
11 #include <linux/if_packet.h>
12 #include <linux/netlink.h>
20 void (*call
)(void *, const struct syscallname
*,
21 abi_long
, abi_long
, abi_long
,
22 abi_long
, abi_long
, abi_long
);
23 void (*result
)(void *, const struct syscallname
*, abi_long
,
24 abi_long
, abi_long
, abi_long
,
25 abi_long
, abi_long
, abi_long
);
29 * It is possible that target doesn't have syscall that uses
30 * following flags but we don't want the compiler to warn
31 * us about them being unused. Same applies to utility print
32 * functions. It is ok to keep them while not used.
34 #define UNUSED __attribute__ ((unused))
37 * Structure used to translate flag values into strings. This is
38 * similar that is in the actual strace tool.
41 abi_long f_value
; /* flag */
42 const char *f_string
; /* stringified flag */
45 /* common flags for all architectures */
46 #define FLAG_GENERIC(name) { name, #name }
47 /* target specific flags (syscall_defs.h has TARGET_<flag>) */
48 #define FLAG_TARGET(name) { TARGET_ ## name, #name }
49 /* end of flags array */
50 #define FLAG_END { 0, NULL }
52 /* Structure used to translate enumerated values into strings */
54 abi_long e_value
; /* enum value */
55 const char *e_string
; /* stringified enum */
58 /* common enums for all architectures */
59 #define ENUM_GENERIC(name) { name, #name }
60 /* target specific enums */
61 #define ENUM_TARGET(name) { TARGET_ ## name, #name }
62 /* end of enums array */
63 #define ENUM_END { 0, NULL }
65 UNUSED
static const char *get_comma(int);
66 UNUSED
static void print_pointer(abi_long
, int);
67 UNUSED
static void print_flags(const struct flags
*, abi_long
, int);
68 UNUSED
static void print_enums(const struct enums
*, abi_long
, int);
69 UNUSED
static void print_at_dirfd(abi_long
, int);
70 UNUSED
static void print_file_mode(abi_long
, int);
71 UNUSED
static void print_open_flags(abi_long
, int);
72 UNUSED
static void print_syscall_prologue(const struct syscallname
*);
73 UNUSED
static void print_syscall_epilogue(const struct syscallname
*);
74 UNUSED
static void print_string(abi_long
, int);
75 UNUSED
static void print_buf(abi_long addr
, abi_long len
, int last
);
76 UNUSED
static void print_raw_param(const char *, abi_long
, int);
77 UNUSED
static void print_timeval(abi_ulong
, int);
78 UNUSED
static void print_timespec(abi_ulong
, int);
79 UNUSED
static void print_timezone(abi_ulong
, int);
80 UNUSED
static void print_itimerval(abi_ulong
, int);
81 UNUSED
static void print_number(abi_long
, int);
82 UNUSED
static void print_signal(abi_ulong
, int);
83 UNUSED
static void print_sockaddr(abi_ulong
, abi_long
, int);
84 UNUSED
static void print_socket_domain(int domain
);
85 UNUSED
static void print_socket_type(int type
);
86 UNUSED
static void print_socket_protocol(int domain
, int type
, int protocol
);
92 print_ipc_cmd(int cmd
)
94 #define output_cmd(val) \
102 /* General IPC commands */
103 output_cmd( IPC_RMID
);
104 output_cmd( IPC_SET
);
105 output_cmd( IPC_STAT
);
106 output_cmd( IPC_INFO
);
107 /* msgctl() commands */
108 output_cmd( MSG_STAT
);
109 output_cmd( MSG_INFO
);
110 /* shmctl() commands */
111 output_cmd( SHM_LOCK
);
112 output_cmd( SHM_UNLOCK
);
113 output_cmd( SHM_STAT
);
114 output_cmd( SHM_INFO
);
115 /* semctl() commands */
116 output_cmd( GETPID
);
117 output_cmd( GETVAL
);
118 output_cmd( GETALL
);
119 output_cmd( GETNCNT
);
120 output_cmd( GETZCNT
);
121 output_cmd( SETVAL
);
122 output_cmd( SETALL
);
123 output_cmd( SEM_STAT
);
124 output_cmd( SEM_INFO
);
125 output_cmd( IPC_RMID
);
126 output_cmd( IPC_RMID
);
127 output_cmd( IPC_RMID
);
128 output_cmd( IPC_RMID
);
129 output_cmd( IPC_RMID
);
130 output_cmd( IPC_RMID
);
131 output_cmd( IPC_RMID
);
132 output_cmd( IPC_RMID
);
133 output_cmd( IPC_RMID
);
135 /* Some value we don't recognize */
140 print_signal(abi_ulong arg
, int last
)
142 const char *signal_name
= NULL
;
144 case TARGET_SIGHUP
: signal_name
= "SIGHUP"; break;
145 case TARGET_SIGINT
: signal_name
= "SIGINT"; break;
146 case TARGET_SIGQUIT
: signal_name
= "SIGQUIT"; break;
147 case TARGET_SIGILL
: signal_name
= "SIGILL"; break;
148 case TARGET_SIGABRT
: signal_name
= "SIGABRT"; break;
149 case TARGET_SIGFPE
: signal_name
= "SIGFPE"; break;
150 case TARGET_SIGKILL
: signal_name
= "SIGKILL"; break;
151 case TARGET_SIGSEGV
: signal_name
= "SIGSEGV"; break;
152 case TARGET_SIGPIPE
: signal_name
= "SIGPIPE"; break;
153 case TARGET_SIGALRM
: signal_name
= "SIGALRM"; break;
154 case TARGET_SIGTERM
: signal_name
= "SIGTERM"; break;
155 case TARGET_SIGUSR1
: signal_name
= "SIGUSR1"; break;
156 case TARGET_SIGUSR2
: signal_name
= "SIGUSR2"; break;
157 case TARGET_SIGCHLD
: signal_name
= "SIGCHLD"; break;
158 case TARGET_SIGCONT
: signal_name
= "SIGCONT"; break;
159 case TARGET_SIGSTOP
: signal_name
= "SIGSTOP"; break;
160 case TARGET_SIGTTIN
: signal_name
= "SIGTTIN"; break;
161 case TARGET_SIGTTOU
: signal_name
= "SIGTTOU"; break;
163 if (signal_name
== NULL
) {
164 print_raw_param("%ld", arg
, last
);
167 qemu_log("%s%s", signal_name
, get_comma(last
));
170 static void print_si_code(int arg
)
172 const char *codename
= NULL
;
176 codename
= "SI_USER";
179 codename
= "SI_KERNEL";
182 codename
= "SI_QUEUE";
185 codename
= "SI_TIMER";
188 codename
= "SI_MESGQ";
191 codename
= "SI_ASYNCIO";
194 codename
= "SI_SIGIO";
197 codename
= "SI_TKILL";
203 qemu_log("%s", codename
);
206 static void get_target_siginfo(target_siginfo_t
*tinfo
,
207 const target_siginfo_t
*info
)
216 __get_user(sig
, &info
->si_signo
);
217 __get_user(si_errno
, &tinfo
->si_errno
);
218 __get_user(si_code
, &info
->si_code
);
220 tinfo
->si_signo
= sig
;
221 tinfo
->si_errno
= si_errno
;
222 tinfo
->si_code
= si_code
;
224 /* Ensure we don't leak random junk to the guest later */
225 memset(tinfo
->_sifields
._pad
, 0, sizeof(tinfo
->_sifields
._pad
));
227 /* This is awkward, because we have to use a combination of
228 * the si_code and si_signo to figure out which of the union's
229 * members are valid. (Within the host kernel it is always possible
230 * to tell, but the kernel carefully avoids giving userspace the
231 * high 16 bits of si_code, so we don't have the information to
232 * do this the easy way...) We therefore make our best guess,
233 * bearing in mind that a guest can spoof most of the si_codes
234 * via rt_sigqueueinfo() if it likes.
236 * Once we have made our guess, we record it in the top 16 bits of
237 * the si_code, so that print_siginfo() later can use it.
238 * print_siginfo() will strip these top bits out before printing
246 /* Sent via kill(), tkill() or tgkill(), or direct from the kernel.
247 * These are the only unspoofable si_code values.
249 __get_user(tinfo
->_sifields
._kill
._pid
, &info
->_sifields
._kill
._pid
);
250 __get_user(tinfo
->_sifields
._kill
._uid
, &info
->_sifields
._kill
._uid
);
251 si_type
= QEMU_SI_KILL
;
254 /* Everything else is spoofable. Make best guess based on signal */
257 __get_user(tinfo
->_sifields
._sigchld
._pid
,
258 &info
->_sifields
._sigchld
._pid
);
259 __get_user(tinfo
->_sifields
._sigchld
._uid
,
260 &info
->_sifields
._sigchld
._uid
);
261 __get_user(tinfo
->_sifields
._sigchld
._status
,
262 &info
->_sifields
._sigchld
._status
);
263 __get_user(tinfo
->_sifields
._sigchld
._utime
,
264 &info
->_sifields
._sigchld
._utime
);
265 __get_user(tinfo
->_sifields
._sigchld
._stime
,
266 &info
->_sifields
._sigchld
._stime
);
267 si_type
= QEMU_SI_CHLD
;
270 __get_user(tinfo
->_sifields
._sigpoll
._band
,
271 &info
->_sifields
._sigpoll
._band
);
272 __get_user(tinfo
->_sifields
._sigpoll
._fd
,
273 &info
->_sifields
._sigpoll
._fd
);
274 si_type
= QEMU_SI_POLL
;
277 /* Assume a sigqueue()/mq_notify()/rt_sigqueueinfo() source. */
278 __get_user(tinfo
->_sifields
._rt
._pid
, &info
->_sifields
._rt
._pid
);
279 __get_user(tinfo
->_sifields
._rt
._uid
, &info
->_sifields
._rt
._uid
);
280 /* XXX: potential problem if 64 bit */
281 __get_user(sival_ptr
, &info
->_sifields
._rt
._sigval
.sival_ptr
);
282 tinfo
->_sifields
._rt
._sigval
.sival_ptr
= sival_ptr
;
284 si_type
= QEMU_SI_RT
;
290 tinfo
->si_code
= deposit32(si_code
, 16, 16, si_type
);
293 static void print_siginfo(const target_siginfo_t
*tinfo
)
295 /* Print a target_siginfo_t in the format desired for printing
296 * signals being taken. We assume the target_siginfo_t is in the
297 * internal form where the top 16 bits of si_code indicate which
298 * part of the union is valid, rather than in the guest-visible
299 * form where the bottom 16 bits are sign-extended into the top 16.
301 int si_type
= extract32(tinfo
->si_code
, 16, 16);
302 int si_code
= sextract32(tinfo
->si_code
, 0, 16);
304 qemu_log("{si_signo=");
305 print_signal(tinfo
->si_signo
, 1);
306 qemu_log(", si_code=");
307 print_si_code(si_code
);
311 qemu_log(", si_pid=%u, si_uid=%u",
312 (unsigned int)tinfo
->_sifields
._kill
._pid
,
313 (unsigned int)tinfo
->_sifields
._kill
._uid
);
316 qemu_log(", si_timer1=%u, si_timer2=%u",
317 tinfo
->_sifields
._timer
._timer1
,
318 tinfo
->_sifields
._timer
._timer2
);
321 qemu_log(", si_band=%d, si_fd=%d",
322 tinfo
->_sifields
._sigpoll
._band
,
323 tinfo
->_sifields
._sigpoll
._fd
);
326 qemu_log(", si_addr=");
327 print_pointer(tinfo
->_sifields
._sigfault
._addr
, 1);
330 qemu_log(", si_pid=%u, si_uid=%u, si_status=%d"
331 ", si_utime=" TARGET_ABI_FMT_ld
332 ", si_stime=" TARGET_ABI_FMT_ld
,
333 (unsigned int)(tinfo
->_sifields
._sigchld
._pid
),
334 (unsigned int)(tinfo
->_sifields
._sigchld
._uid
),
335 tinfo
->_sifields
._sigchld
._status
,
336 tinfo
->_sifields
._sigchld
._utime
,
337 tinfo
->_sifields
._sigchld
._stime
);
340 qemu_log(", si_pid=%u, si_uid=%u, si_sigval=" TARGET_ABI_FMT_ld
,
341 (unsigned int)tinfo
->_sifields
._rt
._pid
,
342 (unsigned int)tinfo
->_sifields
._rt
._uid
,
343 tinfo
->_sifields
._rt
._sigval
.sival_ptr
);
346 g_assert_not_reached();
352 print_sockaddr(abi_ulong addr
, abi_long addrlen
, int last
)
354 struct target_sockaddr
*sa
;
358 sa
= lock_user(VERIFY_READ
, addr
, addrlen
, 1);
360 sa_family
= tswap16(sa
->sa_family
);
363 struct target_sockaddr_un
*un
= (struct target_sockaddr_un
*)sa
;
365 qemu_log("{sun_family=AF_UNIX,sun_path=\"");
366 for (i
= 0; i
< addrlen
-
367 offsetof(struct target_sockaddr_un
, sun_path
) &&
368 un
->sun_path
[i
]; i
++) {
369 qemu_log("%c", un
->sun_path
[i
]);
375 struct target_sockaddr_in
*in
= (struct target_sockaddr_in
*)sa
;
376 uint8_t *c
= (uint8_t *)&in
->sin_addr
.s_addr
;
377 qemu_log("{sin_family=AF_INET,sin_port=htons(%d),",
378 ntohs(in
->sin_port
));
379 qemu_log("sin_addr=inet_addr(\"%d.%d.%d.%d\")",
380 c
[0], c
[1], c
[2], c
[3]);
385 struct target_sockaddr_ll
*ll
= (struct target_sockaddr_ll
*)sa
;
386 uint8_t *c
= (uint8_t *)&ll
->sll_addr
;
387 qemu_log("{sll_family=AF_PACKET,"
388 "sll_protocol=htons(0x%04x),if%d,pkttype=",
389 ntohs(ll
->sll_protocol
), ll
->sll_ifindex
);
390 switch (ll
->sll_pkttype
) {
392 qemu_log("PACKET_HOST");
394 case PACKET_BROADCAST
:
395 qemu_log("PACKET_BROADCAST");
397 case PACKET_MULTICAST
:
398 qemu_log("PACKET_MULTICAST");
400 case PACKET_OTHERHOST
:
401 qemu_log("PACKET_OTHERHOST");
403 case PACKET_OUTGOING
:
404 qemu_log("PACKET_OUTGOING");
407 qemu_log("%d", ll
->sll_pkttype
);
410 qemu_log(",sll_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
411 c
[0], c
[1], c
[2], c
[3], c
[4], c
[5], c
[6], c
[7]);
416 struct target_sockaddr_nl
*nl
= (struct target_sockaddr_nl
*)sa
;
417 qemu_log("{nl_family=AF_NETLINK,nl_pid=%u,nl_groups=%u}",
418 tswap32(nl
->nl_pid
), tswap32(nl
->nl_groups
));
422 qemu_log("{sa_family=%d, sa_data={", sa
->sa_family
);
423 for (i
= 0; i
< 13; i
++) {
424 qemu_log("%02x, ", sa
->sa_data
[i
]);
426 qemu_log("%02x}", sa
->sa_data
[i
]);
430 unlock_user(sa
, addr
, 0);
432 print_raw_param("0x"TARGET_ABI_FMT_lx
, addr
, 0);
434 qemu_log(", "TARGET_ABI_FMT_ld
"%s", addrlen
, get_comma(last
));
438 print_socket_domain(int domain
)
448 qemu_log("PF_NETLINK");
451 qemu_log("PF_PACKET");
454 qemu_log("%d", domain
);
460 print_socket_type(int type
)
462 switch (type
& TARGET_SOCK_TYPE_MASK
) {
463 case TARGET_SOCK_DGRAM
:
464 qemu_log("SOCK_DGRAM");
466 case TARGET_SOCK_STREAM
:
467 qemu_log("SOCK_STREAM");
469 case TARGET_SOCK_RAW
:
470 qemu_log("SOCK_RAW");
472 case TARGET_SOCK_RDM
:
473 qemu_log("SOCK_RDM");
475 case TARGET_SOCK_SEQPACKET
:
476 qemu_log("SOCK_SEQPACKET");
478 case TARGET_SOCK_PACKET
:
479 qemu_log("SOCK_PACKET");
482 if (type
& TARGET_SOCK_CLOEXEC
) {
483 qemu_log("|SOCK_CLOEXEC");
485 if (type
& TARGET_SOCK_NONBLOCK
) {
486 qemu_log("|SOCK_NONBLOCK");
491 print_socket_protocol(int domain
, int type
, int protocol
)
493 if (domain
== AF_PACKET
||
494 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
497 qemu_log("ETH_P_ALL");
500 qemu_log("%d", protocol
);
505 if (domain
== PF_NETLINK
) {
508 qemu_log("NETLINK_ROUTE");
511 qemu_log("NETLINK_AUDIT");
513 case NETLINK_NETFILTER
:
514 qemu_log("NETLINK_NETFILTER");
516 case NETLINK_KOBJECT_UEVENT
:
517 qemu_log("NETLINK_KOBJECT_UEVENT");
520 qemu_log("NETLINK_RDMA");
523 qemu_log("NETLINK_CRYPTO");
526 qemu_log("%d", protocol
);
534 qemu_log("IPPROTO_IP");
537 qemu_log("IPPROTO_TCP");
540 qemu_log("IPPROTO_UDP");
543 qemu_log("IPPROTO_RAW");
546 qemu_log("%d", protocol
);
552 #ifdef TARGET_NR__newselect
554 print_fdset(int n
, abi_ulong target_fds_addr
)
560 if( target_fds_addr
) {
561 abi_long
*target_fds
;
563 target_fds
= lock_user(VERIFY_READ
,
565 sizeof(*target_fds
)*(n
/ TARGET_ABI_BITS
+ 1),
571 for (i
=n
; i
>=0; i
--) {
572 if ((tswapal(target_fds
[i
/ TARGET_ABI_BITS
]) >>
573 (i
& (TARGET_ABI_BITS
- 1))) & 1) {
574 qemu_log("%s%d", get_comma(first
), i
);
578 unlock_user(target_fds
, target_fds_addr
, 0);
585 * Sysycall specific output functions
589 #ifdef TARGET_NR__newselect
591 print_newselect(void *cpu_env
, const struct syscallname
*name
,
592 abi_long arg1
, abi_long arg2
, abi_long arg3
,
593 abi_long arg4
, abi_long arg5
, abi_long arg6
)
595 print_syscall_prologue(name
);
596 print_fdset(arg1
, arg2
);
598 print_fdset(arg1
, arg3
);
600 print_fdset(arg1
, arg4
);
602 print_timeval(arg5
, 1);
603 print_syscall_epilogue(name
);
607 #ifdef TARGET_NR_semctl
609 print_semctl(void *cpu_env
, const struct syscallname
*name
,
610 abi_long arg1
, abi_long arg2
, abi_long arg3
,
611 abi_long arg4
, abi_long arg5
, abi_long arg6
)
613 qemu_log("%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
614 name
->name
, arg1
, arg2
);
616 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
621 print_execve(void *cpu_env
, const struct syscallname
*name
,
622 abi_long arg1
, abi_long arg2
, abi_long arg3
,
623 abi_long arg4
, abi_long arg5
, abi_long arg6
)
625 abi_ulong arg_ptr_addr
;
628 if (!(s
= lock_user_string(arg1
)))
630 qemu_log("%s(\"%s\",{", name
->name
, s
);
631 unlock_user(s
, arg1
, 0);
633 for (arg_ptr_addr
= arg2
; ; arg_ptr_addr
+= sizeof(abi_ulong
)) {
634 abi_ulong
*arg_ptr
, arg_addr
;
636 arg_ptr
= lock_user(VERIFY_READ
, arg_ptr_addr
, sizeof(abi_ulong
), 1);
639 arg_addr
= tswapal(*arg_ptr
);
640 unlock_user(arg_ptr
, arg_ptr_addr
, 0);
643 if ((s
= lock_user_string(arg_addr
))) {
644 qemu_log("\"%s\",", s
);
645 unlock_user(s
, arg_addr
, 0);
654 print_ipc(void *cpu_env
, const struct syscallname
*name
,
655 abi_long arg1
, abi_long arg2
, abi_long arg3
,
656 abi_long arg4
, abi_long arg5
, abi_long arg6
)
660 qemu_log("semctl(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
663 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
667 TARGET_ABI_FMT_ld
","
668 TARGET_ABI_FMT_ld
","
669 TARGET_ABI_FMT_ld
","
672 name
->name
, arg1
, arg2
, arg3
, arg4
);
678 * Variants for the return value output function
682 print_syscall_err(abi_long ret
)
688 errstr
= target_strerror(-ret
);
690 qemu_log("-1 errno=%d (%s)", (int)-ret
, errstr
);
698 print_syscall_ret_addr(void *cpu_env
, const struct syscallname
*name
,
699 abi_long ret
, abi_long arg0
, abi_long arg1
,
700 abi_long arg2
, abi_long arg3
, abi_long arg4
,
703 if (!print_syscall_err(ret
)) {
704 qemu_log("0x" TARGET_ABI_FMT_lx
, ret
);
709 #if 0 /* currently unused */
711 print_syscall_ret_raw(struct syscallname
*name
, abi_long ret
)
713 qemu_log(" = 0x" TARGET_ABI_FMT_lx
"\n", ret
);
717 #ifdef TARGET_NR__newselect
719 print_syscall_ret_newselect(void *cpu_env
, const struct syscallname
*name
,
720 abi_long ret
, abi_long arg0
, abi_long arg1
,
721 abi_long arg2
, abi_long arg3
, abi_long arg4
,
724 if (!print_syscall_err(ret
)) {
725 qemu_log(" = 0x" TARGET_ABI_FMT_lx
" (", ret
);
726 print_fdset(arg0
, arg1
);
728 print_fdset(arg0
, arg2
);
730 print_fdset(arg0
, arg3
);
732 print_timeval(arg4
, 1);
740 /* special meanings of adjtimex()' non-negative return values */
741 #define TARGET_TIME_OK 0 /* clock synchronized, no leap second */
742 #define TARGET_TIME_INS 1 /* insert leap second */
743 #define TARGET_TIME_DEL 2 /* delete leap second */
744 #define TARGET_TIME_OOP 3 /* leap second in progress */
745 #define TARGET_TIME_WAIT 4 /* leap second has occurred */
746 #define TARGET_TIME_ERROR 5 /* clock not synchronized */
747 #ifdef TARGET_NR_adjtimex
749 print_syscall_ret_adjtimex(void *cpu_env
, const struct syscallname
*name
,
750 abi_long ret
, abi_long arg0
, abi_long arg1
,
751 abi_long arg2
, abi_long arg3
, abi_long arg4
,
754 if (!print_syscall_err(ret
)) {
755 qemu_log(TARGET_ABI_FMT_ld
, ret
);
758 qemu_log(" TIME_OK (clock synchronized, no leap second)");
760 case TARGET_TIME_INS
:
761 qemu_log(" TIME_INS (insert leap second)");
763 case TARGET_TIME_DEL
:
764 qemu_log(" TIME_DEL (delete leap second)");
766 case TARGET_TIME_OOP
:
767 qemu_log(" TIME_OOP (leap second in progress)");
769 case TARGET_TIME_WAIT
:
770 qemu_log(" TIME_WAIT (leap second has occurred)");
772 case TARGET_TIME_ERROR
:
773 qemu_log(" TIME_ERROR (clock not synchronized)");
782 #if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
784 print_syscall_ret_clock_gettime(void *cpu_env
, const struct syscallname
*name
,
785 abi_long ret
, abi_long arg0
, abi_long arg1
,
786 abi_long arg2
, abi_long arg3
, abi_long arg4
,
789 if (!print_syscall_err(ret
)) {
790 qemu_log(TARGET_ABI_FMT_ld
, ret
);
792 print_timespec(arg1
, 1);
798 #define print_syscall_ret_clock_getres print_syscall_ret_clock_gettime
801 #ifdef TARGET_NR_gettimeofday
803 print_syscall_ret_gettimeofday(void *cpu_env
, const struct syscallname
*name
,
804 abi_long ret
, abi_long arg0
, abi_long arg1
,
805 abi_long arg2
, abi_long arg3
, abi_long arg4
,
808 if (!print_syscall_err(ret
)) {
809 qemu_log(TARGET_ABI_FMT_ld
, ret
);
811 print_timeval(arg0
, 0);
812 print_timezone(arg1
, 1);
820 #ifdef TARGET_NR_getitimer
822 print_syscall_ret_getitimer(void *cpu_env
, const struct syscallname
*name
,
823 abi_long ret
, abi_long arg0
, abi_long arg1
,
824 abi_long arg2
, abi_long arg3
, abi_long arg4
,
827 if (!print_syscall_err(ret
)) {
828 qemu_log(TARGET_ABI_FMT_ld
, ret
);
830 print_itimerval(arg1
, 1);
839 #ifdef TARGET_NR_getitimer
841 print_syscall_ret_setitimer(void *cpu_env
, const struct syscallname
*name
,
842 abi_long ret
, abi_long arg0
, abi_long arg1
,
843 abi_long arg2
, abi_long arg3
, abi_long arg4
,
846 if (!print_syscall_err(ret
)) {
847 qemu_log(TARGET_ABI_FMT_ld
, ret
);
848 qemu_log(" (old_value = ");
849 print_itimerval(arg2
, 1);
857 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr) \
858 || defined(TARGGET_NR_flistxattr)
860 print_syscall_ret_listxattr(void *cpu_env
, const struct syscallname
*name
,
861 abi_long ret
, abi_long arg0
, abi_long arg1
,
862 abi_long arg2
, abi_long arg3
, abi_long arg4
,
865 if (!print_syscall_err(ret
)) {
866 qemu_log(TARGET_ABI_FMT_ld
, ret
);
867 qemu_log(" (list = ");
869 abi_long attr
= arg1
;
874 print_string(attr
, 1);
875 ret
-= target_strlen(attr
) + 1;
876 attr
+= target_strlen(attr
) + 1;
886 #define print_syscall_ret_llistxattr print_syscall_ret_listxattr
887 #define print_syscall_ret_flistxattr print_syscall_ret_listxattr
890 #ifdef TARGET_NR_ioctl
892 print_syscall_ret_ioctl(void *cpu_env
, const struct syscallname
*name
,
893 abi_long ret
, abi_long arg0
, abi_long arg1
,
894 abi_long arg2
, abi_long arg3
, abi_long arg4
,
897 if (!print_syscall_err(ret
)) {
898 qemu_log(TARGET_ABI_FMT_ld
, ret
);
900 const IOCTLEntry
*ie
;
901 const argtype
*arg_type
;
905 for (ie
= ioctl_entries
; ie
->target_cmd
!= 0; ie
++) {
906 if (ie
->target_cmd
== arg1
) {
911 if (ie
->target_cmd
== arg1
&&
912 (ie
->access
== IOC_R
|| ie
->access
== IOC_RW
)) {
913 arg_type
= ie
->arg_type
;
916 target_size
= thunk_type_size(arg_type
, 0);
917 argptr
= lock_user(VERIFY_READ
, arg2
, target_size
, 1);
919 thunk_print(argptr
, arg_type
);
920 unlock_user(argptr
, arg2
, target_size
);
922 print_pointer(arg2
, 1);
931 UNUSED
static struct flags access_flags
[] = {
939 UNUSED
static struct flags at_file_flags
[] = {
941 FLAG_GENERIC(AT_EACCESS
),
943 #ifdef AT_SYMLINK_NOFOLLOW
944 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
949 UNUSED
static struct flags unlinkat_flags
[] = {
951 FLAG_GENERIC(AT_REMOVEDIR
),
956 UNUSED
static struct flags mode_flags
[] = {
957 FLAG_GENERIC(S_IFSOCK
),
958 FLAG_GENERIC(S_IFLNK
),
959 FLAG_GENERIC(S_IFREG
),
960 FLAG_GENERIC(S_IFBLK
),
961 FLAG_GENERIC(S_IFDIR
),
962 FLAG_GENERIC(S_IFCHR
),
963 FLAG_GENERIC(S_IFIFO
),
967 UNUSED
static struct flags open_access_flags
[] = {
968 FLAG_TARGET(O_RDONLY
),
969 FLAG_TARGET(O_WRONLY
),
974 UNUSED
static struct flags open_flags
[] = {
975 FLAG_TARGET(O_APPEND
),
976 FLAG_TARGET(O_CREAT
),
977 FLAG_TARGET(O_DIRECTORY
),
979 FLAG_TARGET(O_LARGEFILE
),
980 FLAG_TARGET(O_NOCTTY
),
981 FLAG_TARGET(O_NOFOLLOW
),
982 FLAG_TARGET(O_NONBLOCK
), /* also O_NDELAY */
983 FLAG_TARGET(O_DSYNC
),
984 FLAG_TARGET(__O_SYNC
),
985 FLAG_TARGET(O_TRUNC
),
987 FLAG_TARGET(O_DIRECT
),
990 FLAG_TARGET(O_NOATIME
),
993 FLAG_TARGET(O_CLOEXEC
),
999 FLAG_TARGET(O_TMPFILE
),
1000 FLAG_TARGET(__O_TMPFILE
),
1005 UNUSED
static struct flags mount_flags
[] = {
1007 FLAG_GENERIC(MS_BIND
),
1010 FLAG_GENERIC(MS_DIRSYNC
),
1012 FLAG_GENERIC(MS_MANDLOCK
),
1014 FLAG_GENERIC(MS_MOVE
),
1016 FLAG_GENERIC(MS_NOATIME
),
1017 FLAG_GENERIC(MS_NODEV
),
1018 FLAG_GENERIC(MS_NODIRATIME
),
1019 FLAG_GENERIC(MS_NOEXEC
),
1020 FLAG_GENERIC(MS_NOSUID
),
1021 FLAG_GENERIC(MS_RDONLY
),
1023 FLAG_GENERIC(MS_RELATIME
),
1025 FLAG_GENERIC(MS_REMOUNT
),
1026 FLAG_GENERIC(MS_SYNCHRONOUS
),
1030 UNUSED
static struct flags umount2_flags
[] = {
1032 FLAG_GENERIC(MNT_FORCE
),
1035 FLAG_GENERIC(MNT_DETACH
),
1038 FLAG_GENERIC(MNT_EXPIRE
),
1043 UNUSED
static struct flags mmap_prot_flags
[] = {
1044 FLAG_GENERIC(PROT_NONE
),
1045 FLAG_GENERIC(PROT_EXEC
),
1046 FLAG_GENERIC(PROT_READ
),
1047 FLAG_GENERIC(PROT_WRITE
),
1048 FLAG_TARGET(PROT_SEM
),
1049 FLAG_GENERIC(PROT_GROWSDOWN
),
1050 FLAG_GENERIC(PROT_GROWSUP
),
1054 UNUSED
static struct flags mmap_flags
[] = {
1055 FLAG_TARGET(MAP_SHARED
),
1056 FLAG_TARGET(MAP_PRIVATE
),
1057 FLAG_TARGET(MAP_ANONYMOUS
),
1058 FLAG_TARGET(MAP_DENYWRITE
),
1059 FLAG_TARGET(MAP_FIXED
),
1060 FLAG_TARGET(MAP_GROWSDOWN
),
1061 FLAG_TARGET(MAP_EXECUTABLE
),
1063 FLAG_TARGET(MAP_LOCKED
),
1066 FLAG_TARGET(MAP_NONBLOCK
),
1068 FLAG_TARGET(MAP_NORESERVE
),
1070 FLAG_TARGET(MAP_POPULATE
),
1072 #ifdef TARGET_MAP_UNINITIALIZED
1073 FLAG_TARGET(MAP_UNINITIALIZED
),
1078 UNUSED
static struct flags clone_flags
[] = {
1079 FLAG_GENERIC(CLONE_VM
),
1080 FLAG_GENERIC(CLONE_FS
),
1081 FLAG_GENERIC(CLONE_FILES
),
1082 FLAG_GENERIC(CLONE_SIGHAND
),
1083 FLAG_GENERIC(CLONE_PTRACE
),
1084 FLAG_GENERIC(CLONE_VFORK
),
1085 FLAG_GENERIC(CLONE_PARENT
),
1086 FLAG_GENERIC(CLONE_THREAD
),
1087 FLAG_GENERIC(CLONE_NEWNS
),
1088 FLAG_GENERIC(CLONE_SYSVSEM
),
1089 FLAG_GENERIC(CLONE_SETTLS
),
1090 FLAG_GENERIC(CLONE_PARENT_SETTID
),
1091 FLAG_GENERIC(CLONE_CHILD_CLEARTID
),
1092 FLAG_GENERIC(CLONE_DETACHED
),
1093 FLAG_GENERIC(CLONE_UNTRACED
),
1094 FLAG_GENERIC(CLONE_CHILD_SETTID
),
1095 #if defined(CLONE_NEWUTS)
1096 FLAG_GENERIC(CLONE_NEWUTS
),
1098 #if defined(CLONE_NEWIPC)
1099 FLAG_GENERIC(CLONE_NEWIPC
),
1101 #if defined(CLONE_NEWUSER)
1102 FLAG_GENERIC(CLONE_NEWUSER
),
1104 #if defined(CLONE_NEWPID)
1105 FLAG_GENERIC(CLONE_NEWPID
),
1107 #if defined(CLONE_NEWNET)
1108 FLAG_GENERIC(CLONE_NEWNET
),
1110 #if defined(CLONE_IO)
1111 FLAG_GENERIC(CLONE_IO
),
1116 UNUSED
static struct flags msg_flags
[] = {
1118 FLAG_GENERIC(MSG_CONFIRM
),
1119 FLAG_GENERIC(MSG_DONTROUTE
),
1120 FLAG_GENERIC(MSG_DONTWAIT
),
1121 FLAG_GENERIC(MSG_EOR
),
1122 FLAG_GENERIC(MSG_MORE
),
1123 FLAG_GENERIC(MSG_NOSIGNAL
),
1124 FLAG_GENERIC(MSG_OOB
),
1126 FLAG_GENERIC(MSG_CMSG_CLOEXEC
),
1127 FLAG_GENERIC(MSG_ERRQUEUE
),
1128 FLAG_GENERIC(MSG_PEEK
),
1129 FLAG_GENERIC(MSG_TRUNC
),
1130 FLAG_GENERIC(MSG_WAITALL
),
1132 FLAG_GENERIC(MSG_CTRUNC
),
1136 UNUSED
static struct flags statx_flags
[] = {
1137 #ifdef AT_EMPTY_PATH
1138 FLAG_GENERIC(AT_EMPTY_PATH
),
1140 #ifdef AT_NO_AUTOMOUNT
1141 FLAG_GENERIC(AT_NO_AUTOMOUNT
),
1143 #ifdef AT_SYMLINK_NOFOLLOW
1144 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
1146 #ifdef AT_STATX_SYNC_AS_STAT
1147 FLAG_GENERIC(AT_STATX_SYNC_AS_STAT
),
1149 #ifdef AT_STATX_FORCE_SYNC
1150 FLAG_GENERIC(AT_STATX_FORCE_SYNC
),
1152 #ifdef AT_STATX_DONT_SYNC
1153 FLAG_GENERIC(AT_STATX_DONT_SYNC
),
1158 UNUSED
static struct flags statx_mask
[] = {
1159 /* This must come first, because it includes everything. */
1161 FLAG_GENERIC(STATX_ALL
),
1163 /* This must come second; it includes everything except STATX_BTIME. */
1164 #ifdef STATX_BASIC_STATS
1165 FLAG_GENERIC(STATX_BASIC_STATS
),
1168 FLAG_GENERIC(STATX_TYPE
),
1171 FLAG_GENERIC(STATX_MODE
),
1174 FLAG_GENERIC(STATX_NLINK
),
1177 FLAG_GENERIC(STATX_UID
),
1180 FLAG_GENERIC(STATX_GID
),
1183 FLAG_GENERIC(STATX_ATIME
),
1186 FLAG_GENERIC(STATX_MTIME
),
1189 FLAG_GENERIC(STATX_CTIME
),
1192 FLAG_GENERIC(STATX_INO
),
1195 FLAG_GENERIC(STATX_SIZE
),
1198 FLAG_GENERIC(STATX_BLOCKS
),
1201 FLAG_GENERIC(STATX_BTIME
),
1206 UNUSED
static struct flags falloc_flags
[] = {
1207 FLAG_GENERIC(FALLOC_FL_KEEP_SIZE
),
1208 FLAG_GENERIC(FALLOC_FL_PUNCH_HOLE
),
1209 #ifdef FALLOC_FL_NO_HIDE_STALE
1210 FLAG_GENERIC(FALLOC_FL_NO_HIDE_STALE
),
1212 #ifdef FALLOC_FL_COLLAPSE_RANGE
1213 FLAG_GENERIC(FALLOC_FL_COLLAPSE_RANGE
),
1215 #ifdef FALLOC_FL_ZERO_RANGE
1216 FLAG_GENERIC(FALLOC_FL_ZERO_RANGE
),
1218 #ifdef FALLOC_FL_INSERT_RANGE
1219 FLAG_GENERIC(FALLOC_FL_INSERT_RANGE
),
1221 #ifdef FALLOC_FL_UNSHARE_RANGE
1222 FLAG_GENERIC(FALLOC_FL_UNSHARE_RANGE
),
1226 UNUSED
static struct flags termios_iflags
[] = {
1227 FLAG_TARGET(IGNBRK
),
1228 FLAG_TARGET(BRKINT
),
1229 FLAG_TARGET(IGNPAR
),
1230 FLAG_TARGET(PARMRK
),
1232 FLAG_TARGET(ISTRIP
),
1240 FLAG_TARGET(IMAXBEL
),
1245 UNUSED
static struct flags termios_oflags
[] = {
1251 FLAG_TARGET(ONLRET
),
1257 UNUSED
static struct enums termios_oflags_NLDLY
[] = {
1263 UNUSED
static struct enums termios_oflags_CRDLY
[] = {
1271 UNUSED
static struct enums termios_oflags_TABDLY
[] = {
1279 UNUSED
static struct enums termios_oflags_VTDLY
[] = {
1285 UNUSED
static struct enums termios_oflags_FFDLY
[] = {
1291 UNUSED
static struct enums termios_oflags_BSDLY
[] = {
1297 UNUSED
static struct enums termios_cflags_CBAUD
[] = {
1312 ENUM_TARGET(B19200
),
1313 ENUM_TARGET(B38400
),
1314 ENUM_TARGET(B57600
),
1315 ENUM_TARGET(B115200
),
1316 ENUM_TARGET(B230400
),
1317 ENUM_TARGET(B460800
),
1321 UNUSED
static struct enums termios_cflags_CSIZE
[] = {
1329 UNUSED
static struct flags termios_cflags
[] = {
1330 FLAG_TARGET(CSTOPB
),
1332 FLAG_TARGET(PARENB
),
1333 FLAG_TARGET(PARODD
),
1335 FLAG_TARGET(CLOCAL
),
1336 FLAG_TARGET(CRTSCTS
),
1340 UNUSED
static struct flags termios_lflags
[] = {
1342 FLAG_TARGET(ICANON
),
1347 FLAG_TARGET(ECHONL
),
1348 FLAG_TARGET(NOFLSH
),
1349 FLAG_TARGET(TOSTOP
),
1350 FLAG_TARGET(ECHOCTL
),
1351 FLAG_TARGET(ECHOPRT
),
1352 FLAG_TARGET(ECHOKE
),
1353 FLAG_TARGET(FLUSHO
),
1354 FLAG_TARGET(PENDIN
),
1355 FLAG_TARGET(IEXTEN
),
1356 FLAG_TARGET(EXTPROC
),
1360 UNUSED
static struct flags mlockall_flags
[] = {
1361 FLAG_TARGET(MCL_CURRENT
),
1362 FLAG_TARGET(MCL_FUTURE
),
1364 FLAG_TARGET(MCL_ONFAULT
),
1369 /* IDs of the various system clocks */
1370 #define TARGET_CLOCK_REALTIME 0
1371 #define TARGET_CLOCK_MONOTONIC 1
1372 #define TARGET_CLOCK_PROCESS_CPUTIME_ID 2
1373 #define TARGET_CLOCK_THREAD_CPUTIME_ID 3
1374 #define TARGET_CLOCK_MONOTONIC_RAW 4
1375 #define TARGET_CLOCK_REALTIME_COARSE 5
1376 #define TARGET_CLOCK_MONOTONIC_COARSE 6
1377 #define TARGET_CLOCK_BOOTTIME 7
1378 #define TARGET_CLOCK_REALTIME_ALARM 8
1379 #define TARGET_CLOCK_BOOTTIME_ALARM 9
1380 #define TARGET_CLOCK_SGI_CYCLE 10
1381 #define TARGET_CLOCK_TAI 11
1383 UNUSED
static struct enums clockids
[] = {
1384 ENUM_TARGET(CLOCK_REALTIME
),
1385 ENUM_TARGET(CLOCK_MONOTONIC
),
1386 ENUM_TARGET(CLOCK_PROCESS_CPUTIME_ID
),
1387 ENUM_TARGET(CLOCK_THREAD_CPUTIME_ID
),
1388 ENUM_TARGET(CLOCK_MONOTONIC_RAW
),
1389 ENUM_TARGET(CLOCK_REALTIME_COARSE
),
1390 ENUM_TARGET(CLOCK_MONOTONIC_COARSE
),
1391 ENUM_TARGET(CLOCK_BOOTTIME
),
1392 ENUM_TARGET(CLOCK_REALTIME_ALARM
),
1393 ENUM_TARGET(CLOCK_BOOTTIME_ALARM
),
1394 ENUM_TARGET(CLOCK_SGI_CYCLE
),
1395 ENUM_TARGET(CLOCK_TAI
),
1399 UNUSED
static struct enums itimer_types
[] = {
1400 ENUM_GENERIC(ITIMER_REAL
),
1401 ENUM_GENERIC(ITIMER_VIRTUAL
),
1402 ENUM_GENERIC(ITIMER_PROF
),
1407 * print_xxx utility functions. These are used to print syscall
1408 * parameters in certain format. All of these have parameter
1409 * named 'last'. This parameter is used to add comma to output
1416 return ((last
) ? "" : ",");
1420 print_flags(const struct flags
*f
, abi_long flags
, int last
)
1422 const char *sep
= "";
1425 if ((flags
== 0) && (f
->f_value
== 0)) {
1426 qemu_log("%s%s", f
->f_string
, get_comma(last
));
1429 for (n
= 0; f
->f_string
!= NULL
; f
++) {
1430 if ((f
->f_value
!= 0) && ((flags
& f
->f_value
) == f
->f_value
)) {
1431 qemu_log("%s%s", sep
, f
->f_string
);
1432 flags
&= ~f
->f_value
;
1439 /* print rest of the flags as numeric */
1441 qemu_log("%s%#x%s", sep
, (unsigned int)flags
, get_comma(last
));
1443 qemu_log("%s", get_comma(last
));
1446 /* no string version of flags found, print them in hex then */
1447 qemu_log("%#x%s", (unsigned int)flags
, get_comma(last
));
1452 print_enums(const struct enums
*e
, abi_long enum_arg
, int last
)
1454 for (; e
->e_string
!= NULL
; e
++) {
1455 if (e
->e_value
== enum_arg
) {
1456 qemu_log("%s", e
->e_string
);
1461 if (e
->e_string
== NULL
) {
1462 qemu_log("%#x", (unsigned int)enum_arg
);
1465 qemu_log("%s", get_comma(last
));
1469 print_at_dirfd(abi_long dirfd
, int last
)
1472 if (dirfd
== AT_FDCWD
) {
1473 qemu_log("AT_FDCWD%s", get_comma(last
));
1477 qemu_log("%d%s", (int)dirfd
, get_comma(last
));
1481 print_file_mode(abi_long mode
, int last
)
1483 const char *sep
= "";
1484 const struct flags
*m
;
1486 for (m
= &mode_flags
[0]; m
->f_string
!= NULL
; m
++) {
1487 if ((m
->f_value
& mode
) == m
->f_value
) {
1488 qemu_log("%s%s", m
->f_string
, sep
);
1490 mode
&= ~m
->f_value
;
1496 /* print rest of the mode as octal */
1498 qemu_log("%s%#o", sep
, (unsigned int)mode
);
1500 qemu_log("%s", get_comma(last
));
1504 print_open_flags(abi_long flags
, int last
)
1506 print_flags(open_access_flags
, flags
& TARGET_O_ACCMODE
, 1);
1507 flags
&= ~TARGET_O_ACCMODE
;
1509 qemu_log("%s", get_comma(last
));
1513 print_flags(open_flags
, flags
, last
);
1517 print_syscall_prologue(const struct syscallname
*sc
)
1519 qemu_log("%s(", sc
->name
);
1524 print_syscall_epilogue(const struct syscallname
*sc
)
1531 print_string(abi_long addr
, int last
)
1535 if ((s
= lock_user_string(addr
)) != NULL
) {
1536 qemu_log("\"%s\"%s", s
, get_comma(last
));
1537 unlock_user(s
, addr
, 0);
1539 /* can't get string out of it, so print it as pointer */
1540 print_pointer(addr
, last
);
1544 #define MAX_PRINT_BUF 40
1546 print_buf(abi_long addr
, abi_long len
, int last
)
1551 s
= lock_user(VERIFY_READ
, addr
, len
, 1);
1554 for (i
= 0; i
< MAX_PRINT_BUF
&& i
< len
; i
++) {
1555 if (isprint(s
[i
])) {
1556 qemu_log("%c", s
[i
]);
1558 qemu_log("\\%o", s
[i
]);
1568 unlock_user(s
, addr
, 0);
1570 print_pointer(addr
, last
);
1575 * Prints out raw parameter using given format. Caller needs
1576 * to do byte swapping if needed.
1579 print_raw_param(const char *fmt
, abi_long param
, int last
)
1583 (void) snprintf(format
, sizeof (format
), "%s%s", fmt
, get_comma(last
));
1584 qemu_log(format
, param
);
1588 print_pointer(abi_long p
, int last
)
1591 qemu_log("NULL%s", get_comma(last
));
1593 qemu_log("0x" TARGET_ABI_FMT_lx
"%s", p
, get_comma(last
));
1597 * Reads 32-bit (int) number from guest address space from
1598 * address 'addr' and prints it.
1601 print_number(abi_long addr
, int last
)
1604 qemu_log("NULL%s", get_comma(last
));
1608 get_user_s32(num
, addr
);
1609 qemu_log("[%d]%s", num
, get_comma(last
));
1614 print_timeval(abi_ulong tv_addr
, int last
)
1617 struct target_timeval
*tv
;
1619 tv
= lock_user(VERIFY_READ
, tv_addr
, sizeof(*tv
), 1);
1621 print_pointer(tv_addr
, last
);
1624 qemu_log("{tv_sec = " TARGET_ABI_FMT_ld
1625 ",tv_usec = " TARGET_ABI_FMT_ld
"}%s",
1626 tswapal(tv
->tv_sec
), tswapal(tv
->tv_usec
), get_comma(last
));
1627 unlock_user(tv
, tv_addr
, 0);
1629 qemu_log("NULL%s", get_comma(last
));
1633 print_timespec(abi_ulong ts_addr
, int last
)
1636 struct target_timespec
*ts
;
1638 ts
= lock_user(VERIFY_READ
, ts_addr
, sizeof(*ts
), 1);
1640 print_pointer(ts_addr
, last
);
1643 qemu_log("{tv_sec = " TARGET_ABI_FMT_ld
1644 ",tv_nsec = " TARGET_ABI_FMT_ld
"}%s",
1645 tswapal(ts
->tv_sec
), tswapal(ts
->tv_nsec
), get_comma(last
));
1646 unlock_user(ts
, ts_addr
, 0);
1648 qemu_log("NULL%s", get_comma(last
));
1653 print_timezone(abi_ulong tz_addr
, int last
)
1656 struct target_timezone
*tz
;
1658 tz
= lock_user(VERIFY_READ
, tz_addr
, sizeof(*tz
), 1);
1660 print_pointer(tz_addr
, last
);
1663 qemu_log("{%d,%d}%s", tswap32(tz
->tz_minuteswest
),
1664 tswap32(tz
->tz_dsttime
), get_comma(last
));
1665 unlock_user(tz
, tz_addr
, 0);
1667 qemu_log("NULL%s", get_comma(last
));
1672 print_itimerval(abi_ulong it_addr
, int last
)
1675 qemu_log("{it_interval=");
1676 print_timeval(it_addr
+
1677 offsetof(struct target_itimerval
, it_interval
), 0);
1678 qemu_log("it_value=");
1679 print_timeval(it_addr
+
1680 offsetof(struct target_itimerval
, it_value
), 0);
1681 qemu_log("}%s", get_comma(last
));
1683 qemu_log("NULL%s", get_comma(last
));
1688 print_termios(void *arg
)
1690 const struct target_termios
*target
= arg
;
1692 target_tcflag_t iflags
= tswap32(target
->c_iflag
);
1693 target_tcflag_t oflags
= tswap32(target
->c_oflag
);
1694 target_tcflag_t cflags
= tswap32(target
->c_cflag
);
1695 target_tcflag_t lflags
= tswap32(target
->c_lflag
);
1699 qemu_log("c_iflag = ");
1700 print_flags(termios_iflags
, iflags
, 0);
1702 qemu_log("c_oflag = ");
1703 target_tcflag_t oflags_clean
= oflags
& ~(TARGET_NLDLY
| TARGET_CRDLY
|
1704 TARGET_TABDLY
| TARGET_BSDLY
|
1705 TARGET_VTDLY
| TARGET_FFDLY
);
1706 print_flags(termios_oflags
, oflags_clean
, 0);
1707 if (oflags
& TARGET_NLDLY
) {
1708 print_enums(termios_oflags_NLDLY
, oflags
& TARGET_NLDLY
, 0);
1710 if (oflags
& TARGET_CRDLY
) {
1711 print_enums(termios_oflags_CRDLY
, oflags
& TARGET_CRDLY
, 0);
1713 if (oflags
& TARGET_TABDLY
) {
1714 print_enums(termios_oflags_TABDLY
, oflags
& TARGET_TABDLY
, 0);
1716 if (oflags
& TARGET_BSDLY
) {
1717 print_enums(termios_oflags_BSDLY
, oflags
& TARGET_BSDLY
, 0);
1719 if (oflags
& TARGET_VTDLY
) {
1720 print_enums(termios_oflags_VTDLY
, oflags
& TARGET_VTDLY
, 0);
1722 if (oflags
& TARGET_FFDLY
) {
1723 print_enums(termios_oflags_FFDLY
, oflags
& TARGET_FFDLY
, 0);
1726 qemu_log("c_cflag = ");
1727 if (cflags
& TARGET_CBAUD
) {
1728 print_enums(termios_cflags_CBAUD
, cflags
& TARGET_CBAUD
, 0);
1730 if (cflags
& TARGET_CSIZE
) {
1731 print_enums(termios_cflags_CSIZE
, cflags
& TARGET_CSIZE
, 0);
1733 target_tcflag_t cflags_clean
= cflags
& ~(TARGET_CBAUD
| TARGET_CSIZE
);
1734 print_flags(termios_cflags
, cflags_clean
, 0);
1736 qemu_log("c_lflag = ");
1737 print_flags(termios_lflags
, lflags
, 0);
1739 qemu_log("c_cc = ");
1740 qemu_log("\"%s\",", target
->c_cc
);
1742 qemu_log("c_line = ");
1743 print_raw_param("\'%c\'", target
->c_line
, 1);
1750 #ifdef TARGET_NR_accept
1752 print_accept(void *cpu_env
, const struct syscallname
*name
,
1753 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1754 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1756 print_syscall_prologue(name
);
1757 print_raw_param("%d", arg0
, 0);
1758 print_pointer(arg1
, 0);
1759 print_number(arg2
, 1);
1760 print_syscall_epilogue(name
);
1764 #ifdef TARGET_NR_access
1766 print_access(void *cpu_env
, const struct syscallname
*name
,
1767 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1768 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1770 print_syscall_prologue(name
);
1771 print_string(arg0
, 0);
1772 print_flags(access_flags
, arg1
, 1);
1773 print_syscall_epilogue(name
);
1777 #ifdef TARGET_NR_acct
1779 print_acct(void *cpu_env
, const struct syscallname
*name
,
1780 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1781 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1783 print_syscall_prologue(name
);
1784 print_string(arg0
, 1);
1785 print_syscall_epilogue(name
);
1789 #ifdef TARGET_NR_brk
1791 print_brk(void *cpu_env
, const struct syscallname
*name
,
1792 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1793 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1795 print_syscall_prologue(name
);
1796 print_pointer(arg0
, 1);
1797 print_syscall_epilogue(name
);
1801 #ifdef TARGET_NR_chdir
1803 print_chdir(void *cpu_env
, const struct syscallname
*name
,
1804 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1805 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1807 print_syscall_prologue(name
);
1808 print_string(arg0
, 1);
1809 print_syscall_epilogue(name
);
1813 #ifdef TARGET_NR_chroot
1815 print_chroot(void *cpu_env
, const struct syscallname
*name
,
1816 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1817 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1819 print_syscall_prologue(name
);
1820 print_string(arg0
, 1);
1821 print_syscall_epilogue(name
);
1825 #ifdef TARGET_NR_chmod
1827 print_chmod(void *cpu_env
, const struct syscallname
*name
,
1828 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1829 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1831 print_syscall_prologue(name
);
1832 print_string(arg0
, 0);
1833 print_file_mode(arg1
, 1);
1834 print_syscall_epilogue(name
);
1838 #if defined(TARGET_NR_chown) || defined(TARGET_NR_lchown)
1840 print_chown(void *cpu_env
, const struct syscallname
*name
,
1841 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1842 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1844 print_syscall_prologue(name
);
1845 print_string(arg0
, 0);
1846 print_raw_param("%d", arg1
, 0);
1847 print_raw_param("%d", arg2
, 1);
1848 print_syscall_epilogue(name
);
1850 #define print_lchown print_chown
1853 #ifdef TARGET_NR_clock_adjtime
1855 print_clock_adjtime(void *cpu_env
, const struct syscallname
*name
,
1856 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1857 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1859 print_syscall_prologue(name
);
1860 print_enums(clockids
, arg0
, 0);
1861 print_pointer(arg1
, 1);
1862 print_syscall_epilogue(name
);
1866 #ifdef TARGET_NR_clone
1867 static void do_print_clone(unsigned int flags
, abi_ulong newsp
,
1868 abi_ulong parent_tidptr
, target_ulong newtls
,
1869 abi_ulong child_tidptr
)
1871 print_flags(clone_flags
, flags
, 0);
1872 print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx
, newsp
, 0);
1873 print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx
, parent_tidptr
, 0);
1874 print_raw_param("tls=0x" TARGET_ABI_FMT_lx
, newtls
, 0);
1875 print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx
, child_tidptr
, 1);
1879 print_clone(void *cpu_env
, const struct syscallname
*name
,
1880 abi_long arg1
, abi_long arg2
, abi_long arg3
,
1881 abi_long arg4
, abi_long arg5
, abi_long arg6
)
1883 print_syscall_prologue(name
);
1884 #if defined(TARGET_MICROBLAZE)
1885 do_print_clone(arg1
, arg2
, arg4
, arg6
, arg5
);
1886 #elif defined(TARGET_CLONE_BACKWARDS)
1887 do_print_clone(arg1
, arg2
, arg3
, arg4
, arg5
);
1888 #elif defined(TARGET_CLONE_BACKWARDS2)
1889 do_print_clone(arg2
, arg1
, arg3
, arg5
, arg4
);
1891 do_print_clone(arg1
, arg2
, arg3
, arg5
, arg4
);
1893 print_syscall_epilogue(name
);
1897 #ifdef TARGET_NR_creat
1899 print_creat(void *cpu_env
, const struct syscallname
*name
,
1900 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1901 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1903 print_syscall_prologue(name
);
1904 print_string(arg0
, 0);
1905 print_file_mode(arg1
, 1);
1906 print_syscall_epilogue(name
);
1910 #ifdef TARGET_NR_execv
1912 print_execv(void *cpu_env
, const struct syscallname
*name
,
1913 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1914 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1916 print_syscall_prologue(name
);
1917 print_string(arg0
, 0);
1918 print_raw_param("0x" TARGET_ABI_FMT_lx
, arg1
, 1);
1919 print_syscall_epilogue(name
);
1923 #ifdef TARGET_NR_faccessat
1925 print_faccessat(void *cpu_env
, const struct syscallname
*name
,
1926 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1927 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1929 print_syscall_prologue(name
);
1930 print_at_dirfd(arg0
, 0);
1931 print_string(arg1
, 0);
1932 print_flags(access_flags
, arg2
, 0);
1933 print_flags(at_file_flags
, arg3
, 1);
1934 print_syscall_epilogue(name
);
1938 #ifdef TARGET_NR_fallocate
1940 print_fallocate(void *cpu_env
, const struct syscallname
*name
,
1941 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1942 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1944 print_syscall_prologue(name
);
1945 print_raw_param("%d", arg0
, 0);
1946 print_flags(falloc_flags
, arg1
, 0);
1947 #if TARGET_ABI_BITS == 32
1948 print_raw_param("%" PRIu64
, target_offset64(arg2
, arg3
), 0);
1949 print_raw_param("%" PRIu64
, target_offset64(arg4
, arg5
), 1);
1951 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
1952 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 1);
1954 print_syscall_epilogue(name
);
1958 #ifdef TARGET_NR_fchmodat
1960 print_fchmodat(void *cpu_env
, const struct syscallname
*name
,
1961 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1962 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1964 print_syscall_prologue(name
);
1965 print_at_dirfd(arg0
, 0);
1966 print_string(arg1
, 0);
1967 print_file_mode(arg2
, 0);
1968 print_flags(at_file_flags
, arg3
, 1);
1969 print_syscall_epilogue(name
);
1973 #ifdef TARGET_NR_fchownat
1975 print_fchownat(void *cpu_env
, const struct syscallname
*name
,
1976 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1977 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1979 print_syscall_prologue(name
);
1980 print_at_dirfd(arg0
, 0);
1981 print_string(arg1
, 0);
1982 print_raw_param("%d", arg2
, 0);
1983 print_raw_param("%d", arg3
, 0);
1984 print_flags(at_file_flags
, arg4
, 1);
1985 print_syscall_epilogue(name
);
1989 #if defined(TARGET_NR_fcntl) || defined(TARGET_NR_fcntl64)
1991 print_fcntl(void *cpu_env
, const struct syscallname
*name
,
1992 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1993 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1995 print_syscall_prologue(name
);
1996 print_raw_param("%d", arg0
, 0);
1998 case TARGET_F_DUPFD
:
1999 qemu_log("F_DUPFD,");
2000 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2002 case TARGET_F_GETFD
:
2003 qemu_log("F_GETFD");
2005 case TARGET_F_SETFD
:
2006 qemu_log("F_SETFD,");
2007 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2009 case TARGET_F_GETFL
:
2010 qemu_log("F_GETFL");
2012 case TARGET_F_SETFL
:
2013 qemu_log("F_SETFL,");
2014 print_open_flags(arg2
, 1);
2016 case TARGET_F_GETLK
:
2017 qemu_log("F_GETLK,");
2018 print_pointer(arg2
, 1);
2020 case TARGET_F_SETLK
:
2021 qemu_log("F_SETLK,");
2022 print_pointer(arg2
, 1);
2024 case TARGET_F_SETLKW
:
2025 qemu_log("F_SETLKW,");
2026 print_pointer(arg2
, 1);
2028 case TARGET_F_GETOWN
:
2029 qemu_log("F_GETOWN");
2031 case TARGET_F_SETOWN
:
2032 qemu_log("F_SETOWN,");
2033 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2035 case TARGET_F_GETSIG
:
2036 qemu_log("F_GETSIG");
2038 case TARGET_F_SETSIG
:
2039 qemu_log("F_SETSIG,");
2040 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2042 #if TARGET_ABI_BITS == 32
2043 case TARGET_F_GETLK64
:
2044 qemu_log("F_GETLK64,");
2045 print_pointer(arg2
, 1);
2047 case TARGET_F_SETLK64
:
2048 qemu_log("F_SETLK64,");
2049 print_pointer(arg2
, 1);
2051 case TARGET_F_SETLKW64
:
2052 qemu_log("F_SETLKW64,");
2053 print_pointer(arg2
, 1);
2056 case TARGET_F_OFD_GETLK
:
2057 qemu_log("F_OFD_GETLK,");
2058 print_pointer(arg2
, 1);
2060 case TARGET_F_OFD_SETLK
:
2061 qemu_log("F_OFD_SETLK,");
2062 print_pointer(arg2
, 1);
2064 case TARGET_F_OFD_SETLKW
:
2065 qemu_log("F_OFD_SETLKW,");
2066 print_pointer(arg2
, 1);
2068 case TARGET_F_SETLEASE
:
2069 qemu_log("F_SETLEASE,");
2070 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2072 case TARGET_F_GETLEASE
:
2073 qemu_log("F_GETLEASE");
2075 #ifdef F_DUPFD_CLOEXEC
2076 case TARGET_F_DUPFD_CLOEXEC
:
2077 qemu_log("F_DUPFD_CLOEXEC,");
2078 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2081 case TARGET_F_NOTIFY
:
2082 qemu_log("F_NOTIFY,");
2083 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2086 case TARGET_F_GETOWN_EX
:
2087 qemu_log("F_GETOWN_EX,");
2088 print_pointer(arg2
, 1);
2092 case TARGET_F_SETOWN_EX
:
2093 qemu_log("F_SETOWN_EX,");
2094 print_pointer(arg2
, 1);
2098 case TARGET_F_SETPIPE_SZ
:
2099 qemu_log("F_SETPIPE_SZ,");
2100 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2102 case TARGET_F_GETPIPE_SZ
:
2103 qemu_log("F_GETPIPE_SZ");
2107 case TARGET_F_ADD_SEALS
:
2108 qemu_log("F_ADD_SEALS,");
2109 print_raw_param("0x"TARGET_ABI_FMT_lx
, arg2
, 1);
2111 case TARGET_F_GET_SEALS
:
2112 qemu_log("F_GET_SEALS");
2116 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2117 print_pointer(arg2
, 1);
2120 print_syscall_epilogue(name
);
2122 #define print_fcntl64 print_fcntl
2125 #ifdef TARGET_NR_fgetxattr
2127 print_fgetxattr(void *cpu_env
, const struct syscallname
*name
,
2128 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2129 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2131 print_syscall_prologue(name
);
2132 print_raw_param("%d", arg0
, 0);
2133 print_string(arg1
, 0);
2134 print_pointer(arg2
, 0);
2135 print_raw_param(TARGET_FMT_lu
, arg3
, 1);
2136 print_syscall_epilogue(name
);
2140 #ifdef TARGET_NR_flistxattr
2142 print_flistxattr(void *cpu_env
, const struct syscallname
*name
,
2143 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2144 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2146 print_syscall_prologue(name
);
2147 print_raw_param("%d", arg0
, 0);
2148 print_pointer(arg1
, 0);
2149 print_raw_param(TARGET_FMT_lu
, arg2
, 1);
2150 print_syscall_epilogue(name
);
2154 #if defined(TARGET_NR_getxattr) || defined(TARGET_NR_lgetxattr)
2156 print_getxattr(void *cpu_env
, const struct syscallname
*name
,
2157 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2158 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2160 print_syscall_prologue(name
);
2161 print_string(arg0
, 0);
2162 print_string(arg1
, 0);
2163 print_pointer(arg2
, 0);
2164 print_raw_param(TARGET_FMT_lu
, arg3
, 1);
2165 print_syscall_epilogue(name
);
2167 #define print_lgetxattr print_getxattr
2170 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr)
2172 print_listxattr(void *cpu_env
, const struct syscallname
*name
,
2173 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2174 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2176 print_syscall_prologue(name
);
2177 print_string(arg0
, 0);
2178 print_pointer(arg1
, 0);
2179 print_raw_param(TARGET_FMT_lu
, arg2
, 1);
2180 print_syscall_epilogue(name
);
2182 #define print_llistxattr print_listxattr
2185 #if defined(TARGET_NR_fremovexattr)
2187 print_fremovexattr(void *cpu_env
, const struct syscallname
*name
,
2188 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2189 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2191 print_syscall_prologue(name
);
2192 print_raw_param("%d", arg0
, 0);
2193 print_string(arg1
, 1);
2194 print_syscall_epilogue(name
);
2198 #if defined(TARGET_NR_removexattr) || defined(TARGET_NR_lremovexattr)
2200 print_removexattr(void *cpu_env
, const struct syscallname
*name
,
2201 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2202 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2204 print_syscall_prologue(name
);
2205 print_string(arg0
, 0);
2206 print_string(arg1
, 1);
2207 print_syscall_epilogue(name
);
2209 #define print_lremovexattr print_removexattr
2212 #ifdef TARGET_NR_futimesat
2214 print_futimesat(void *cpu_env
, const struct syscallname
*name
,
2215 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2216 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2218 print_syscall_prologue(name
);
2219 print_at_dirfd(arg0
, 0);
2220 print_string(arg1
, 0);
2221 print_timeval(arg2
, 0);
2222 print_timeval(arg2
+ sizeof (struct target_timeval
), 1);
2223 print_syscall_epilogue(name
);
2227 #ifdef TARGET_NR_gettimeofday
2229 print_gettimeofday(void *cpu_env
, const struct syscallname
*name
,
2230 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2231 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2233 print_syscall_prologue(name
);
2234 print_pointer(arg0
, 0);
2235 print_pointer(arg1
, 1);
2236 print_syscall_epilogue(name
);
2240 #ifdef TARGET_NR_settimeofday
2242 print_settimeofday(void *cpu_env
, const struct syscallname
*name
,
2243 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2244 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2246 print_syscall_prologue(name
);
2247 print_timeval(arg0
, 0);
2248 print_timezone(arg1
, 1);
2249 print_syscall_epilogue(name
);
2253 #if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
2255 print_clock_gettime(void *cpu_env
, const struct syscallname
*name
,
2256 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2257 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2259 print_syscall_prologue(name
);
2260 print_enums(clockids
, arg0
, 0);
2261 print_pointer(arg1
, 1);
2262 print_syscall_epilogue(name
);
2264 #define print_clock_getres print_clock_gettime
2267 #ifdef TARGET_NR_clock_settime
2269 print_clock_settime(void *cpu_env
, const struct syscallname
*name
,
2270 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2271 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2273 print_syscall_prologue(name
);
2274 print_enums(clockids
, arg0
, 0);
2275 print_timespec(arg1
, 1);
2276 print_syscall_epilogue(name
);
2280 #ifdef TARGET_NR_getitimer
2282 print_getitimer(void *cpu_env
, const struct syscallname
*name
,
2283 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2284 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2286 print_syscall_prologue(name
);
2287 print_enums(itimer_types
, arg0
, 0);
2288 print_pointer(arg1
, 1);
2289 print_syscall_epilogue(name
);
2293 #ifdef TARGET_NR_setitimer
2295 print_setitimer(void *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_enums(itimer_types
, arg0
, 0);
2301 print_itimerval(arg1
, 0);
2302 print_pointer(arg2
, 1);
2303 print_syscall_epilogue(name
);
2307 #ifdef TARGET_NR_link
2309 print_link(void *cpu_env
, const struct syscallname
*name
,
2310 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2311 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2313 print_syscall_prologue(name
);
2314 print_string(arg0
, 0);
2315 print_string(arg1
, 1);
2316 print_syscall_epilogue(name
);
2320 #ifdef TARGET_NR_linkat
2322 print_linkat(void *cpu_env
, const struct syscallname
*name
,
2323 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2324 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2326 print_syscall_prologue(name
);
2327 print_at_dirfd(arg0
, 0);
2328 print_string(arg1
, 0);
2329 print_at_dirfd(arg2
, 0);
2330 print_string(arg3
, 0);
2331 print_flags(at_file_flags
, arg4
, 1);
2332 print_syscall_epilogue(name
);
2336 #ifdef TARGET_NR__llseek
2338 print__llseek(void *cpu_env
, const struct syscallname
*name
,
2339 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2340 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2342 const char *whence
= "UNKNOWN";
2343 print_syscall_prologue(name
);
2344 print_raw_param("%d", arg0
, 0);
2345 print_raw_param("%ld", arg1
, 0);
2346 print_raw_param("%ld", arg2
, 0);
2347 print_pointer(arg3
, 0);
2349 case SEEK_SET
: whence
= "SEEK_SET"; break;
2350 case SEEK_CUR
: whence
= "SEEK_CUR"; break;
2351 case SEEK_END
: whence
= "SEEK_END"; break;
2353 qemu_log("%s", whence
);
2354 print_syscall_epilogue(name
);
2358 #ifdef TARGET_NR_lseek
2360 print_lseek(void *cpu_env
, const struct syscallname
*name
,
2361 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2362 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2364 print_syscall_prologue(name
);
2365 print_raw_param("%d", arg0
, 0);
2366 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2369 qemu_log("SEEK_SET"); break;
2371 qemu_log("SEEK_CUR"); break;
2373 qemu_log("SEEK_END"); break;
2376 qemu_log("SEEK_DATA"); break;
2380 qemu_log("SEEK_HOLE"); break;
2383 print_raw_param("%#x", arg2
, 1);
2385 print_syscall_epilogue(name
);
2389 #ifdef TARGET_NR_truncate
2391 print_truncate(void *cpu_env
, const struct syscallname
*name
,
2392 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2393 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2395 print_syscall_prologue(name
);
2396 print_string(arg0
, 0);
2397 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 1);
2398 print_syscall_epilogue(name
);
2402 #ifdef TARGET_NR_truncate64
2404 print_truncate64(void *cpu_env
, const struct syscallname
*name
,
2405 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2406 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2408 print_syscall_prologue(name
);
2409 print_string(arg0
, 0);
2410 if (regpairs_aligned(cpu_env
, TARGET_NR_truncate64
)) {
2414 print_raw_param("%" PRIu64
, target_offset64(arg1
, arg2
), 1);
2415 print_syscall_epilogue(name
);
2419 #ifdef TARGET_NR_ftruncate64
2421 print_ftruncate64(void *cpu_env
, const struct syscallname
*name
,
2422 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2423 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2425 print_syscall_prologue(name
);
2426 print_raw_param("%d", arg0
, 0);
2427 if (regpairs_aligned(cpu_env
, TARGET_NR_ftruncate64
)) {
2431 print_raw_param("%" PRIu64
, target_offset64(arg1
, arg2
), 1);
2432 print_syscall_epilogue(name
);
2436 #ifdef TARGET_NR_mlockall
2438 print_mlockall(void *cpu_env
, const struct syscallname
*name
,
2439 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2440 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2442 print_syscall_prologue(name
);
2443 print_flags(mlockall_flags
, arg0
, 1);
2444 print_syscall_epilogue(name
);
2448 #if defined(TARGET_NR_socket)
2450 print_socket(void *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 abi_ulong domain
= arg0
, type
= arg1
, protocol
= arg2
;
2456 print_syscall_prologue(name
);
2457 print_socket_domain(domain
);
2459 print_socket_type(type
);
2461 if (domain
== AF_PACKET
||
2462 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
2463 protocol
= tswap16(protocol
);
2465 print_socket_protocol(domain
, type
, protocol
);
2466 print_syscall_epilogue(name
);
2471 #if defined(TARGET_NR_socketcall) || defined(TARGET_NR_bind)
2473 static void print_sockfd(abi_long sockfd
, int last
)
2475 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, last
);
2480 #if defined(TARGET_NR_socketcall)
2482 #define get_user_ualx(x, gaddr, idx) \
2483 get_user_ual(x, (gaddr) + (idx) * sizeof(abi_long))
2485 static void do_print_socket(const char *name
, abi_long arg1
)
2487 abi_ulong domain
, type
, protocol
;
2489 get_user_ualx(domain
, arg1
, 0);
2490 get_user_ualx(type
, arg1
, 1);
2491 get_user_ualx(protocol
, arg1
, 2);
2492 qemu_log("%s(", name
);
2493 print_socket_domain(domain
);
2495 print_socket_type(type
);
2497 if (domain
== AF_PACKET
||
2498 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
2499 protocol
= tswap16(protocol
);
2501 print_socket_protocol(domain
, type
, protocol
);
2505 static void do_print_sockaddr(const char *name
, abi_long arg1
)
2507 abi_ulong sockfd
, addr
, addrlen
;
2509 get_user_ualx(sockfd
, arg1
, 0);
2510 get_user_ualx(addr
, arg1
, 1);
2511 get_user_ualx(addrlen
, arg1
, 2);
2513 qemu_log("%s(", name
);
2514 print_sockfd(sockfd
, 0);
2515 print_sockaddr(addr
, addrlen
, 0);
2519 static void do_print_listen(const char *name
, abi_long arg1
)
2521 abi_ulong sockfd
, backlog
;
2523 get_user_ualx(sockfd
, arg1
, 0);
2524 get_user_ualx(backlog
, arg1
, 1);
2526 qemu_log("%s(", name
);
2527 print_sockfd(sockfd
, 0);
2528 print_raw_param(TARGET_ABI_FMT_ld
, backlog
, 1);
2532 static void do_print_socketpair(const char *name
, abi_long arg1
)
2534 abi_ulong domain
, type
, protocol
, tab
;
2536 get_user_ualx(domain
, arg1
, 0);
2537 get_user_ualx(type
, arg1
, 1);
2538 get_user_ualx(protocol
, arg1
, 2);
2539 get_user_ualx(tab
, arg1
, 3);
2541 qemu_log("%s(", name
);
2542 print_socket_domain(domain
);
2544 print_socket_type(type
);
2546 print_socket_protocol(domain
, type
, protocol
);
2548 print_raw_param(TARGET_ABI_FMT_lx
, tab
, 1);
2552 static void do_print_sendrecv(const char *name
, abi_long arg1
)
2554 abi_ulong sockfd
, msg
, len
, flags
;
2556 get_user_ualx(sockfd
, arg1
, 0);
2557 get_user_ualx(msg
, arg1
, 1);
2558 get_user_ualx(len
, arg1
, 2);
2559 get_user_ualx(flags
, arg1
, 3);
2561 qemu_log("%s(", name
);
2562 print_sockfd(sockfd
, 0);
2563 print_buf(msg
, len
, 0);
2564 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
2565 print_flags(msg_flags
, flags
, 1);
2569 static void do_print_msgaddr(const char *name
, abi_long arg1
)
2571 abi_ulong sockfd
, msg
, len
, flags
, addr
, addrlen
;
2573 get_user_ualx(sockfd
, arg1
, 0);
2574 get_user_ualx(msg
, arg1
, 1);
2575 get_user_ualx(len
, arg1
, 2);
2576 get_user_ualx(flags
, arg1
, 3);
2577 get_user_ualx(addr
, arg1
, 4);
2578 get_user_ualx(addrlen
, arg1
, 5);
2580 qemu_log("%s(", name
);
2581 print_sockfd(sockfd
, 0);
2582 print_buf(msg
, len
, 0);
2583 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
2584 print_flags(msg_flags
, flags
, 0);
2585 print_sockaddr(addr
, addrlen
, 0);
2589 static void do_print_shutdown(const char *name
, abi_long arg1
)
2591 abi_ulong sockfd
, how
;
2593 get_user_ualx(sockfd
, arg1
, 0);
2594 get_user_ualx(how
, arg1
, 1);
2596 qemu_log("shutdown(");
2597 print_sockfd(sockfd
, 0);
2600 qemu_log("SHUT_RD");
2603 qemu_log("SHUT_WR");
2606 qemu_log("SHUT_RDWR");
2609 print_raw_param(TARGET_ABI_FMT_ld
, how
, 1);
2615 static void do_print_msg(const char *name
, abi_long arg1
)
2617 abi_ulong sockfd
, msg
, flags
;
2619 get_user_ualx(sockfd
, arg1
, 0);
2620 get_user_ualx(msg
, arg1
, 1);
2621 get_user_ualx(flags
, arg1
, 2);
2623 qemu_log("%s(", name
);
2624 print_sockfd(sockfd
, 0);
2625 print_pointer(msg
, 0);
2626 print_flags(msg_flags
, flags
, 1);
2630 static void do_print_sockopt(const char *name
, abi_long arg1
)
2632 abi_ulong sockfd
, level
, optname
, optval
, optlen
;
2634 get_user_ualx(sockfd
, arg1
, 0);
2635 get_user_ualx(level
, arg1
, 1);
2636 get_user_ualx(optname
, arg1
, 2);
2637 get_user_ualx(optval
, arg1
, 3);
2638 get_user_ualx(optlen
, arg1
, 4);
2640 qemu_log("%s(", name
);
2641 print_sockfd(sockfd
, 0);
2644 qemu_log("SOL_TCP,");
2645 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2646 print_pointer(optval
, 0);
2649 qemu_log("SOL_UDP,");
2650 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2651 print_pointer(optval
, 0);
2654 qemu_log("SOL_IP,");
2655 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2656 print_pointer(optval
, 0);
2659 qemu_log("SOL_RAW,");
2660 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2661 print_pointer(optval
, 0);
2663 case TARGET_SOL_SOCKET
:
2664 qemu_log("SOL_SOCKET,");
2666 case TARGET_SO_DEBUG
:
2667 qemu_log("SO_DEBUG,");
2669 print_number(optval
, 0);
2671 case TARGET_SO_REUSEADDR
:
2672 qemu_log("SO_REUSEADDR,");
2674 case TARGET_SO_REUSEPORT
:
2675 qemu_log("SO_REUSEPORT,");
2677 case TARGET_SO_TYPE
:
2678 qemu_log("SO_TYPE,");
2680 case TARGET_SO_ERROR
:
2681 qemu_log("SO_ERROR,");
2683 case TARGET_SO_DONTROUTE
:
2684 qemu_log("SO_DONTROUTE,");
2686 case TARGET_SO_BROADCAST
:
2687 qemu_log("SO_BROADCAST,");
2689 case TARGET_SO_SNDBUF
:
2690 qemu_log("SO_SNDBUF,");
2692 case TARGET_SO_RCVBUF
:
2693 qemu_log("SO_RCVBUF,");
2695 case TARGET_SO_KEEPALIVE
:
2696 qemu_log("SO_KEEPALIVE,");
2698 case TARGET_SO_OOBINLINE
:
2699 qemu_log("SO_OOBINLINE,");
2701 case TARGET_SO_NO_CHECK
:
2702 qemu_log("SO_NO_CHECK,");
2704 case TARGET_SO_PRIORITY
:
2705 qemu_log("SO_PRIORITY,");
2707 case TARGET_SO_BSDCOMPAT
:
2708 qemu_log("SO_BSDCOMPAT,");
2710 case TARGET_SO_PASSCRED
:
2711 qemu_log("SO_PASSCRED,");
2713 case TARGET_SO_TIMESTAMP
:
2714 qemu_log("SO_TIMESTAMP,");
2716 case TARGET_SO_RCVLOWAT
:
2717 qemu_log("SO_RCVLOWAT,");
2719 case TARGET_SO_RCVTIMEO
:
2720 qemu_log("SO_RCVTIMEO,");
2721 print_timeval(optval
, 0);
2723 case TARGET_SO_SNDTIMEO
:
2724 qemu_log("SO_SNDTIMEO,");
2725 print_timeval(optval
, 0);
2727 case TARGET_SO_ATTACH_FILTER
: {
2728 struct target_sock_fprog
*fprog
;
2730 qemu_log("SO_ATTACH_FILTER,");
2732 if (lock_user_struct(VERIFY_READ
, fprog
, optval
, 0)) {
2733 struct target_sock_filter
*filter
;
2735 if (lock_user_struct(VERIFY_READ
, filter
,
2736 tswapal(fprog
->filter
), 0)) {
2738 for (i
= 0; i
< tswap16(fprog
->len
) - 1; i
++) {
2739 qemu_log("[%d]{0x%x,%d,%d,0x%x},",
2740 i
, tswap16(filter
[i
].code
),
2741 filter
[i
].jt
, filter
[i
].jf
,
2742 tswap32(filter
[i
].k
));
2744 qemu_log("[%d]{0x%x,%d,%d,0x%x}",
2745 i
, tswap16(filter
[i
].code
),
2746 filter
[i
].jt
, filter
[i
].jf
,
2747 tswap32(filter
[i
].k
));
2749 qemu_log(TARGET_ABI_FMT_lx
, tswapal(fprog
->filter
));
2751 qemu_log(",%d},", tswap16(fprog
->len
));
2752 unlock_user(fprog
, optval
, 0);
2754 print_pointer(optval
, 0);
2759 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2760 print_pointer(optval
, 0);
2765 print_raw_param(TARGET_ABI_FMT_ld
, level
, 0);
2766 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2767 print_pointer(optval
, 0);
2770 print_raw_param(TARGET_ABI_FMT_ld
, optlen
, 1);
2774 #define PRINT_SOCKOP(name, func) \
2775 [TARGET_SYS_##name] = { #name, func }
2779 void (*print
)(const char *, abi_long
);
2781 PRINT_SOCKOP(SOCKET
, do_print_socket
),
2782 PRINT_SOCKOP(BIND
, do_print_sockaddr
),
2783 PRINT_SOCKOP(CONNECT
, do_print_sockaddr
),
2784 PRINT_SOCKOP(LISTEN
, do_print_listen
),
2785 PRINT_SOCKOP(ACCEPT
, do_print_sockaddr
),
2786 PRINT_SOCKOP(GETSOCKNAME
, do_print_sockaddr
),
2787 PRINT_SOCKOP(GETPEERNAME
, do_print_sockaddr
),
2788 PRINT_SOCKOP(SOCKETPAIR
, do_print_socketpair
),
2789 PRINT_SOCKOP(SEND
, do_print_sendrecv
),
2790 PRINT_SOCKOP(RECV
, do_print_sendrecv
),
2791 PRINT_SOCKOP(SENDTO
, do_print_msgaddr
),
2792 PRINT_SOCKOP(RECVFROM
, do_print_msgaddr
),
2793 PRINT_SOCKOP(SHUTDOWN
, do_print_shutdown
),
2794 PRINT_SOCKOP(SETSOCKOPT
, do_print_sockopt
),
2795 PRINT_SOCKOP(GETSOCKOPT
, do_print_sockopt
),
2796 PRINT_SOCKOP(SENDMSG
, do_print_msg
),
2797 PRINT_SOCKOP(RECVMSG
, do_print_msg
),
2798 PRINT_SOCKOP(ACCEPT4
, NULL
),
2799 PRINT_SOCKOP(RECVMMSG
, NULL
),
2800 PRINT_SOCKOP(SENDMMSG
, NULL
),
2804 print_socketcall(void *cpu_env
, const struct syscallname
*name
,
2805 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2806 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2808 if (arg0
>= 0 && arg0
< ARRAY_SIZE(scall
) && scall
[arg0
].print
) {
2809 scall
[arg0
].print(scall
[arg0
].name
, arg1
);
2812 print_syscall_prologue(name
);
2813 print_raw_param(TARGET_ABI_FMT_ld
, arg0
, 0);
2814 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2815 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2816 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 0);
2817 print_raw_param(TARGET_ABI_FMT_ld
, arg4
, 0);
2818 print_raw_param(TARGET_ABI_FMT_ld
, arg5
, 0);
2819 print_syscall_epilogue(name
);
2823 #if defined(TARGET_NR_bind)
2825 print_bind(void *cpu_env
, const struct syscallname
*name
,
2826 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2827 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2829 print_syscall_prologue(name
);
2830 print_sockfd(arg0
, 0);
2831 print_sockaddr(arg1
, arg2
, 1);
2832 print_syscall_epilogue(name
);
2836 #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \
2837 defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64)
2839 print_stat(void *cpu_env
, const struct syscallname
*name
,
2840 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2841 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2843 print_syscall_prologue(name
);
2844 print_string(arg0
, 0);
2845 print_pointer(arg1
, 1);
2846 print_syscall_epilogue(name
);
2848 #define print_lstat print_stat
2849 #define print_stat64 print_stat
2850 #define print_lstat64 print_stat
2853 #if defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64)
2855 print_fstat(void *cpu_env
, const struct syscallname
*name
,
2856 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2857 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2859 print_syscall_prologue(name
);
2860 print_raw_param("%d", arg0
, 0);
2861 print_pointer(arg1
, 1);
2862 print_syscall_epilogue(name
);
2864 #define print_fstat64 print_fstat
2867 #ifdef TARGET_NR_mkdir
2869 print_mkdir(void *cpu_env
, const struct syscallname
*name
,
2870 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2871 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2873 print_syscall_prologue(name
);
2874 print_string(arg0
, 0);
2875 print_file_mode(arg1
, 1);
2876 print_syscall_epilogue(name
);
2880 #ifdef TARGET_NR_mkdirat
2882 print_mkdirat(void *cpu_env
, const struct syscallname
*name
,
2883 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2884 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2886 print_syscall_prologue(name
);
2887 print_at_dirfd(arg0
, 0);
2888 print_string(arg1
, 0);
2889 print_file_mode(arg2
, 1);
2890 print_syscall_epilogue(name
);
2894 #ifdef TARGET_NR_rmdir
2896 print_rmdir(void *cpu_env
, const struct syscallname
*name
,
2897 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2898 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2900 print_syscall_prologue(name
);
2901 print_string(arg0
, 0);
2902 print_syscall_epilogue(name
);
2906 #ifdef TARGET_NR_rt_sigaction
2908 print_rt_sigaction(void *cpu_env
, const struct syscallname
*name
,
2909 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2910 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2912 print_syscall_prologue(name
);
2913 print_signal(arg0
, 0);
2914 print_pointer(arg1
, 0);
2915 print_pointer(arg2
, 1);
2916 print_syscall_epilogue(name
);
2920 #ifdef TARGET_NR_rt_sigprocmask
2922 print_rt_sigprocmask(void *cpu_env
, const struct syscallname
*name
,
2923 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2924 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2926 const char *how
= "UNKNOWN";
2927 print_syscall_prologue(name
);
2929 case TARGET_SIG_BLOCK
: how
= "SIG_BLOCK"; break;
2930 case TARGET_SIG_UNBLOCK
: how
= "SIG_UNBLOCK"; break;
2931 case TARGET_SIG_SETMASK
: how
= "SIG_SETMASK"; break;
2933 qemu_log("%s,", how
);
2934 print_pointer(arg1
, 0);
2935 print_pointer(arg2
, 1);
2936 print_syscall_epilogue(name
);
2940 #ifdef TARGET_NR_rt_sigqueueinfo
2942 print_rt_sigqueueinfo(void *cpu_env
, const struct syscallname
*name
,
2943 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2944 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2947 target_siginfo_t uinfo
;
2949 print_syscall_prologue(name
);
2950 print_raw_param("%d", arg0
, 0);
2951 print_signal(arg1
, 0);
2952 p
= lock_user(VERIFY_READ
, arg2
, sizeof(target_siginfo_t
), 1);
2954 get_target_siginfo(&uinfo
, p
);
2955 print_siginfo(&uinfo
);
2957 unlock_user(p
, arg2
, 0);
2959 print_pointer(arg2
, 1);
2961 print_syscall_epilogue(name
);
2965 #ifdef TARGET_NR_rt_tgsigqueueinfo
2967 print_rt_tgsigqueueinfo(void *cpu_env
, const struct syscallname
*name
,
2968 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2969 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2972 target_siginfo_t uinfo
;
2974 print_syscall_prologue(name
);
2975 print_raw_param("%d", arg0
, 0);
2976 print_raw_param("%d", arg1
, 0);
2977 print_signal(arg2
, 0);
2978 p
= lock_user(VERIFY_READ
, arg3
, sizeof(target_siginfo_t
), 1);
2980 get_target_siginfo(&uinfo
, p
);
2981 print_siginfo(&uinfo
);
2983 unlock_user(p
, arg3
, 0);
2985 print_pointer(arg3
, 1);
2987 print_syscall_epilogue(name
);
2991 #ifdef TARGET_NR_syslog
2993 print_syslog_action(abi_ulong arg
, int last
)
2998 case TARGET_SYSLOG_ACTION_CLOSE
: {
2999 type
= "SYSLOG_ACTION_CLOSE";
3002 case TARGET_SYSLOG_ACTION_OPEN
: {
3003 type
= "SYSLOG_ACTION_OPEN";
3006 case TARGET_SYSLOG_ACTION_READ
: {
3007 type
= "SYSLOG_ACTION_READ";
3010 case TARGET_SYSLOG_ACTION_READ_ALL
: {
3011 type
= "SYSLOG_ACTION_READ_ALL";
3014 case TARGET_SYSLOG_ACTION_READ_CLEAR
: {
3015 type
= "SYSLOG_ACTION_READ_CLEAR";
3018 case TARGET_SYSLOG_ACTION_CLEAR
: {
3019 type
= "SYSLOG_ACTION_CLEAR";
3022 case TARGET_SYSLOG_ACTION_CONSOLE_OFF
: {
3023 type
= "SYSLOG_ACTION_CONSOLE_OFF";
3026 case TARGET_SYSLOG_ACTION_CONSOLE_ON
: {
3027 type
= "SYSLOG_ACTION_CONSOLE_ON";
3030 case TARGET_SYSLOG_ACTION_CONSOLE_LEVEL
: {
3031 type
= "SYSLOG_ACTION_CONSOLE_LEVEL";
3034 case TARGET_SYSLOG_ACTION_SIZE_UNREAD
: {
3035 type
= "SYSLOG_ACTION_SIZE_UNREAD";
3038 case TARGET_SYSLOG_ACTION_SIZE_BUFFER
: {
3039 type
= "SYSLOG_ACTION_SIZE_BUFFER";
3043 print_raw_param("%ld", arg
, last
);
3047 qemu_log("%s%s", type
, get_comma(last
));
3051 print_syslog(void *cpu_env
, const struct syscallname
*name
,
3052 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3053 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3055 print_syscall_prologue(name
);
3056 print_syslog_action(arg0
, 0);
3057 print_pointer(arg1
, 0);
3058 print_raw_param("%d", arg2
, 1);
3059 print_syscall_epilogue(name
);
3063 #ifdef TARGET_NR_mknod
3065 print_mknod(void *cpu_env
, const struct syscallname
*name
,
3066 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3067 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3069 int hasdev
= (arg1
& (S_IFCHR
|S_IFBLK
));
3071 print_syscall_prologue(name
);
3072 print_string(arg0
, 0);
3073 print_file_mode(arg1
, (hasdev
== 0));
3075 print_raw_param("makedev(%d", major(arg2
), 0);
3076 print_raw_param("%d)", minor(arg2
), 1);
3078 print_syscall_epilogue(name
);
3082 #ifdef TARGET_NR_mknodat
3084 print_mknodat(void *cpu_env
, const struct syscallname
*name
,
3085 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3086 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3088 int hasdev
= (arg2
& (S_IFCHR
|S_IFBLK
));
3090 print_syscall_prologue(name
);
3091 print_at_dirfd(arg0
, 0);
3092 print_string(arg1
, 0);
3093 print_file_mode(arg2
, (hasdev
== 0));
3095 print_raw_param("makedev(%d", major(arg3
), 0);
3096 print_raw_param("%d)", minor(arg3
), 1);
3098 print_syscall_epilogue(name
);
3102 #ifdef TARGET_NR_mq_open
3104 print_mq_open(void *cpu_env
, const struct syscallname
*name
,
3105 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3106 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3108 int is_creat
= (arg1
& TARGET_O_CREAT
);
3110 print_syscall_prologue(name
);
3111 print_string(arg0
, 0);
3112 print_open_flags(arg1
, (is_creat
== 0));
3114 print_file_mode(arg2
, 0);
3115 print_pointer(arg3
, 1);
3117 print_syscall_epilogue(name
);
3121 #ifdef TARGET_NR_open
3123 print_open(void *cpu_env
, const struct syscallname
*name
,
3124 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3125 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3127 int is_creat
= (arg1
& TARGET_O_CREAT
);
3129 print_syscall_prologue(name
);
3130 print_string(arg0
, 0);
3131 print_open_flags(arg1
, (is_creat
== 0));
3133 print_file_mode(arg2
, 1);
3134 print_syscall_epilogue(name
);
3138 #ifdef TARGET_NR_openat
3140 print_openat(void *cpu_env
, const struct syscallname
*name
,
3141 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3142 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3144 int is_creat
= (arg2
& TARGET_O_CREAT
);
3146 print_syscall_prologue(name
);
3147 print_at_dirfd(arg0
, 0);
3148 print_string(arg1
, 0);
3149 print_open_flags(arg2
, (is_creat
== 0));
3151 print_file_mode(arg3
, 1);
3152 print_syscall_epilogue(name
);
3156 #ifdef TARGET_NR_mq_unlink
3158 print_mq_unlink(void *cpu_env
, const struct syscallname
*name
,
3159 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3160 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3162 print_syscall_prologue(name
);
3163 print_string(arg0
, 1);
3164 print_syscall_epilogue(name
);
3168 #if defined(TARGET_NR_fstatat64) || defined(TARGET_NR_newfstatat)
3170 print_fstatat64(void *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_at_dirfd(arg0
, 0);
3176 print_string(arg1
, 0);
3177 print_pointer(arg2
, 0);
3178 print_flags(at_file_flags
, arg3
, 1);
3179 print_syscall_epilogue(name
);
3181 #define print_newfstatat print_fstatat64
3184 #ifdef TARGET_NR_readlink
3186 print_readlink(void *cpu_env
, const struct syscallname
*name
,
3187 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3188 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3190 print_syscall_prologue(name
);
3191 print_string(arg0
, 0);
3192 print_pointer(arg1
, 0);
3193 print_raw_param("%u", arg2
, 1);
3194 print_syscall_epilogue(name
);
3198 #ifdef TARGET_NR_readlinkat
3200 print_readlinkat(void *cpu_env
, const struct syscallname
*name
,
3201 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3202 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3204 print_syscall_prologue(name
);
3205 print_at_dirfd(arg0
, 0);
3206 print_string(arg1
, 0);
3207 print_pointer(arg2
, 0);
3208 print_raw_param("%u", arg3
, 1);
3209 print_syscall_epilogue(name
);
3213 #ifdef TARGET_NR_rename
3215 print_rename(void *cpu_env
, const struct syscallname
*name
,
3216 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3217 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3219 print_syscall_prologue(name
);
3220 print_string(arg0
, 0);
3221 print_string(arg1
, 1);
3222 print_syscall_epilogue(name
);
3226 #ifdef TARGET_NR_renameat
3228 print_renameat(void *cpu_env
, const struct syscallname
*name
,
3229 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3230 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3232 print_syscall_prologue(name
);
3233 print_at_dirfd(arg0
, 0);
3234 print_string(arg1
, 0);
3235 print_at_dirfd(arg2
, 0);
3236 print_string(arg3
, 1);
3237 print_syscall_epilogue(name
);
3241 #ifdef TARGET_NR_statfs
3243 print_statfs(void *cpu_env
, const struct syscallname
*name
,
3244 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3245 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3247 print_syscall_prologue(name
);
3248 print_string(arg0
, 0);
3249 print_pointer(arg1
, 1);
3250 print_syscall_epilogue(name
);
3254 #ifdef TARGET_NR_statfs64
3256 print_statfs64(void *cpu_env
, const struct syscallname
*name
,
3257 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3258 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3260 print_syscall_prologue(name
);
3261 print_string(arg0
, 0);
3262 print_pointer(arg1
, 1);
3263 print_syscall_epilogue(name
);
3267 #ifdef TARGET_NR_symlink
3269 print_symlink(void *cpu_env
, const struct syscallname
*name
,
3270 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3271 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3273 print_syscall_prologue(name
);
3274 print_string(arg0
, 0);
3275 print_string(arg1
, 1);
3276 print_syscall_epilogue(name
);
3280 #ifdef TARGET_NR_symlinkat
3282 print_symlinkat(void *cpu_env
, const struct syscallname
*name
,
3283 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3284 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3286 print_syscall_prologue(name
);
3287 print_string(arg0
, 0);
3288 print_at_dirfd(arg1
, 0);
3289 print_string(arg2
, 1);
3290 print_syscall_epilogue(name
);
3294 #ifdef TARGET_NR_mount
3296 print_mount(void *cpu_env
, const struct syscallname
*name
,
3297 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3298 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3300 print_syscall_prologue(name
);
3301 print_string(arg0
, 0);
3302 print_string(arg1
, 0);
3303 print_string(arg2
, 0);
3304 print_flags(mount_flags
, arg3
, 0);
3305 print_pointer(arg4
, 1);
3306 print_syscall_epilogue(name
);
3310 #ifdef TARGET_NR_umount
3312 print_umount(void *cpu_env
, const struct syscallname
*name
,
3313 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3314 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3316 print_syscall_prologue(name
);
3317 print_string(arg0
, 1);
3318 print_syscall_epilogue(name
);
3322 #ifdef TARGET_NR_umount2
3324 print_umount2(void *cpu_env
, const struct syscallname
*name
,
3325 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3326 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3328 print_syscall_prologue(name
);
3329 print_string(arg0
, 0);
3330 print_flags(umount2_flags
, arg1
, 1);
3331 print_syscall_epilogue(name
);
3335 #ifdef TARGET_NR_unlink
3337 print_unlink(void *cpu_env
, const struct syscallname
*name
,
3338 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3339 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3341 print_syscall_prologue(name
);
3342 print_string(arg0
, 1);
3343 print_syscall_epilogue(name
);
3347 #ifdef TARGET_NR_unlinkat
3349 print_unlinkat(void *cpu_env
, const struct syscallname
*name
,
3350 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3351 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3353 print_syscall_prologue(name
);
3354 print_at_dirfd(arg0
, 0);
3355 print_string(arg1
, 0);
3356 print_flags(unlinkat_flags
, arg2
, 1);
3357 print_syscall_epilogue(name
);
3361 #ifdef TARGET_NR_utime
3363 print_utime(void *cpu_env
, const struct syscallname
*name
,
3364 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3365 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3367 print_syscall_prologue(name
);
3368 print_string(arg0
, 0);
3369 print_pointer(arg1
, 1);
3370 print_syscall_epilogue(name
);
3374 #ifdef TARGET_NR_utimes
3376 print_utimes(void *cpu_env
, const struct syscallname
*name
,
3377 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3378 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3380 print_syscall_prologue(name
);
3381 print_string(arg0
, 0);
3382 print_pointer(arg1
, 1);
3383 print_syscall_epilogue(name
);
3387 #ifdef TARGET_NR_utimensat
3389 print_utimensat(void *cpu_env
, const struct syscallname
*name
,
3390 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3391 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3393 print_syscall_prologue(name
);
3394 print_at_dirfd(arg0
, 0);
3395 print_string(arg1
, 0);
3396 print_pointer(arg2
, 0);
3397 print_flags(at_file_flags
, arg3
, 1);
3398 print_syscall_epilogue(name
);
3402 #if defined(TARGET_NR_mmap) || defined(TARGET_NR_mmap2)
3404 print_mmap(void *cpu_env
, const struct syscallname
*name
,
3405 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3406 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3408 print_syscall_prologue(name
);
3409 print_pointer(arg0
, 0);
3410 print_raw_param("%d", arg1
, 0);
3411 print_flags(mmap_prot_flags
, arg2
, 0);
3412 print_flags(mmap_flags
, arg3
, 0);
3413 print_raw_param("%d", arg4
, 0);
3414 print_raw_param("%#x", arg5
, 1);
3415 print_syscall_epilogue(name
);
3417 #define print_mmap2 print_mmap
3420 #ifdef TARGET_NR_mprotect
3422 print_mprotect(void *cpu_env
, const struct syscallname
*name
,
3423 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3424 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3426 print_syscall_prologue(name
);
3427 print_pointer(arg0
, 0);
3428 print_raw_param("%d", arg1
, 0);
3429 print_flags(mmap_prot_flags
, arg2
, 1);
3430 print_syscall_epilogue(name
);
3434 #ifdef TARGET_NR_munmap
3436 print_munmap(void *cpu_env
, const struct syscallname
*name
,
3437 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3438 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3440 print_syscall_prologue(name
);
3441 print_pointer(arg0
, 0);
3442 print_raw_param("%d", arg1
, 1);
3443 print_syscall_epilogue(name
);
3447 #ifdef TARGET_NR_futex
3448 static void print_futex_op(abi_long tflag
, int last
)
3450 #define print_op(val) \
3451 if( cmd == val ) { \
3456 int cmd
= (int)tflag
;
3457 #ifdef FUTEX_PRIVATE_FLAG
3458 if (cmd
& FUTEX_PRIVATE_FLAG
) {
3459 qemu_log("FUTEX_PRIVATE_FLAG|");
3460 cmd
&= ~FUTEX_PRIVATE_FLAG
;
3463 #ifdef FUTEX_CLOCK_REALTIME
3464 if (cmd
& FUTEX_CLOCK_REALTIME
) {
3465 qemu_log("FUTEX_CLOCK_REALTIME|");
3466 cmd
&= ~FUTEX_CLOCK_REALTIME
;
3469 print_op(FUTEX_WAIT
)
3470 print_op(FUTEX_WAKE
)
3472 print_op(FUTEX_REQUEUE
)
3473 print_op(FUTEX_CMP_REQUEUE
)
3474 print_op(FUTEX_WAKE_OP
)
3475 print_op(FUTEX_LOCK_PI
)
3476 print_op(FUTEX_UNLOCK_PI
)
3477 print_op(FUTEX_TRYLOCK_PI
)
3478 #ifdef FUTEX_WAIT_BITSET
3479 print_op(FUTEX_WAIT_BITSET
)
3481 #ifdef FUTEX_WAKE_BITSET
3482 print_op(FUTEX_WAKE_BITSET
)
3484 /* unknown values */
3485 qemu_log("%d", cmd
);
3489 print_futex(void *cpu_env
, const struct syscallname
*name
,
3490 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3491 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3493 print_syscall_prologue(name
);
3494 print_pointer(arg0
, 0);
3495 print_futex_op(arg1
, 0);
3496 print_raw_param(",%d", arg2
, 0);
3497 print_pointer(arg3
, 0); /* struct timespec */
3498 print_pointer(arg4
, 0);
3499 print_raw_param("%d", arg4
, 1);
3500 print_syscall_epilogue(name
);
3504 #ifdef TARGET_NR_kill
3506 print_kill(void *cpu_env
, const struct syscallname
*name
,
3507 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3508 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3510 print_syscall_prologue(name
);
3511 print_raw_param("%d", arg0
, 0);
3512 print_signal(arg1
, 1);
3513 print_syscall_epilogue(name
);
3517 #ifdef TARGET_NR_tkill
3519 print_tkill(void *cpu_env
, const struct syscallname
*name
,
3520 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3521 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3523 print_syscall_prologue(name
);
3524 print_raw_param("%d", arg0
, 0);
3525 print_signal(arg1
, 1);
3526 print_syscall_epilogue(name
);
3530 #ifdef TARGET_NR_tgkill
3532 print_tgkill(void *cpu_env
, const struct syscallname
*name
,
3533 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3534 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3536 print_syscall_prologue(name
);
3537 print_raw_param("%d", arg0
, 0);
3538 print_raw_param("%d", arg1
, 0);
3539 print_signal(arg2
, 1);
3540 print_syscall_epilogue(name
);
3544 #ifdef TARGET_NR_statx
3546 print_statx(void *cpu_env
, const struct syscallname
*name
,
3547 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3548 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3550 print_syscall_prologue(name
);
3551 print_at_dirfd(arg0
, 0);
3552 print_string(arg1
, 0);
3553 print_flags(statx_flags
, arg2
, 0);
3554 print_flags(statx_mask
, arg3
, 0);
3555 print_pointer(arg4
, 1);
3556 print_syscall_epilogue(name
);
3560 #ifdef TARGET_NR_ioctl
3562 print_ioctl(void *cpu_env
, const struct syscallname
*name
,
3563 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3564 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3566 print_syscall_prologue(name
);
3567 print_raw_param("%d", arg0
, 0);
3569 const IOCTLEntry
*ie
;
3570 const argtype
*arg_type
;
3574 for (ie
= ioctl_entries
; ie
->target_cmd
!= 0; ie
++) {
3575 if (ie
->target_cmd
== arg1
) {
3580 if (ie
->target_cmd
== 0) {
3581 print_raw_param("%#x", arg1
, 0);
3582 print_raw_param("%#x", arg2
, 1);
3584 qemu_log("%s", ie
->name
);
3585 arg_type
= ie
->arg_type
;
3587 if (arg_type
[0] != TYPE_NULL
) {
3590 switch (arg_type
[0]) {
3592 print_pointer(arg2
, 1);
3597 print_raw_param("%d", arg2
, 1);
3600 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
3603 print_raw_param(TARGET_ABI_FMT_lu
, arg2
, 1);
3606 switch (ie
->access
) {
3608 print_pointer(arg2
, 1);
3613 target_size
= thunk_type_size(arg_type
, 0);
3614 argptr
= lock_user(VERIFY_READ
, arg2
, target_size
, 1);
3616 thunk_print(argptr
, arg_type
);
3617 unlock_user(argptr
, arg2
, target_size
);
3619 print_pointer(arg2
, 1);
3625 g_assert_not_reached();
3629 print_syscall_epilogue(name
);
3634 * An array of all of the syscalls we know about
3637 static const struct syscallname scnames
[] = {
3638 #include "strace.list"
3641 static int nsyscalls
= ARRAY_SIZE(scnames
);
3644 * The public interface to this module.
3647 print_syscall(void *cpu_env
, int num
,
3648 abi_long arg1
, abi_long arg2
, abi_long arg3
,
3649 abi_long arg4
, abi_long arg5
, abi_long arg6
)
3652 const char *format
="%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
")";
3654 qemu_log("%d ", getpid());
3656 for(i
=0;i
<nsyscalls
;i
++)
3657 if( scnames
[i
].nr
== num
) {
3658 if( scnames
[i
].call
!= NULL
) {
3660 cpu_env
, &scnames
[i
], arg1
, arg2
, arg3
, arg4
, arg5
, arg6
);
3662 /* XXX: this format system is broken because it uses
3663 host types and host pointers for strings */
3664 if( scnames
[i
].format
!= NULL
)
3665 format
= scnames
[i
].format
;
3667 scnames
[i
].name
, arg1
, arg2
, arg3
, arg4
, arg5
, arg6
);
3671 qemu_log("Unknown syscall %d\n", num
);
3676 print_syscall_ret(void *cpu_env
, int num
, abi_long ret
,
3677 abi_long arg1
, abi_long arg2
, abi_long arg3
,
3678 abi_long arg4
, abi_long arg5
, abi_long arg6
)
3682 for(i
=0;i
<nsyscalls
;i
++)
3683 if( scnames
[i
].nr
== num
) {
3684 if( scnames
[i
].result
!= NULL
) {
3685 scnames
[i
].result(cpu_env
, &scnames
[i
], ret
,
3689 if (!print_syscall_err(ret
)) {
3690 qemu_log(TARGET_ABI_FMT_ld
, ret
);
3698 void print_taken_signal(int target_signum
, const target_siginfo_t
*tinfo
)
3700 /* Print the strace output for a signal being taken:
3701 * --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
3704 print_signal(target_signum
, 1);
3706 print_siginfo(tinfo
);