qemu
4273 строки · 118.5 Кб
1#include "qemu/osdep.h"2
3#include <sys/ipc.h>4#include <sys/msg.h>5#include <sys/sem.h>6#include <sys/shm.h>7#include <sys/select.h>8#include <sys/mount.h>9#include <arpa/inet.h>10#include <netinet/in.h>11#include <netinet/tcp.h>12#include <netinet/udp.h>13#include <linux/if_packet.h>14#include <linux/in6.h>15#include <linux/netlink.h>16#include <sched.h>17#include "qemu.h"18#include "user-internals.h"19#include "strace.h"20#include "signal-common.h"21#include "target_mman.h"22
23struct syscallname {24int nr;25const char *name;26const char *format;27void (*call)(CPUArchState *, const struct syscallname *,28abi_long, abi_long, abi_long,29abi_long, abi_long, abi_long);30void (*result)(CPUArchState *, const struct syscallname *, abi_long,31abi_long, abi_long, abi_long,32abi_long, abi_long, abi_long);33};34
35/*
36* It is possible that target doesn't have syscall that uses
37* following flags but we don't want the compiler to warn
38* us about them being unused. Same applies to utility print
39* functions. It is ok to keep them while not used.
40*/
41#define UNUSED __attribute__ ((unused))42
43/*
44* Structure used to translate flag values into strings. This is
45* similar that is in the actual strace tool.
46*/
47struct flags {48abi_long f_value; /* flag */49abi_long f_mask; /* mask */50const char *f_string; /* stringified flag */51};52
53/* No 'struct flags' element should have a zero mask. */
54#define FLAG_BASIC(V, M, N) { V, M | QEMU_BUILD_BUG_ON_ZERO(!(M)), N }55
56/* common flags for all architectures */
57#define FLAG_GENERIC_MASK(V, M) FLAG_BASIC(V, M, #V)58#define FLAG_GENERIC(V) FLAG_BASIC(V, V, #V)59/* target specific flags (syscall_defs.h has TARGET_<flag>) */
60#define FLAG_TARGET_MASK(V, M) FLAG_BASIC(TARGET_##V, TARGET_##M, #V)61#define FLAG_TARGET(V) FLAG_BASIC(TARGET_##V, TARGET_##V, #V)62/* end of flags array */
63#define FLAG_END { 0, 0, NULL }64
65/* Structure used to translate enumerated values into strings */
66struct enums {67abi_long e_value; /* enum value */68const char *e_string; /* stringified enum */69};70
71/* common enums for all architectures */
72#define ENUM_GENERIC(name) { name, #name }73/* target specific enums */
74#define ENUM_TARGET(name) { TARGET_ ## name, #name }75/* end of enums array */
76#define ENUM_END { 0, NULL }77
78UNUSED static const char *get_comma(int);79UNUSED static void print_pointer(abi_long, int);80UNUSED static void print_flags(const struct flags *, abi_long, int);81UNUSED static void print_enums(const struct enums *, abi_long, int);82UNUSED static void print_at_dirfd(abi_long, int);83UNUSED static void print_file_mode(abi_long, int);84UNUSED static void print_open_flags(abi_long, int);85UNUSED static void print_syscall_prologue(const struct syscallname *);86UNUSED static void print_syscall_epilogue(const struct syscallname *);87UNUSED static void print_string(abi_long, int);88UNUSED static void print_buf(abi_long addr, abi_long len, int last);89UNUSED static void print_raw_param(const char *, abi_long, int);90UNUSED static void print_raw_param64(const char *, long long, int last);91UNUSED static void print_timeval(abi_ulong, int);92UNUSED static void print_timespec(abi_ulong, int);93UNUSED static void print_timespec64(abi_ulong, int);94UNUSED static void print_timezone(abi_ulong, int);95UNUSED static void print_itimerval(abi_ulong, int);96UNUSED static void print_number(abi_long, int);97UNUSED static void print_signal(abi_ulong, int);98UNUSED static void print_sockaddr(abi_ulong, abi_long, int);99UNUSED static void print_socket_domain(int domain);100UNUSED static void print_socket_type(int type);101UNUSED static void print_socket_protocol(int domain, int type, int protocol);102
103/*
104* Utility functions
105*/
106static void107print_ipc_cmd(int cmd)108{
109#define output_cmd(val) \110if( cmd == val ) { \111qemu_log(#val); \112return; \113}
114
115cmd &= 0xff;116
117/* General IPC commands */118output_cmd( IPC_RMID );119output_cmd( IPC_SET );120output_cmd( IPC_STAT );121output_cmd( IPC_INFO );122/* msgctl() commands */123output_cmd( MSG_STAT );124output_cmd( MSG_INFO );125/* shmctl() commands */126output_cmd( SHM_LOCK );127output_cmd( SHM_UNLOCK );128output_cmd( SHM_STAT );129output_cmd( SHM_INFO );130/* semctl() commands */131output_cmd( GETPID );132output_cmd( GETVAL );133output_cmd( GETALL );134output_cmd( GETNCNT );135output_cmd( GETZCNT );136output_cmd( SETVAL );137output_cmd( SETALL );138output_cmd( SEM_STAT );139output_cmd( SEM_INFO );140output_cmd( IPC_RMID );141output_cmd( IPC_RMID );142output_cmd( IPC_RMID );143output_cmd( IPC_RMID );144output_cmd( IPC_RMID );145output_cmd( IPC_RMID );146output_cmd( IPC_RMID );147output_cmd( IPC_RMID );148output_cmd( IPC_RMID );149
150/* Some value we don't recognize */151qemu_log("%d", cmd);152}
153
154static const char * const target_signal_name[] = {155#define MAKE_SIG_ENTRY(sig) [TARGET_##sig] = #sig,156MAKE_SIGNAL_LIST
157#undef MAKE_SIG_ENTRY158};159
160static void161print_signal(abi_ulong arg, int last)162{
163const char *signal_name = NULL;164
165if (arg < ARRAY_SIZE(target_signal_name)) {166signal_name = target_signal_name[arg];167}168
169if (signal_name == NULL) {170print_raw_param("%ld", arg, last);171return;172}173qemu_log("%s%s", signal_name, get_comma(last));174}
175
176static void print_si_code(int arg)177{
178const char *codename = NULL;179
180switch (arg) {181case SI_USER:182codename = "SI_USER";183break;184case SI_KERNEL:185codename = "SI_KERNEL";186break;187case SI_QUEUE:188codename = "SI_QUEUE";189break;190case SI_TIMER:191codename = "SI_TIMER";192break;193case SI_MESGQ:194codename = "SI_MESGQ";195break;196case SI_ASYNCIO:197codename = "SI_ASYNCIO";198break;199case SI_SIGIO:200codename = "SI_SIGIO";201break;202case SI_TKILL:203codename = "SI_TKILL";204break;205default:206qemu_log("%d", arg);207return;208}209qemu_log("%s", codename);210}
211
212static void get_target_siginfo(target_siginfo_t *tinfo,213const target_siginfo_t *info)214{
215abi_ulong sival_ptr;216
217int sig;218int si_errno;219int si_code;220int si_type;221
222__get_user(sig, &info->si_signo);223__get_user(si_errno, &tinfo->si_errno);224__get_user(si_code, &info->si_code);225
226tinfo->si_signo = sig;227tinfo->si_errno = si_errno;228tinfo->si_code = si_code;229
230/* Ensure we don't leak random junk to the guest later */231memset(tinfo->_sifields._pad, 0, sizeof(tinfo->_sifields._pad));232
233/* This is awkward, because we have to use a combination of234* the si_code and si_signo to figure out which of the union's
235* members are valid. (Within the host kernel it is always possible
236* to tell, but the kernel carefully avoids giving userspace the
237* high 16 bits of si_code, so we don't have the information to
238* do this the easy way...) We therefore make our best guess,
239* bearing in mind that a guest can spoof most of the si_codes
240* via rt_sigqueueinfo() if it likes.
241*
242* Once we have made our guess, we record it in the top 16 bits of
243* the si_code, so that print_siginfo() later can use it.
244* print_siginfo() will strip these top bits out before printing
245* the si_code.
246*/
247
248switch (si_code) {249case SI_USER:250case SI_TKILL:251case SI_KERNEL:252/* Sent via kill(), tkill() or tgkill(), or direct from the kernel.253* These are the only unspoofable si_code values.
254*/
255__get_user(tinfo->_sifields._kill._pid, &info->_sifields._kill._pid);256__get_user(tinfo->_sifields._kill._uid, &info->_sifields._kill._uid);257si_type = QEMU_SI_KILL;258break;259default:260/* Everything else is spoofable. Make best guess based on signal */261switch (sig) {262case TARGET_SIGCHLD:263__get_user(tinfo->_sifields._sigchld._pid,264&info->_sifields._sigchld._pid);265__get_user(tinfo->_sifields._sigchld._uid,266&info->_sifields._sigchld._uid);267__get_user(tinfo->_sifields._sigchld._status,268&info->_sifields._sigchld._status);269__get_user(tinfo->_sifields._sigchld._utime,270&info->_sifields._sigchld._utime);271__get_user(tinfo->_sifields._sigchld._stime,272&info->_sifields._sigchld._stime);273si_type = QEMU_SI_CHLD;274break;275case TARGET_SIGIO:276__get_user(tinfo->_sifields._sigpoll._band,277&info->_sifields._sigpoll._band);278__get_user(tinfo->_sifields._sigpoll._fd,279&info->_sifields._sigpoll._fd);280si_type = QEMU_SI_POLL;281break;282default:283/* Assume a sigqueue()/mq_notify()/rt_sigqueueinfo() source. */284__get_user(tinfo->_sifields._rt._pid, &info->_sifields._rt._pid);285__get_user(tinfo->_sifields._rt._uid, &info->_sifields._rt._uid);286/* XXX: potential problem if 64 bit */287__get_user(sival_ptr, &info->_sifields._rt._sigval.sival_ptr);288tinfo->_sifields._rt._sigval.sival_ptr = sival_ptr;289
290si_type = QEMU_SI_RT;291break;292}293break;294}295
296tinfo->si_code = deposit32(si_code, 16, 16, si_type);297}
298
299static void print_siginfo(const target_siginfo_t *tinfo)300{
301/* Print a target_siginfo_t in the format desired for printing302* signals being taken. We assume the target_siginfo_t is in the
303* internal form where the top 16 bits of si_code indicate which
304* part of the union is valid, rather than in the guest-visible
305* form where the bottom 16 bits are sign-extended into the top 16.
306*/
307int si_type = extract32(tinfo->si_code, 16, 16);308int si_code = sextract32(tinfo->si_code, 0, 16);309
310qemu_log("{si_signo=");311print_signal(tinfo->si_signo, 1);312qemu_log(", si_code=");313print_si_code(si_code);314
315switch (si_type) {316case QEMU_SI_KILL:317qemu_log(", si_pid=%u, si_uid=%u",318(unsigned int)tinfo->_sifields._kill._pid,319(unsigned int)tinfo->_sifields._kill._uid);320break;321case QEMU_SI_TIMER:322qemu_log(", si_timer1=%u, si_timer2=%u",323tinfo->_sifields._timer._timer1,324tinfo->_sifields._timer._timer2);325break;326case QEMU_SI_POLL:327qemu_log(", si_band=%d, si_fd=%d",328tinfo->_sifields._sigpoll._band,329tinfo->_sifields._sigpoll._fd);330break;331case QEMU_SI_FAULT:332qemu_log(", si_addr=");333print_pointer(tinfo->_sifields._sigfault._addr, 1);334break;335case QEMU_SI_CHLD:336qemu_log(", si_pid=%u, si_uid=%u, si_status=%d"337", si_utime=" TARGET_ABI_FMT_ld338", si_stime=" TARGET_ABI_FMT_ld,339(unsigned int)(tinfo->_sifields._sigchld._pid),340(unsigned int)(tinfo->_sifields._sigchld._uid),341tinfo->_sifields._sigchld._status,342tinfo->_sifields._sigchld._utime,343tinfo->_sifields._sigchld._stime);344break;345case QEMU_SI_RT:346qemu_log(", si_pid=%u, si_uid=%u, si_sigval=" TARGET_ABI_FMT_ld,347(unsigned int)tinfo->_sifields._rt._pid,348(unsigned int)tinfo->_sifields._rt._uid,349tinfo->_sifields._rt._sigval.sival_ptr);350break;351default:352g_assert_not_reached();353}354qemu_log("}");355}
356
357static void358print_sockaddr(abi_ulong addr, abi_long addrlen, int last)359{
360struct target_sockaddr *sa;361int i;362int sa_family;363
364sa = lock_user(VERIFY_READ, addr, addrlen, 1);365if (sa) {366sa_family = tswap16(sa->sa_family);367switch (sa_family) {368case AF_UNIX: {369struct target_sockaddr_un *un = (struct target_sockaddr_un *)sa;370qemu_log("{sun_family=AF_UNIX,sun_path=\"");371for (i = 0; i < addrlen -372offsetof(struct target_sockaddr_un, sun_path) &&373un->sun_path[i]; i++) {374qemu_log("%c", un->sun_path[i]);375}376qemu_log("\"}");377break;378}379case AF_INET: {380struct target_sockaddr_in *in = (struct target_sockaddr_in *)sa;381uint8_t *c = (uint8_t *)&in->sin_addr.s_addr;382qemu_log("{sin_family=AF_INET,sin_port=htons(%d),",383ntohs(in->sin_port));384qemu_log("sin_addr=inet_addr(\"%d.%d.%d.%d\")",385c[0], c[1], c[2], c[3]);386qemu_log("}");387break;388}389case AF_PACKET: {390struct target_sockaddr_ll *ll = (struct target_sockaddr_ll *)sa;391uint8_t *c = (uint8_t *)&ll->sll_addr;392qemu_log("{sll_family=AF_PACKET,"393"sll_protocol=htons(0x%04x),if%d,pkttype=",394ntohs(ll->sll_protocol), ll->sll_ifindex);395switch (ll->sll_pkttype) {396case PACKET_HOST:397qemu_log("PACKET_HOST");398break;399case PACKET_BROADCAST:400qemu_log("PACKET_BROADCAST");401break;402case PACKET_MULTICAST:403qemu_log("PACKET_MULTICAST");404break;405case PACKET_OTHERHOST:406qemu_log("PACKET_OTHERHOST");407break;408case PACKET_OUTGOING:409qemu_log("PACKET_OUTGOING");410break;411default:412qemu_log("%d", ll->sll_pkttype);413break;414}415qemu_log(",sll_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",416c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]);417qemu_log("}");418break;419}420case AF_NETLINK: {421struct target_sockaddr_nl *nl = (struct target_sockaddr_nl *)sa;422qemu_log("{nl_family=AF_NETLINK,nl_pid=%u,nl_groups=%u}",423tswap32(nl->nl_pid), tswap32(nl->nl_groups));424break;425}426default:427qemu_log("{sa_family=%d, sa_data={", sa->sa_family);428for (i = 0; i < 13; i++) {429qemu_log("%02x, ", sa->sa_data[i]);430}431qemu_log("%02x}", sa->sa_data[i]);432qemu_log("}");433break;434}435unlock_user(sa, addr, 0);436} else {437print_raw_param("0x"TARGET_ABI_FMT_lx, addr, 0);438}439qemu_log(", "TARGET_ABI_FMT_ld"%s", addrlen, get_comma(last));440}
441
442static void443print_socket_domain(int domain)444{
445switch (domain) {446case PF_UNIX:447qemu_log("PF_UNIX");448break;449case PF_INET:450qemu_log("PF_INET");451break;452case PF_NETLINK:453qemu_log("PF_NETLINK");454break;455case PF_PACKET:456qemu_log("PF_PACKET");457break;458default:459qemu_log("%d", domain);460break;461}462}
463
464static void465print_socket_type(int type)466{
467switch (type & TARGET_SOCK_TYPE_MASK) {468case TARGET_SOCK_DGRAM:469qemu_log("SOCK_DGRAM");470break;471case TARGET_SOCK_STREAM:472qemu_log("SOCK_STREAM");473break;474case TARGET_SOCK_RAW:475qemu_log("SOCK_RAW");476break;477case TARGET_SOCK_RDM:478qemu_log("SOCK_RDM");479break;480case TARGET_SOCK_SEQPACKET:481qemu_log("SOCK_SEQPACKET");482break;483case TARGET_SOCK_PACKET:484qemu_log("SOCK_PACKET");485break;486}487if (type & TARGET_SOCK_CLOEXEC) {488qemu_log("|SOCK_CLOEXEC");489}490if (type & TARGET_SOCK_NONBLOCK) {491qemu_log("|SOCK_NONBLOCK");492}493}
494
495static void496print_socket_protocol(int domain, int type, int protocol)497{
498if (domain == AF_PACKET ||499(domain == AF_INET && type == TARGET_SOCK_PACKET)) {500switch (protocol) {501case 0x0003:502qemu_log("ETH_P_ALL");503break;504default:505qemu_log("%d", protocol);506}507return;508}509
510if (domain == PF_NETLINK) {511switch (protocol) {512case NETLINK_ROUTE:513qemu_log("NETLINK_ROUTE");514break;515case NETLINK_UNUSED:516qemu_log("NETLINK_UNUSED");517break;518case NETLINK_USERSOCK:519qemu_log("NETLINK_USERSOCK");520break;521case NETLINK_FIREWALL:522qemu_log("NETLINK_FIREWALL");523break;524case NETLINK_SOCK_DIAG:525qemu_log("NETLINK_SOCK_DIAG");526break;527case NETLINK_NFLOG:528qemu_log("NETLINK_NFLOG");529break;530case NETLINK_XFRM:531qemu_log("NETLINK_XFRM");532break;533case NETLINK_SELINUX:534qemu_log("NETLINK_SELINUX");535break;536case NETLINK_ISCSI:537qemu_log("NETLINK_ISCSI");538break;539case NETLINK_AUDIT:540qemu_log("NETLINK_AUDIT");541break;542case NETLINK_FIB_LOOKUP:543qemu_log("NETLINK_FIB_LOOKUP");544break;545case NETLINK_CONNECTOR:546qemu_log("NETLINK_CONNECTOR");547break;548case NETLINK_NETFILTER:549qemu_log("NETLINK_NETFILTER");550break;551case NETLINK_IP6_FW:552qemu_log("NETLINK_IP6_FW");553break;554case NETLINK_DNRTMSG:555qemu_log("NETLINK_DNRTMSG");556break;557case NETLINK_KOBJECT_UEVENT:558qemu_log("NETLINK_KOBJECT_UEVENT");559break;560case NETLINK_GENERIC:561qemu_log("NETLINK_GENERIC");562break;563case NETLINK_SCSITRANSPORT:564qemu_log("NETLINK_SCSITRANSPORT");565break;566case NETLINK_ECRYPTFS:567qemu_log("NETLINK_ECRYPTFS");568break;569case NETLINK_RDMA:570qemu_log("NETLINK_RDMA");571break;572case NETLINK_CRYPTO:573qemu_log("NETLINK_CRYPTO");574break;575case NETLINK_SMC:576qemu_log("NETLINK_SMC");577break;578default:579qemu_log("%d", protocol);580break;581}582return;583}584
585switch (protocol) {586case IPPROTO_IP:587qemu_log("IPPROTO_IP");588break;589case IPPROTO_TCP:590qemu_log("IPPROTO_TCP");591break;592case IPPROTO_UDP:593qemu_log("IPPROTO_UDP");594break;595case IPPROTO_RAW:596qemu_log("IPPROTO_RAW");597break;598default:599qemu_log("%d", protocol);600break;601}602}
603
604
605#ifdef TARGET_NR__newselect606static void607print_fdset(int n, abi_ulong target_fds_addr)608{
609int i;610int first = 1;611
612qemu_log("[");613if( target_fds_addr ) {614abi_long *target_fds;615
616target_fds = lock_user(VERIFY_READ,617target_fds_addr,618sizeof(*target_fds)*(n / TARGET_ABI_BITS + 1),6191);620
621if (!target_fds)622return;623
624for (i=n; i>=0; i--) {625if ((tswapal(target_fds[i / TARGET_ABI_BITS]) >>626(i & (TARGET_ABI_BITS - 1))) & 1) {627qemu_log("%s%d", get_comma(first), i);628first = 0;629}630}631unlock_user(target_fds, target_fds_addr, 0);632}633qemu_log("]");634}
635#endif636
637/*
638* Sysycall specific output functions
639*/
640
641/* select */
642#ifdef TARGET_NR__newselect643static void644print_newselect(CPUArchState *cpu_env, const struct syscallname *name,645abi_long arg1, abi_long arg2, abi_long arg3,646abi_long arg4, abi_long arg5, abi_long arg6)647{
648print_syscall_prologue(name);649print_fdset(arg1, arg2);650qemu_log(",");651print_fdset(arg1, arg3);652qemu_log(",");653print_fdset(arg1, arg4);654qemu_log(",");655print_timeval(arg5, 1);656print_syscall_epilogue(name);657}
658#endif659
660static void661print_semctl(CPUArchState *cpu_env, const struct syscallname *name,662abi_long arg1, abi_long arg2, abi_long arg3,663abi_long arg4, abi_long arg5, abi_long arg6)664{
665qemu_log("%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ",",666name->name, arg1, arg2);667print_ipc_cmd(arg3);668qemu_log(",0x" TARGET_ABI_FMT_lx ")", arg4);669}
670
671static void672print_shmat(CPUArchState *cpu_env, const struct syscallname *name,673abi_long arg0, abi_long arg1, abi_long arg2,674abi_long arg3, abi_long arg4, abi_long arg5)675{
676static const struct flags shmat_flags[] = {677FLAG_GENERIC(SHM_RND),678FLAG_GENERIC(SHM_REMAP),679FLAG_GENERIC(SHM_RDONLY),680FLAG_GENERIC(SHM_EXEC),681FLAG_END
682};683
684print_syscall_prologue(name);685print_raw_param(TARGET_ABI_FMT_ld, arg0, 0);686print_pointer(arg1, 0);687print_flags(shmat_flags, arg2, 1);688print_syscall_epilogue(name);689}
690
691#ifdef TARGET_NR_ipc692static void693print_ipc(CPUArchState *cpu_env, const struct syscallname *name,694abi_long arg1, abi_long arg2, abi_long arg3,695abi_long arg4, abi_long arg5, abi_long arg6)696{
697switch(arg1) {698case IPCOP_semctl:699print_semctl(cpu_env, &(const struct syscallname){ .name = "semctl" },700arg2, arg3, arg4, arg5, 0, 0);701break;702case IPCOP_shmat:703print_shmat(cpu_env, &(const struct syscallname){ .name = "shmat" },704arg2, arg5, arg3, 0, 0, 0);705break;706default:707qemu_log(("%s("708TARGET_ABI_FMT_ld ","709TARGET_ABI_FMT_ld ","710TARGET_ABI_FMT_ld ","711TARGET_ABI_FMT_ld
712")"),713name->name, arg1, arg2, arg3, arg4);714}715}
716#endif717
718/*
719* Variants for the return value output function
720*/
721
722static bool723print_syscall_err(abi_long ret)724{
725const char *errstr;726
727qemu_log(" = ");728if (is_error(ret)) {729errstr = target_strerror(-ret);730if (errstr) {731qemu_log("-1 errno=%d (%s)", (int)-ret, errstr);732return true;733}734}735return false;736}
737
738static void739print_syscall_ret_addr(CPUArchState *cpu_env, const struct syscallname *name,740abi_long ret, abi_long arg0, abi_long arg1,741abi_long arg2, abi_long arg3, abi_long arg4,742abi_long arg5)743{
744if (!print_syscall_err(ret)) {745qemu_log("0x" TARGET_ABI_FMT_lx, ret);746}747qemu_log("\n");748}
749
750#if 0 /* currently unused */751static void752print_syscall_ret_raw(struct syscallname *name, abi_long ret)753{
754qemu_log(" = 0x" TARGET_ABI_FMT_lx "\n", ret);755}
756#endif757
758#ifdef TARGET_NR__newselect759static void760print_syscall_ret_newselect(CPUArchState *cpu_env, const struct syscallname *name,761abi_long ret, abi_long arg0, abi_long arg1,762abi_long arg2, abi_long arg3, abi_long arg4,763abi_long arg5)764{
765if (!print_syscall_err(ret)) {766qemu_log(" = 0x" TARGET_ABI_FMT_lx " (", ret);767print_fdset(arg0, arg1);768qemu_log(",");769print_fdset(arg0, arg2);770qemu_log(",");771print_fdset(arg0, arg3);772qemu_log(",");773print_timeval(arg4, 1);774qemu_log(")");775}776
777qemu_log("\n");778}
779#endif780
781/* special meanings of adjtimex()' non-negative return values */
782#define TARGET_TIME_OK 0 /* clock synchronized, no leap second */783#define TARGET_TIME_INS 1 /* insert leap second */784#define TARGET_TIME_DEL 2 /* delete leap second */785#define TARGET_TIME_OOP 3 /* leap second in progress */786#define TARGET_TIME_WAIT 4 /* leap second has occurred */787#define TARGET_TIME_ERROR 5 /* clock not synchronized */788#ifdef TARGET_NR_adjtimex789static void790print_syscall_ret_adjtimex(CPUArchState *cpu_env, const struct syscallname *name,791abi_long ret, abi_long arg0, abi_long arg1,792abi_long arg2, abi_long arg3, abi_long arg4,793abi_long arg5)794{
795if (!print_syscall_err(ret)) {796qemu_log(TARGET_ABI_FMT_ld, ret);797switch (ret) {798case TARGET_TIME_OK:799qemu_log(" TIME_OK (clock synchronized, no leap second)");800break;801case TARGET_TIME_INS:802qemu_log(" TIME_INS (insert leap second)");803break;804case TARGET_TIME_DEL:805qemu_log(" TIME_DEL (delete leap second)");806break;807case TARGET_TIME_OOP:808qemu_log(" TIME_OOP (leap second in progress)");809break;810case TARGET_TIME_WAIT:811qemu_log(" TIME_WAIT (leap second has occurred)");812break;813case TARGET_TIME_ERROR:814qemu_log(" TIME_ERROR (clock not synchronized)");815break;816}817}818
819qemu_log("\n");820}
821#endif822
823#if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)824static void825print_syscall_ret_clock_gettime(CPUArchState *cpu_env, const struct syscallname *name,826abi_long ret, abi_long arg0, abi_long arg1,827abi_long arg2, abi_long arg3, abi_long arg4,828abi_long arg5)829{
830if (!print_syscall_err(ret)) {831qemu_log(TARGET_ABI_FMT_ld, ret);832qemu_log(" (");833print_timespec(arg1, 1);834qemu_log(")");835}836
837qemu_log("\n");838}
839#define print_syscall_ret_clock_getres print_syscall_ret_clock_gettime840#endif841
842#if defined(TARGET_NR_clock_gettime64)843static void844print_syscall_ret_clock_gettime64(CPUArchState *cpu_env, const struct syscallname *name,845abi_long ret, abi_long arg0, abi_long arg1,846abi_long arg2, abi_long arg3, abi_long arg4,847abi_long arg5)848{
849if (!print_syscall_err(ret)) {850qemu_log(TARGET_ABI_FMT_ld, ret);851qemu_log(" (");852print_timespec64(arg1, 1);853qemu_log(")");854}855
856qemu_log("\n");857}
858#endif859
860#ifdef TARGET_NR_gettimeofday861static void862print_syscall_ret_gettimeofday(CPUArchState *cpu_env, const struct syscallname *name,863abi_long ret, abi_long arg0, abi_long arg1,864abi_long arg2, abi_long arg3, abi_long arg4,865abi_long arg5)866{
867if (!print_syscall_err(ret)) {868qemu_log(TARGET_ABI_FMT_ld, ret);869qemu_log(" (");870print_timeval(arg0, 0);871print_timezone(arg1, 1);872qemu_log(")");873}874
875qemu_log("\n");876}
877#endif878
879#ifdef TARGET_NR_getitimer880static void881print_syscall_ret_getitimer(CPUArchState *cpu_env, const struct syscallname *name,882abi_long ret, abi_long arg0, abi_long arg1,883abi_long arg2, abi_long arg3, abi_long arg4,884abi_long arg5)885{
886if (!print_syscall_err(ret)) {887qemu_log(TARGET_ABI_FMT_ld, ret);888qemu_log(" (");889print_itimerval(arg1, 1);890qemu_log(")");891}892
893qemu_log("\n");894}
895#endif896
897
898#ifdef TARGET_NR_getitimer899static void900print_syscall_ret_setitimer(CPUArchState *cpu_env, const struct syscallname *name,901abi_long ret, abi_long arg0, abi_long arg1,902abi_long arg2, abi_long arg3, abi_long arg4,903abi_long arg5)904{
905if (!print_syscall_err(ret)) {906qemu_log(TARGET_ABI_FMT_ld, ret);907qemu_log(" (old_value = ");908print_itimerval(arg2, 1);909qemu_log(")");910}911
912qemu_log("\n");913}
914#endif915
916#if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr) \917|| defined(TARGGET_NR_flistxattr)918static void919print_syscall_ret_listxattr(CPUArchState *cpu_env, const struct syscallname *name,920abi_long ret, abi_long arg0, abi_long arg1,921abi_long arg2, abi_long arg3, abi_long arg4,922abi_long arg5)923{
924if (!print_syscall_err(ret)) {925qemu_log(TARGET_ABI_FMT_ld, ret);926qemu_log(" (list = ");927if (arg1 != 0) {928abi_long attr = arg1;929while (ret) {930if (attr != arg1) {931qemu_log(",");932}933print_string(attr, 1);934ret -= target_strlen(attr) + 1;935attr += target_strlen(attr) + 1;936}937} else {938qemu_log("NULL");939}940qemu_log(")");941}942
943qemu_log("\n");944}
945#define print_syscall_ret_llistxattr print_syscall_ret_listxattr946#define print_syscall_ret_flistxattr print_syscall_ret_listxattr947#endif948
949#ifdef TARGET_NR_ioctl950static void951print_syscall_ret_ioctl(CPUArchState *cpu_env, const struct syscallname *name,952abi_long ret, abi_long arg0, abi_long arg1,953abi_long arg2, abi_long arg3, abi_long arg4,954abi_long arg5)955{
956if (!print_syscall_err(ret)) {957qemu_log(TARGET_ABI_FMT_ld, ret);958
959const IOCTLEntry *ie;960const argtype *arg_type;961void *argptr;962int target_size;963
964for (ie = ioctl_entries; ie->target_cmd != 0; ie++) {965if (ie->target_cmd == arg1) {966break;967}968}969
970if (ie->target_cmd == arg1 &&971(ie->access == IOC_R || ie->access == IOC_RW)) {972arg_type = ie->arg_type;973qemu_log(" (");974arg_type++;975target_size = thunk_type_size(arg_type, 0);976argptr = lock_user(VERIFY_READ, arg2, target_size, 1);977if (argptr) {978thunk_print(argptr, arg_type);979unlock_user(argptr, arg2, target_size);980} else {981print_pointer(arg2, 1);982}983qemu_log(")");984}985}986qemu_log("\n");987}
988#endif989
990UNUSED static const struct flags access_flags[] = {991FLAG_GENERIC_MASK(F_OK, R_OK | W_OK | X_OK),992FLAG_GENERIC(R_OK),993FLAG_GENERIC(W_OK),994FLAG_GENERIC(X_OK),995FLAG_END,996};997
998UNUSED static const struct flags at_file_flags[] = {999#ifdef AT_EACCESS1000FLAG_GENERIC(AT_EACCESS),1001#endif1002#ifdef AT_SYMLINK_NOFOLLOW1003FLAG_GENERIC(AT_SYMLINK_NOFOLLOW),1004#endif1005FLAG_END,1006};1007
1008UNUSED static const struct flags unlinkat_flags[] = {1009#ifdef AT_REMOVEDIR1010FLAG_GENERIC(AT_REMOVEDIR),1011#endif1012FLAG_END,1013};1014
1015UNUSED static const struct flags mode_flags[] = {1016FLAG_GENERIC(S_IFSOCK),1017FLAG_GENERIC(S_IFLNK),1018FLAG_GENERIC(S_IFREG),1019FLAG_GENERIC(S_IFBLK),1020FLAG_GENERIC(S_IFDIR),1021FLAG_GENERIC(S_IFCHR),1022FLAG_GENERIC(S_IFIFO),1023FLAG_END,1024};1025
1026UNUSED static const struct flags open_access_flags[] = {1027FLAG_TARGET_MASK(O_RDONLY, O_ACCMODE),1028FLAG_TARGET_MASK(O_WRONLY, O_ACCMODE),1029FLAG_TARGET_MASK(O_RDWR, O_ACCMODE),1030FLAG_END,1031};1032
1033UNUSED static const struct flags open_flags[] = {1034FLAG_TARGET(O_APPEND),1035FLAG_TARGET(O_CREAT),1036FLAG_TARGET(O_DIRECTORY),1037FLAG_TARGET(O_EXCL),1038#if TARGET_O_LARGEFILE != 01039FLAG_TARGET(O_LARGEFILE),1040#endif1041FLAG_TARGET(O_NOCTTY),1042FLAG_TARGET(O_NOFOLLOW),1043FLAG_TARGET(O_NONBLOCK), /* also O_NDELAY */1044FLAG_TARGET(O_DSYNC),1045FLAG_TARGET(__O_SYNC),1046FLAG_TARGET(O_TRUNC),1047#ifdef O_DIRECT1048FLAG_TARGET(O_DIRECT),1049#endif1050#ifdef O_NOATIME1051FLAG_TARGET(O_NOATIME),1052#endif1053#ifdef O_CLOEXEC1054FLAG_TARGET(O_CLOEXEC),1055#endif1056#ifdef O_PATH1057FLAG_TARGET(O_PATH),1058#endif1059#ifdef O_TMPFILE1060FLAG_TARGET(O_TMPFILE),1061FLAG_TARGET(__O_TMPFILE),1062#endif1063FLAG_END,1064};1065
1066UNUSED static const struct flags mount_flags[] = {1067#ifdef MS_BIND1068FLAG_GENERIC(MS_BIND),1069#endif1070#ifdef MS_DIRSYNC1071FLAG_GENERIC(MS_DIRSYNC),1072#endif1073FLAG_GENERIC(MS_MANDLOCK),1074#ifdef MS_MOVE1075FLAG_GENERIC(MS_MOVE),1076#endif1077FLAG_GENERIC(MS_NOATIME),1078FLAG_GENERIC(MS_NODEV),1079FLAG_GENERIC(MS_NODIRATIME),1080FLAG_GENERIC(MS_NOEXEC),1081FLAG_GENERIC(MS_NOSUID),1082FLAG_GENERIC(MS_RDONLY),1083#ifdef MS_RELATIME1084FLAG_GENERIC(MS_RELATIME),1085#endif1086FLAG_GENERIC(MS_REMOUNT),1087FLAG_GENERIC(MS_SYNCHRONOUS),1088FLAG_END,1089};1090
1091UNUSED static const struct flags umount2_flags[] = {1092#ifdef MNT_FORCE1093FLAG_GENERIC(MNT_FORCE),1094#endif1095#ifdef MNT_DETACH1096FLAG_GENERIC(MNT_DETACH),1097#endif1098#ifdef MNT_EXPIRE1099FLAG_GENERIC(MNT_EXPIRE),1100#endif1101FLAG_END,1102};1103
1104UNUSED static const struct flags mmap_prot_flags[] = {1105FLAG_GENERIC_MASK(PROT_NONE, PROT_READ | PROT_WRITE | PROT_EXEC),1106FLAG_GENERIC(PROT_EXEC),1107FLAG_GENERIC(PROT_READ),1108FLAG_GENERIC(PROT_WRITE),1109FLAG_TARGET(PROT_SEM),1110FLAG_GENERIC(PROT_GROWSDOWN),1111FLAG_GENERIC(PROT_GROWSUP),1112FLAG_END,1113};1114
1115UNUSED static const struct flags mmap_flags[] = {1116FLAG_TARGET_MASK(MAP_SHARED, MAP_TYPE),1117FLAG_TARGET_MASK(MAP_PRIVATE, MAP_TYPE),1118FLAG_TARGET_MASK(MAP_SHARED_VALIDATE, MAP_TYPE),1119FLAG_TARGET(MAP_ANONYMOUS),1120FLAG_TARGET(MAP_DENYWRITE),1121FLAG_TARGET(MAP_EXECUTABLE),1122FLAG_TARGET(MAP_FIXED),1123FLAG_TARGET(MAP_FIXED_NOREPLACE),1124FLAG_TARGET(MAP_GROWSDOWN),1125FLAG_TARGET(MAP_HUGETLB),1126FLAG_TARGET(MAP_LOCKED),1127FLAG_TARGET(MAP_NONBLOCK),1128FLAG_TARGET(MAP_NORESERVE),1129FLAG_TARGET(MAP_POPULATE),1130FLAG_TARGET(MAP_STACK),1131FLAG_TARGET(MAP_SYNC),1132#if TARGET_MAP_UNINITIALIZED != 01133FLAG_TARGET(MAP_UNINITIALIZED),1134#endif1135FLAG_END,1136};1137
1138#ifndef CLONE_PIDFD1139# define CLONE_PIDFD 0x000010001140#endif1141
1142UNUSED static const struct flags clone_flags[] = {1143FLAG_GENERIC(CLONE_VM),1144FLAG_GENERIC(CLONE_FS),1145FLAG_GENERIC(CLONE_FILES),1146FLAG_GENERIC(CLONE_SIGHAND),1147FLAG_GENERIC(CLONE_PIDFD),1148FLAG_GENERIC(CLONE_PTRACE),1149FLAG_GENERIC(CLONE_VFORK),1150FLAG_GENERIC(CLONE_PARENT),1151FLAG_GENERIC(CLONE_THREAD),1152FLAG_GENERIC(CLONE_NEWNS),1153FLAG_GENERIC(CLONE_SYSVSEM),1154FLAG_GENERIC(CLONE_SETTLS),1155FLAG_GENERIC(CLONE_PARENT_SETTID),1156FLAG_GENERIC(CLONE_CHILD_CLEARTID),1157FLAG_GENERIC(CLONE_DETACHED),1158FLAG_GENERIC(CLONE_UNTRACED),1159FLAG_GENERIC(CLONE_CHILD_SETTID),1160#if defined(CLONE_NEWUTS)1161FLAG_GENERIC(CLONE_NEWUTS),1162#endif1163#if defined(CLONE_NEWIPC)1164FLAG_GENERIC(CLONE_NEWIPC),1165#endif1166#if defined(CLONE_NEWUSER)1167FLAG_GENERIC(CLONE_NEWUSER),1168#endif1169#if defined(CLONE_NEWPID)1170FLAG_GENERIC(CLONE_NEWPID),1171#endif1172#if defined(CLONE_NEWNET)1173FLAG_GENERIC(CLONE_NEWNET),1174#endif1175#if defined(CLONE_NEWCGROUP)1176FLAG_GENERIC(CLONE_NEWCGROUP),1177#endif1178#if defined(CLONE_NEWTIME)1179FLAG_GENERIC(CLONE_NEWTIME),1180#endif1181#if defined(CLONE_IO)1182FLAG_GENERIC(CLONE_IO),1183#endif1184FLAG_END,1185};1186
1187UNUSED static const struct flags execveat_flags[] = {1188#ifdef AT_EMPTY_PATH1189FLAG_GENERIC(AT_EMPTY_PATH),1190#endif1191#ifdef AT_SYMLINK_NOFOLLOW1192FLAG_GENERIC(AT_SYMLINK_NOFOLLOW),1193#endif1194FLAG_END,1195};1196
1197UNUSED static const struct flags msg_flags[] = {1198/* send */1199FLAG_GENERIC(MSG_CONFIRM),1200FLAG_GENERIC(MSG_DONTROUTE),1201FLAG_GENERIC(MSG_DONTWAIT),1202FLAG_GENERIC(MSG_EOR),1203FLAG_GENERIC(MSG_MORE),1204FLAG_GENERIC(MSG_NOSIGNAL),1205FLAG_GENERIC(MSG_OOB),1206/* recv */1207FLAG_GENERIC(MSG_CMSG_CLOEXEC),1208FLAG_GENERIC(MSG_ERRQUEUE),1209FLAG_GENERIC(MSG_PEEK),1210FLAG_GENERIC(MSG_TRUNC),1211FLAG_GENERIC(MSG_WAITALL),1212/* recvmsg */1213FLAG_GENERIC(MSG_CTRUNC),1214FLAG_END,1215};1216
1217UNUSED static const struct flags statx_flags[] = {1218#ifdef AT_EMPTY_PATH1219FLAG_GENERIC(AT_EMPTY_PATH),1220#endif1221#ifdef AT_NO_AUTOMOUNT1222FLAG_GENERIC(AT_NO_AUTOMOUNT),1223#endif1224#ifdef AT_SYMLINK_NOFOLLOW1225FLAG_GENERIC(AT_SYMLINK_NOFOLLOW),1226#endif1227#ifdef AT_STATX_SYNC_AS_STAT1228FLAG_GENERIC_MASK(AT_STATX_SYNC_AS_STAT, AT_STATX_SYNC_TYPE),1229#endif1230#ifdef AT_STATX_FORCE_SYNC1231FLAG_GENERIC_MASK(AT_STATX_FORCE_SYNC, AT_STATX_SYNC_TYPE),1232#endif1233#ifdef AT_STATX_DONT_SYNC1234FLAG_GENERIC_MASK(AT_STATX_DONT_SYNC, AT_STATX_SYNC_TYPE),1235#endif1236FLAG_END,1237};1238
1239UNUSED static const struct flags statx_mask[] = {1240/* This must come first, because it includes everything. */
1241#ifdef STATX_ALL1242FLAG_GENERIC(STATX_ALL),1243#endif1244/* This must come second; it includes everything except STATX_BTIME. */
1245#ifdef STATX_BASIC_STATS1246FLAG_GENERIC(STATX_BASIC_STATS),1247#endif1248#ifdef STATX_TYPE1249FLAG_GENERIC(STATX_TYPE),1250#endif1251#ifdef STATX_MODE1252FLAG_GENERIC(STATX_MODE),1253#endif1254#ifdef STATX_NLINK1255FLAG_GENERIC(STATX_NLINK),1256#endif1257#ifdef STATX_UID1258FLAG_GENERIC(STATX_UID),1259#endif1260#ifdef STATX_GID1261FLAG_GENERIC(STATX_GID),1262#endif1263#ifdef STATX_ATIME1264FLAG_GENERIC(STATX_ATIME),1265#endif1266#ifdef STATX_MTIME1267FLAG_GENERIC(STATX_MTIME),1268#endif1269#ifdef STATX_CTIME1270FLAG_GENERIC(STATX_CTIME),1271#endif1272#ifdef STATX_INO1273FLAG_GENERIC(STATX_INO),1274#endif1275#ifdef STATX_SIZE1276FLAG_GENERIC(STATX_SIZE),1277#endif1278#ifdef STATX_BLOCKS1279FLAG_GENERIC(STATX_BLOCKS),1280#endif1281#ifdef STATX_BTIME1282FLAG_GENERIC(STATX_BTIME),1283#endif1284FLAG_END,1285};1286
1287UNUSED static const struct flags falloc_flags[] = {1288FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),1289FLAG_GENERIC(FALLOC_FL_PUNCH_HOLE),1290#ifdef FALLOC_FL_NO_HIDE_STALE1291FLAG_GENERIC(FALLOC_FL_NO_HIDE_STALE),1292#endif1293#ifdef FALLOC_FL_COLLAPSE_RANGE1294FLAG_GENERIC(FALLOC_FL_COLLAPSE_RANGE),1295#endif1296#ifdef FALLOC_FL_ZERO_RANGE1297FLAG_GENERIC(FALLOC_FL_ZERO_RANGE),1298#endif1299#ifdef FALLOC_FL_INSERT_RANGE1300FLAG_GENERIC(FALLOC_FL_INSERT_RANGE),1301#endif1302#ifdef FALLOC_FL_UNSHARE_RANGE1303FLAG_GENERIC(FALLOC_FL_UNSHARE_RANGE),1304#endif1305};1306
1307UNUSED static const struct flags termios_iflags[] = {1308FLAG_TARGET(IGNBRK),1309FLAG_TARGET(BRKINT),1310FLAG_TARGET(IGNPAR),1311FLAG_TARGET(PARMRK),1312FLAG_TARGET(INPCK),1313FLAG_TARGET(ISTRIP),1314FLAG_TARGET(INLCR),1315FLAG_TARGET(IGNCR),1316FLAG_TARGET(ICRNL),1317FLAG_TARGET(IUCLC),1318FLAG_TARGET(IXON),1319FLAG_TARGET(IXANY),1320FLAG_TARGET(IXOFF),1321FLAG_TARGET(IMAXBEL),1322FLAG_TARGET(IUTF8),1323FLAG_END,1324};1325
1326UNUSED static const struct flags termios_oflags[] = {1327FLAG_TARGET(OPOST),1328FLAG_TARGET(OLCUC),1329FLAG_TARGET(ONLCR),1330FLAG_TARGET(OCRNL),1331FLAG_TARGET(ONOCR),1332FLAG_TARGET(ONLRET),1333FLAG_TARGET(OFILL),1334FLAG_TARGET(OFDEL),1335FLAG_END,1336};1337
1338UNUSED static struct enums termios_oflags_NLDLY[] = {1339ENUM_TARGET(NL0),1340ENUM_TARGET(NL1),1341ENUM_END,1342};1343
1344UNUSED static struct enums termios_oflags_CRDLY[] = {1345ENUM_TARGET(CR0),1346ENUM_TARGET(CR1),1347ENUM_TARGET(CR2),1348ENUM_TARGET(CR3),1349ENUM_END,1350};1351
1352UNUSED static struct enums termios_oflags_TABDLY[] = {1353ENUM_TARGET(TAB0),1354ENUM_TARGET(TAB1),1355ENUM_TARGET(TAB2),1356ENUM_TARGET(TAB3),1357ENUM_END,1358};1359
1360UNUSED static struct enums termios_oflags_VTDLY[] = {1361ENUM_TARGET(VT0),1362ENUM_TARGET(VT1),1363ENUM_END,1364};1365
1366UNUSED static struct enums termios_oflags_FFDLY[] = {1367ENUM_TARGET(FF0),1368ENUM_TARGET(FF1),1369ENUM_END,1370};1371
1372UNUSED static struct enums termios_oflags_BSDLY[] = {1373ENUM_TARGET(BS0),1374ENUM_TARGET(BS1),1375ENUM_END,1376};1377
1378UNUSED static struct enums termios_cflags_CBAUD[] = {1379ENUM_TARGET(B0),1380ENUM_TARGET(B50),1381ENUM_TARGET(B75),1382ENUM_TARGET(B110),1383ENUM_TARGET(B134),1384ENUM_TARGET(B150),1385ENUM_TARGET(B200),1386ENUM_TARGET(B300),1387ENUM_TARGET(B600),1388ENUM_TARGET(B1200),1389ENUM_TARGET(B1800),1390ENUM_TARGET(B2400),1391ENUM_TARGET(B4800),1392ENUM_TARGET(B9600),1393ENUM_TARGET(B19200),1394ENUM_TARGET(B38400),1395ENUM_TARGET(B57600),1396ENUM_TARGET(B115200),1397ENUM_TARGET(B230400),1398ENUM_TARGET(B460800),1399ENUM_END,1400};1401
1402UNUSED static struct enums termios_cflags_CSIZE[] = {1403ENUM_TARGET(CS5),1404ENUM_TARGET(CS6),1405ENUM_TARGET(CS7),1406ENUM_TARGET(CS8),1407ENUM_END,1408};1409
1410UNUSED static const struct flags termios_cflags[] = {1411FLAG_TARGET(CSTOPB),1412FLAG_TARGET(CREAD),1413FLAG_TARGET(PARENB),1414FLAG_TARGET(PARODD),1415FLAG_TARGET(HUPCL),1416FLAG_TARGET(CLOCAL),1417FLAG_TARGET(CRTSCTS),1418FLAG_END,1419};1420
1421UNUSED static const struct flags termios_lflags[] = {1422FLAG_TARGET(ISIG),1423FLAG_TARGET(ICANON),1424FLAG_TARGET(XCASE),1425FLAG_TARGET(ECHO),1426FLAG_TARGET(ECHOE),1427FLAG_TARGET(ECHOK),1428FLAG_TARGET(ECHONL),1429FLAG_TARGET(NOFLSH),1430FLAG_TARGET(TOSTOP),1431FLAG_TARGET(ECHOCTL),1432FLAG_TARGET(ECHOPRT),1433FLAG_TARGET(ECHOKE),1434FLAG_TARGET(FLUSHO),1435FLAG_TARGET(PENDIN),1436FLAG_TARGET(IEXTEN),1437FLAG_TARGET(EXTPROC),1438FLAG_END,1439};1440
1441#ifdef TARGET_NR_mlockall1442static const struct flags mlockall_flags[] = {1443FLAG_TARGET(MCL_CURRENT),1444FLAG_TARGET(MCL_FUTURE),1445#ifdef MCL_ONFAULT1446FLAG_TARGET(MCL_ONFAULT),1447#endif1448FLAG_END,1449};1450#endif1451
1452/* IDs of the various system clocks */
1453#define TARGET_CLOCK_REALTIME 01454#define TARGET_CLOCK_MONOTONIC 11455#define TARGET_CLOCK_PROCESS_CPUTIME_ID 21456#define TARGET_CLOCK_THREAD_CPUTIME_ID 31457#define TARGET_CLOCK_MONOTONIC_RAW 41458#define TARGET_CLOCK_REALTIME_COARSE 51459#define TARGET_CLOCK_MONOTONIC_COARSE 61460#define TARGET_CLOCK_BOOTTIME 71461#define TARGET_CLOCK_REALTIME_ALARM 81462#define TARGET_CLOCK_BOOTTIME_ALARM 91463#define TARGET_CLOCK_SGI_CYCLE 101464#define TARGET_CLOCK_TAI 111465
1466UNUSED static struct enums clockids[] = {1467ENUM_TARGET(CLOCK_REALTIME),1468ENUM_TARGET(CLOCK_MONOTONIC),1469ENUM_TARGET(CLOCK_PROCESS_CPUTIME_ID),1470ENUM_TARGET(CLOCK_THREAD_CPUTIME_ID),1471ENUM_TARGET(CLOCK_MONOTONIC_RAW),1472ENUM_TARGET(CLOCK_REALTIME_COARSE),1473ENUM_TARGET(CLOCK_MONOTONIC_COARSE),1474ENUM_TARGET(CLOCK_BOOTTIME),1475ENUM_TARGET(CLOCK_REALTIME_ALARM),1476ENUM_TARGET(CLOCK_BOOTTIME_ALARM),1477ENUM_TARGET(CLOCK_SGI_CYCLE),1478ENUM_TARGET(CLOCK_TAI),1479ENUM_END,1480};1481
1482UNUSED static struct enums itimer_types[] = {1483ENUM_GENERIC(ITIMER_REAL),1484ENUM_GENERIC(ITIMER_VIRTUAL),1485ENUM_GENERIC(ITIMER_PROF),1486ENUM_END,1487};1488
1489/*
1490* print_xxx utility functions. These are used to print syscall
1491* parameters in certain format. All of these have parameter
1492* named 'last'. This parameter is used to add comma to output
1493* when last == 0.
1494*/
1495
1496static const char *1497get_comma(int last)1498{
1499return ((last) ? "" : ",");1500}
1501
1502static void1503print_flags(const struct flags *f, abi_long flags, int last)1504{
1505const char *sep = "";1506int n;1507
1508for (n = 0; f->f_string != NULL; f++) {1509if ((flags & f->f_mask) == f->f_value) {1510qemu_log("%s%s", sep, f->f_string);1511flags &= ~f->f_mask;1512sep = "|";1513n++;1514}1515}1516
1517if (n > 0) {1518/* print rest of the flags as numeric */1519if (flags != 0) {1520qemu_log("%s%#x%s", sep, (unsigned int)flags, get_comma(last));1521} else {1522qemu_log("%s", get_comma(last));1523}1524} else {1525/* no string version of flags found, print them in hex then */1526qemu_log("%#x%s", (unsigned int)flags, get_comma(last));1527}1528}
1529
1530static void1531print_enums(const struct enums *e, abi_long enum_arg, int last)1532{
1533for (; e->e_string != NULL; e++) {1534if (e->e_value == enum_arg) {1535qemu_log("%s", e->e_string);1536break;1537}1538}1539
1540if (e->e_string == NULL) {1541qemu_log("%#x", (unsigned int)enum_arg);1542}1543
1544qemu_log("%s", get_comma(last));1545}
1546
1547static void1548print_at_dirfd(abi_long dirfd, int last)1549{
1550#ifdef AT_FDCWD1551if (dirfd == AT_FDCWD) {1552qemu_log("AT_FDCWD%s", get_comma(last));1553return;1554}1555#endif1556qemu_log("%d%s", (int)dirfd, get_comma(last));1557}
1558
1559static void1560print_file_mode(abi_long mode, int last)1561{
1562const char *sep = "";1563const struct flags *m;1564
1565if (mode == 0) {1566qemu_log("000%s", get_comma(last));1567return;1568}1569
1570for (m = &mode_flags[0]; m->f_string != NULL; m++) {1571if ((m->f_value & mode) == m->f_value) {1572qemu_log("%s%s", m->f_string, sep);1573sep = "|";1574mode &= ~m->f_value;1575break;1576}1577}1578
1579mode &= ~S_IFMT;1580/* print rest of the mode as octal */1581if (mode != 0)1582qemu_log("%s%#o", sep, (unsigned int)mode);1583
1584qemu_log("%s", get_comma(last));1585}
1586
1587static void1588print_open_flags(abi_long flags, int last)1589{
1590print_flags(open_access_flags, flags & TARGET_O_ACCMODE, 1);1591flags &= ~TARGET_O_ACCMODE;1592if (flags == 0) {1593qemu_log("%s", get_comma(last));1594return;1595}1596qemu_log("|");1597print_flags(open_flags, flags, last);1598}
1599
1600static void1601print_syscall_prologue(const struct syscallname *sc)1602{
1603qemu_log("%s(", sc->name);1604}
1605
1606/*ARGSUSED*/
1607static void1608print_syscall_epilogue(const struct syscallname *sc)1609{
1610(void)sc;1611qemu_log(")");1612}
1613
1614static void1615print_string(abi_long addr, int last)1616{
1617char *s;1618
1619if ((s = lock_user_string(addr)) != NULL) {1620qemu_log("\"%s\"%s", s, get_comma(last));1621unlock_user(s, addr, 0);1622} else {1623/* can't get string out of it, so print it as pointer */1624print_pointer(addr, last);1625}1626}
1627
1628#define MAX_PRINT_BUF 401629static void1630print_buf(abi_long addr, abi_long len, int last)1631{
1632uint8_t *s;1633int i;1634
1635s = lock_user(VERIFY_READ, addr, len, 1);1636if (s) {1637qemu_log("\"");1638for (i = 0; i < MAX_PRINT_BUF && i < len; i++) {1639if (isprint(s[i])) {1640qemu_log("%c", s[i]);1641} else {1642qemu_log("\\%o", s[i]);1643}1644}1645qemu_log("\"");1646if (i != len) {1647qemu_log("...");1648}1649if (!last) {1650qemu_log(",");1651}1652unlock_user(s, addr, 0);1653} else {1654print_pointer(addr, last);1655}1656}
1657
1658/*
1659* Prints out raw parameter using given format. Caller needs
1660* to do byte swapping if needed.
1661*/
1662static void1663print_raw_param(const char *fmt, abi_long param, int last)1664{
1665char format[64];1666
1667(void) snprintf(format, sizeof (format), "%s%s", fmt, get_comma(last));1668qemu_log(format, param);1669}
1670
1671/*
1672* Same as print_raw_param() but prints out raw 64-bit parameter.
1673*/
1674static void1675print_raw_param64(const char *fmt, long long param, int last)1676{
1677char format[64];1678
1679(void)snprintf(format, sizeof(format), "%s%s", fmt, get_comma(last));1680qemu_log(format, param);1681}
1682
1683
1684static void1685print_pointer(abi_long p, int last)1686{
1687if (p == 0)1688qemu_log("NULL%s", get_comma(last));1689else1690qemu_log("0x" TARGET_ABI_FMT_lx "%s", p, get_comma(last));1691}
1692
1693/*
1694* Reads 32-bit (int) number from guest address space from
1695* address 'addr' and prints it.
1696*/
1697static void1698print_number(abi_long addr, int last)1699{
1700if (addr == 0) {1701qemu_log("NULL%s", get_comma(last));1702} else {1703int num;1704
1705get_user_s32(num, addr);1706qemu_log("[%d]%s", num, get_comma(last));1707}1708}
1709
1710static void1711print_timeval(abi_ulong tv_addr, int last)1712{
1713if( tv_addr ) {1714struct target_timeval *tv;1715
1716tv = lock_user(VERIFY_READ, tv_addr, sizeof(*tv), 1);1717if (!tv) {1718print_pointer(tv_addr, last);1719return;1720}1721qemu_log("{tv_sec = " TARGET_ABI_FMT_ld1722",tv_usec = " TARGET_ABI_FMT_ld "}%s",1723tswapal(tv->tv_sec), tswapal(tv->tv_usec), get_comma(last));1724unlock_user(tv, tv_addr, 0);1725} else1726qemu_log("NULL%s", get_comma(last));1727}
1728
1729static void1730print_timespec(abi_ulong ts_addr, int last)1731{
1732if (ts_addr) {1733struct target_timespec *ts;1734
1735ts = lock_user(VERIFY_READ, ts_addr, sizeof(*ts), 1);1736if (!ts) {1737print_pointer(ts_addr, last);1738return;1739}1740qemu_log("{tv_sec = " TARGET_ABI_FMT_ld1741",tv_nsec = " TARGET_ABI_FMT_ld "}%s",1742tswapal(ts->tv_sec), tswapal(ts->tv_nsec), get_comma(last));1743unlock_user(ts, ts_addr, 0);1744} else {1745qemu_log("NULL%s", get_comma(last));1746}1747}
1748
1749static void1750print_timespec64(abi_ulong ts_addr, int last)1751{
1752if (ts_addr) {1753struct target__kernel_timespec *ts;1754
1755ts = lock_user(VERIFY_READ, ts_addr, sizeof(*ts), 1);1756if (!ts) {1757print_pointer(ts_addr, last);1758return;1759}1760print_raw_param64("{tv_sec=%" PRId64, tswap64(ts->tv_sec), 0);1761print_raw_param64("tv_nsec=%" PRId64 "}", tswap64(ts->tv_nsec), last);1762unlock_user(ts, ts_addr, 0);1763} else {1764qemu_log("NULL%s", get_comma(last));1765}1766}
1767
1768static void1769print_timezone(abi_ulong tz_addr, int last)1770{
1771if (tz_addr) {1772struct target_timezone *tz;1773
1774tz = lock_user(VERIFY_READ, tz_addr, sizeof(*tz), 1);1775if (!tz) {1776print_pointer(tz_addr, last);1777return;1778}1779qemu_log("{%d,%d}%s", tswap32(tz->tz_minuteswest),1780tswap32(tz->tz_dsttime), get_comma(last));1781unlock_user(tz, tz_addr, 0);1782} else {1783qemu_log("NULL%s", get_comma(last));1784}1785}
1786
1787static void1788print_itimerval(abi_ulong it_addr, int last)1789{
1790if (it_addr) {1791qemu_log("{it_interval=");1792print_timeval(it_addr +1793offsetof(struct target_itimerval, it_interval), 0);1794qemu_log("it_value=");1795print_timeval(it_addr +1796offsetof(struct target_itimerval, it_value), 0);1797qemu_log("}%s", get_comma(last));1798} else {1799qemu_log("NULL%s", get_comma(last));1800}1801}
1802
1803void
1804print_termios(void *arg)1805{
1806const struct target_termios *target = arg;1807
1808target_tcflag_t iflags = tswap32(target->c_iflag);1809target_tcflag_t oflags = tswap32(target->c_oflag);1810target_tcflag_t cflags = tswap32(target->c_cflag);1811target_tcflag_t lflags = tswap32(target->c_lflag);1812
1813qemu_log("{");1814
1815qemu_log("c_iflag = ");1816print_flags(termios_iflags, iflags, 0);1817
1818qemu_log("c_oflag = ");1819target_tcflag_t oflags_clean = oflags & ~(TARGET_NLDLY | TARGET_CRDLY |1820TARGET_TABDLY | TARGET_BSDLY |1821TARGET_VTDLY | TARGET_FFDLY);1822print_flags(termios_oflags, oflags_clean, 0);1823if (oflags & TARGET_NLDLY) {1824print_enums(termios_oflags_NLDLY, oflags & TARGET_NLDLY, 0);1825}1826if (oflags & TARGET_CRDLY) {1827print_enums(termios_oflags_CRDLY, oflags & TARGET_CRDLY, 0);1828}1829if (oflags & TARGET_TABDLY) {1830print_enums(termios_oflags_TABDLY, oflags & TARGET_TABDLY, 0);1831}1832if (oflags & TARGET_BSDLY) {1833print_enums(termios_oflags_BSDLY, oflags & TARGET_BSDLY, 0);1834}1835if (oflags & TARGET_VTDLY) {1836print_enums(termios_oflags_VTDLY, oflags & TARGET_VTDLY, 0);1837}1838if (oflags & TARGET_FFDLY) {1839print_enums(termios_oflags_FFDLY, oflags & TARGET_FFDLY, 0);1840}1841
1842qemu_log("c_cflag = ");1843if (cflags & TARGET_CBAUD) {1844print_enums(termios_cflags_CBAUD, cflags & TARGET_CBAUD, 0);1845}1846if (cflags & TARGET_CSIZE) {1847print_enums(termios_cflags_CSIZE, cflags & TARGET_CSIZE, 0);1848}1849target_tcflag_t cflags_clean = cflags & ~(TARGET_CBAUD | TARGET_CSIZE);1850print_flags(termios_cflags, cflags_clean, 0);1851
1852qemu_log("c_lflag = ");1853print_flags(termios_lflags, lflags, 0);1854
1855qemu_log("c_cc = ");1856qemu_log("\"%s\",", target->c_cc);1857
1858qemu_log("c_line = ");1859print_raw_param("\'%c\'", target->c_line, 1);1860
1861qemu_log("}");1862}
1863
1864#undef UNUSED1865
1866#ifdef TARGET_NR_accept1867static void1868print_accept(CPUArchState *cpu_env, const struct syscallname *name,1869abi_long arg0, abi_long arg1, abi_long arg2,1870abi_long arg3, abi_long arg4, abi_long arg5)1871{
1872print_syscall_prologue(name);1873print_raw_param("%d", arg0, 0);1874print_pointer(arg1, 0);1875print_number(arg2, 1);1876print_syscall_epilogue(name);1877}
1878#endif1879
1880#ifdef TARGET_NR_access1881static void1882print_access(CPUArchState *cpu_env, const struct syscallname *name,1883abi_long arg0, abi_long arg1, abi_long arg2,1884abi_long arg3, abi_long arg4, abi_long arg5)1885{
1886print_syscall_prologue(name);1887print_string(arg0, 0);1888print_flags(access_flags, arg1, 1);1889print_syscall_epilogue(name);1890}
1891#endif1892
1893#ifdef TARGET_NR_acct1894static void1895print_acct(CPUArchState *cpu_env, const struct syscallname *name,1896abi_long arg0, abi_long arg1, abi_long arg2,1897abi_long arg3, abi_long arg4, abi_long arg5)1898{
1899print_syscall_prologue(name);1900print_string(arg0, 1);1901print_syscall_epilogue(name);1902}
1903#endif1904
1905#ifdef TARGET_NR_brk1906static void1907print_brk(CPUArchState *cpu_env, const struct syscallname *name,1908abi_long arg0, abi_long arg1, abi_long arg2,1909abi_long arg3, abi_long arg4, abi_long arg5)1910{
1911print_syscall_prologue(name);1912print_pointer(arg0, 1);1913print_syscall_epilogue(name);1914}
1915#endif1916
1917#ifdef TARGET_NR_chdir1918static void1919print_chdir(CPUArchState *cpu_env, const struct syscallname *name,1920abi_long arg0, abi_long arg1, abi_long arg2,1921abi_long arg3, abi_long arg4, abi_long arg5)1922{
1923print_syscall_prologue(name);1924print_string(arg0, 1);1925print_syscall_epilogue(name);1926}
1927#endif1928
1929#ifdef TARGET_NR_chroot1930static void1931print_chroot(CPUArchState *cpu_env, const struct syscallname *name,1932abi_long arg0, abi_long arg1, abi_long arg2,1933abi_long arg3, abi_long arg4, abi_long arg5)1934{
1935print_syscall_prologue(name);1936print_string(arg0, 1);1937print_syscall_epilogue(name);1938}
1939#endif1940
1941#ifdef TARGET_NR_chmod1942static void1943print_chmod(CPUArchState *cpu_env, const struct syscallname *name,1944abi_long arg0, abi_long arg1, abi_long arg2,1945abi_long arg3, abi_long arg4, abi_long arg5)1946{
1947print_syscall_prologue(name);1948print_string(arg0, 0);1949print_file_mode(arg1, 1);1950print_syscall_epilogue(name);1951}
1952#endif1953
1954#if defined(TARGET_NR_chown) || defined(TARGET_NR_lchown)1955static void1956print_chown(CPUArchState *cpu_env, const struct syscallname *name,1957abi_long arg0, abi_long arg1, abi_long arg2,1958abi_long arg3, abi_long arg4, abi_long arg5)1959{
1960print_syscall_prologue(name);1961print_string(arg0, 0);1962print_raw_param("%d", arg1, 0);1963print_raw_param("%d", arg2, 1);1964print_syscall_epilogue(name);1965}
1966#define print_lchown print_chown1967#endif1968
1969#ifdef TARGET_NR_clock_adjtime1970static void1971print_clock_adjtime(CPUArchState *cpu_env, const struct syscallname *name,1972abi_long arg0, abi_long arg1, abi_long arg2,1973abi_long arg3, abi_long arg4, abi_long arg5)1974{
1975print_syscall_prologue(name);1976print_enums(clockids, arg0, 0);1977print_pointer(arg1, 1);1978print_syscall_epilogue(name);1979}
1980#endif1981
1982#ifdef TARGET_NR_clone1983static void do_print_clone(unsigned int flags, abi_ulong newsp,1984abi_ulong parent_tidptr, target_ulong newtls,1985abi_ulong child_tidptr)1986{
1987print_flags(clone_flags, flags, 0);1988print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx, newsp, 0);1989print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx, parent_tidptr, 0);1990print_raw_param("tls=0x" TARGET_ABI_FMT_lx, newtls, 0);1991print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx, child_tidptr, 1);1992}
1993
1994static void1995print_clone(CPUArchState *cpu_env, const struct syscallname *name,1996abi_long arg1, abi_long arg2, abi_long arg3,1997abi_long arg4, abi_long arg5, abi_long arg6)1998{
1999print_syscall_prologue(name);2000#if defined(TARGET_MICROBLAZE)2001do_print_clone(arg1, arg2, arg4, arg6, arg5);2002#elif defined(TARGET_CLONE_BACKWARDS)2003do_print_clone(arg1, arg2, arg3, arg4, arg5);2004#elif defined(TARGET_CLONE_BACKWARDS2)2005do_print_clone(arg2, arg1, arg3, arg5, arg4);2006#else2007do_print_clone(arg1, arg2, arg3, arg5, arg4);2008#endif2009print_syscall_epilogue(name);2010}
2011#endif2012
2013#ifdef TARGET_NR_creat2014static void2015print_creat(CPUArchState *cpu_env, const struct syscallname *name,2016abi_long arg0, abi_long arg1, abi_long arg2,2017abi_long arg3, abi_long arg4, abi_long arg5)2018{
2019print_syscall_prologue(name);2020print_string(arg0, 0);2021print_file_mode(arg1, 1);2022print_syscall_epilogue(name);2023}
2024#endif2025
2026#ifdef TARGET_NR_execv2027static void2028print_execv(CPUArchState *cpu_env, const struct syscallname *name,2029abi_long arg0, abi_long arg1, abi_long arg2,2030abi_long arg3, abi_long arg4, abi_long arg5)2031{
2032print_syscall_prologue(name);2033print_string(arg0, 0);2034print_raw_param("0x" TARGET_ABI_FMT_lx, arg1, 1);2035print_syscall_epilogue(name);2036}
2037#endif2038
2039static void2040print_execve_argv(abi_long argv, int last)2041{
2042abi_ulong arg_ptr_addr;2043char *s;2044
2045qemu_log("{");2046for (arg_ptr_addr = argv; ; arg_ptr_addr += sizeof(abi_ulong)) {2047abi_ulong *arg_ptr, arg_addr;2048
2049arg_ptr = lock_user(VERIFY_READ, arg_ptr_addr, sizeof(abi_ulong), 1);2050if (!arg_ptr) {2051return;2052}2053arg_addr = tswapal(*arg_ptr);2054unlock_user(arg_ptr, arg_ptr_addr, 0);2055if (!arg_addr) {2056break;2057}2058s = lock_user_string(arg_addr);2059if (s) {2060qemu_log("\"%s\",", s);2061unlock_user(s, arg_addr, 0);2062}2063}2064qemu_log("NULL}%s", get_comma(last));2065}
2066
2067static void2068print_execve(CPUArchState *cpu_env, const struct syscallname *name,2069abi_long arg1, abi_long arg2, abi_long arg3,2070abi_long arg4, abi_long arg5, abi_long arg6)2071{
2072print_syscall_prologue(name);2073print_string(arg1, 0);2074print_execve_argv(arg2, 1);2075print_syscall_epilogue(name);2076}
2077
2078static void2079print_execveat(CPUArchState *cpu_env, const struct syscallname *name,2080abi_long arg1, abi_long arg2, abi_long arg3,2081abi_long arg4, abi_long arg5, abi_long arg6)2082{
2083print_syscall_prologue(name);2084print_at_dirfd(arg1, 0);2085print_string(arg2, 0);2086print_execve_argv(arg3, 0);2087print_flags(execveat_flags, arg5, 1);2088print_syscall_epilogue(name);2089}
2090
2091#if defined(TARGET_NR_faccessat) || defined(TARGET_NR_faccessat2)2092static void2093print_faccessat(CPUArchState *cpu_env, const struct syscallname *name,2094abi_long arg0, abi_long arg1, abi_long arg2,2095abi_long arg3, abi_long arg4, abi_long arg5)2096{
2097print_syscall_prologue(name);2098print_at_dirfd(arg0, 0);2099print_string(arg1, 0);2100print_flags(access_flags, arg2, 0);2101print_flags(at_file_flags, arg3, 1);2102print_syscall_epilogue(name);2103}
2104#endif2105
2106#ifdef TARGET_NR_fallocate2107static void2108print_fallocate(CPUArchState *cpu_env, const struct syscallname *name,2109abi_long arg0, abi_long arg1, abi_long arg2,2110abi_long arg3, abi_long arg4, abi_long arg5)2111{
2112print_syscall_prologue(name);2113print_raw_param("%d", arg0, 0);2114print_flags(falloc_flags, arg1, 0);2115#if TARGET_ABI_BITS == 322116print_raw_param("%" PRIu64, target_offset64(arg2, arg3), 0);2117print_raw_param("%" PRIu64, target_offset64(arg4, arg5), 1);2118#else2119print_raw_param(TARGET_ABI_FMT_ld, arg2, 0);2120print_raw_param(TARGET_ABI_FMT_ld, arg3, 1);2121#endif2122print_syscall_epilogue(name);2123}
2124#endif2125
2126#ifdef TARGET_NR_fchmodat2127static void2128print_fchmodat(CPUArchState *cpu_env, const struct syscallname *name,2129abi_long arg0, abi_long arg1, abi_long arg2,2130abi_long arg3, abi_long arg4, abi_long arg5)2131{
2132print_syscall_prologue(name);2133print_at_dirfd(arg0, 0);2134print_string(arg1, 0);2135print_file_mode(arg2, 0);2136print_flags(at_file_flags, arg3, 1);2137print_syscall_epilogue(name);2138}
2139#endif2140
2141#ifdef TARGET_NR_fchownat2142static void2143print_fchownat(CPUArchState *cpu_env, const struct syscallname *name,2144abi_long arg0, abi_long arg1, abi_long arg2,2145abi_long arg3, abi_long arg4, abi_long arg5)2146{
2147print_syscall_prologue(name);2148print_at_dirfd(arg0, 0);2149print_string(arg1, 0);2150print_raw_param("%d", arg2, 0);2151print_raw_param("%d", arg3, 0);2152print_flags(at_file_flags, arg4, 1);2153print_syscall_epilogue(name);2154}
2155#endif2156
2157#if defined(TARGET_NR_fcntl) || defined(TARGET_NR_fcntl64)2158static void2159print_fcntl(CPUArchState *cpu_env, const struct syscallname *name,2160abi_long arg0, abi_long arg1, abi_long arg2,2161abi_long arg3, abi_long arg4, abi_long arg5)2162{
2163print_syscall_prologue(name);2164print_raw_param("%d", arg0, 0);2165switch(arg1) {2166case TARGET_F_DUPFD:2167qemu_log("F_DUPFD,");2168print_raw_param(TARGET_ABI_FMT_ld, arg2, 1);2169break;2170case TARGET_F_GETFD:2171qemu_log("F_GETFD");2172break;2173case TARGET_F_SETFD:2174qemu_log("F_SETFD,");2175print_raw_param(TARGET_ABI_FMT_ld, arg2, 1);2176break;2177case TARGET_F_GETFL:2178qemu_log("F_GETFL");2179break;2180case TARGET_F_SETFL:2181qemu_log("F_SETFL,");2182print_open_flags(arg2, 1);2183break;2184case TARGET_F_GETLK:2185qemu_log("F_GETLK,");2186print_pointer(arg2, 1);2187break;2188case TARGET_F_SETLK:2189qemu_log("F_SETLK,");2190print_pointer(arg2, 1);2191break;2192case TARGET_F_SETLKW:2193qemu_log("F_SETLKW,");2194print_pointer(arg2, 1);2195break;2196case TARGET_F_GETOWN:2197qemu_log("F_GETOWN");2198break;2199case TARGET_F_SETOWN:2200qemu_log("F_SETOWN,");2201print_raw_param(TARGET_ABI_FMT_ld, arg2, 0);2202break;2203case TARGET_F_GETSIG:2204qemu_log("F_GETSIG");2205break;2206case TARGET_F_SETSIG:2207qemu_log("F_SETSIG,");2208print_raw_param(TARGET_ABI_FMT_ld, arg2, 0);2209break;2210#if TARGET_ABI_BITS == 322211case TARGET_F_GETLK64:2212qemu_log("F_GETLK64,");2213print_pointer(arg2, 1);2214break;2215case TARGET_F_SETLK64:2216qemu_log("F_SETLK64,");2217print_pointer(arg2, 1);2218break;2219case TARGET_F_SETLKW64:2220qemu_log("F_SETLKW64,");2221print_pointer(arg2, 1);2222break;2223#endif2224case TARGET_F_OFD_GETLK:2225qemu_log("F_OFD_GETLK,");2226print_pointer(arg2, 1);2227break;2228case TARGET_F_OFD_SETLK:2229qemu_log("F_OFD_SETLK,");2230print_pointer(arg2, 1);2231break;2232case TARGET_F_OFD_SETLKW:2233qemu_log("F_OFD_SETLKW,");2234print_pointer(arg2, 1);2235break;2236case TARGET_F_SETLEASE:2237qemu_log("F_SETLEASE,");2238print_raw_param(TARGET_ABI_FMT_ld, arg2, 1);2239break;2240case TARGET_F_GETLEASE:2241qemu_log("F_GETLEASE");2242break;2243#ifdef F_DUPFD_CLOEXEC2244case TARGET_F_DUPFD_CLOEXEC:2245qemu_log("F_DUPFD_CLOEXEC,");2246print_raw_param(TARGET_ABI_FMT_ld, arg2, 1);2247break;2248#endif2249case TARGET_F_NOTIFY:2250qemu_log("F_NOTIFY,");2251print_raw_param(TARGET_ABI_FMT_ld, arg2, 1);2252break;2253#ifdef F_GETOWN_EX2254case TARGET_F_GETOWN_EX:2255qemu_log("F_GETOWN_EX,");2256print_pointer(arg2, 1);2257break;2258#endif2259#ifdef F_SETOWN_EX2260case TARGET_F_SETOWN_EX:2261qemu_log("F_SETOWN_EX,");2262print_pointer(arg2, 1);2263break;2264#endif2265#ifdef F_SETPIPE_SZ2266case TARGET_F_SETPIPE_SZ:2267qemu_log("F_SETPIPE_SZ,");2268print_raw_param(TARGET_ABI_FMT_ld, arg2, 1);2269break;2270case TARGET_F_GETPIPE_SZ:2271qemu_log("F_GETPIPE_SZ");2272break;2273#endif2274#ifdef F_ADD_SEALS2275case TARGET_F_ADD_SEALS:2276qemu_log("F_ADD_SEALS,");2277print_raw_param("0x"TARGET_ABI_FMT_lx, arg2, 1);2278break;2279case TARGET_F_GET_SEALS:2280qemu_log("F_GET_SEALS");2281break;2282#endif2283default:2284print_raw_param(TARGET_ABI_FMT_ld, arg1, 0);2285print_pointer(arg2, 1);2286break;2287}2288print_syscall_epilogue(name);2289}
2290#define print_fcntl64 print_fcntl2291#endif2292
2293#ifdef TARGET_NR_fgetxattr2294static void2295print_fgetxattr(CPUArchState *cpu_env, const struct syscallname *name,2296abi_long arg0, abi_long arg1, abi_long arg2,2297abi_long arg3, abi_long arg4, abi_long arg5)2298{
2299print_syscall_prologue(name);2300print_raw_param("%d", arg0, 0);2301print_string(arg1, 0);2302print_pointer(arg2, 0);2303print_raw_param(TARGET_FMT_lu, arg3, 1);2304print_syscall_epilogue(name);2305}
2306#endif2307
2308#ifdef TARGET_NR_flistxattr2309static void2310print_flistxattr(CPUArchState *cpu_env, const struct syscallname *name,2311abi_long arg0, abi_long arg1, abi_long arg2,2312abi_long arg3, abi_long arg4, abi_long arg5)2313{
2314print_syscall_prologue(name);2315print_raw_param("%d", arg0, 0);2316print_pointer(arg1, 0);2317print_raw_param(TARGET_FMT_lu, arg2, 1);2318print_syscall_epilogue(name);2319}
2320#endif2321
2322#if defined(TARGET_NR_getxattr) || defined(TARGET_NR_lgetxattr)2323static void2324print_getxattr(CPUArchState *cpu_env, const struct syscallname *name,2325abi_long arg0, abi_long arg1, abi_long arg2,2326abi_long arg3, abi_long arg4, abi_long arg5)2327{
2328print_syscall_prologue(name);2329print_string(arg0, 0);2330print_string(arg1, 0);2331print_pointer(arg2, 0);2332print_raw_param(TARGET_FMT_lu, arg3, 1);2333print_syscall_epilogue(name);2334}
2335#define print_lgetxattr print_getxattr2336#endif2337
2338#if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr)2339static void2340print_listxattr(CPUArchState *cpu_env, const struct syscallname *name,2341abi_long arg0, abi_long arg1, abi_long arg2,2342abi_long arg3, abi_long arg4, abi_long arg5)2343{
2344print_syscall_prologue(name);2345print_string(arg0, 0);2346print_pointer(arg1, 0);2347print_raw_param(TARGET_FMT_lu, arg2, 1);2348print_syscall_epilogue(name);2349}
2350#define print_llistxattr print_listxattr2351#endif2352
2353#if defined(TARGET_NR_fremovexattr)2354static void2355print_fremovexattr(CPUArchState *cpu_env, const struct syscallname *name,2356abi_long arg0, abi_long arg1, abi_long arg2,2357abi_long arg3, abi_long arg4, abi_long arg5)2358{
2359print_syscall_prologue(name);2360print_raw_param("%d", arg0, 0);2361print_string(arg1, 1);2362print_syscall_epilogue(name);2363}
2364#endif2365
2366#if defined(TARGET_NR_removexattr) || defined(TARGET_NR_lremovexattr)2367static void2368print_removexattr(CPUArchState *cpu_env, const struct syscallname *name,2369abi_long arg0, abi_long arg1, abi_long arg2,2370abi_long arg3, abi_long arg4, abi_long arg5)2371{
2372print_syscall_prologue(name);2373print_string(arg0, 0);2374print_string(arg1, 1);2375print_syscall_epilogue(name);2376}
2377#define print_lremovexattr print_removexattr2378#endif2379
2380#ifdef TARGET_NR_futimesat2381static void2382print_futimesat(CPUArchState *cpu_env, const struct syscallname *name,2383abi_long arg0, abi_long arg1, abi_long arg2,2384abi_long arg3, abi_long arg4, abi_long arg5)2385{
2386print_syscall_prologue(name);2387print_at_dirfd(arg0, 0);2388print_string(arg1, 0);2389print_timeval(arg2, 0);2390print_timeval(arg2 + sizeof (struct target_timeval), 1);2391print_syscall_epilogue(name);2392}
2393#endif2394
2395#ifdef TARGET_NR_gettimeofday2396static void2397print_gettimeofday(CPUArchState *cpu_env, const struct syscallname *name,2398abi_long arg0, abi_long arg1, abi_long arg2,2399abi_long arg3, abi_long arg4, abi_long arg5)2400{
2401print_syscall_prologue(name);2402print_pointer(arg0, 0);2403print_pointer(arg1, 1);2404print_syscall_epilogue(name);2405}
2406#endif2407
2408#ifdef TARGET_NR_settimeofday2409static void2410print_settimeofday(CPUArchState *cpu_env, const struct syscallname *name,2411abi_long arg0, abi_long arg1, abi_long arg2,2412abi_long arg3, abi_long arg4, abi_long arg5)2413{
2414print_syscall_prologue(name);2415print_timeval(arg0, 0);2416print_timezone(arg1, 1);2417print_syscall_epilogue(name);2418}
2419#endif2420
2421#if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)2422static void2423print_clock_gettime(CPUArchState *cpu_env, const struct syscallname *name,2424abi_long arg0, abi_long arg1, abi_long arg2,2425abi_long arg3, abi_long arg4, abi_long arg5)2426{
2427print_syscall_prologue(name);2428print_enums(clockids, arg0, 0);2429print_pointer(arg1, 1);2430print_syscall_epilogue(name);2431}
2432#define print_clock_getres print_clock_gettime2433#endif2434
2435#if defined(TARGET_NR_clock_gettime64)2436static void2437print_clock_gettime64(CPUArchState *cpu_env, const struct syscallname *name,2438abi_long arg0, abi_long arg1, abi_long arg2,2439abi_long arg3, abi_long arg4, abi_long arg5)2440{
2441print_syscall_prologue(name);2442print_enums(clockids, arg0, 0);2443print_pointer(arg1, 1);2444print_syscall_epilogue(name);2445}
2446#endif2447
2448#ifdef TARGET_NR_clock_settime2449static void2450print_clock_settime(CPUArchState *cpu_env, const struct syscallname *name,2451abi_long arg0, abi_long arg1, abi_long arg2,2452abi_long arg3, abi_long arg4, abi_long arg5)2453{
2454print_syscall_prologue(name);2455print_enums(clockids, arg0, 0);2456print_timespec(arg1, 1);2457print_syscall_epilogue(name);2458}
2459#endif2460
2461#ifdef TARGET_NR_getitimer2462static void2463print_getitimer(CPUArchState *cpu_env, const struct syscallname *name,2464abi_long arg0, abi_long arg1, abi_long arg2,2465abi_long arg3, abi_long arg4, abi_long arg5)2466{
2467print_syscall_prologue(name);2468print_enums(itimer_types, arg0, 0);2469print_pointer(arg1, 1);2470print_syscall_epilogue(name);2471}
2472#endif2473
2474#ifdef TARGET_NR_setitimer2475static void2476print_setitimer(CPUArchState *cpu_env, const struct syscallname *name,2477abi_long arg0, abi_long arg1, abi_long arg2,2478abi_long arg3, abi_long arg4, abi_long arg5)2479{
2480print_syscall_prologue(name);2481print_enums(itimer_types, arg0, 0);2482print_itimerval(arg1, 0);2483print_pointer(arg2, 1);2484print_syscall_epilogue(name);2485}
2486#endif2487
2488#ifdef TARGET_NR_link2489static void2490print_link(CPUArchState *cpu_env, const struct syscallname *name,2491abi_long arg0, abi_long arg1, abi_long arg2,2492abi_long arg3, abi_long arg4, abi_long arg5)2493{
2494print_syscall_prologue(name);2495print_string(arg0, 0);2496print_string(arg1, 1);2497print_syscall_epilogue(name);2498}
2499#endif2500
2501#ifdef TARGET_NR_linkat2502static void2503print_linkat(CPUArchState *cpu_env, const struct syscallname *name,2504abi_long arg0, abi_long arg1, abi_long arg2,2505abi_long arg3, abi_long arg4, abi_long arg5)2506{
2507print_syscall_prologue(name);2508print_at_dirfd(arg0, 0);2509print_string(arg1, 0);2510print_at_dirfd(arg2, 0);2511print_string(arg3, 0);2512print_flags(at_file_flags, arg4, 1);2513print_syscall_epilogue(name);2514}
2515#endif2516
2517#if defined(TARGET_NR__llseek) || defined(TARGET_NR_llseek)2518static void2519print__llseek(CPUArchState *cpu_env, const struct syscallname *name,2520abi_long arg0, abi_long arg1, abi_long arg2,2521abi_long arg3, abi_long arg4, abi_long arg5)2522{
2523const char *whence = "UNKNOWN";2524print_syscall_prologue(name);2525print_raw_param("%d", arg0, 0);2526print_raw_param("%ld", arg1, 0);2527print_raw_param("%ld", arg2, 0);2528print_pointer(arg3, 0);2529switch(arg4) {2530case SEEK_SET: whence = "SEEK_SET"; break;2531case SEEK_CUR: whence = "SEEK_CUR"; break;2532case SEEK_END: whence = "SEEK_END"; break;2533}2534qemu_log("%s", whence);2535print_syscall_epilogue(name);2536}
2537#define print_llseek print__llseek2538#endif2539
2540#ifdef TARGET_NR_lseek2541static void2542print_lseek(CPUArchState *cpu_env, const struct syscallname *name,2543abi_long arg0, abi_long arg1, abi_long arg2,2544abi_long arg3, abi_long arg4, abi_long arg5)2545{
2546print_syscall_prologue(name);2547print_raw_param("%d", arg0, 0);2548print_raw_param(TARGET_ABI_FMT_ld, arg1, 0);2549switch (arg2) {2550case SEEK_SET:2551qemu_log("SEEK_SET"); break;2552case SEEK_CUR:2553qemu_log("SEEK_CUR"); break;2554case SEEK_END:2555qemu_log("SEEK_END"); break;2556#ifdef SEEK_DATA2557case SEEK_DATA:2558qemu_log("SEEK_DATA"); break;2559#endif2560#ifdef SEEK_HOLE2561case SEEK_HOLE:2562qemu_log("SEEK_HOLE"); break;2563#endif2564default:2565print_raw_param("%#x", arg2, 1);2566}2567print_syscall_epilogue(name);2568}
2569#endif2570
2571#ifdef TARGET_NR_truncate2572static void2573print_truncate(CPUArchState *cpu_env, const struct syscallname *name,2574abi_long arg0, abi_long arg1, abi_long arg2,2575abi_long arg3, abi_long arg4, abi_long arg5)2576{
2577print_syscall_prologue(name);2578print_string(arg0, 0);2579print_raw_param(TARGET_ABI_FMT_ld, arg1, 1);2580print_syscall_epilogue(name);2581}
2582#endif2583
2584#ifdef TARGET_NR_truncate642585static void2586print_truncate64(CPUArchState *cpu_env, const struct syscallname *name,2587abi_long arg0, abi_long arg1, abi_long arg2,2588abi_long arg3, abi_long arg4, abi_long arg5)2589{
2590print_syscall_prologue(name);2591print_string(arg0, 0);2592if (regpairs_aligned(cpu_env, TARGET_NR_truncate64)) {2593arg1 = arg2;2594arg2 = arg3;2595}2596print_raw_param("%" PRIu64, target_offset64(arg1, arg2), 1);2597print_syscall_epilogue(name);2598}
2599#endif2600
2601#ifdef TARGET_NR_ftruncate642602static void2603print_ftruncate64(CPUArchState *cpu_env, const struct syscallname *name,2604abi_long arg0, abi_long arg1, abi_long arg2,2605abi_long arg3, abi_long arg4, abi_long arg5)2606{
2607print_syscall_prologue(name);2608print_raw_param("%d", arg0, 0);2609if (regpairs_aligned(cpu_env, TARGET_NR_ftruncate64)) {2610arg1 = arg2;2611arg2 = arg3;2612}2613print_raw_param("%" PRIu64, target_offset64(arg1, arg2), 1);2614print_syscall_epilogue(name);2615}
2616#endif2617
2618#ifdef TARGET_NR_mlockall2619static void2620print_mlockall(CPUArchState *cpu_env, const struct syscallname *name,2621abi_long arg0, abi_long arg1, abi_long arg2,2622abi_long arg3, abi_long arg4, abi_long arg5)2623{
2624print_syscall_prologue(name);2625print_flags(mlockall_flags, arg0, 1);2626print_syscall_epilogue(name);2627}
2628#endif2629
2630#if defined(TARGET_NR_socket)2631static void2632print_socket(CPUArchState *cpu_env, const struct syscallname *name,2633abi_long arg0, abi_long arg1, abi_long arg2,2634abi_long arg3, abi_long arg4, abi_long arg5)2635{
2636abi_ulong domain = arg0, type = arg1, protocol = arg2;2637
2638print_syscall_prologue(name);2639print_socket_domain(domain);2640qemu_log(",");2641print_socket_type(type);2642qemu_log(",");2643if (domain == AF_PACKET ||2644(domain == AF_INET && type == TARGET_SOCK_PACKET)) {2645protocol = tswap16(protocol);2646}2647print_socket_protocol(domain, type, protocol);2648print_syscall_epilogue(name);2649}
2650
2651#endif2652
2653#if defined(TARGET_NR_socketcall) || defined(TARGET_NR_bind)2654
2655static void print_sockfd(abi_long sockfd, int last)2656{
2657print_raw_param(TARGET_ABI_FMT_ld, sockfd, last);2658}
2659
2660#endif2661
2662#if defined(TARGET_NR_socketcall)2663
2664#define get_user_ualx(x, gaddr, idx) \2665get_user_ual(x, (gaddr) + (idx) * sizeof(abi_long))2666
2667static void do_print_socket(const char *name, abi_long arg1)2668{
2669abi_ulong domain, type, protocol;2670
2671get_user_ualx(domain, arg1, 0);2672get_user_ualx(type, arg1, 1);2673get_user_ualx(protocol, arg1, 2);2674qemu_log("%s(", name);2675print_socket_domain(domain);2676qemu_log(",");2677print_socket_type(type);2678qemu_log(",");2679if (domain == AF_PACKET ||2680(domain == AF_INET && type == TARGET_SOCK_PACKET)) {2681protocol = tswap16(protocol);2682}2683print_socket_protocol(domain, type, protocol);2684qemu_log(")");2685}
2686
2687static void do_print_sockaddr(const char *name, abi_long arg1)2688{
2689abi_ulong sockfd, addr, addrlen;2690
2691get_user_ualx(sockfd, arg1, 0);2692get_user_ualx(addr, arg1, 1);2693get_user_ualx(addrlen, arg1, 2);2694
2695qemu_log("%s(", name);2696print_sockfd(sockfd, 0);2697print_sockaddr(addr, addrlen, 0);2698qemu_log(")");2699}
2700
2701static void do_print_listen(const char *name, abi_long arg1)2702{
2703abi_ulong sockfd, backlog;2704
2705get_user_ualx(sockfd, arg1, 0);2706get_user_ualx(backlog, arg1, 1);2707
2708qemu_log("%s(", name);2709print_sockfd(sockfd, 0);2710print_raw_param(TARGET_ABI_FMT_ld, backlog, 1);2711qemu_log(")");2712}
2713
2714static void do_print_socketpair(const char *name, abi_long arg1)2715{
2716abi_ulong domain, type, protocol, tab;2717
2718get_user_ualx(domain, arg1, 0);2719get_user_ualx(type, arg1, 1);2720get_user_ualx(protocol, arg1, 2);2721get_user_ualx(tab, arg1, 3);2722
2723qemu_log("%s(", name);2724print_socket_domain(domain);2725qemu_log(",");2726print_socket_type(type);2727qemu_log(",");2728print_socket_protocol(domain, type, protocol);2729qemu_log(",");2730print_raw_param(TARGET_ABI_FMT_lx, tab, 1);2731qemu_log(")");2732}
2733
2734static void do_print_sendrecv(const char *name, abi_long arg1)2735{
2736abi_ulong sockfd, msg, len, flags;2737
2738get_user_ualx(sockfd, arg1, 0);2739get_user_ualx(msg, arg1, 1);2740get_user_ualx(len, arg1, 2);2741get_user_ualx(flags, arg1, 3);2742
2743qemu_log("%s(", name);2744print_sockfd(sockfd, 0);2745print_buf(msg, len, 0);2746print_raw_param(TARGET_ABI_FMT_ld, len, 0);2747print_flags(msg_flags, flags, 1);2748qemu_log(")");2749}
2750
2751static void do_print_msgaddr(const char *name, abi_long arg1)2752{
2753abi_ulong sockfd, msg, len, flags, addr, addrlen;2754
2755get_user_ualx(sockfd, arg1, 0);2756get_user_ualx(msg, arg1, 1);2757get_user_ualx(len, arg1, 2);2758get_user_ualx(flags, arg1, 3);2759get_user_ualx(addr, arg1, 4);2760get_user_ualx(addrlen, arg1, 5);2761
2762qemu_log("%s(", name);2763print_sockfd(sockfd, 0);2764print_buf(msg, len, 0);2765print_raw_param(TARGET_ABI_FMT_ld, len, 0);2766print_flags(msg_flags, flags, 0);2767print_sockaddr(addr, addrlen, 0);2768qemu_log(")");2769}
2770
2771static void do_print_shutdown(const char *name, abi_long arg1)2772{
2773abi_ulong sockfd, how;2774
2775get_user_ualx(sockfd, arg1, 0);2776get_user_ualx(how, arg1, 1);2777
2778qemu_log("shutdown(");2779print_sockfd(sockfd, 0);2780switch (how) {2781case SHUT_RD:2782qemu_log("SHUT_RD");2783break;2784case SHUT_WR:2785qemu_log("SHUT_WR");2786break;2787case SHUT_RDWR:2788qemu_log("SHUT_RDWR");2789break;2790default:2791print_raw_param(TARGET_ABI_FMT_ld, how, 1);2792break;2793}2794qemu_log(")");2795}
2796
2797static void do_print_msg(const char *name, abi_long arg1)2798{
2799abi_ulong sockfd, msg, flags;2800
2801get_user_ualx(sockfd, arg1, 0);2802get_user_ualx(msg, arg1, 1);2803get_user_ualx(flags, arg1, 2);2804
2805qemu_log("%s(", name);2806print_sockfd(sockfd, 0);2807print_pointer(msg, 0);2808print_flags(msg_flags, flags, 1);2809qemu_log(")");2810}
2811
2812static void do_print_sockopt(const char *name, abi_long arg1)2813{
2814abi_ulong sockfd, level, optname, optval, optlen;2815
2816get_user_ualx(sockfd, arg1, 0);2817get_user_ualx(level, arg1, 1);2818get_user_ualx(optname, arg1, 2);2819get_user_ualx(optval, arg1, 3);2820get_user_ualx(optlen, arg1, 4);2821
2822qemu_log("%s(", name);2823print_sockfd(sockfd, 0);2824switch (level) {2825case SOL_TCP:2826qemu_log("SOL_TCP,");2827print_raw_param(TARGET_ABI_FMT_ld, optname, 0);2828print_pointer(optval, 0);2829break;2830case SOL_UDP:2831qemu_log("SOL_UDP,");2832print_raw_param(TARGET_ABI_FMT_ld, optname, 0);2833print_pointer(optval, 0);2834break;2835case SOL_IP:2836qemu_log("SOL_IP,");2837print_raw_param(TARGET_ABI_FMT_ld, optname, 0);2838print_pointer(optval, 0);2839break;2840case SOL_RAW:2841qemu_log("SOL_RAW,");2842print_raw_param(TARGET_ABI_FMT_ld, optname, 0);2843print_pointer(optval, 0);2844break;2845case TARGET_SOL_SOCKET:2846qemu_log("SOL_SOCKET,");2847switch (optname) {2848case TARGET_SO_DEBUG:2849qemu_log("SO_DEBUG,");2850print_optint:2851print_number(optval, 0);2852break;2853case TARGET_SO_REUSEADDR:2854qemu_log("SO_REUSEADDR,");2855goto print_optint;2856case TARGET_SO_REUSEPORT:2857qemu_log("SO_REUSEPORT,");2858goto print_optint;2859case TARGET_SO_TYPE:2860qemu_log("SO_TYPE,");2861goto print_optint;2862case TARGET_SO_ERROR:2863qemu_log("SO_ERROR,");2864goto print_optint;2865case TARGET_SO_DONTROUTE:2866qemu_log("SO_DONTROUTE,");2867goto print_optint;2868case TARGET_SO_BROADCAST:2869qemu_log("SO_BROADCAST,");2870goto print_optint;2871case TARGET_SO_SNDBUF:2872qemu_log("SO_SNDBUF,");2873goto print_optint;2874case TARGET_SO_RCVBUF:2875qemu_log("SO_RCVBUF,");2876goto print_optint;2877case TARGET_SO_KEEPALIVE:2878qemu_log("SO_KEEPALIVE,");2879goto print_optint;2880case TARGET_SO_OOBINLINE:2881qemu_log("SO_OOBINLINE,");2882goto print_optint;2883case TARGET_SO_NO_CHECK:2884qemu_log("SO_NO_CHECK,");2885goto print_optint;2886case TARGET_SO_PRIORITY:2887qemu_log("SO_PRIORITY,");2888goto print_optint;2889case TARGET_SO_BSDCOMPAT:2890qemu_log("SO_BSDCOMPAT,");2891goto print_optint;2892case TARGET_SO_PASSCRED:2893qemu_log("SO_PASSCRED,");2894goto print_optint;2895case TARGET_SO_TIMESTAMP:2896qemu_log("SO_TIMESTAMP,");2897goto print_optint;2898case TARGET_SO_RCVLOWAT:2899qemu_log("SO_RCVLOWAT,");2900goto print_optint;2901case TARGET_SO_RCVTIMEO:2902qemu_log("SO_RCVTIMEO,");2903print_timeval(optval, 0);2904break;2905case TARGET_SO_SNDTIMEO:2906qemu_log("SO_SNDTIMEO,");2907print_timeval(optval, 0);2908break;2909case TARGET_SO_ATTACH_FILTER: {2910struct target_sock_fprog *fprog;2911
2912qemu_log("SO_ATTACH_FILTER,");2913
2914if (lock_user_struct(VERIFY_READ, fprog, optval, 0)) {2915struct target_sock_filter *filter;2916qemu_log("{");2917if (lock_user_struct(VERIFY_READ, filter,2918tswapal(fprog->filter), 0)) {2919int i;2920for (i = 0; i < tswap16(fprog->len) - 1; i++) {2921qemu_log("[%d]{0x%x,%d,%d,0x%x},",2922i, tswap16(filter[i].code),2923filter[i].jt, filter[i].jf,2924tswap32(filter[i].k));2925}2926qemu_log("[%d]{0x%x,%d,%d,0x%x}",2927i, tswap16(filter[i].code),2928filter[i].jt, filter[i].jf,2929tswap32(filter[i].k));2930} else {2931qemu_log(TARGET_ABI_FMT_lx, tswapal(fprog->filter));2932}2933qemu_log(",%d},", tswap16(fprog->len));2934unlock_user(fprog, optval, 0);2935} else {2936print_pointer(optval, 0);2937}2938break;2939}2940default:2941print_raw_param(TARGET_ABI_FMT_ld, optname, 0);2942print_pointer(optval, 0);2943break;2944}2945break;2946case SOL_IPV6:2947qemu_log("SOL_IPV6,");2948switch (optname) {2949case IPV6_MTU_DISCOVER:2950qemu_log("IPV6_MTU_DISCOVER,");2951goto print_optint;2952case IPV6_MTU:2953qemu_log("IPV6_MTU,");2954goto print_optint;2955case IPV6_V6ONLY:2956qemu_log("IPV6_V6ONLY,");2957goto print_optint;2958case IPV6_RECVPKTINFO:2959qemu_log("IPV6_RECVPKTINFO,");2960goto print_optint;2961case IPV6_UNICAST_HOPS:2962qemu_log("IPV6_UNICAST_HOPS,");2963goto print_optint;2964case IPV6_MULTICAST_HOPS:2965qemu_log("IPV6_MULTICAST_HOPS,");2966goto print_optint;2967case IPV6_MULTICAST_LOOP:2968qemu_log("IPV6_MULTICAST_LOOP,");2969goto print_optint;2970case IPV6_RECVERR:2971qemu_log("IPV6_RECVERR,");2972goto print_optint;2973case IPV6_RECVHOPLIMIT:2974qemu_log("IPV6_RECVHOPLIMIT,");2975goto print_optint;2976case IPV6_2292HOPLIMIT:2977qemu_log("IPV6_2292HOPLIMIT,");2978goto print_optint;2979case IPV6_CHECKSUM:2980qemu_log("IPV6_CHECKSUM,");2981goto print_optint;2982case IPV6_ADDRFORM:2983qemu_log("IPV6_ADDRFORM,");2984goto print_optint;2985case IPV6_2292PKTINFO:2986qemu_log("IPV6_2292PKTINFO,");2987goto print_optint;2988case IPV6_RECVTCLASS:2989qemu_log("IPV6_RECVTCLASS,");2990goto print_optint;2991case IPV6_RECVRTHDR:2992qemu_log("IPV6_RECVRTHDR,");2993goto print_optint;2994case IPV6_2292RTHDR:2995qemu_log("IPV6_2292RTHDR,");2996goto print_optint;2997case IPV6_RECVHOPOPTS:2998qemu_log("IPV6_RECVHOPOPTS,");2999goto print_optint;3000case IPV6_2292HOPOPTS:3001qemu_log("IPV6_2292HOPOPTS,");3002goto print_optint;3003case IPV6_RECVDSTOPTS:3004qemu_log("IPV6_RECVDSTOPTS,");3005goto print_optint;3006case IPV6_2292DSTOPTS:3007qemu_log("IPV6_2292DSTOPTS,");3008goto print_optint;3009case IPV6_TCLASS:3010qemu_log("IPV6_TCLASS,");3011goto print_optint;3012case IPV6_ADDR_PREFERENCES:3013qemu_log("IPV6_ADDR_PREFERENCES,");3014goto print_optint;3015#ifdef IPV6_RECVPATHMTU3016case IPV6_RECVPATHMTU:3017qemu_log("IPV6_RECVPATHMTU,");3018goto print_optint;3019#endif3020#ifdef IPV6_TRANSPARENT3021case IPV6_TRANSPARENT:3022qemu_log("IPV6_TRANSPARENT,");3023goto print_optint;3024#endif3025#ifdef IPV6_FREEBIND3026case IPV6_FREEBIND:3027qemu_log("IPV6_FREEBIND,");3028goto print_optint;3029#endif3030#ifdef IPV6_RECVORIGDSTADDR3031case IPV6_RECVORIGDSTADDR:3032qemu_log("IPV6_RECVORIGDSTADDR,");3033goto print_optint;3034#endif3035case IPV6_PKTINFO:3036qemu_log("IPV6_PKTINFO,");3037print_pointer(optval, 0);3038break;3039case IPV6_ADD_MEMBERSHIP:3040qemu_log("IPV6_ADD_MEMBERSHIP,");3041print_pointer(optval, 0);3042break;3043case IPV6_DROP_MEMBERSHIP:3044qemu_log("IPV6_DROP_MEMBERSHIP,");3045print_pointer(optval, 0);3046break;3047default:3048print_raw_param(TARGET_ABI_FMT_ld, optname, 0);3049print_pointer(optval, 0);3050break;3051}3052break;3053default:3054print_raw_param(TARGET_ABI_FMT_ld, level, 0);3055print_raw_param(TARGET_ABI_FMT_ld, optname, 0);3056print_pointer(optval, 0);3057break;3058}3059print_raw_param(TARGET_ABI_FMT_ld, optlen, 1);3060qemu_log(")");3061}
3062
3063#define PRINT_SOCKOP(name, func) \3064[TARGET_SYS_##name] = { #name, func }3065
3066static struct {3067const char *name;3068void (*print)(const char *, abi_long);3069} scall[] = {3070PRINT_SOCKOP(SOCKET, do_print_socket),3071PRINT_SOCKOP(BIND, do_print_sockaddr),3072PRINT_SOCKOP(CONNECT, do_print_sockaddr),3073PRINT_SOCKOP(LISTEN, do_print_listen),3074PRINT_SOCKOP(ACCEPT, do_print_sockaddr),3075PRINT_SOCKOP(GETSOCKNAME, do_print_sockaddr),3076PRINT_SOCKOP(GETPEERNAME, do_print_sockaddr),3077PRINT_SOCKOP(SOCKETPAIR, do_print_socketpair),3078PRINT_SOCKOP(SEND, do_print_sendrecv),3079PRINT_SOCKOP(RECV, do_print_sendrecv),3080PRINT_SOCKOP(SENDTO, do_print_msgaddr),3081PRINT_SOCKOP(RECVFROM, do_print_msgaddr),3082PRINT_SOCKOP(SHUTDOWN, do_print_shutdown),3083PRINT_SOCKOP(SETSOCKOPT, do_print_sockopt),3084PRINT_SOCKOP(GETSOCKOPT, do_print_sockopt),3085PRINT_SOCKOP(SENDMSG, do_print_msg),3086PRINT_SOCKOP(RECVMSG, do_print_msg),3087PRINT_SOCKOP(ACCEPT4, NULL),3088PRINT_SOCKOP(RECVMMSG, NULL),3089PRINT_SOCKOP(SENDMMSG, NULL),3090};3091
3092static void3093print_socketcall(CPUArchState *cpu_env, const struct syscallname *name,3094abi_long arg0, abi_long arg1, abi_long arg2,3095abi_long arg3, abi_long arg4, abi_long arg5)3096{
3097if (arg0 >= 0 && arg0 < ARRAY_SIZE(scall) && scall[arg0].print) {3098scall[arg0].print(scall[arg0].name, arg1);3099return;3100}3101print_syscall_prologue(name);3102print_raw_param(TARGET_ABI_FMT_ld, arg0, 0);3103print_raw_param(TARGET_ABI_FMT_ld, arg1, 0);3104print_raw_param(TARGET_ABI_FMT_ld, arg2, 0);3105print_raw_param(TARGET_ABI_FMT_ld, arg3, 0);3106print_raw_param(TARGET_ABI_FMT_ld, arg4, 0);3107print_raw_param(TARGET_ABI_FMT_ld, arg5, 0);3108print_syscall_epilogue(name);3109}
3110#endif3111
3112#if defined(TARGET_NR_bind)3113static void3114print_bind(CPUArchState *cpu_env, const struct syscallname *name,3115abi_long arg0, abi_long arg1, abi_long arg2,3116abi_long arg3, abi_long arg4, abi_long arg5)3117{
3118print_syscall_prologue(name);3119print_sockfd(arg0, 0);3120print_sockaddr(arg1, arg2, 1);3121print_syscall_epilogue(name);3122}
3123#endif3124
3125#if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \3126defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64)3127static void3128print_stat(CPUArchState *cpu_env, const struct syscallname *name,3129abi_long arg0, abi_long arg1, abi_long arg2,3130abi_long arg3, abi_long arg4, abi_long arg5)3131{
3132print_syscall_prologue(name);3133print_string(arg0, 0);3134print_pointer(arg1, 1);3135print_syscall_epilogue(name);3136}
3137#define print_lstat print_stat3138#define print_stat64 print_stat3139#define print_lstat64 print_stat3140#endif3141
3142#if defined(TARGET_NR_madvise)3143static struct enums madvise_advice[] = {3144ENUM_TARGET(MADV_NORMAL),3145ENUM_TARGET(MADV_RANDOM),3146ENUM_TARGET(MADV_SEQUENTIAL),3147ENUM_TARGET(MADV_WILLNEED),3148ENUM_TARGET(MADV_DONTNEED),3149ENUM_TARGET(MADV_FREE),3150ENUM_TARGET(MADV_REMOVE),3151ENUM_TARGET(MADV_DONTFORK),3152ENUM_TARGET(MADV_DOFORK),3153ENUM_TARGET(MADV_MERGEABLE),3154ENUM_TARGET(MADV_UNMERGEABLE),3155ENUM_TARGET(MADV_HUGEPAGE),3156ENUM_TARGET(MADV_NOHUGEPAGE),3157ENUM_TARGET(MADV_DONTDUMP),3158ENUM_TARGET(MADV_DODUMP),3159ENUM_TARGET(MADV_WIPEONFORK),3160ENUM_TARGET(MADV_KEEPONFORK),3161ENUM_TARGET(MADV_COLD),3162ENUM_TARGET(MADV_PAGEOUT),3163ENUM_TARGET(MADV_POPULATE_READ),3164ENUM_TARGET(MADV_POPULATE_WRITE),3165ENUM_TARGET(MADV_DONTNEED_LOCKED),3166ENUM_END,3167};3168
3169static void3170print_madvise(CPUArchState *cpu_env, const struct syscallname *name,3171abi_long arg0, abi_long arg1, abi_long arg2,3172abi_long arg3, abi_long arg4, abi_long arg5)3173{
3174print_syscall_prologue(name);3175print_pointer(arg0, 0);3176print_raw_param("%d", arg1, 0);3177print_enums(madvise_advice, arg2, 1);3178print_syscall_epilogue(name);3179}
3180#endif3181
3182#if defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64)3183static void3184print_fstat(CPUArchState *cpu_env, const struct syscallname *name,3185abi_long arg0, abi_long arg1, abi_long arg2,3186abi_long arg3, abi_long arg4, abi_long arg5)3187{
3188print_syscall_prologue(name);3189print_raw_param("%d", arg0, 0);3190print_pointer(arg1, 1);3191print_syscall_epilogue(name);3192}
3193#define print_fstat64 print_fstat3194#endif3195
3196#ifdef TARGET_NR_mkdir3197static void3198print_mkdir(CPUArchState *cpu_env, const struct syscallname *name,3199abi_long arg0, abi_long arg1, abi_long arg2,3200abi_long arg3, abi_long arg4, abi_long arg5)3201{
3202print_syscall_prologue(name);3203print_string(arg0, 0);3204print_file_mode(arg1, 1);3205print_syscall_epilogue(name);3206}
3207#endif3208
3209#ifdef TARGET_NR_mkdirat3210static void3211print_mkdirat(CPUArchState *cpu_env, const struct syscallname *name,3212abi_long arg0, abi_long arg1, abi_long arg2,3213abi_long arg3, abi_long arg4, abi_long arg5)3214{
3215print_syscall_prologue(name);3216print_at_dirfd(arg0, 0);3217print_string(arg1, 0);3218print_file_mode(arg2, 1);3219print_syscall_epilogue(name);3220}
3221#endif3222
3223#ifdef TARGET_NR_rmdir3224static void3225print_rmdir(CPUArchState *cpu_env, const struct syscallname *name,3226abi_long arg0, abi_long arg1, abi_long arg2,3227abi_long arg3, abi_long arg4, abi_long arg5)3228{
3229print_syscall_prologue(name);3230print_string(arg0, 0);3231print_syscall_epilogue(name);3232}
3233#endif3234
3235#ifdef TARGET_NR_rt_sigaction3236static void3237print_rt_sigaction(CPUArchState *cpu_env, const struct syscallname *name,3238abi_long arg0, abi_long arg1, abi_long arg2,3239abi_long arg3, abi_long arg4, abi_long arg5)3240{
3241print_syscall_prologue(name);3242print_signal(arg0, 0);3243print_pointer(arg1, 0);3244print_pointer(arg2, 1);3245print_syscall_epilogue(name);3246}
3247#endif3248
3249#ifdef TARGET_NR_rt_sigprocmask3250static void3251print_rt_sigprocmask(CPUArchState *cpu_env, const struct syscallname *name,3252abi_long arg0, abi_long arg1, abi_long arg2,3253abi_long arg3, abi_long arg4, abi_long arg5)3254{
3255const char *how = "UNKNOWN";3256print_syscall_prologue(name);3257switch(arg0) {3258case TARGET_SIG_BLOCK: how = "SIG_BLOCK"; break;3259case TARGET_SIG_UNBLOCK: how = "SIG_UNBLOCK"; break;3260case TARGET_SIG_SETMASK: how = "SIG_SETMASK"; break;3261}3262qemu_log("%s,", how);3263print_pointer(arg1, 0);3264print_pointer(arg2, 0);3265print_raw_param("%u", arg3, 1);3266print_syscall_epilogue(name);3267}
3268#endif3269
3270#ifdef TARGET_NR_rt_sigqueueinfo3271static void3272print_rt_sigqueueinfo(CPUArchState *cpu_env, const struct syscallname *name,3273abi_long arg0, abi_long arg1, abi_long arg2,3274abi_long arg3, abi_long arg4, abi_long arg5)3275{
3276void *p;3277target_siginfo_t uinfo;3278
3279print_syscall_prologue(name);3280print_raw_param("%d", arg0, 0);3281print_signal(arg1, 0);3282p = lock_user(VERIFY_READ, arg2, sizeof(target_siginfo_t), 1);3283if (p) {3284get_target_siginfo(&uinfo, p);3285print_siginfo(&uinfo);3286
3287unlock_user(p, arg2, 0);3288} else {3289print_pointer(arg2, 1);3290}3291print_syscall_epilogue(name);3292}
3293#endif3294
3295#ifdef TARGET_NR_rt_tgsigqueueinfo3296static void3297print_rt_tgsigqueueinfo(CPUArchState *cpu_env, const struct syscallname *name,3298abi_long arg0, abi_long arg1, abi_long arg2,3299abi_long arg3, abi_long arg4, abi_long arg5)3300{
3301void *p;3302target_siginfo_t uinfo;3303
3304print_syscall_prologue(name);3305print_raw_param("%d", arg0, 0);3306print_raw_param("%d", arg1, 0);3307print_signal(arg2, 0);3308p = lock_user(VERIFY_READ, arg3, sizeof(target_siginfo_t), 1);3309if (p) {3310get_target_siginfo(&uinfo, p);3311print_siginfo(&uinfo);3312
3313unlock_user(p, arg3, 0);3314} else {3315print_pointer(arg3, 1);3316}3317print_syscall_epilogue(name);3318}
3319#endif3320
3321#ifdef TARGET_NR_syslog3322static void3323print_syslog_action(abi_ulong arg, int last)3324{
3325const char *type;3326
3327switch (arg) {3328case TARGET_SYSLOG_ACTION_CLOSE: {3329type = "SYSLOG_ACTION_CLOSE";3330break;3331}3332case TARGET_SYSLOG_ACTION_OPEN: {3333type = "SYSLOG_ACTION_OPEN";3334break;3335}3336case TARGET_SYSLOG_ACTION_READ: {3337type = "SYSLOG_ACTION_READ";3338break;3339}3340case TARGET_SYSLOG_ACTION_READ_ALL: {3341type = "SYSLOG_ACTION_READ_ALL";3342break;3343}3344case TARGET_SYSLOG_ACTION_READ_CLEAR: {3345type = "SYSLOG_ACTION_READ_CLEAR";3346break;3347}3348case TARGET_SYSLOG_ACTION_CLEAR: {3349type = "SYSLOG_ACTION_CLEAR";3350break;3351}3352case TARGET_SYSLOG_ACTION_CONSOLE_OFF: {3353type = "SYSLOG_ACTION_CONSOLE_OFF";3354break;3355}3356case TARGET_SYSLOG_ACTION_CONSOLE_ON: {3357type = "SYSLOG_ACTION_CONSOLE_ON";3358break;3359}3360case TARGET_SYSLOG_ACTION_CONSOLE_LEVEL: {3361type = "SYSLOG_ACTION_CONSOLE_LEVEL";3362break;3363}3364case TARGET_SYSLOG_ACTION_SIZE_UNREAD: {3365type = "SYSLOG_ACTION_SIZE_UNREAD";3366break;3367}3368case TARGET_SYSLOG_ACTION_SIZE_BUFFER: {3369type = "SYSLOG_ACTION_SIZE_BUFFER";3370break;3371}3372default: {3373print_raw_param("%ld", arg, last);3374return;3375}3376}3377qemu_log("%s%s", type, get_comma(last));3378}
3379
3380static void3381print_syslog(CPUArchState *cpu_env, const struct syscallname *name,3382abi_long arg0, abi_long arg1, abi_long arg2,3383abi_long arg3, abi_long arg4, abi_long arg5)3384{
3385print_syscall_prologue(name);3386print_syslog_action(arg0, 0);3387print_pointer(arg1, 0);3388print_raw_param("%d", arg2, 1);3389print_syscall_epilogue(name);3390}
3391#endif3392
3393#ifdef TARGET_NR_mknod3394static void3395print_mknod(CPUArchState *cpu_env, const struct syscallname *name,3396abi_long arg0, abi_long arg1, abi_long arg2,3397abi_long arg3, abi_long arg4, abi_long arg5)3398{
3399int hasdev = (arg1 & (S_IFCHR|S_IFBLK));3400
3401print_syscall_prologue(name);3402print_string(arg0, 0);3403print_file_mode(arg1, (hasdev == 0));3404if (hasdev) {3405print_raw_param("makedev(%d", major(arg2), 0);3406print_raw_param("%d)", minor(arg2), 1);3407}3408print_syscall_epilogue(name);3409}
3410#endif3411
3412#ifdef TARGET_NR_mknodat3413static void3414print_mknodat(CPUArchState *cpu_env, const struct syscallname *name,3415abi_long arg0, abi_long arg1, abi_long arg2,3416abi_long arg3, abi_long arg4, abi_long arg5)3417{
3418int hasdev = (arg2 & (S_IFCHR|S_IFBLK));3419
3420print_syscall_prologue(name);3421print_at_dirfd(arg0, 0);3422print_string(arg1, 0);3423print_file_mode(arg2, (hasdev == 0));3424if (hasdev) {3425print_raw_param("makedev(%d", major(arg3), 0);3426print_raw_param("%d)", minor(arg3), 1);3427}3428print_syscall_epilogue(name);3429}
3430#endif3431
3432#ifdef TARGET_NR_mq_open3433static void3434print_mq_open(CPUArchState *cpu_env, const struct syscallname *name,3435abi_long arg0, abi_long arg1, abi_long arg2,3436abi_long arg3, abi_long arg4, abi_long arg5)3437{
3438int is_creat = (arg1 & TARGET_O_CREAT);3439
3440print_syscall_prologue(name);3441print_string(arg0, 0);3442print_open_flags(arg1, (is_creat == 0));3443if (is_creat) {3444print_file_mode(arg2, 0);3445print_pointer(arg3, 1);3446}3447print_syscall_epilogue(name);3448}
3449#endif3450
3451#ifdef TARGET_NR_open3452static void3453print_open(CPUArchState *cpu_env, const struct syscallname *name,3454abi_long arg0, abi_long arg1, abi_long arg2,3455abi_long arg3, abi_long arg4, abi_long arg5)3456{
3457int is_creat = (arg1 & TARGET_O_CREAT);3458
3459print_syscall_prologue(name);3460print_string(arg0, 0);3461print_open_flags(arg1, (is_creat == 0));3462if (is_creat)3463print_file_mode(arg2, 1);3464print_syscall_epilogue(name);3465}
3466#endif3467
3468#ifdef TARGET_NR_openat3469static void3470print_openat(CPUArchState *cpu_env, const struct syscallname *name,3471abi_long arg0, abi_long arg1, abi_long arg2,3472abi_long arg3, abi_long arg4, abi_long arg5)3473{
3474int is_creat = (arg2 & TARGET_O_CREAT);3475
3476print_syscall_prologue(name);3477print_at_dirfd(arg0, 0);3478print_string(arg1, 0);3479print_open_flags(arg2, (is_creat == 0));3480if (is_creat)3481print_file_mode(arg3, 1);3482print_syscall_epilogue(name);3483}
3484#endif3485
3486#ifdef TARGET_NR_pidfd_send_signal3487static void3488print_pidfd_send_signal(CPUArchState *cpu_env, const struct syscallname *name,3489abi_long arg0, abi_long arg1, abi_long arg2,3490abi_long arg3, abi_long arg4, abi_long arg5)3491{
3492void *p;3493target_siginfo_t uinfo;3494
3495print_syscall_prologue(name);3496print_raw_param("%d", arg0, 0);3497print_signal(arg1, 0);3498
3499p = lock_user(VERIFY_READ, arg2, sizeof(target_siginfo_t), 1);3500if (p) {3501get_target_siginfo(&uinfo, p);3502print_siginfo(&uinfo);3503
3504unlock_user(p, arg2, 0);3505} else {3506print_pointer(arg2, 0);3507}3508
3509print_raw_param("%u", arg3, 1);3510print_syscall_epilogue(name);3511}
3512#endif3513
3514#ifdef TARGET_NR_mq_unlink3515static void3516print_mq_unlink(CPUArchState *cpu_env, const struct syscallname *name,3517abi_long arg0, abi_long arg1, abi_long arg2,3518abi_long arg3, abi_long arg4, abi_long arg5)3519{
3520print_syscall_prologue(name);3521print_string(arg0, 1);3522print_syscall_epilogue(name);3523}
3524#endif3525
3526#if defined(TARGET_NR_fstatat64) || defined(TARGET_NR_newfstatat)3527static void3528print_fstatat64(CPUArchState *cpu_env, const struct syscallname *name,3529abi_long arg0, abi_long arg1, abi_long arg2,3530abi_long arg3, abi_long arg4, abi_long arg5)3531{
3532print_syscall_prologue(name);3533print_at_dirfd(arg0, 0);3534print_string(arg1, 0);3535print_pointer(arg2, 0);3536print_flags(at_file_flags, arg3, 1);3537print_syscall_epilogue(name);3538}
3539#define print_newfstatat print_fstatat643540#endif3541
3542#ifdef TARGET_NR_readlink3543static void3544print_readlink(CPUArchState *cpu_env, const struct syscallname *name,3545abi_long arg0, abi_long arg1, abi_long arg2,3546abi_long arg3, abi_long arg4, abi_long arg5)3547{
3548print_syscall_prologue(name);3549print_string(arg0, 0);3550print_pointer(arg1, 0);3551print_raw_param("%u", arg2, 1);3552print_syscall_epilogue(name);3553}
3554#endif3555
3556#ifdef TARGET_NR_readlinkat3557static void3558print_readlinkat(CPUArchState *cpu_env, const struct syscallname *name,3559abi_long arg0, abi_long arg1, abi_long arg2,3560abi_long arg3, abi_long arg4, abi_long arg5)3561{
3562print_syscall_prologue(name);3563print_at_dirfd(arg0, 0);3564print_string(arg1, 0);3565print_pointer(arg2, 0);3566print_raw_param("%u", arg3, 1);3567print_syscall_epilogue(name);3568}
3569#endif3570
3571#ifdef TARGET_NR_rename3572static void3573print_rename(CPUArchState *cpu_env, const struct syscallname *name,3574abi_long arg0, abi_long arg1, abi_long arg2,3575abi_long arg3, abi_long arg4, abi_long arg5)3576{
3577print_syscall_prologue(name);3578print_string(arg0, 0);3579print_string(arg1, 1);3580print_syscall_epilogue(name);3581}
3582#endif3583
3584#ifdef TARGET_NR_renameat3585static void3586print_renameat(CPUArchState *cpu_env, const struct syscallname *name,3587abi_long arg0, abi_long arg1, abi_long arg2,3588abi_long arg3, abi_long arg4, abi_long arg5)3589{
3590print_syscall_prologue(name);3591print_at_dirfd(arg0, 0);3592print_string(arg1, 0);3593print_at_dirfd(arg2, 0);3594print_string(arg3, 1);3595print_syscall_epilogue(name);3596}
3597#endif3598
3599#ifdef TARGET_NR_statfs3600static void3601print_statfs(CPUArchState *cpu_env, const struct syscallname *name,3602abi_long arg0, abi_long arg1, abi_long arg2,3603abi_long arg3, abi_long arg4, abi_long arg5)3604{
3605print_syscall_prologue(name);3606print_string(arg0, 0);3607print_pointer(arg1, 1);3608print_syscall_epilogue(name);3609}
3610#endif3611
3612#ifdef TARGET_NR_statfs643613static void3614print_statfs64(CPUArchState *cpu_env, const struct syscallname *name,3615abi_long arg0, abi_long arg1, abi_long arg2,3616abi_long arg3, abi_long arg4, abi_long arg5)3617{
3618print_syscall_prologue(name);3619print_string(arg0, 0);3620print_pointer(arg1, 1);3621print_syscall_epilogue(name);3622}
3623#endif3624
3625#ifdef TARGET_NR_symlink3626static void3627print_symlink(CPUArchState *cpu_env, const struct syscallname *name,3628abi_long arg0, abi_long arg1, abi_long arg2,3629abi_long arg3, abi_long arg4, abi_long arg5)3630{
3631print_syscall_prologue(name);3632print_string(arg0, 0);3633print_string(arg1, 1);3634print_syscall_epilogue(name);3635}
3636#endif3637
3638#ifdef TARGET_NR_symlinkat3639static void3640print_symlinkat(CPUArchState *cpu_env, const struct syscallname *name,3641abi_long arg0, abi_long arg1, abi_long arg2,3642abi_long arg3, abi_long arg4, abi_long arg5)3643{
3644print_syscall_prologue(name);3645print_string(arg0, 0);3646print_at_dirfd(arg1, 0);3647print_string(arg2, 1);3648print_syscall_epilogue(name);3649}
3650#endif3651
3652#ifdef TARGET_NR_mount3653static void3654print_mount(CPUArchState *cpu_env, const struct syscallname *name,3655abi_long arg0, abi_long arg1, abi_long arg2,3656abi_long arg3, abi_long arg4, abi_long arg5)3657{
3658print_syscall_prologue(name);3659print_string(arg0, 0);3660print_string(arg1, 0);3661print_string(arg2, 0);3662print_flags(mount_flags, arg3, 0);3663print_pointer(arg4, 1);3664print_syscall_epilogue(name);3665}
3666#endif3667
3668#ifdef TARGET_NR_umount3669static void3670print_umount(CPUArchState *cpu_env, const struct syscallname *name,3671abi_long arg0, abi_long arg1, abi_long arg2,3672abi_long arg3, abi_long arg4, abi_long arg5)3673{
3674print_syscall_prologue(name);3675print_string(arg0, 1);3676print_syscall_epilogue(name);3677}
3678#endif3679
3680#ifdef TARGET_NR_umount23681static void3682print_umount2(CPUArchState *cpu_env, const struct syscallname *name,3683abi_long arg0, abi_long arg1, abi_long arg2,3684abi_long arg3, abi_long arg4, abi_long arg5)3685{
3686print_syscall_prologue(name);3687print_string(arg0, 0);3688print_flags(umount2_flags, arg1, 1);3689print_syscall_epilogue(name);3690}
3691#endif3692
3693#ifdef TARGET_NR_unlink3694static void3695print_unlink(CPUArchState *cpu_env, const struct syscallname *name,3696abi_long arg0, abi_long arg1, abi_long arg2,3697abi_long arg3, abi_long arg4, abi_long arg5)3698{
3699print_syscall_prologue(name);3700print_string(arg0, 1);3701print_syscall_epilogue(name);3702}
3703#endif3704
3705#ifdef TARGET_NR_unlinkat3706static void3707print_unlinkat(CPUArchState *cpu_env, const struct syscallname *name,3708abi_long arg0, abi_long arg1, abi_long arg2,3709abi_long arg3, abi_long arg4, abi_long arg5)3710{
3711print_syscall_prologue(name);3712print_at_dirfd(arg0, 0);3713print_string(arg1, 0);3714print_flags(unlinkat_flags, arg2, 1);3715print_syscall_epilogue(name);3716}
3717#endif3718
3719#ifdef TARGET_NR_unshare3720static void3721print_unshare(CPUArchState *cpu_env, const struct syscallname *name,3722abi_long arg0, abi_long arg1, abi_long arg2,3723abi_long arg3, abi_long arg4, abi_long arg5)3724{
3725print_syscall_prologue(name);3726print_flags(clone_flags, arg0, 1);3727print_syscall_epilogue(name);3728}
3729#endif3730
3731#ifdef TARGET_NR_clock_nanosleep3732static void3733print_clock_nanosleep(CPUArchState *cpu_env, const struct syscallname *name,3734abi_long arg0, abi_long arg1, abi_long arg2,3735abi_long arg3, abi_long arg4, abi_long arg5)3736{
3737print_syscall_prologue(name);3738print_enums(clockids, arg0, 0);3739print_raw_param("%d", arg1, 0);3740print_timespec(arg2, 0);3741print_timespec(arg3, 1);3742print_syscall_epilogue(name);3743}
3744#endif3745
3746#ifdef TARGET_NR_utime3747static void3748print_utime(CPUArchState *cpu_env, const struct syscallname *name,3749abi_long arg0, abi_long arg1, abi_long arg2,3750abi_long arg3, abi_long arg4, abi_long arg5)3751{
3752print_syscall_prologue(name);3753print_string(arg0, 0);3754print_pointer(arg1, 1);3755print_syscall_epilogue(name);3756}
3757#endif3758
3759#ifdef TARGET_NR_utimes3760static void3761print_utimes(CPUArchState *cpu_env, const struct syscallname *name,3762abi_long arg0, abi_long arg1, abi_long arg2,3763abi_long arg3, abi_long arg4, abi_long arg5)3764{
3765print_syscall_prologue(name);3766print_string(arg0, 0);3767print_pointer(arg1, 1);3768print_syscall_epilogue(name);3769}
3770#endif3771
3772#ifdef TARGET_NR_utimensat3773static void3774print_utimensat(CPUArchState *cpu_env, const struct syscallname *name,3775abi_long arg0, abi_long arg1, abi_long arg2,3776abi_long arg3, abi_long arg4, abi_long arg5)3777{
3778print_syscall_prologue(name);3779print_at_dirfd(arg0, 0);3780print_string(arg1, 0);3781print_pointer(arg2, 0);3782print_flags(at_file_flags, arg3, 1);3783print_syscall_epilogue(name);3784}
3785#endif3786
3787#if defined(TARGET_NR_mmap) || defined(TARGET_NR_mmap2)3788static void3789print_mmap_both(CPUArchState *cpu_env, const struct syscallname *name,3790abi_long arg0, abi_long arg1, abi_long arg2,3791abi_long arg3, abi_long arg4, abi_long arg5,3792bool is_old_mmap)3793{
3794if (is_old_mmap) {3795abi_ulong *v;3796abi_ulong argp = arg0;3797if (!(v = lock_user(VERIFY_READ, argp, 6 * sizeof(abi_ulong), 1)))3798return;3799arg0 = tswapal(v[0]);3800arg1 = tswapal(v[1]);3801arg2 = tswapal(v[2]);3802arg3 = tswapal(v[3]);3803arg4 = tswapal(v[4]);3804arg5 = tswapal(v[5]);3805unlock_user(v, argp, 0);3806}3807print_syscall_prologue(name);3808print_pointer(arg0, 0);3809print_raw_param("%d", arg1, 0);3810print_flags(mmap_prot_flags, arg2, 0);3811print_flags(mmap_flags, arg3, 0);3812print_raw_param("%d", arg4, 0);3813print_raw_param("%#x", arg5, 1);3814print_syscall_epilogue(name);3815}
3816#endif3817
3818#if defined(TARGET_NR_mmap)3819static void3820print_mmap(CPUArchState *cpu_env, const struct syscallname *name,3821abi_long arg0, abi_long arg1, abi_long arg2,3822abi_long arg3, abi_long arg4, abi_long arg5)3823{
3824return print_mmap_both(cpu_env, name, arg0, arg1, arg2, arg3,3825arg4, arg5,3826#if defined(TARGET_NR_mmap2)3827true
3828#else3829false
3830#endif3831);3832}
3833#endif3834
3835#if defined(TARGET_NR_mmap2)3836static void3837print_mmap2(CPUArchState *cpu_env, const struct syscallname *name,3838abi_long arg0, abi_long arg1, abi_long arg2,3839abi_long arg3, abi_long arg4, abi_long arg5)3840{
3841return print_mmap_both(cpu_env, name, arg0, arg1, arg2, arg3,3842arg4, arg5, false);3843}
3844#endif3845
3846#ifdef TARGET_NR_mprotect3847static void3848print_mprotect(CPUArchState *cpu_env, const struct syscallname *name,3849abi_long arg0, abi_long arg1, abi_long arg2,3850abi_long arg3, abi_long arg4, abi_long arg5)3851{
3852print_syscall_prologue(name);3853print_pointer(arg0, 0);3854print_raw_param("%d", arg1, 0);3855print_flags(mmap_prot_flags, arg2, 1);3856print_syscall_epilogue(name);3857}
3858#endif3859
3860#ifdef TARGET_NR_munmap3861static void3862print_munmap(CPUArchState *cpu_env, const struct syscallname *name,3863abi_long arg0, abi_long arg1, abi_long arg2,3864abi_long arg3, abi_long arg4, abi_long arg5)3865{
3866print_syscall_prologue(name);3867print_pointer(arg0, 0);3868print_raw_param("%d", arg1, 1);3869print_syscall_epilogue(name);3870}
3871#endif3872
3873#ifdef TARGET_NR_futex3874static void print_futex_op(int cmd, int last)3875{
3876static const char * const futex_names[] = {3877#define NAME(X) [X] = #X3878NAME(FUTEX_WAIT),3879NAME(FUTEX_WAKE),3880NAME(FUTEX_FD),3881NAME(FUTEX_REQUEUE),3882NAME(FUTEX_CMP_REQUEUE),3883NAME(FUTEX_WAKE_OP),3884NAME(FUTEX_LOCK_PI),3885NAME(FUTEX_UNLOCK_PI),3886NAME(FUTEX_TRYLOCK_PI),3887NAME(FUTEX_WAIT_BITSET),3888NAME(FUTEX_WAKE_BITSET),3889NAME(FUTEX_WAIT_REQUEUE_PI),3890NAME(FUTEX_CMP_REQUEUE_PI),3891NAME(FUTEX_LOCK_PI2),3892#undef NAME3893};3894
3895unsigned base_cmd = cmd & FUTEX_CMD_MASK;3896
3897if (base_cmd < ARRAY_SIZE(futex_names)) {3898qemu_log("%s%s%s",3899(cmd & FUTEX_PRIVATE_FLAG ? "FUTEX_PRIVATE_FLAG|" : ""),3900(cmd & FUTEX_CLOCK_REALTIME ? "FUTEX_CLOCK_REALTIME|" : ""),3901futex_names[base_cmd]);3902} else {3903qemu_log("0x%x", cmd);3904}3905}
3906
3907static void3908print_futex(CPUArchState *cpu_env, const struct syscallname *name,3909abi_long arg0, abi_long arg1, abi_long arg2,3910abi_long arg3, abi_long arg4, abi_long arg5)3911{
3912abi_long op = arg1 & FUTEX_CMD_MASK;3913print_syscall_prologue(name);3914print_pointer(arg0, 0);3915print_futex_op(arg1, 0);3916print_raw_param(",%d", arg2, 0);3917switch (op) {3918case FUTEX_WAIT:3919case FUTEX_WAIT_BITSET:3920case FUTEX_LOCK_PI:3921case FUTEX_LOCK_PI2:3922case FUTEX_WAIT_REQUEUE_PI:3923print_timespec(arg3, 0);3924break;3925default:3926print_pointer(arg3, 0);3927break;3928}3929print_pointer(arg4, 0);3930print_raw_param("%d", arg4, 1);3931print_syscall_epilogue(name);3932}
3933#endif3934
3935#ifdef TARGET_NR_prlimit643936static const char *target_ressource_string(abi_ulong r)3937{
3938#define RET_RES_ENTRY(res) case TARGET_##res: return #res;3939switch (r) {3940RET_RES_ENTRY(RLIMIT_AS);3941RET_RES_ENTRY(RLIMIT_CORE);3942RET_RES_ENTRY(RLIMIT_CPU);3943RET_RES_ENTRY(RLIMIT_DATA);3944RET_RES_ENTRY(RLIMIT_FSIZE);3945RET_RES_ENTRY(RLIMIT_LOCKS);3946RET_RES_ENTRY(RLIMIT_MEMLOCK);3947RET_RES_ENTRY(RLIMIT_MSGQUEUE);3948RET_RES_ENTRY(RLIMIT_NICE);3949RET_RES_ENTRY(RLIMIT_NOFILE);3950RET_RES_ENTRY(RLIMIT_NPROC);3951RET_RES_ENTRY(RLIMIT_RSS);3952RET_RES_ENTRY(RLIMIT_RTPRIO);3953#ifdef RLIMIT_RTTIME3954RET_RES_ENTRY(RLIMIT_RTTIME);3955#endif3956RET_RES_ENTRY(RLIMIT_SIGPENDING);3957RET_RES_ENTRY(RLIMIT_STACK);3958default:3959return NULL;3960}3961#undef RET_RES_ENTRY3962}
3963
3964static void3965print_rlimit64(abi_ulong rlim_addr, int last)3966{
3967if (rlim_addr) {3968struct target_rlimit64 *rl;3969
3970rl = lock_user(VERIFY_READ, rlim_addr, sizeof(*rl), 1);3971if (!rl) {3972print_pointer(rlim_addr, last);3973return;3974}3975print_raw_param64("{rlim_cur=%" PRId64, tswap64(rl->rlim_cur), 0);3976print_raw_param64("rlim_max=%" PRId64 "}", tswap64(rl->rlim_max),3977last);3978unlock_user(rl, rlim_addr, 0);3979} else {3980qemu_log("NULL%s", get_comma(last));3981}3982}
3983
3984static void3985print_prlimit64(CPUArchState *cpu_env, const struct syscallname *name,3986abi_long arg0, abi_long arg1, abi_long arg2,3987abi_long arg3, abi_long arg4, abi_long arg5)3988{
3989const char *rlim_name;3990
3991print_syscall_prologue(name);3992print_raw_param("%d", arg0, 0);3993rlim_name = target_ressource_string(arg1);3994if (rlim_name) {3995qemu_log("%s,", rlim_name);3996} else {3997print_raw_param("%d", arg1, 0);3998}3999print_rlimit64(arg2, 0);4000print_pointer(arg3, 1);4001print_syscall_epilogue(name);4002}
4003
4004static void4005print_syscall_ret_prlimit64(CPUArchState *cpu_env,4006const struct syscallname *name,4007abi_long ret, abi_long arg0, abi_long arg1,4008abi_long arg2, abi_long arg3, abi_long arg4,4009abi_long arg5)4010{
4011if (!print_syscall_err(ret)) {4012qemu_log(TARGET_ABI_FMT_ld, ret);4013if (arg3) {4014qemu_log(" (");4015print_rlimit64(arg3, 1);4016qemu_log(")");4017}4018}4019qemu_log("\n");4020}
4021#endif4022
4023#ifdef TARGET_NR_kill4024static void4025print_kill(CPUArchState *cpu_env, const struct syscallname *name,4026abi_long arg0, abi_long arg1, abi_long arg2,4027abi_long arg3, abi_long arg4, abi_long arg5)4028{
4029print_syscall_prologue(name);4030print_raw_param("%d", arg0, 0);4031print_signal(arg1, 1);4032print_syscall_epilogue(name);4033}
4034#endif4035
4036#ifdef TARGET_NR_tkill4037static void4038print_tkill(CPUArchState *cpu_env, const struct syscallname *name,4039abi_long arg0, abi_long arg1, abi_long arg2,4040abi_long arg3, abi_long arg4, abi_long arg5)4041{
4042print_syscall_prologue(name);4043print_raw_param("%d", arg0, 0);4044print_signal(arg1, 1);4045print_syscall_epilogue(name);4046}
4047#endif4048
4049#ifdef TARGET_NR_tgkill4050static void4051print_tgkill(CPUArchState *cpu_env, const struct syscallname *name,4052abi_long arg0, abi_long arg1, abi_long arg2,4053abi_long arg3, abi_long arg4, abi_long arg5)4054{
4055print_syscall_prologue(name);4056print_raw_param("%d", arg0, 0);4057print_raw_param("%d", arg1, 0);4058print_signal(arg2, 1);4059print_syscall_epilogue(name);4060}
4061#endif4062
4063#if defined(TARGET_NR_pread64) || defined(TARGET_NR_pwrite64)4064static void4065print_pread64(CPUArchState *cpu_env, const struct syscallname *name,4066abi_long arg0, abi_long arg1, abi_long arg2,4067abi_long arg3, abi_long arg4, abi_long arg5)4068{
4069if (regpairs_aligned(cpu_env, TARGET_NR_pread64)) {4070arg3 = arg4;4071arg4 = arg5;4072}4073print_syscall_prologue(name);4074print_raw_param("%d", arg0, 0);4075print_pointer(arg1, 0);4076print_raw_param("%d", arg2, 0);4077print_raw_param("%" PRIu64, target_offset64(arg3, arg4), 1);4078print_syscall_epilogue(name);4079}
4080#endif4081
4082#ifdef TARGET_NR_statx4083static void4084print_statx(CPUArchState *cpu_env, const struct syscallname *name,4085abi_long arg0, abi_long arg1, abi_long arg2,4086abi_long arg3, abi_long arg4, abi_long arg5)4087{
4088print_syscall_prologue(name);4089print_at_dirfd(arg0, 0);4090print_string(arg1, 0);4091print_flags(statx_flags, arg2, 0);4092print_flags(statx_mask, arg3, 0);4093print_pointer(arg4, 1);4094print_syscall_epilogue(name);4095}
4096#endif4097
4098#ifdef TARGET_NR_ioctl4099static void4100print_ioctl(CPUArchState *cpu_env, const struct syscallname *name,4101abi_long arg0, abi_long arg1, abi_long arg2,4102abi_long arg3, abi_long arg4, abi_long arg5)4103{
4104print_syscall_prologue(name);4105print_raw_param("%d", arg0, 0);4106
4107const IOCTLEntry *ie;4108const argtype *arg_type;4109void *argptr;4110int target_size;4111
4112for (ie = ioctl_entries; ie->target_cmd != 0; ie++) {4113if (ie->target_cmd == arg1) {4114break;4115}4116}4117
4118if (ie->target_cmd == 0) {4119print_raw_param("%#x", arg1, 0);4120print_raw_param("%#x", arg2, 1);4121} else {4122qemu_log("%s", ie->name);4123arg_type = ie->arg_type;4124
4125if (arg_type[0] != TYPE_NULL) {4126qemu_log(",");4127
4128switch (arg_type[0]) {4129case TYPE_PTRVOID:4130print_pointer(arg2, 1);4131break;4132case TYPE_CHAR:4133case TYPE_SHORT:4134case TYPE_INT:4135print_raw_param("%d", arg2, 1);4136break;4137case TYPE_LONG:4138print_raw_param(TARGET_ABI_FMT_ld, arg2, 1);4139break;4140case TYPE_ULONG:4141print_raw_param(TARGET_ABI_FMT_lu, arg2, 1);4142break;4143case TYPE_PTR:4144switch (ie->access) {4145case IOC_R:4146print_pointer(arg2, 1);4147break;4148case IOC_W:4149case IOC_RW:4150arg_type++;4151target_size = thunk_type_size(arg_type, 0);4152argptr = lock_user(VERIFY_READ, arg2, target_size, 1);4153if (argptr) {4154thunk_print(argptr, arg_type);4155unlock_user(argptr, arg2, target_size);4156} else {4157print_pointer(arg2, 1);4158}4159break;4160}4161break;4162default:4163g_assert_not_reached();4164}4165}4166}4167print_syscall_epilogue(name);4168}
4169#endif4170
4171/*
4172* An array of all of the syscalls we know about
4173*/
4174
4175static const struct syscallname scnames[] = {4176#include "strace.list"4177};4178
4179static int nsyscalls = ARRAY_SIZE(scnames);4180
4181/*
4182* The public interface to this module.
4183*/
4184void
4185print_syscall(CPUArchState *cpu_env, int num,4186abi_long arg1, abi_long arg2, abi_long arg3,4187abi_long arg4, abi_long arg5, abi_long arg6)4188{
4189int i;4190FILE *f;4191const char *format = "%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ","4192TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ","4193TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ")";4194
4195f = qemu_log_trylock();4196if (!f) {4197return;4198}4199fprintf(f, "%d ", getpid());4200
4201for (i = 0; i < nsyscalls; i++) {4202if (scnames[i].nr == num) {4203if (scnames[i].call != NULL) {4204scnames[i].call(cpu_env, &scnames[i], arg1, arg2, arg3,4205arg4, arg5, arg6);4206} else {4207/* XXX: this format system is broken because it uses4208host types and host pointers for strings */
4209if (scnames[i].format != NULL) {4210format = scnames[i].format;4211}4212fprintf(f, format, scnames[i].name, arg1, arg2,4213arg3, arg4, arg5, arg6);4214}4215qemu_log_unlock(f);4216return;4217}4218}4219fprintf(f, "Unknown syscall %d\n", num);4220qemu_log_unlock(f);4221}
4222
4223
4224void
4225print_syscall_ret(CPUArchState *cpu_env, int num, abi_long ret,4226abi_long arg1, abi_long arg2, abi_long arg3,4227abi_long arg4, abi_long arg5, abi_long arg6)4228{
4229int i;4230FILE *f;4231
4232f = qemu_log_trylock();4233if (!f) {4234return;4235}4236
4237for (i = 0; i < nsyscalls; i++) {4238if (scnames[i].nr == num) {4239if (scnames[i].result != NULL) {4240scnames[i].result(cpu_env, &scnames[i], ret,4241arg1, arg2, arg3,4242arg4, arg5, arg6);4243} else {4244if (!print_syscall_err(ret)) {4245fprintf(f, TARGET_ABI_FMT_ld, ret);4246}4247fprintf(f, "\n");4248}4249break;4250}4251}4252qemu_log_unlock(f);4253}
4254
4255void print_taken_signal(int target_signum, const target_siginfo_t *tinfo)4256{
4257/* Print the strace output for a signal being taken:4258* --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
4259*/
4260FILE *f;4261
4262f = qemu_log_trylock();4263if (!f) {4264return;4265}4266
4267fprintf(f, "--- ");4268print_signal(target_signum, 1);4269fprintf(f, " ");4270print_siginfo(tinfo);4271fprintf(f, " ---\n");4272qemu_log_unlock(f);4273}
4274