1 #include "qemu/osdep.h"
6 #include <sys/select.h>
9 #include <netinet/tcp.h>
10 #include <linux/if_packet.h>
20 void (*call
)(const struct syscallname
*,
21 abi_long
, abi_long
, abi_long
,
22 abi_long
, abi_long
, abi_long
);
23 void (*result
)(const struct syscallname
*, abi_long
);
28 * It is possible that target doesn't have syscall that uses
29 * following flags but we don't want the compiler to warn
30 * us about them being unused. Same applies to utility print
31 * functions. It is ok to keep them while not used.
33 #define UNUSED __attribute__ ((unused))
39 * Structure used to translate flag values into strings. This is
40 * similar that is in the actual strace tool.
43 abi_long f_value
; /* flag */
44 const char *f_string
; /* stringified flag */
47 /* common flags for all architectures */
48 #define FLAG_GENERIC(name) { name, #name }
49 /* target specific flags (syscall_defs.h has TARGET_<flag>) */
50 #define FLAG_TARGET(name) { TARGET_ ## name, #name }
51 /* end of flags array */
52 #define FLAG_END { 0, NULL }
54 UNUSED
static const char *get_comma(int);
55 UNUSED
static void print_pointer(abi_long
, int);
56 UNUSED
static void print_flags(const struct flags
*, abi_long
, int);
57 UNUSED
static void print_at_dirfd(abi_long
, int);
58 UNUSED
static void print_file_mode(abi_long
, int);
59 UNUSED
static void print_open_flags(abi_long
, int);
60 UNUSED
static void print_syscall_prologue(const struct syscallname
*);
61 UNUSED
static void print_syscall_epilogue(const struct syscallname
*);
62 UNUSED
static void print_string(abi_long
, int);
63 UNUSED
static void print_buf(abi_long addr
, abi_long len
, int last
);
64 UNUSED
static void print_raw_param(const char *, abi_long
, int);
65 UNUSED
static void print_timeval(abi_ulong
, int);
66 UNUSED
static void print_number(abi_long
, int);
67 UNUSED
static void print_signal(abi_ulong
, int);
68 UNUSED
static void print_sockaddr(abi_ulong addr
, abi_long addrlen
);
69 UNUSED
static void print_socket_domain(int domain
);
70 UNUSED
static void print_socket_type(int type
);
71 UNUSED
static void print_socket_protocol(int domain
, int type
, int protocol
);
77 print_ipc_cmd(int cmd
)
79 #define output_cmd(val) \
87 /* General IPC commands */
88 output_cmd( IPC_RMID
);
89 output_cmd( IPC_SET
);
90 output_cmd( IPC_STAT
);
91 output_cmd( IPC_INFO
);
92 /* msgctl() commands */
94 output_cmd( MSG_STAT
);
95 output_cmd( MSG_INFO
);
97 /* shmctl() commands */
98 output_cmd( SHM_LOCK
);
99 output_cmd( SHM_UNLOCK
);
100 output_cmd( SHM_STAT
);
101 output_cmd( SHM_INFO
);
102 /* semctl() commands */
103 output_cmd( GETPID
);
104 output_cmd( GETVAL
);
105 output_cmd( GETALL
);
106 output_cmd( GETNCNT
);
107 output_cmd( GETZCNT
);
108 output_cmd( SETVAL
);
109 output_cmd( SETALL
);
110 output_cmd( SEM_STAT
);
111 output_cmd( SEM_INFO
);
112 output_cmd( IPC_RMID
);
113 output_cmd( IPC_RMID
);
114 output_cmd( IPC_RMID
);
115 output_cmd( IPC_RMID
);
116 output_cmd( IPC_RMID
);
117 output_cmd( IPC_RMID
);
118 output_cmd( IPC_RMID
);
119 output_cmd( IPC_RMID
);
120 output_cmd( IPC_RMID
);
122 /* Some value we don't recognize */
127 print_signal(abi_ulong arg
, int last
)
129 const char *signal_name
= NULL
;
131 case TARGET_SIGHUP
: signal_name
= "SIGHUP"; break;
132 case TARGET_SIGINT
: signal_name
= "SIGINT"; break;
133 case TARGET_SIGQUIT
: signal_name
= "SIGQUIT"; break;
134 case TARGET_SIGILL
: signal_name
= "SIGILL"; break;
135 case TARGET_SIGABRT
: signal_name
= "SIGABRT"; break;
136 case TARGET_SIGFPE
: signal_name
= "SIGFPE"; break;
137 case TARGET_SIGKILL
: signal_name
= "SIGKILL"; break;
138 case TARGET_SIGSEGV
: signal_name
= "SIGSEGV"; break;
139 case TARGET_SIGPIPE
: signal_name
= "SIGPIPE"; break;
140 case TARGET_SIGALRM
: signal_name
= "SIGALRM"; break;
141 case TARGET_SIGTERM
: signal_name
= "SIGTERM"; break;
142 case TARGET_SIGUSR1
: signal_name
= "SIGUSR1"; break;
143 case TARGET_SIGUSR2
: signal_name
= "SIGUSR2"; break;
144 case TARGET_SIGCHLD
: signal_name
= "SIGCHLD"; break;
145 case TARGET_SIGCONT
: signal_name
= "SIGCONT"; break;
146 case TARGET_SIGSTOP
: signal_name
= "SIGSTOP"; break;
147 case TARGET_SIGTTIN
: signal_name
= "SIGTTIN"; break;
148 case TARGET_SIGTTOU
: signal_name
= "SIGTTOU"; break;
150 if (signal_name
== NULL
) {
151 print_raw_param("%ld", arg
, last
);
154 gemu_log("%s%s", signal_name
, get_comma(last
));
157 static void print_si_code(int arg
)
159 const char *codename
= NULL
;
163 codename
= "SI_USER";
166 codename
= "SI_KERNEL";
169 codename
= "SI_QUEUE";
172 codename
= "SI_TIMER";
175 codename
= "SI_MESGQ";
178 codename
= "SI_ASYNCIO";
181 codename
= "SI_SIGIO";
184 codename
= "SI_TKILL";
190 gemu_log("%s", codename
);
193 static void print_siginfo(const target_siginfo_t
*tinfo
)
195 /* Print a target_siginfo_t in the format desired for printing
196 * signals being taken. We assume the target_siginfo_t is in the
197 * internal form where the top 16 bits of si_code indicate which
198 * part of the union is valid, rather than in the guest-visible
199 * form where the bottom 16 bits are sign-extended into the top 16.
201 int si_type
= extract32(tinfo
->si_code
, 16, 16);
202 int si_code
= sextract32(tinfo
->si_code
, 0, 16);
204 gemu_log("{si_signo=");
205 print_signal(tinfo
->si_signo
, 1);
206 gemu_log(", si_code=");
207 print_si_code(si_code
);
211 gemu_log(", si_pid = %u, si_uid = %u",
212 (unsigned int)tinfo
->_sifields
._kill
._pid
,
213 (unsigned int)tinfo
->_sifields
._kill
._uid
);
216 gemu_log(", si_timer1 = %u, si_timer2 = %u",
217 tinfo
->_sifields
._timer
._timer1
,
218 tinfo
->_sifields
._timer
._timer2
);
221 gemu_log(", si_band = %d, si_fd = %d",
222 tinfo
->_sifields
._sigpoll
._band
,
223 tinfo
->_sifields
._sigpoll
._fd
);
226 gemu_log(", si_addr = ");
227 print_pointer(tinfo
->_sifields
._sigfault
._addr
, 1);
230 gemu_log(", si_pid = %u, si_uid = %u, si_status = %d"
231 ", si_utime=" TARGET_ABI_FMT_ld
232 ", si_stime=" TARGET_ABI_FMT_ld
,
233 (unsigned int)(tinfo
->_sifields
._sigchld
._pid
),
234 (unsigned int)(tinfo
->_sifields
._sigchld
._uid
),
235 tinfo
->_sifields
._sigchld
._status
,
236 tinfo
->_sifields
._sigchld
._utime
,
237 tinfo
->_sifields
._sigchld
._stime
);
240 gemu_log(", si_pid = %u, si_uid = %u, si_sigval = " TARGET_ABI_FMT_ld
,
241 (unsigned int)tinfo
->_sifields
._rt
._pid
,
242 (unsigned int)tinfo
->_sifields
._rt
._uid
,
243 tinfo
->_sifields
._rt
._sigval
.sival_ptr
);
246 g_assert_not_reached();
252 print_sockaddr(abi_ulong addr
, abi_long addrlen
)
254 struct target_sockaddr
*sa
;
258 sa
= lock_user(VERIFY_READ
, addr
, addrlen
, 1);
260 sa_family
= tswap16(sa
->sa_family
);
263 struct target_sockaddr_un
*un
= (struct target_sockaddr_un
*)sa
;
265 gemu_log("{sun_family=AF_UNIX,sun_path=\"");
266 for (i
= 0; i
< addrlen
-
267 offsetof(struct target_sockaddr_un
, sun_path
) &&
268 un
->sun_path
[i
]; i
++) {
269 gemu_log("%c", un
->sun_path
[i
]);
275 struct target_sockaddr_in
*in
= (struct target_sockaddr_in
*)sa
;
276 uint8_t *c
= (uint8_t *)&in
->sin_addr
.s_addr
;
277 gemu_log("{sin_family=AF_INET,sin_port=htons(%d),",
278 ntohs(in
->sin_port
));
279 gemu_log("sin_addr=inet_addr(\"%d.%d.%d.%d\")",
280 c
[0], c
[1], c
[2], c
[3]);
285 struct target_sockaddr_ll
*ll
= (struct target_sockaddr_ll
*)sa
;
286 uint8_t *c
= (uint8_t *)&ll
->sll_addr
;
287 gemu_log("{sll_family=AF_PACKET,"
288 "sll_protocol=htons(0x%04x),if%d,pkttype=",
289 ntohs(ll
->sll_protocol
), ll
->sll_ifindex
);
290 switch (ll
->sll_pkttype
) {
292 gemu_log("PACKET_HOST");
294 case PACKET_BROADCAST
:
295 gemu_log("PACKET_BROADCAST");
297 case PACKET_MULTICAST
:
298 gemu_log("PACKET_MULTICAST");
300 case PACKET_OTHERHOST
:
301 gemu_log("PACKET_OTHERHOST");
303 case PACKET_OUTGOING
:
304 gemu_log("PACKET_OUTGOING");
307 gemu_log("%d", ll
->sll_pkttype
);
310 gemu_log(",sll_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
311 c
[0], c
[1], c
[2], c
[3], c
[4], c
[5], c
[6], c
[7]);
316 gemu_log("{sa_family=%d, sa_data={", sa
->sa_family
);
317 for (i
= 0; i
< 13; i
++) {
318 gemu_log("%02x, ", sa
->sa_data
[i
]);
320 gemu_log("%02x}", sa
->sa_data
[i
]);
324 unlock_user(sa
, addr
, 0);
326 print_raw_param("0x"TARGET_ABI_FMT_lx
, addr
, 0);
328 gemu_log(", "TARGET_ABI_FMT_ld
, addrlen
);
332 print_socket_domain(int domain
)
342 gemu_log("PF_PACKET");
345 gemu_log("%d", domain
);
351 print_socket_type(int type
)
354 case TARGET_SOCK_DGRAM
:
355 gemu_log("SOCK_DGRAM");
357 case TARGET_SOCK_STREAM
:
358 gemu_log("SOCK_STREAM");
360 case TARGET_SOCK_RAW
:
361 gemu_log("SOCK_RAW");
363 case TARGET_SOCK_RDM
:
364 gemu_log("SOCK_RDM");
366 case TARGET_SOCK_SEQPACKET
:
367 gemu_log("SOCK_SEQPACKET");
369 case TARGET_SOCK_PACKET
:
370 gemu_log("SOCK_PACKET");
376 print_socket_protocol(int domain
, int type
, int protocol
)
378 if (domain
== AF_PACKET
||
379 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
382 gemu_log("ETH_P_ALL");
385 gemu_log("%d", protocol
);
392 gemu_log("IPPROTO_IP");
395 gemu_log("IPPROTO_TCP");
398 gemu_log("IPPROTO_UDP");
401 gemu_log("IPPROTO_RAW");
404 gemu_log("%d", protocol
);
410 #ifdef TARGET_NR__newselect
412 print_fdset(int n
, abi_ulong target_fds_addr
)
417 if( target_fds_addr
) {
418 abi_long
*target_fds
;
420 target_fds
= lock_user(VERIFY_READ
,
422 sizeof(*target_fds
)*(n
/ TARGET_ABI_BITS
+ 1),
428 for (i
=n
; i
>=0; i
--) {
429 if ((tswapal(target_fds
[i
/ TARGET_ABI_BITS
]) >> (i
& (TARGET_ABI_BITS
- 1))) & 1)
432 unlock_user(target_fds
, target_fds_addr
, 0);
439 * Sysycall specific output functions
443 #ifdef TARGET_NR__newselect
444 static long newselect_arg1
= 0;
445 static long newselect_arg2
= 0;
446 static long newselect_arg3
= 0;
447 static long newselect_arg4
= 0;
448 static long newselect_arg5
= 0;
451 print_newselect(const struct syscallname
*name
,
452 abi_long arg1
, abi_long arg2
, abi_long arg3
,
453 abi_long arg4
, abi_long arg5
, abi_long arg6
)
455 gemu_log("%s(" TARGET_ABI_FMT_ld
",", name
->name
, arg1
);
456 print_fdset(arg1
, arg2
);
458 print_fdset(arg1
, arg3
);
460 print_fdset(arg1
, arg4
);
462 print_timeval(arg5
, 1);
465 /* save for use in the return output function below */
474 #ifdef TARGET_NR_semctl
476 print_semctl(const struct syscallname
*name
,
477 abi_long arg1
, abi_long arg2
, abi_long arg3
,
478 abi_long arg4
, abi_long arg5
, abi_long arg6
)
480 gemu_log("%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",", name
->name
, arg1
, arg2
);
482 gemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
487 print_execve(const struct syscallname
*name
,
488 abi_long arg1
, abi_long arg2
, abi_long arg3
,
489 abi_long arg4
, abi_long arg5
, abi_long arg6
)
491 abi_ulong arg_ptr_addr
;
494 if (!(s
= lock_user_string(arg1
)))
496 gemu_log("%s(\"%s\",{", name
->name
, s
);
497 unlock_user(s
, arg1
, 0);
499 for (arg_ptr_addr
= arg2
; ; arg_ptr_addr
+= sizeof(abi_ulong
)) {
500 abi_ulong
*arg_ptr
, arg_addr
;
502 arg_ptr
= lock_user(VERIFY_READ
, arg_ptr_addr
, sizeof(abi_ulong
), 1);
505 arg_addr
= tswapal(*arg_ptr
);
506 unlock_user(arg_ptr
, arg_ptr_addr
, 0);
509 if ((s
= lock_user_string(arg_addr
))) {
510 gemu_log("\"%s\",", s
);
511 unlock_user(s
, arg_addr
, 0);
520 print_ipc(const struct syscallname
*name
,
521 abi_long arg1
, abi_long arg2
, abi_long arg3
,
522 abi_long arg4
, abi_long arg5
, abi_long arg6
)
526 gemu_log("semctl(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",", arg1
, arg2
);
528 gemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
531 gemu_log("%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
")",
532 name
->name
, arg1
, arg2
, arg3
, arg4
);
538 * Variants for the return value output function
542 print_syscall_ret_addr(const struct syscallname
*name
, abi_long ret
)
544 const char *errstr
= NULL
;
547 errstr
= target_strerror(-ret
);
550 gemu_log(" = -1 errno=%d (%s)\n", (int)-ret
, errstr
);
552 gemu_log(" = 0x" TARGET_ABI_FMT_lx
"\n", ret
);
556 #if 0 /* currently unused */
558 print_syscall_ret_raw(struct syscallname
*name
, abi_long ret
)
560 gemu_log(" = 0x" TARGET_ABI_FMT_lx
"\n", ret
);
564 #ifdef TARGET_NR__newselect
566 print_syscall_ret_newselect(const struct syscallname
*name
, abi_long ret
)
568 gemu_log(" = 0x" TARGET_ABI_FMT_lx
" (", ret
);
569 print_fdset(newselect_arg1
,newselect_arg2
);
571 print_fdset(newselect_arg1
,newselect_arg3
);
573 print_fdset(newselect_arg1
,newselect_arg4
);
575 print_timeval(newselect_arg5
, 1);
580 UNUSED
static struct flags access_flags
[] = {
588 UNUSED
static struct flags at_file_flags
[] = {
590 FLAG_GENERIC(AT_EACCESS
),
592 #ifdef AT_SYMLINK_NOFOLLOW
593 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
598 UNUSED
static struct flags unlinkat_flags
[] = {
600 FLAG_GENERIC(AT_REMOVEDIR
),
605 UNUSED
static struct flags mode_flags
[] = {
606 FLAG_GENERIC(S_IFSOCK
),
607 FLAG_GENERIC(S_IFLNK
),
608 FLAG_GENERIC(S_IFREG
),
609 FLAG_GENERIC(S_IFBLK
),
610 FLAG_GENERIC(S_IFDIR
),
611 FLAG_GENERIC(S_IFCHR
),
612 FLAG_GENERIC(S_IFIFO
),
616 UNUSED
static struct flags open_access_flags
[] = {
617 FLAG_TARGET(O_RDONLY
),
618 FLAG_TARGET(O_WRONLY
),
623 UNUSED
static struct flags open_flags
[] = {
624 FLAG_TARGET(O_APPEND
),
625 FLAG_TARGET(O_CREAT
),
626 FLAG_TARGET(O_DIRECTORY
),
628 FLAG_TARGET(O_LARGEFILE
),
629 FLAG_TARGET(O_NOCTTY
),
630 FLAG_TARGET(O_NOFOLLOW
),
631 FLAG_TARGET(O_NONBLOCK
), /* also O_NDELAY */
632 FLAG_TARGET(O_DSYNC
),
633 FLAG_TARGET(__O_SYNC
),
634 FLAG_TARGET(O_TRUNC
),
636 FLAG_TARGET(O_DIRECT
),
639 FLAG_TARGET(O_NOATIME
),
642 FLAG_TARGET(O_CLOEXEC
),
650 UNUSED
static struct flags mount_flags
[] = {
652 FLAG_GENERIC(MS_BIND
),
655 FLAG_GENERIC(MS_DIRSYNC
),
657 FLAG_GENERIC(MS_MANDLOCK
),
659 FLAG_GENERIC(MS_MOVE
),
661 FLAG_GENERIC(MS_NOATIME
),
662 FLAG_GENERIC(MS_NODEV
),
663 FLAG_GENERIC(MS_NODIRATIME
),
664 FLAG_GENERIC(MS_NOEXEC
),
665 FLAG_GENERIC(MS_NOSUID
),
666 FLAG_GENERIC(MS_RDONLY
),
668 FLAG_GENERIC(MS_RELATIME
),
670 FLAG_GENERIC(MS_REMOUNT
),
671 FLAG_GENERIC(MS_SYNCHRONOUS
),
675 UNUSED
static struct flags umount2_flags
[] = {
677 FLAG_GENERIC(MNT_FORCE
),
680 FLAG_GENERIC(MNT_DETACH
),
683 FLAG_GENERIC(MNT_EXPIRE
),
688 UNUSED
static struct flags mmap_prot_flags
[] = {
689 FLAG_GENERIC(PROT_NONE
),
690 FLAG_GENERIC(PROT_EXEC
),
691 FLAG_GENERIC(PROT_READ
),
692 FLAG_GENERIC(PROT_WRITE
),
693 FLAG_TARGET(PROT_SEM
),
694 FLAG_GENERIC(PROT_GROWSDOWN
),
695 FLAG_GENERIC(PROT_GROWSUP
),
699 UNUSED
static struct flags mmap_flags
[] = {
700 FLAG_TARGET(MAP_SHARED
),
701 FLAG_TARGET(MAP_PRIVATE
),
702 FLAG_TARGET(MAP_ANONYMOUS
),
703 FLAG_TARGET(MAP_DENYWRITE
),
704 FLAG_TARGET(MAP_FIXED
),
705 FLAG_TARGET(MAP_GROWSDOWN
),
706 FLAG_TARGET(MAP_EXECUTABLE
),
708 FLAG_TARGET(MAP_LOCKED
),
711 FLAG_TARGET(MAP_NONBLOCK
),
713 FLAG_TARGET(MAP_NORESERVE
),
715 FLAG_TARGET(MAP_POPULATE
),
717 #ifdef TARGET_MAP_UNINITIALIZED
718 FLAG_TARGET(MAP_UNINITIALIZED
),
723 UNUSED
static struct flags clone_flags
[] = {
724 FLAG_GENERIC(CLONE_VM
),
725 FLAG_GENERIC(CLONE_FS
),
726 FLAG_GENERIC(CLONE_FILES
),
727 FLAG_GENERIC(CLONE_SIGHAND
),
728 FLAG_GENERIC(CLONE_PTRACE
),
729 FLAG_GENERIC(CLONE_VFORK
),
730 FLAG_GENERIC(CLONE_PARENT
),
731 FLAG_GENERIC(CLONE_THREAD
),
732 FLAG_GENERIC(CLONE_NEWNS
),
733 FLAG_GENERIC(CLONE_SYSVSEM
),
734 FLAG_GENERIC(CLONE_SETTLS
),
735 FLAG_GENERIC(CLONE_PARENT_SETTID
),
736 FLAG_GENERIC(CLONE_CHILD_CLEARTID
),
737 FLAG_GENERIC(CLONE_DETACHED
),
738 FLAG_GENERIC(CLONE_UNTRACED
),
739 FLAG_GENERIC(CLONE_CHILD_SETTID
),
740 #if defined(CLONE_NEWUTS)
741 FLAG_GENERIC(CLONE_NEWUTS
),
743 #if defined(CLONE_NEWIPC)
744 FLAG_GENERIC(CLONE_NEWIPC
),
746 #if defined(CLONE_NEWUSER)
747 FLAG_GENERIC(CLONE_NEWUSER
),
749 #if defined(CLONE_NEWPID)
750 FLAG_GENERIC(CLONE_NEWPID
),
752 #if defined(CLONE_NEWNET)
753 FLAG_GENERIC(CLONE_NEWNET
),
755 #if defined(CLONE_IO)
756 FLAG_GENERIC(CLONE_IO
),
761 UNUSED
static struct flags msg_flags
[] = {
763 FLAG_GENERIC(MSG_CONFIRM
),
764 FLAG_GENERIC(MSG_DONTROUTE
),
765 FLAG_GENERIC(MSG_DONTWAIT
),
766 FLAG_GENERIC(MSG_EOR
),
767 FLAG_GENERIC(MSG_MORE
),
768 FLAG_GENERIC(MSG_NOSIGNAL
),
769 FLAG_GENERIC(MSG_OOB
),
771 FLAG_GENERIC(MSG_CMSG_CLOEXEC
),
772 FLAG_GENERIC(MSG_ERRQUEUE
),
773 FLAG_GENERIC(MSG_PEEK
),
774 FLAG_GENERIC(MSG_TRUNC
),
775 FLAG_GENERIC(MSG_WAITALL
),
777 FLAG_GENERIC(MSG_CTRUNC
),
782 * print_xxx utility functions. These are used to print syscall
783 * parameters in certain format. All of these have parameter
784 * named 'last'. This parameter is used to add comma to output
791 return ((last
) ? "" : ",");
795 print_flags(const struct flags
*f
, abi_long flags
, int last
)
797 const char *sep
= "";
800 if ((flags
== 0) && (f
->f_value
== 0)) {
801 gemu_log("%s%s", f
->f_string
, get_comma(last
));
804 for (n
= 0; f
->f_string
!= NULL
; f
++) {
805 if ((f
->f_value
!= 0) && ((flags
& f
->f_value
) == f
->f_value
)) {
806 gemu_log("%s%s", sep
, f
->f_string
);
807 flags
&= ~f
->f_value
;
814 /* print rest of the flags as numeric */
816 gemu_log("%s%#x%s", sep
, (unsigned int)flags
, get_comma(last
));
818 gemu_log("%s", get_comma(last
));
821 /* no string version of flags found, print them in hex then */
822 gemu_log("%#x%s", (unsigned int)flags
, get_comma(last
));
827 print_at_dirfd(abi_long dirfd
, int last
)
830 if (dirfd
== AT_FDCWD
) {
831 gemu_log("AT_FDCWD%s", get_comma(last
));
835 gemu_log("%d%s", (int)dirfd
, get_comma(last
));
839 print_file_mode(abi_long mode
, int last
)
841 const char *sep
= "";
842 const struct flags
*m
;
844 for (m
= &mode_flags
[0]; m
->f_string
!= NULL
; m
++) {
845 if ((m
->f_value
& mode
) == m
->f_value
) {
846 gemu_log("%s%s", m
->f_string
, sep
);
854 /* print rest of the mode as octal */
856 gemu_log("%s%#o", sep
, (unsigned int)mode
);
858 gemu_log("%s", get_comma(last
));
862 print_open_flags(abi_long flags
, int last
)
864 print_flags(open_access_flags
, flags
& TARGET_O_ACCMODE
, 1);
865 flags
&= ~TARGET_O_ACCMODE
;
867 gemu_log("%s", get_comma(last
));
871 print_flags(open_flags
, flags
, last
);
875 print_syscall_prologue(const struct syscallname
*sc
)
877 gemu_log("%s(", sc
->name
);
882 print_syscall_epilogue(const struct syscallname
*sc
)
889 print_string(abi_long addr
, int last
)
893 if ((s
= lock_user_string(addr
)) != NULL
) {
894 gemu_log("\"%s\"%s", s
, get_comma(last
));
895 unlock_user(s
, addr
, 0);
897 /* can't get string out of it, so print it as pointer */
898 print_pointer(addr
, last
);
902 #define MAX_PRINT_BUF 40
904 print_buf(abi_long addr
, abi_long len
, int last
)
909 s
= lock_user(VERIFY_READ
, addr
, len
, 1);
912 for (i
= 0; i
< MAX_PRINT_BUF
&& i
< len
; i
++) {
914 gemu_log("%c", s
[i
]);
916 gemu_log("\\%o", s
[i
]);
926 unlock_user(s
, addr
, 0);
928 print_pointer(addr
, last
);
933 * Prints out raw parameter using given format. Caller needs
934 * to do byte swapping if needed.
937 print_raw_param(const char *fmt
, abi_long param
, int last
)
941 (void) snprintf(format
, sizeof (format
), "%s%s", fmt
, get_comma(last
));
942 gemu_log(format
, param
);
946 print_pointer(abi_long p
, int last
)
949 gemu_log("NULL%s", get_comma(last
));
951 gemu_log("0x" TARGET_ABI_FMT_lx
"%s", p
, get_comma(last
));
955 * Reads 32-bit (int) number from guest address space from
956 * address 'addr' and prints it.
959 print_number(abi_long addr
, int last
)
962 gemu_log("NULL%s", get_comma(last
));
966 get_user_s32(num
, addr
);
967 gemu_log("[%d]%s", num
, get_comma(last
));
972 print_timeval(abi_ulong tv_addr
, int last
)
975 struct target_timeval
*tv
;
977 tv
= lock_user(VERIFY_READ
, tv_addr
, sizeof(*tv
), 1);
980 gemu_log("{" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"}%s",
981 tswapal(tv
->tv_sec
), tswapal(tv
->tv_usec
), get_comma(last
));
982 unlock_user(tv
, tv_addr
, 0);
984 gemu_log("NULL%s", get_comma(last
));
989 #ifdef TARGET_NR_accept
991 print_accept(const struct syscallname
*name
,
992 abi_long arg0
, abi_long arg1
, abi_long arg2
,
993 abi_long arg3
, abi_long arg4
, abi_long arg5
)
995 print_syscall_prologue(name
);
996 print_raw_param("%d", arg0
, 0);
997 print_pointer(arg1
, 0);
998 print_number(arg2
, 1);
999 print_syscall_epilogue(name
);
1003 #ifdef TARGET_NR_access
1005 print_access(const struct syscallname
*name
,
1006 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1007 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1009 print_syscall_prologue(name
);
1010 print_string(arg0
, 0);
1011 print_flags(access_flags
, arg1
, 1);
1012 print_syscall_epilogue(name
);
1016 #ifdef TARGET_NR_brk
1018 print_brk(const struct syscallname
*name
,
1019 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1020 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1022 print_syscall_prologue(name
);
1023 print_pointer(arg0
, 1);
1024 print_syscall_epilogue(name
);
1028 #ifdef TARGET_NR_chdir
1030 print_chdir(const struct syscallname
*name
,
1031 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1032 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1034 print_syscall_prologue(name
);
1035 print_string(arg0
, 1);
1036 print_syscall_epilogue(name
);
1040 #ifdef TARGET_NR_chmod
1042 print_chmod(const struct syscallname
*name
,
1043 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1044 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1046 print_syscall_prologue(name
);
1047 print_string(arg0
, 0);
1048 print_file_mode(arg1
, 1);
1049 print_syscall_epilogue(name
);
1053 #ifdef TARGET_NR_clone
1054 static void do_print_clone(unsigned int flags
, abi_ulong newsp
,
1055 abi_ulong parent_tidptr
, target_ulong newtls
,
1056 abi_ulong child_tidptr
)
1058 print_flags(clone_flags
, flags
, 0);
1059 print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx
, newsp
, 0);
1060 print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx
, parent_tidptr
, 0);
1061 print_raw_param("tls=0x" TARGET_ABI_FMT_lx
, newtls
, 0);
1062 print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx
, child_tidptr
, 1);
1066 print_clone(const struct syscallname
*name
,
1067 abi_long arg1
, abi_long arg2
, abi_long arg3
,
1068 abi_long arg4
, abi_long arg5
, abi_long arg6
)
1070 print_syscall_prologue(name
);
1071 #if defined(TARGET_MICROBLAZE)
1072 do_print_clone(arg1
, arg2
, arg4
, arg6
, arg5
);
1073 #elif defined(TARGET_CLONE_BACKWARDS)
1074 do_print_clone(arg1
, arg2
, arg3
, arg4
, arg5
);
1075 #elif defined(TARGET_CLONE_BACKWARDS2)
1076 do_print_clone(arg2
, arg1
, arg3
, arg5
, arg4
);
1078 do_print_clone(arg1
, arg2
, arg3
, arg5
, arg4
);
1080 print_syscall_epilogue(name
);
1084 #ifdef TARGET_NR_creat
1086 print_creat(const struct syscallname
*name
,
1087 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1088 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1090 print_syscall_prologue(name
);
1091 print_string(arg0
, 0);
1092 print_file_mode(arg1
, 1);
1093 print_syscall_epilogue(name
);
1097 #ifdef TARGET_NR_execv
1099 print_execv(const struct syscallname
*name
,
1100 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1101 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1103 print_syscall_prologue(name
);
1104 print_string(arg0
, 0);
1105 print_raw_param("0x" TARGET_ABI_FMT_lx
, arg1
, 1);
1106 print_syscall_epilogue(name
);
1110 #ifdef TARGET_NR_faccessat
1112 print_faccessat(const struct syscallname
*name
,
1113 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1114 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1116 print_syscall_prologue(name
);
1117 print_at_dirfd(arg0
, 0);
1118 print_string(arg1
, 0);
1119 print_flags(access_flags
, arg2
, 0);
1120 print_flags(at_file_flags
, arg3
, 1);
1121 print_syscall_epilogue(name
);
1125 #ifdef TARGET_NR_fchmodat
1127 print_fchmodat(const struct syscallname
*name
,
1128 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1129 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1131 print_syscall_prologue(name
);
1132 print_at_dirfd(arg0
, 0);
1133 print_string(arg1
, 0);
1134 print_file_mode(arg2
, 0);
1135 print_flags(at_file_flags
, arg3
, 1);
1136 print_syscall_epilogue(name
);
1140 #ifdef TARGET_NR_fchownat
1142 print_fchownat(const struct syscallname
*name
,
1143 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1144 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1146 print_syscall_prologue(name
);
1147 print_at_dirfd(arg0
, 0);
1148 print_string(arg1
, 0);
1149 print_raw_param("%d", arg2
, 0);
1150 print_raw_param("%d", arg3
, 0);
1151 print_flags(at_file_flags
, arg4
, 1);
1152 print_syscall_epilogue(name
);
1156 #if defined(TARGET_NR_fcntl) || defined(TARGET_NR_fcntl64)
1158 print_fcntl(const struct syscallname
*name
,
1159 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1160 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1162 print_syscall_prologue(name
);
1163 print_raw_param("%d", arg0
, 0);
1165 case TARGET_F_DUPFD
:
1166 gemu_log("F_DUPFD,");
1167 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
1169 case TARGET_F_GETFD
:
1170 gemu_log("F_GETFD");
1172 case TARGET_F_SETFD
:
1173 gemu_log("F_SETFD,");
1174 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
1176 case TARGET_F_GETFL
:
1177 gemu_log("F_GETFL");
1179 case TARGET_F_SETFL
:
1180 gemu_log("F_SETFL,");
1181 print_open_flags(arg2
, 1);
1183 case TARGET_F_GETLK
:
1184 gemu_log("F_GETLK,");
1185 print_pointer(arg2
, 1);
1187 case TARGET_F_SETLK
:
1188 gemu_log("F_SETLK,");
1189 print_pointer(arg2
, 1);
1191 case TARGET_F_SETLKW
:
1192 gemu_log("F_SETLKW,");
1193 print_pointer(arg2
, 1);
1195 case TARGET_F_GETOWN
:
1196 gemu_log("F_GETOWN");
1198 case TARGET_F_SETOWN
:
1199 gemu_log("F_SETOWN,");
1200 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
1202 case TARGET_F_GETSIG
:
1203 gemu_log("F_GETSIG");
1205 case TARGET_F_SETSIG
:
1206 gemu_log("F_SETSIG,");
1207 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
1209 #if TARGET_ABI_BITS == 32
1210 case TARGET_F_GETLK64
:
1211 gemu_log("F_GETLK64,");
1212 print_pointer(arg2
, 1);
1214 case TARGET_F_SETLK64
:
1215 gemu_log("F_SETLK64,");
1216 print_pointer(arg2
, 1);
1218 case TARGET_F_SETLKW64
:
1219 gemu_log("F_SETLKW64,");
1220 print_pointer(arg2
, 1);
1223 case TARGET_F_SETLEASE
:
1224 gemu_log("F_SETLEASE,");
1225 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
1227 case TARGET_F_GETLEASE
:
1228 gemu_log("F_GETLEASE");
1230 case TARGET_F_SETPIPE_SZ
:
1231 gemu_log("F_SETPIPE_SZ,");
1232 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
1234 case TARGET_F_GETPIPE_SZ
:
1235 gemu_log("F_GETPIPE_SZ");
1237 case TARGET_F_DUPFD_CLOEXEC
:
1238 gemu_log("F_DUPFD_CLOEXEC,");
1239 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
1241 case TARGET_F_NOTIFY
:
1242 gemu_log("F_NOTIFY,");
1243 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
1246 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
1247 print_pointer(arg2
, 1);
1250 print_syscall_epilogue(name
);
1252 #define print_fcntl64 print_fcntl
1256 #ifdef TARGET_NR_futimesat
1258 print_futimesat(const struct syscallname
*name
,
1259 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1260 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1262 print_syscall_prologue(name
);
1263 print_at_dirfd(arg0
, 0);
1264 print_string(arg1
, 0);
1265 print_timeval(arg2
, 0);
1266 print_timeval(arg2
+ sizeof (struct target_timeval
), 1);
1267 print_syscall_epilogue(name
);
1271 #ifdef TARGET_NR_link
1273 print_link(const struct syscallname
*name
,
1274 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1275 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1277 print_syscall_prologue(name
);
1278 print_string(arg0
, 0);
1279 print_string(arg1
, 1);
1280 print_syscall_epilogue(name
);
1284 #ifdef TARGET_NR_linkat
1286 print_linkat(const struct syscallname
*name
,
1287 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1288 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1290 print_syscall_prologue(name
);
1291 print_at_dirfd(arg0
, 0);
1292 print_string(arg1
, 0);
1293 print_at_dirfd(arg2
, 0);
1294 print_string(arg3
, 0);
1295 print_flags(at_file_flags
, arg4
, 1);
1296 print_syscall_epilogue(name
);
1300 #ifdef TARGET_NR__llseek
1302 print__llseek(const struct syscallname
*name
,
1303 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1304 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1306 const char *whence
= "UNKNOWN";
1307 print_syscall_prologue(name
);
1308 print_raw_param("%d", arg0
, 0);
1309 print_raw_param("%ld", arg1
, 0);
1310 print_raw_param("%ld", arg2
, 0);
1311 print_pointer(arg3
, 0);
1313 case SEEK_SET
: whence
= "SEEK_SET"; break;
1314 case SEEK_CUR
: whence
= "SEEK_CUR"; break;
1315 case SEEK_END
: whence
= "SEEK_END"; break;
1317 gemu_log("%s",whence
);
1318 print_syscall_epilogue(name
);
1322 #if defined(TARGET_NR_socket)
1324 print_socket(const struct syscallname
*name
,
1325 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1326 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1328 abi_ulong domain
= arg0
, type
= arg1
, protocol
= arg2
;
1330 print_syscall_prologue(name
);
1331 print_socket_domain(domain
);
1333 print_socket_type(type
);
1335 if (domain
== AF_PACKET
||
1336 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
1337 protocol
= tswap16(protocol
);
1339 print_socket_protocol(domain
, type
, protocol
);
1340 print_syscall_epilogue(name
);
1345 #if defined(TARGET_NR_socketcall)
1347 #define get_user_ualx(x, gaddr, idx) \
1348 get_user_ual(x, (gaddr) + (idx) * sizeof(abi_long))
1350 static void do_print_socket(const char *name
, abi_long arg1
)
1352 abi_ulong domain
, type
, protocol
;
1354 get_user_ualx(domain
, arg1
, 0);
1355 get_user_ualx(type
, arg1
, 1);
1356 get_user_ualx(protocol
, arg1
, 2);
1357 gemu_log("%s(", name
);
1358 print_socket_domain(domain
);
1360 print_socket_type(type
);
1362 if (domain
== AF_PACKET
||
1363 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
1364 protocol
= tswap16(protocol
);
1366 print_socket_protocol(domain
, type
, protocol
);
1370 static void do_print_sockaddr(const char *name
, abi_long arg1
)
1372 abi_ulong sockfd
, addr
, addrlen
;
1374 get_user_ualx(sockfd
, arg1
, 0);
1375 get_user_ualx(addr
, arg1
, 1);
1376 get_user_ualx(addrlen
, arg1
, 2);
1378 gemu_log("%s(", name
);
1379 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, 0);
1380 print_sockaddr(addr
, addrlen
);
1384 static void do_print_listen(const char *name
, abi_long arg1
)
1386 abi_ulong sockfd
, backlog
;
1388 get_user_ualx(sockfd
, arg1
, 0);
1389 get_user_ualx(backlog
, arg1
, 1);
1391 gemu_log("%s(", name
);
1392 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, 0);
1393 print_raw_param(TARGET_ABI_FMT_ld
, backlog
, 1);
1397 static void do_print_socketpair(const char *name
, abi_long arg1
)
1399 abi_ulong domain
, type
, protocol
, tab
;
1401 get_user_ualx(domain
, arg1
, 0);
1402 get_user_ualx(type
, arg1
, 1);
1403 get_user_ualx(protocol
, arg1
, 2);
1404 get_user_ualx(tab
, arg1
, 3);
1406 gemu_log("%s(", name
);
1407 print_socket_domain(domain
);
1409 print_socket_type(type
);
1411 print_socket_protocol(domain
, type
, protocol
);
1413 print_raw_param(TARGET_ABI_FMT_lx
, tab
, 1);
1417 static void do_print_sendrecv(const char *name
, abi_long arg1
)
1419 abi_ulong sockfd
, msg
, len
, flags
;
1421 get_user_ualx(sockfd
, arg1
, 0);
1422 get_user_ualx(msg
, arg1
, 1);
1423 get_user_ualx(len
, arg1
, 2);
1424 get_user_ualx(flags
, arg1
, 3);
1426 gemu_log("%s(", name
);
1427 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, 0);
1428 print_buf(msg
, len
, 0);
1429 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
1430 print_flags(msg_flags
, flags
, 1);
1434 static void do_print_msgaddr(const char *name
, abi_long arg1
)
1436 abi_ulong sockfd
, msg
, len
, flags
, addr
, addrlen
;
1438 get_user_ualx(sockfd
, arg1
, 0);
1439 get_user_ualx(msg
, arg1
, 1);
1440 get_user_ualx(len
, arg1
, 2);
1441 get_user_ualx(flags
, arg1
, 3);
1442 get_user_ualx(addr
, arg1
, 4);
1443 get_user_ualx(addrlen
, arg1
, 5);
1445 gemu_log("%s(", name
);
1446 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, 0);
1447 print_buf(msg
, len
, 0);
1448 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
1449 print_flags(msg_flags
, flags
, 0);
1450 print_sockaddr(addr
, addrlen
);
1454 static void do_print_shutdown(const char *name
, abi_long arg1
)
1456 abi_ulong sockfd
, how
;
1458 get_user_ualx(sockfd
, arg1
, 0);
1459 get_user_ualx(how
, arg1
, 1);
1461 gemu_log("shutdown(");
1462 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, 0);
1465 gemu_log("SHUT_RD");
1468 gemu_log("SHUT_WR");
1471 gemu_log("SHUT_RDWR");
1474 print_raw_param(TARGET_ABI_FMT_ld
, how
, 1);
1480 static void do_print_msg(const char *name
, abi_long arg1
)
1482 abi_ulong sockfd
, msg
, flags
;
1484 get_user_ualx(sockfd
, arg1
, 0);
1485 get_user_ualx(msg
, arg1
, 1);
1486 get_user_ualx(flags
, arg1
, 2);
1488 gemu_log("%s(", name
);
1489 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, 0);
1490 print_pointer(msg
, 0);
1491 print_flags(msg_flags
, flags
, 1);
1495 static void do_print_sockopt(const char *name
, abi_long arg1
)
1497 abi_ulong sockfd
, level
, optname
, optval
, optlen
;
1499 get_user_ualx(sockfd
, arg1
, 0);
1500 get_user_ualx(level
, arg1
, 1);
1501 get_user_ualx(optname
, arg1
, 2);
1502 get_user_ualx(optval
, arg1
, 3);
1503 get_user_ualx(optlen
, arg1
, 4);
1505 gemu_log("%s(", name
);
1506 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, 0);
1509 gemu_log("SOL_TCP,");
1510 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
1511 print_pointer(optval
, 0);
1514 gemu_log("SOL_IP,");
1515 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
1516 print_pointer(optval
, 0);
1519 gemu_log("SOL_RAW,");
1520 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
1521 print_pointer(optval
, 0);
1523 case TARGET_SOL_SOCKET
:
1524 gemu_log("SOL_SOCKET,");
1526 case TARGET_SO_DEBUG
:
1527 gemu_log("SO_DEBUG,");
1529 print_number(optval
, 0);
1531 case TARGET_SO_REUSEADDR
:
1532 gemu_log("SO_REUSEADDR,");
1534 case TARGET_SO_TYPE
:
1535 gemu_log("SO_TYPE,");
1537 case TARGET_SO_ERROR
:
1538 gemu_log("SO_ERROR,");
1540 case TARGET_SO_DONTROUTE
:
1541 gemu_log("SO_DONTROUTE,");
1543 case TARGET_SO_BROADCAST
:
1544 gemu_log("SO_BROADCAST,");
1546 case TARGET_SO_SNDBUF
:
1547 gemu_log("SO_SNDBUF,");
1549 case TARGET_SO_RCVBUF
:
1550 gemu_log("SO_RCVBUF,");
1552 case TARGET_SO_KEEPALIVE
:
1553 gemu_log("SO_KEEPALIVE,");
1555 case TARGET_SO_OOBINLINE
:
1556 gemu_log("SO_OOBINLINE,");
1558 case TARGET_SO_NO_CHECK
:
1559 gemu_log("SO_NO_CHECK,");
1561 case TARGET_SO_PRIORITY
:
1562 gemu_log("SO_PRIORITY,");
1564 case TARGET_SO_BSDCOMPAT
:
1565 gemu_log("SO_BSDCOMPAT,");
1567 case TARGET_SO_PASSCRED
:
1568 gemu_log("SO_PASSCRED,");
1570 case TARGET_SO_TIMESTAMP
:
1571 gemu_log("SO_TIMESTAMP,");
1573 case TARGET_SO_RCVLOWAT
:
1574 gemu_log("SO_RCVLOWAT,");
1576 case TARGET_SO_RCVTIMEO
:
1577 gemu_log("SO_RCVTIMEO,");
1578 print_timeval(optval
, 0);
1580 case TARGET_SO_SNDTIMEO
:
1581 gemu_log("SO_SNDTIMEO,");
1582 print_timeval(optval
, 0);
1584 case TARGET_SO_ATTACH_FILTER
: {
1585 struct target_sock_fprog
*fprog
;
1587 gemu_log("SO_ATTACH_FILTER,");
1589 if (lock_user_struct(VERIFY_READ
, fprog
, optval
, 0)) {
1590 struct target_sock_filter
*filter
;
1592 if (lock_user_struct(VERIFY_READ
, filter
,
1593 tswapal(fprog
->filter
), 0)) {
1595 for (i
= 0; i
< tswap16(fprog
->len
) - 1; i
++) {
1596 gemu_log("[%d]{0x%x,%d,%d,0x%x},",
1597 i
, tswap16(filter
[i
].code
),
1598 filter
[i
].jt
, filter
[i
].jf
,
1599 tswap32(filter
[i
].k
));
1601 gemu_log("[%d]{0x%x,%d,%d,0x%x}",
1602 i
, tswap16(filter
[i
].code
),
1603 filter
[i
].jt
, filter
[i
].jf
,
1604 tswap32(filter
[i
].k
));
1606 gemu_log(TARGET_ABI_FMT_lx
, tswapal(fprog
->filter
));
1608 gemu_log(",%d},", tswap16(fprog
->len
));
1609 unlock_user(fprog
, optval
, 0);
1611 print_pointer(optval
, 0);
1616 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
1617 print_pointer(optval
, 0);
1622 print_raw_param(TARGET_ABI_FMT_ld
, level
, 0);
1623 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
1624 print_pointer(optval
, 0);
1627 print_raw_param(TARGET_ABI_FMT_ld
, optlen
, 1);
1631 #define PRINT_SOCKOP(name, func) \
1632 [SOCKOP_##name] = { #name, func }
1636 void (*print
)(const char *, abi_long
);
1638 PRINT_SOCKOP(socket
, do_print_socket
),
1639 PRINT_SOCKOP(bind
, do_print_sockaddr
),
1640 PRINT_SOCKOP(connect
, do_print_sockaddr
),
1641 PRINT_SOCKOP(listen
, do_print_listen
),
1642 PRINT_SOCKOP(accept
, do_print_sockaddr
),
1643 PRINT_SOCKOP(getsockname
, do_print_sockaddr
),
1644 PRINT_SOCKOP(getpeername
, do_print_sockaddr
),
1645 PRINT_SOCKOP(socketpair
, do_print_socketpair
),
1646 PRINT_SOCKOP(send
, do_print_sendrecv
),
1647 PRINT_SOCKOP(recv
, do_print_sendrecv
),
1648 PRINT_SOCKOP(sendto
, do_print_msgaddr
),
1649 PRINT_SOCKOP(recvfrom
, do_print_msgaddr
),
1650 PRINT_SOCKOP(shutdown
, do_print_shutdown
),
1651 PRINT_SOCKOP(sendmsg
, do_print_msg
),
1652 PRINT_SOCKOP(recvmsg
, do_print_msg
),
1653 PRINT_SOCKOP(setsockopt
, do_print_sockopt
),
1654 PRINT_SOCKOP(getsockopt
, do_print_sockopt
),
1658 print_socketcall(const struct syscallname
*name
,
1659 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1660 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1662 if (arg0
>= 0 && arg0
< ARRAY_SIZE(scall
) && scall
[arg0
].print
) {
1663 scall
[arg0
].print(scall
[arg0
].name
, arg1
);
1666 print_syscall_prologue(name
);
1667 print_raw_param(TARGET_ABI_FMT_ld
, arg0
, 0);
1668 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
1669 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
1670 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 0);
1671 print_raw_param(TARGET_ABI_FMT_ld
, arg4
, 0);
1672 print_raw_param(TARGET_ABI_FMT_ld
, arg5
, 0);
1673 print_syscall_epilogue(name
);
1677 #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \
1678 defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64)
1680 print_stat(const struct syscallname
*name
,
1681 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1682 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1684 print_syscall_prologue(name
);
1685 print_string(arg0
, 0);
1686 print_pointer(arg1
, 1);
1687 print_syscall_epilogue(name
);
1689 #define print_lstat print_stat
1690 #define print_stat64 print_stat
1691 #define print_lstat64 print_stat
1694 #if defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64)
1696 print_fstat(const struct syscallname
*name
,
1697 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1698 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1700 print_syscall_prologue(name
);
1701 print_raw_param("%d", arg0
, 0);
1702 print_pointer(arg1
, 1);
1703 print_syscall_epilogue(name
);
1705 #define print_fstat64 print_fstat
1708 #ifdef TARGET_NR_mkdir
1710 print_mkdir(const struct syscallname
*name
,
1711 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1712 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1714 print_syscall_prologue(name
);
1715 print_string(arg0
, 0);
1716 print_file_mode(arg1
, 1);
1717 print_syscall_epilogue(name
);
1721 #ifdef TARGET_NR_mkdirat
1723 print_mkdirat(const struct syscallname
*name
,
1724 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1725 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1727 print_syscall_prologue(name
);
1728 print_at_dirfd(arg0
, 0);
1729 print_string(arg1
, 0);
1730 print_file_mode(arg2
, 1);
1731 print_syscall_epilogue(name
);
1735 #ifdef TARGET_NR_rmdir
1737 print_rmdir(const struct syscallname
*name
,
1738 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1739 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1741 print_syscall_prologue(name
);
1742 print_string(arg0
, 0);
1743 print_syscall_epilogue(name
);
1747 #ifdef TARGET_NR_rt_sigaction
1749 print_rt_sigaction(const struct syscallname
*name
,
1750 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1751 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1753 print_syscall_prologue(name
);
1754 print_signal(arg0
, 0);
1755 print_pointer(arg1
, 0);
1756 print_pointer(arg2
, 1);
1757 print_syscall_epilogue(name
);
1761 #ifdef TARGET_NR_rt_sigprocmask
1763 print_rt_sigprocmask(const struct syscallname
*name
,
1764 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1765 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1767 const char *how
= "UNKNOWN";
1768 print_syscall_prologue(name
);
1770 case TARGET_SIG_BLOCK
: how
= "SIG_BLOCK"; break;
1771 case TARGET_SIG_UNBLOCK
: how
= "SIG_UNBLOCK"; break;
1772 case TARGET_SIG_SETMASK
: how
= "SIG_SETMASK"; break;
1774 gemu_log("%s,",how
);
1775 print_pointer(arg1
, 0);
1776 print_pointer(arg2
, 1);
1777 print_syscall_epilogue(name
);
1781 #ifdef TARGET_NR_mknod
1783 print_mknod(const struct syscallname
*name
,
1784 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1785 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1787 int hasdev
= (arg1
& (S_IFCHR
|S_IFBLK
));
1789 print_syscall_prologue(name
);
1790 print_string(arg0
, 0);
1791 print_file_mode(arg1
, (hasdev
== 0));
1793 print_raw_param("makedev(%d", major(arg2
), 0);
1794 print_raw_param("%d)", minor(arg2
), 1);
1796 print_syscall_epilogue(name
);
1800 #ifdef TARGET_NR_mknodat
1802 print_mknodat(const struct syscallname
*name
,
1803 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1804 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1806 int hasdev
= (arg2
& (S_IFCHR
|S_IFBLK
));
1808 print_syscall_prologue(name
);
1809 print_at_dirfd(arg0
, 0);
1810 print_string(arg1
, 0);
1811 print_file_mode(arg2
, (hasdev
== 0));
1813 print_raw_param("makedev(%d", major(arg3
), 0);
1814 print_raw_param("%d)", minor(arg3
), 1);
1816 print_syscall_epilogue(name
);
1820 #ifdef TARGET_NR_mq_open
1822 print_mq_open(const struct syscallname
*name
,
1823 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1824 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1826 int is_creat
= (arg1
& TARGET_O_CREAT
);
1828 print_syscall_prologue(name
);
1829 print_string(arg0
, 0);
1830 print_open_flags(arg1
, (is_creat
== 0));
1832 print_file_mode(arg2
, 0);
1833 print_pointer(arg3
, 1);
1835 print_syscall_epilogue(name
);
1839 #ifdef TARGET_NR_open
1841 print_open(const struct syscallname
*name
,
1842 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1843 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1845 int is_creat
= (arg1
& TARGET_O_CREAT
);
1847 print_syscall_prologue(name
);
1848 print_string(arg0
, 0);
1849 print_open_flags(arg1
, (is_creat
== 0));
1851 print_file_mode(arg2
, 1);
1852 print_syscall_epilogue(name
);
1856 #ifdef TARGET_NR_openat
1858 print_openat(const struct syscallname
*name
,
1859 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1860 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1862 int is_creat
= (arg2
& TARGET_O_CREAT
);
1864 print_syscall_prologue(name
);
1865 print_at_dirfd(arg0
, 0);
1866 print_string(arg1
, 0);
1867 print_open_flags(arg2
, (is_creat
== 0));
1869 print_file_mode(arg3
, 1);
1870 print_syscall_epilogue(name
);
1874 #ifdef TARGET_NR_mq_unlink
1876 print_mq_unlink(const struct syscallname
*name
,
1877 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1878 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1880 print_syscall_prologue(name
);
1881 print_string(arg0
, 1);
1882 print_syscall_epilogue(name
);
1886 #if defined(TARGET_NR_fstatat64) || defined(TARGET_NR_newfstatat)
1888 print_fstatat64(const struct syscallname
*name
,
1889 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1890 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1892 print_syscall_prologue(name
);
1893 print_at_dirfd(arg0
, 0);
1894 print_string(arg1
, 0);
1895 print_pointer(arg2
, 0);
1896 print_flags(at_file_flags
, arg3
, 1);
1897 print_syscall_epilogue(name
);
1899 #define print_newfstatat print_fstatat64
1902 #ifdef TARGET_NR_readlink
1904 print_readlink(const struct syscallname
*name
,
1905 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1906 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1908 print_syscall_prologue(name
);
1909 print_string(arg0
, 0);
1910 print_pointer(arg1
, 0);
1911 print_raw_param("%u", arg2
, 1);
1912 print_syscall_epilogue(name
);
1916 #ifdef TARGET_NR_readlinkat
1918 print_readlinkat(const struct syscallname
*name
,
1919 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1920 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1922 print_syscall_prologue(name
);
1923 print_at_dirfd(arg0
, 0);
1924 print_string(arg1
, 0);
1925 print_pointer(arg2
, 0);
1926 print_raw_param("%u", arg3
, 1);
1927 print_syscall_epilogue(name
);
1931 #ifdef TARGET_NR_rename
1933 print_rename(const struct syscallname
*name
,
1934 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1935 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1937 print_syscall_prologue(name
);
1938 print_string(arg0
, 0);
1939 print_string(arg1
, 1);
1940 print_syscall_epilogue(name
);
1944 #ifdef TARGET_NR_renameat
1946 print_renameat(const struct syscallname
*name
,
1947 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1948 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1950 print_syscall_prologue(name
);
1951 print_at_dirfd(arg0
, 0);
1952 print_string(arg1
, 0);
1953 print_at_dirfd(arg2
, 0);
1954 print_string(arg3
, 1);
1955 print_syscall_epilogue(name
);
1959 #ifdef TARGET_NR_statfs
1961 print_statfs(const struct syscallname
*name
,
1962 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1963 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1965 print_syscall_prologue(name
);
1966 print_string(arg0
, 0);
1967 print_pointer(arg1
, 1);
1968 print_syscall_epilogue(name
);
1970 #define print_statfs64 print_statfs
1973 #ifdef TARGET_NR_symlink
1975 print_symlink(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_string(arg0
, 0);
1981 print_string(arg1
, 1);
1982 print_syscall_epilogue(name
);
1986 #ifdef TARGET_NR_symlinkat
1988 print_symlinkat(const struct syscallname
*name
,
1989 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1990 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1992 print_syscall_prologue(name
);
1993 print_string(arg0
, 0);
1994 print_at_dirfd(arg1
, 0);
1995 print_string(arg2
, 1);
1996 print_syscall_epilogue(name
);
2000 #ifdef TARGET_NR_mount
2002 print_mount(const struct syscallname
*name
,
2003 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2004 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2006 print_syscall_prologue(name
);
2007 print_string(arg0
, 0);
2008 print_string(arg1
, 0);
2009 print_string(arg2
, 0);
2010 print_flags(mount_flags
, arg3
, 0);
2011 print_pointer(arg4
, 1);
2012 print_syscall_epilogue(name
);
2016 #ifdef TARGET_NR_umount
2018 print_umount(const struct syscallname
*name
,
2019 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2020 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2022 print_syscall_prologue(name
);
2023 print_string(arg0
, 1);
2024 print_syscall_epilogue(name
);
2028 #ifdef TARGET_NR_umount2
2030 print_umount2(const struct syscallname
*name
,
2031 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2032 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2034 print_syscall_prologue(name
);
2035 print_string(arg0
, 0);
2036 print_flags(umount2_flags
, arg1
, 1);
2037 print_syscall_epilogue(name
);
2041 #ifdef TARGET_NR_unlink
2043 print_unlink(const struct syscallname
*name
,
2044 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2045 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2047 print_syscall_prologue(name
);
2048 print_string(arg0
, 1);
2049 print_syscall_epilogue(name
);
2053 #ifdef TARGET_NR_unlinkat
2055 print_unlinkat(const struct syscallname
*name
,
2056 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2057 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2059 print_syscall_prologue(name
);
2060 print_at_dirfd(arg0
, 0);
2061 print_string(arg1
, 0);
2062 print_flags(unlinkat_flags
, arg2
, 1);
2063 print_syscall_epilogue(name
);
2067 #ifdef TARGET_NR_utime
2069 print_utime(const struct syscallname
*name
,
2070 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2071 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2073 print_syscall_prologue(name
);
2074 print_string(arg0
, 0);
2075 print_pointer(arg1
, 1);
2076 print_syscall_epilogue(name
);
2080 #ifdef TARGET_NR_utimes
2082 print_utimes(const struct syscallname
*name
,
2083 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2084 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2086 print_syscall_prologue(name
);
2087 print_string(arg0
, 0);
2088 print_pointer(arg1
, 1);
2089 print_syscall_epilogue(name
);
2093 #ifdef TARGET_NR_utimensat
2095 print_utimensat(const struct syscallname
*name
,
2096 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2097 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2099 print_syscall_prologue(name
);
2100 print_at_dirfd(arg0
, 0);
2101 print_string(arg1
, 0);
2102 print_pointer(arg2
, 0);
2103 print_flags(at_file_flags
, arg3
, 1);
2104 print_syscall_epilogue(name
);
2108 #if defined(TARGET_NR_mmap) || defined(TARGET_NR_mmap2)
2110 print_mmap(const struct syscallname
*name
,
2111 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2112 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2114 print_syscall_prologue(name
);
2115 print_pointer(arg0
, 0);
2116 print_raw_param("%d", arg1
, 0);
2117 print_flags(mmap_prot_flags
, arg2
, 0);
2118 print_flags(mmap_flags
, arg3
, 0);
2119 print_raw_param("%d", arg4
, 0);
2120 print_raw_param("%#x", arg5
, 1);
2121 print_syscall_epilogue(name
);
2123 #define print_mmap2 print_mmap
2126 #ifdef TARGET_NR_mprotect
2128 print_mprotect(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_pointer(arg0
, 0);
2134 print_raw_param("%d", arg1
, 0);
2135 print_flags(mmap_prot_flags
, arg2
, 1);
2136 print_syscall_epilogue(name
);
2140 #ifdef TARGET_NR_munmap
2142 print_munmap(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_pointer(arg0
, 0);
2148 print_raw_param("%d", arg1
, 1);
2149 print_syscall_epilogue(name
);
2153 #ifdef TARGET_NR_futex
2154 static void print_futex_op(abi_long tflag
, int last
)
2156 #define print_op(val) \
2157 if( cmd == val ) { \
2162 int cmd
= (int)tflag
;
2163 #ifdef FUTEX_PRIVATE_FLAG
2164 if (cmd
& FUTEX_PRIVATE_FLAG
) {
2165 gemu_log("FUTEX_PRIVATE_FLAG|");
2166 cmd
&= ~FUTEX_PRIVATE_FLAG
;
2169 #ifdef FUTEX_CLOCK_REALTIME
2170 if (cmd
& FUTEX_CLOCK_REALTIME
) {
2171 gemu_log("FUTEX_CLOCK_REALTIME|");
2172 cmd
&= ~FUTEX_CLOCK_REALTIME
;
2175 print_op(FUTEX_WAIT
)
2176 print_op(FUTEX_WAKE
)
2178 print_op(FUTEX_REQUEUE
)
2179 print_op(FUTEX_CMP_REQUEUE
)
2180 print_op(FUTEX_WAKE_OP
)
2181 print_op(FUTEX_LOCK_PI
)
2182 print_op(FUTEX_UNLOCK_PI
)
2183 print_op(FUTEX_TRYLOCK_PI
)
2184 #ifdef FUTEX_WAIT_BITSET
2185 print_op(FUTEX_WAIT_BITSET
)
2187 #ifdef FUTEX_WAKE_BITSET
2188 print_op(FUTEX_WAKE_BITSET
)
2190 /* unknown values */
2195 print_futex(const struct syscallname
*name
,
2196 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2197 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2199 print_syscall_prologue(name
);
2200 print_pointer(arg0
, 0);
2201 print_futex_op(arg1
, 0);
2202 print_raw_param(",%d", arg2
, 0);
2203 print_pointer(arg3
, 0); /* struct timespec */
2204 print_pointer(arg4
, 0);
2205 print_raw_param("%d", arg4
, 1);
2206 print_syscall_epilogue(name
);
2210 #ifdef TARGET_NR_kill
2212 print_kill(const struct syscallname
*name
,
2213 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2214 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2216 print_syscall_prologue(name
);
2217 print_raw_param("%d", arg0
, 0);
2218 print_signal(arg1
, 1);
2219 print_syscall_epilogue(name
);
2224 * An array of all of the syscalls we know about
2227 static const struct syscallname scnames
[] = {
2228 #include "strace.list"
2231 static int nsyscalls
= ARRAY_SIZE(scnames
);
2234 * The public interface to this module.
2237 print_syscall(int num
,
2238 abi_long arg1
, abi_long arg2
, abi_long arg3
,
2239 abi_long arg4
, abi_long arg5
, abi_long arg6
)
2242 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
")";
2244 gemu_log("%d ", getpid() );
2246 for(i
=0;i
<nsyscalls
;i
++)
2247 if( scnames
[i
].nr
== num
) {
2248 if( scnames
[i
].call
!= NULL
) {
2249 scnames
[i
].call(&scnames
[i
],arg1
,arg2
,arg3
,arg4
,arg5
,arg6
);
2251 /* XXX: this format system is broken because it uses
2252 host types and host pointers for strings */
2253 if( scnames
[i
].format
!= NULL
)
2254 format
= scnames
[i
].format
;
2255 gemu_log(format
,scnames
[i
].name
, arg1
,arg2
,arg3
,arg4
,arg5
,arg6
);
2259 gemu_log("Unknown syscall %d\n", num
);
2264 print_syscall_ret(int num
, abi_long ret
)
2267 const char *errstr
= NULL
;
2269 for(i
=0;i
<nsyscalls
;i
++)
2270 if( scnames
[i
].nr
== num
) {
2271 if( scnames
[i
].result
!= NULL
) {
2272 scnames
[i
].result(&scnames
[i
],ret
);
2275 errstr
= target_strerror(-ret
);
2278 gemu_log(" = -1 errno=" TARGET_ABI_FMT_ld
" (%s)\n",
2281 gemu_log(" = " TARGET_ABI_FMT_ld
"\n", ret
);
2288 void print_taken_signal(int target_signum
, const target_siginfo_t
*tinfo
)
2290 /* Print the strace output for a signal being taken:
2291 * --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
2294 print_signal(target_signum
, 1);
2296 print_siginfo(tinfo
);