2003-02-18 23:55:36 +01:00
|
|
|
/* common syscall defines for all architectures */
|
|
|
|
|
2003-06-15 21:58:13 +02:00
|
|
|
/* Note: although the syscall numbers change between architectures,
|
2011-11-22 11:06:17 +01:00
|
|
|
most of them stay the same, so we handle it by putting ifdefs if
|
2003-06-15 21:58:13 +02:00
|
|
|
necessary */
|
|
|
|
|
2012-12-06 12:15:58 +01:00
|
|
|
#ifndef SYSCALL_DEFS_H
|
2016-06-29 15:54:17 +02:00
|
|
|
#define SYSCALL_DEFS_H
|
2012-12-06 12:15:58 +01:00
|
|
|
|
2003-09-30 23:04:53 +02:00
|
|
|
#include "syscall_nr.h"
|
2003-06-15 21:58:13 +02:00
|
|
|
|
linux-user: Fix socketcall() syscall support
Since not all Linux host platforms support socketcall() (most notably
Intel), do_socketcall() function in Qemu's syscalls.c is implemented to
mirror the corespondant implementation of socketcall() in Linux kernel,
and to utilise individual socket operations that are supported on all
Linux platforms. (see kernel source file net/socket.c, definition of
socketcall).
However, error codes produced by Qemu implementation are wrong for the
cases of invalid values of the first argument. Also, naming of constants
is not consistent with kernel one, and not consistant with Qemu convention
of prefixing such constants with "TARGET_". This patch in that light
brings do_socketcall() closer to its kernel counterpart, and in that way
fixes the errors and yields more consisrtent Qemu code.
There were also three missing cases (among 20) for strace support for
socketcall(). The array that contains pointers for appropriate printing
functions is updated with 3 elements, however pointers to functions are
left NULL, and its implementation is left for future.
Also, this patch fixes failure of LTP test socketcall02, if executed on some
Qemu emulated sywstems (uer mode).
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-09-22 18:56:57 +02:00
|
|
|
|
|
|
|
/* socket operations for socketcall() */
|
|
|
|
#define TARGET_SYS_SOCKET 1 /* socket() */
|
|
|
|
#define TARGET_SYS_BIND 2 /* bind() */
|
|
|
|
#define TARGET_SYS_CONNECT 3 /* connect() */
|
|
|
|
#define TARGET_SYS_LISTEN 4 /* listen() */
|
|
|
|
#define TARGET_SYS_ACCEPT 5 /* accept() */
|
|
|
|
#define TARGET_SYS_GETSOCKNAME 6 /* getsockname() */
|
|
|
|
#define TARGET_SYS_GETPEERNAME 7 /* getpeername() */
|
|
|
|
#define TARGET_SYS_SOCKETPAIR 8 /* socketpair() */
|
|
|
|
#define TARGET_SYS_SEND 9 /* send() */
|
|
|
|
#define TARGET_SYS_RECV 10 /* recv() */
|
|
|
|
#define TARGET_SYS_SENDTO 11 /* sendto() */
|
|
|
|
#define TARGET_SYS_RECVFROM 12 /* recvfrom() */
|
|
|
|
#define TARGET_SYS_SHUTDOWN 13 /* shutdown() */
|
|
|
|
#define TARGET_SYS_SETSOCKOPT 14 /* setsockopt() */
|
|
|
|
#define TARGET_SYS_GETSOCKOPT 15 /* getsockopt() */
|
|
|
|
#define TARGET_SYS_SENDMSG 16 /* sendmsg() */
|
|
|
|
#define TARGET_SYS_RECVMSG 17 /* recvmsg() */
|
|
|
|
#define TARGET_SYS_ACCEPT4 18 /* accept4() */
|
|
|
|
#define TARGET_SYS_RECVMMSG 19 /* recvmmsg() */
|
|
|
|
#define TARGET_SYS_SENDMMSG 20 /* sendmmsg() */
|
2003-02-18 23:55:36 +01:00
|
|
|
|
2019-05-29 10:48:04 +02:00
|
|
|
#define IPCOP_CALL(VERSION, OP) ((VERSION) << 16 | (OP))
|
2004-02-22 15:57:26 +01:00
|
|
|
#define IPCOP_semop 1
|
|
|
|
#define IPCOP_semget 2
|
|
|
|
#define IPCOP_semctl 3
|
|
|
|
#define IPCOP_semtimedop 4
|
|
|
|
#define IPCOP_msgsnd 11
|
|
|
|
#define IPCOP_msgrcv 12
|
|
|
|
#define IPCOP_msgget 13
|
|
|
|
#define IPCOP_msgctl 14
|
|
|
|
#define IPCOP_shmat 21
|
|
|
|
#define IPCOP_shmdt 22
|
|
|
|
#define IPCOP_shmget 23
|
|
|
|
#define IPCOP_shmctl 24
|
|
|
|
|
2003-06-15 21:58:13 +02:00
|
|
|
/*
|
|
|
|
* The following is for compatibility across the various Linux
|
|
|
|
* platforms. The i386 ioctl numbering scheme doesn't really enforce
|
|
|
|
* a type field. De facto, however, the top 8 bits of the lower 16
|
|
|
|
* bits are indeed used as a type field, so we might just as well make
|
|
|
|
* this explicit here. Please be sure to use the decoding macros
|
|
|
|
* below from now on.
|
|
|
|
*/
|
|
|
|
#define TARGET_IOC_NRBITS 8
|
|
|
|
#define TARGET_IOC_TYPEBITS 8
|
|
|
|
|
2016-03-01 17:25:17 +01:00
|
|
|
#if (defined(TARGET_I386) && defined(TARGET_ABI32)) \
|
|
|
|
|| (defined(TARGET_ARM) && defined(TARGET_ABI32)) \
|
2014-03-02 20:36:40 +01:00
|
|
|
|| defined(TARGET_SPARC) \
|
2011-04-18 14:23:06 +02:00
|
|
|
|| defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
|
2009-04-07 15:57:29 +02:00
|
|
|
/* 16 bit uid wrappers emulation */
|
|
|
|
#define USE_UID16
|
2011-04-18 14:23:06 +02:00
|
|
|
#define target_id uint16_t
|
|
|
|
#else
|
|
|
|
#define target_id uint32_t
|
2009-04-07 15:57:29 +02:00
|
|
|
#endif
|
|
|
|
|
2006-10-22 02:18:54 +02:00
|
|
|
#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
|
2015-08-20 23:36:37 +02:00
|
|
|
|| defined(TARGET_M68K) || defined(TARGET_CRIS) \
|
2018-03-08 15:47:32 +01:00
|
|
|
|| defined(TARGET_S390X) \
|
2017-01-18 23:01:42 +01:00
|
|
|
|| defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) \
|
2017-01-25 19:54:11 +01:00
|
|
|
|| defined(TARGET_NIOS2) || defined(TARGET_RISCV) \
|
|
|
|
|| defined(TARGET_XTENSA)
|
2003-06-15 21:58:13 +02:00
|
|
|
|
|
|
|
#define TARGET_IOC_SIZEBITS 14
|
|
|
|
#define TARGET_IOC_DIRBITS 2
|
|
|
|
|
|
|
|
#define TARGET_IOC_NONE 0U
|
|
|
|
#define TARGET_IOC_WRITE 1U
|
|
|
|
#define TARGET_IOC_READ 2U
|
|
|
|
|
2005-11-26 19:47:20 +01:00
|
|
|
#elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \
|
2009-05-20 21:31:33 +02:00
|
|
|
defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \
|
|
|
|
defined(TARGET_MIPS)
|
2003-06-15 21:58:13 +02:00
|
|
|
|
|
|
|
#define TARGET_IOC_SIZEBITS 13
|
|
|
|
#define TARGET_IOC_DIRBITS 3
|
|
|
|
|
|
|
|
#define TARGET_IOC_NONE 1U
|
|
|
|
#define TARGET_IOC_READ 2U
|
|
|
|
#define TARGET_IOC_WRITE 4U
|
|
|
|
|
2016-12-15 18:56:41 +01:00
|
|
|
#elif defined(TARGET_HPPA)
|
|
|
|
|
|
|
|
#define TARGET_IOC_SIZEBITS 14
|
|
|
|
#define TARGET_IOC_DIRBITS 2
|
|
|
|
|
|
|
|
#define TARGET_IOC_NONE 0U
|
|
|
|
#define TARGET_IOC_WRITE 2U
|
|
|
|
#define TARGET_IOC_READ 1U
|
|
|
|
|
2003-06-15 21:58:13 +02:00
|
|
|
#else
|
|
|
|
#error unsupported CPU
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1)
|
|
|
|
#define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1)
|
|
|
|
#define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1)
|
|
|
|
#define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1)
|
|
|
|
|
|
|
|
#define TARGET_IOC_NRSHIFT 0
|
|
|
|
#define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS)
|
|
|
|
#define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS)
|
|
|
|
#define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS)
|
|
|
|
|
|
|
|
#define TARGET_IOC(dir,type,nr,size) \
|
|
|
|
(((dir) << TARGET_IOC_DIRSHIFT) | \
|
|
|
|
((type) << TARGET_IOC_TYPESHIFT) | \
|
|
|
|
((nr) << TARGET_IOC_NRSHIFT) | \
|
|
|
|
((size) << TARGET_IOC_SIZESHIFT))
|
|
|
|
|
|
|
|
/* used to create numbers */
|
|
|
|
#define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0)
|
|
|
|
#define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size))
|
|
|
|
#define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size))
|
|
|
|
#define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size))
|
|
|
|
|
|
|
|
/* the size is automatically computed for these defines */
|
|
|
|
#define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK)
|
|
|
|
#define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
|
|
|
|
#define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
|
|
|
|
|
2003-03-29 18:22:23 +01:00
|
|
|
struct target_sockaddr {
|
|
|
|
uint16_t sa_family;
|
|
|
|
uint8_t sa_data[14];
|
|
|
|
};
|
|
|
|
|
2014-07-12 15:47:07 +02:00
|
|
|
struct target_sockaddr_ll {
|
|
|
|
uint16_t sll_family; /* Always AF_PACKET */
|
|
|
|
uint16_t sll_protocol; /* Physical layer protocol */
|
|
|
|
int sll_ifindex; /* Interface number */
|
|
|
|
uint16_t sll_hatype; /* ARP hardware type */
|
|
|
|
uint8_t sll_pkttype; /* Packet type */
|
|
|
|
uint8_t sll_halen; /* Length of address */
|
|
|
|
uint8_t sll_addr[8]; /* Physical layer address */
|
|
|
|
};
|
|
|
|
|
2016-06-11 02:19:45 +02:00
|
|
|
struct target_sockaddr_un {
|
|
|
|
uint16_t su_family;
|
|
|
|
uint8_t sun_path[108];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct target_in_addr {
|
|
|
|
uint32_t s_addr; /* big endian */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct target_sockaddr_in {
|
|
|
|
uint16_t sin_family;
|
|
|
|
int16_t sin_port; /* big endian */
|
|
|
|
struct target_in_addr sin_addr;
|
|
|
|
uint8_t __pad[sizeof(struct target_sockaddr) -
|
|
|
|
sizeof(uint16_t) - sizeof(int16_t) -
|
|
|
|
sizeof(struct target_in_addr)];
|
|
|
|
};
|
|
|
|
|
2017-02-18 23:31:30 +01:00
|
|
|
struct target_sockaddr_in6 {
|
|
|
|
uint16_t sin6_family;
|
|
|
|
uint16_t sin6_port; /* big endian */
|
|
|
|
uint32_t sin6_flowinfo; /* big endian */
|
|
|
|
struct in6_addr sin6_addr; /* IPv6 address, big endian */
|
|
|
|
uint32_t sin6_scope_id;
|
|
|
|
};
|
|
|
|
|
2013-08-30 01:46:41 +02:00
|
|
|
struct target_sock_filter {
|
|
|
|
abi_ushort code;
|
|
|
|
uint8_t jt;
|
|
|
|
uint8_t jf;
|
|
|
|
abi_uint k;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct target_sock_fprog {
|
|
|
|
abi_ushort len;
|
|
|
|
abi_ulong filter;
|
|
|
|
};
|
|
|
|
|
2009-04-25 23:30:19 +02:00
|
|
|
struct target_ip_mreq {
|
|
|
|
struct target_in_addr imr_multiaddr;
|
|
|
|
struct target_in_addr imr_address;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct target_ip_mreqn {
|
|
|
|
struct target_in_addr imr_multiaddr;
|
|
|
|
struct target_in_addr imr_address;
|
|
|
|
abi_long imr_ifindex;
|
|
|
|
};
|
|
|
|
|
2009-04-25 23:31:18 +02:00
|
|
|
struct target_ip_mreq_source {
|
|
|
|
/* big endian */
|
|
|
|
uint32_t imr_multiaddr;
|
|
|
|
uint32_t imr_interface;
|
|
|
|
uint32_t imr_sourceaddr;
|
|
|
|
};
|
|
|
|
|
2018-08-24 10:56:01 +02:00
|
|
|
struct target_linger {
|
|
|
|
abi_int l_onoff; /* Linger active */
|
|
|
|
abi_int l_linger; /* How long to linger for */
|
|
|
|
};
|
|
|
|
|
2019-07-18 15:06:41 +02:00
|
|
|
#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
|
|
|
|
struct target_timeval {
|
|
|
|
abi_long tv_sec;
|
|
|
|
abi_int tv_usec;
|
|
|
|
};
|
|
|
|
#define target__kernel_sock_timeval target_timeval
|
|
|
|
#else
|
2003-02-18 23:55:36 +01:00
|
|
|
struct target_timeval {
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long tv_sec;
|
|
|
|
abi_long tv_usec;
|
2003-02-18 23:55:36 +01:00
|
|
|
};
|
|
|
|
|
2019-07-18 15:06:41 +02:00
|
|
|
struct target__kernel_sock_timeval {
|
|
|
|
abi_llong tv_sec;
|
|
|
|
abi_llong tv_usec;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2003-03-22 18:31:38 +01:00
|
|
|
struct target_timespec {
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long tv_sec;
|
|
|
|
abi_long tv_nsec;
|
2003-03-22 18:31:38 +01:00
|
|
|
};
|
|
|
|
|
2019-07-18 15:06:41 +02:00
|
|
|
struct target__kernel_timespec {
|
|
|
|
abi_llong tv_sec;
|
|
|
|
abi_llong tv_nsec;
|
|
|
|
};
|
|
|
|
|
2014-06-22 12:25:40 +02:00
|
|
|
struct target_timezone {
|
|
|
|
abi_int tz_minuteswest;
|
|
|
|
abi_int tz_dsttime;
|
|
|
|
};
|
|
|
|
|
2003-03-23 02:06:05 +01:00
|
|
|
struct target_itimerval {
|
|
|
|
struct target_timeval it_interval;
|
|
|
|
struct target_timeval it_value;
|
|
|
|
};
|
|
|
|
|
2013-11-29 08:39:22 +01:00
|
|
|
struct target_itimerspec {
|
|
|
|
struct target_timespec it_interval;
|
|
|
|
struct target_timespec it_value;
|
|
|
|
};
|
|
|
|
|
2016-09-22 18:56:50 +02:00
|
|
|
struct target_timex {
|
|
|
|
abi_uint modes; /* Mode selector */
|
|
|
|
abi_long offset; /* Time offset */
|
|
|
|
abi_long freq; /* Frequency offset */
|
|
|
|
abi_long maxerror; /* Maximum error (microseconds) */
|
|
|
|
abi_long esterror; /* Estimated error (microseconds) */
|
|
|
|
abi_int status; /* Clock command/status */
|
|
|
|
abi_long constant; /* PLL (phase-locked loop) time constant */
|
|
|
|
abi_long precision; /* Clock precision (microseconds, ro) */
|
|
|
|
abi_long tolerance; /* Clock freq. tolerance (ppm, ro) */
|
|
|
|
struct target_timeval time; /* Current time */
|
|
|
|
abi_long tick; /* Microseconds between clock ticks */
|
|
|
|
abi_long ppsfreq; /* PPS (pulse per second) frequency */
|
|
|
|
abi_long jitter; /* PPS jitter (ro); nanoseconds */
|
|
|
|
abi_int shift; /* PPS interval duration (seconds) */
|
|
|
|
abi_long stabil; /* PPS stability */
|
|
|
|
abi_long jitcnt; /* PPS jitter limit exceeded (ro) */
|
|
|
|
abi_long calcnt; /* PPS calibration intervals */
|
|
|
|
abi_long errcnt; /* PPS calibration errors */
|
|
|
|
abi_long stbcnt; /* PPS stability limit exceeded */
|
|
|
|
abi_int tai; /* TAI offset */
|
|
|
|
|
|
|
|
/* Further padding bytes to allow for future expansion */
|
|
|
|
abi_int:32; abi_int:32; abi_int:32; abi_int:32;
|
|
|
|
abi_int:32; abi_int:32; abi_int:32; abi_int:32;
|
|
|
|
abi_int:32; abi_int:32; abi_int:32;
|
|
|
|
};
|
|
|
|
|
2009-10-01 23:12:16 +02:00
|
|
|
typedef abi_long target_clock_t;
|
2003-03-30 23:29:48 +02:00
|
|
|
|
2003-07-13 19:32:31 +02:00
|
|
|
#define TARGET_HZ 100
|
|
|
|
|
2003-03-30 23:29:48 +02:00
|
|
|
struct target_tms {
|
2009-10-01 23:12:16 +02:00
|
|
|
target_clock_t tms_utime;
|
|
|
|
target_clock_t tms_stime;
|
|
|
|
target_clock_t tms_cutime;
|
|
|
|
target_clock_t tms_cstime;
|
2003-03-30 23:29:48 +02:00
|
|
|
};
|
|
|
|
|
2003-09-30 23:04:53 +02:00
|
|
|
struct target_utimbuf {
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long actime;
|
|
|
|
abi_long modtime;
|
2003-09-30 23:04:53 +02:00
|
|
|
};
|
|
|
|
|
2003-07-09 14:26:09 +02:00
|
|
|
struct target_sel_arg_struct {
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long n;
|
|
|
|
abi_long inp, outp, exp;
|
|
|
|
abi_long tvp;
|
2003-07-09 14:26:09 +02:00
|
|
|
};
|
|
|
|
|
2003-02-18 23:55:36 +01:00
|
|
|
struct target_iovec {
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long iov_base; /* Starting address */
|
|
|
|
abi_long iov_len; /* Number of bytes */
|
2003-02-18 23:55:36 +01:00
|
|
|
};
|
|
|
|
|
2003-03-16 21:28:50 +01:00
|
|
|
struct target_msghdr {
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long msg_name; /* Socket name */
|
|
|
|
int msg_namelen; /* Length of name */
|
|
|
|
abi_long msg_iov; /* Data blocks */
|
|
|
|
abi_long msg_iovlen; /* Number of blocks */
|
|
|
|
abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
|
|
|
|
abi_long msg_controllen; /* Length of cmsg list */
|
2003-03-16 21:28:50 +01:00
|
|
|
unsigned int msg_flags;
|
|
|
|
};
|
|
|
|
|
2003-03-29 18:22:23 +01:00
|
|
|
struct target_cmsghdr {
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long cmsg_len;
|
2003-03-29 18:22:23 +01:00
|
|
|
int cmsg_level;
|
|
|
|
int cmsg_type;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1))
|
2015-09-03 07:27:26 +02:00
|
|
|
#define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \
|
|
|
|
__target_cmsg_nxthdr(mhdr, cmsg, cmsg_start)
|
2007-10-14 18:27:31 +02:00
|
|
|
#define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \
|
|
|
|
& (size_t) ~(sizeof (abi_long) - 1))
|
2017-12-15 14:52:56 +01:00
|
|
|
#define TARGET_CMSG_SPACE(len) (sizeof(struct target_cmsghdr) + \
|
|
|
|
TARGET_CMSG_ALIGN(len))
|
|
|
|
#define TARGET_CMSG_LEN(len) (sizeof(struct target_cmsghdr) + (len))
|
2003-03-29 18:22:23 +01:00
|
|
|
|
|
|
|
static __inline__ struct target_cmsghdr *
|
2015-09-03 07:27:26 +02:00
|
|
|
__target_cmsg_nxthdr(struct target_msghdr *__mhdr,
|
|
|
|
struct target_cmsghdr *__cmsg,
|
|
|
|
struct target_cmsghdr *__cmsg_start)
|
2003-03-29 18:22:23 +01:00
|
|
|
{
|
2007-05-28 23:35:23 +02:00
|
|
|
struct target_cmsghdr *__ptr;
|
|
|
|
|
|
|
|
__ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg
|
2011-08-12 19:57:41 +02:00
|
|
|
+ TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len)));
|
2015-09-03 07:27:26 +02:00
|
|
|
if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start)
|
|
|
|
> tswapal(__mhdr->msg_controllen)) {
|
2003-03-29 18:22:23 +01:00
|
|
|
/* No more entries. */
|
2007-05-28 23:35:23 +02:00
|
|
|
return (struct target_cmsghdr *)0;
|
2015-09-03 07:27:26 +02:00
|
|
|
}
|
|
|
|
return __ptr;
|
2003-03-29 18:22:23 +01:00
|
|
|
}
|
|
|
|
|
2014-03-02 20:36:42 +01:00
|
|
|
struct target_mmsghdr {
|
|
|
|
struct target_msghdr msg_hdr; /* Message header */
|
|
|
|
unsigned int msg_len; /* Number of bytes transmitted */
|
|
|
|
};
|
2003-03-29 18:22:23 +01:00
|
|
|
|
2003-02-18 23:55:36 +01:00
|
|
|
struct target_rusage {
|
|
|
|
struct target_timeval ru_utime; /* user time used */
|
|
|
|
struct target_timeval ru_stime; /* system time used */
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long ru_maxrss; /* maximum resident set size */
|
|
|
|
abi_long ru_ixrss; /* integral shared memory size */
|
|
|
|
abi_long ru_idrss; /* integral unshared data size */
|
|
|
|
abi_long ru_isrss; /* integral unshared stack size */
|
|
|
|
abi_long ru_minflt; /* page reclaims */
|
|
|
|
abi_long ru_majflt; /* page faults */
|
|
|
|
abi_long ru_nswap; /* swaps */
|
|
|
|
abi_long ru_inblock; /* block input operations */
|
|
|
|
abi_long ru_oublock; /* block output operations */
|
|
|
|
abi_long ru_msgsnd; /* messages sent */
|
|
|
|
abi_long ru_msgrcv; /* messages received */
|
|
|
|
abi_long ru_nsignals; /* signals received */
|
|
|
|
abi_long ru_nvcsw; /* voluntary context switches */
|
|
|
|
abi_long ru_nivcsw; /* involuntary " */
|
2003-02-18 23:55:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int val[2];
|
2009-10-01 23:12:16 +02:00
|
|
|
} kernel_fsid_t;
|
2003-02-18 23:55:36 +01:00
|
|
|
|
2003-03-22 16:23:14 +01:00
|
|
|
struct target_dirent {
|
2012-08-21 00:13:12 +02:00
|
|
|
abi_long d_ino;
|
|
|
|
abi_long d_off;
|
|
|
|
unsigned short d_reclen;
|
|
|
|
char d_name[];
|
2003-03-22 16:23:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct target_dirent64 {
|
|
|
|
uint64_t d_ino;
|
|
|
|
int64_t d_off;
|
|
|
|
unsigned short d_reclen;
|
|
|
|
unsigned char d_type;
|
|
|
|
char d_name[256];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-02-18 23:55:36 +01:00
|
|
|
/* mostly generic signal stuff */
|
2007-10-14 18:27:31 +02:00
|
|
|
#define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */
|
|
|
|
#define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */
|
|
|
|
#define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */
|
2003-02-18 23:55:36 +01:00
|
|
|
|
|
|
|
#ifdef TARGET_MIPS
|
|
|
|
#define TARGET_NSIG 128
|
|
|
|
#else
|
|
|
|
#define TARGET_NSIG 64
|
|
|
|
#endif
|
2007-10-14 18:27:31 +02:00
|
|
|
#define TARGET_NSIG_BPW TARGET_ABI_BITS
|
2003-02-18 23:55:36 +01:00
|
|
|
#define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW)
|
|
|
|
|
|
|
|
typedef struct {
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong sig[TARGET_NSIG_WORDS];
|
2009-10-01 23:12:16 +02:00
|
|
|
} target_sigset_t;
|
2003-02-18 23:55:36 +01:00
|
|
|
|
2003-03-23 02:06:05 +01:00
|
|
|
#ifdef BSWAP_NEEDED
|
2009-10-01 23:12:16 +02:00
|
|
|
static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
|
2003-03-23 02:06:05 +01:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for(i = 0;i < TARGET_NSIG_WORDS; i++)
|
2011-08-12 19:57:41 +02:00
|
|
|
d->sig[i] = tswapal(s->sig[i]);
|
2003-03-23 02:06:05 +01:00
|
|
|
}
|
|
|
|
#else
|
2009-10-01 23:12:16 +02:00
|
|
|
static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
|
2003-03-23 02:06:05 +01:00
|
|
|
{
|
|
|
|
*d = *s;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-10-01 23:12:16 +02:00
|
|
|
static inline void target_siginitset(target_sigset_t *d, abi_ulong set)
|
2003-03-23 02:06:05 +01:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
d->sig[0] = set;
|
|
|
|
for(i = 1;i < TARGET_NSIG_WORDS; i++)
|
|
|
|
d->sig[i] = 0;
|
|
|
|
}
|
|
|
|
|
2009-10-01 23:12:16 +02:00
|
|
|
void host_to_target_sigset(target_sigset_t *d, const sigset_t *s);
|
|
|
|
void target_to_host_sigset(sigset_t *d, const target_sigset_t *s);
|
2007-10-14 18:27:31 +02:00
|
|
|
void host_to_target_old_sigset(abi_ulong *old_sigset,
|
2003-03-23 02:06:05 +01:00
|
|
|
const sigset_t *sigset);
|
2007-09-16 23:08:06 +02:00
|
|
|
void target_to_host_old_sigset(sigset_t *sigset,
|
2007-10-14 18:27:31 +02:00
|
|
|
const abi_ulong *old_sigset);
|
2003-03-23 02:06:05 +01:00
|
|
|
struct target_sigaction;
|
|
|
|
int do_sigaction(int sig, const struct target_sigaction *act,
|
|
|
|
struct target_sigaction *oact);
|
|
|
|
|
2018-05-29 21:42:00 +02:00
|
|
|
#include "target_signal.h"
|
|
|
|
|
2017-10-31 13:53:52 +01:00
|
|
|
#ifdef TARGET_SA_RESTORER
|
|
|
|
#define TARGET_ARCH_HAS_SA_RESTORER 1
|
|
|
|
#endif
|
|
|
|
|
2009-12-28 03:30:03 +01:00
|
|
|
#if defined(TARGET_ALPHA)
|
|
|
|
struct target_old_sigaction {
|
|
|
|
abi_ulong _sa_handler;
|
|
|
|
abi_ulong sa_mask;
|
2013-01-05 01:39:32 +01:00
|
|
|
int32_t sa_flags;
|
2009-12-28 03:30:03 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct target_rt_sigaction {
|
|
|
|
abi_ulong _sa_handler;
|
|
|
|
abi_ulong sa_flags;
|
|
|
|
target_sigset_t sa_mask;
|
|
|
|
};
|
2006-06-27 23:08:10 +02:00
|
|
|
|
2009-12-28 03:30:03 +01:00
|
|
|
/* This is the struct used inside the kernel. The ka_restorer
|
|
|
|
field comes from the 5th argument to sys_rt_sigaction. */
|
|
|
|
struct target_sigaction {
|
|
|
|
abi_ulong _sa_handler;
|
|
|
|
abi_ulong sa_flags;
|
|
|
|
target_sigset_t sa_mask;
|
|
|
|
abi_ulong sa_restorer;
|
|
|
|
};
|
|
|
|
#elif defined(TARGET_MIPS)
|
2006-06-27 23:08:10 +02:00
|
|
|
struct target_sigaction {
|
2007-09-30 03:58:33 +02:00
|
|
|
uint32_t sa_flags;
|
2007-11-08 19:05:37 +01:00
|
|
|
#if defined(TARGET_ABI_MIPSN32)
|
2007-09-30 03:58:33 +02:00
|
|
|
uint32_t _sa_handler;
|
|
|
|
#else
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong _sa_handler;
|
2007-09-30 03:58:33 +02:00
|
|
|
#endif
|
2009-10-01 23:12:16 +02:00
|
|
|
target_sigset_t sa_mask;
|
2017-10-31 13:53:52 +01:00
|
|
|
#ifdef TARGET_ARCH_HAS_SA_RESTORER
|
|
|
|
/* ??? This is always present, but ignored unless O32. */
|
|
|
|
abi_ulong sa_restorer;
|
|
|
|
#endif
|
2006-06-27 23:08:10 +02:00
|
|
|
};
|
|
|
|
#else
|
2003-06-15 21:58:13 +02:00
|
|
|
struct target_old_sigaction {
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong _sa_handler;
|
|
|
|
abi_ulong sa_mask;
|
|
|
|
abi_ulong sa_flags;
|
2017-10-31 13:53:52 +01:00
|
|
|
#ifdef TARGET_ARCH_HAS_SA_RESTORER
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong sa_restorer;
|
2017-10-31 13:53:52 +01:00
|
|
|
#endif
|
2003-06-15 21:58:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct target_sigaction {
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong _sa_handler;
|
|
|
|
abi_ulong sa_flags;
|
2017-10-31 13:53:52 +01:00
|
|
|
#ifdef TARGET_ARCH_HAS_SA_RESTORER
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong sa_restorer;
|
2017-10-31 13:53:52 +01:00
|
|
|
#endif
|
2009-10-01 23:12:16 +02:00
|
|
|
target_sigset_t sa_mask;
|
2018-04-02 12:24:52 +02:00
|
|
|
#ifdef TARGET_ARCH_HAS_KA_RESTORER
|
|
|
|
abi_ulong ka_restorer;
|
|
|
|
#endif
|
2003-06-15 21:58:13 +02:00
|
|
|
};
|
2006-06-27 23:08:10 +02:00
|
|
|
#endif
|
2003-06-15 21:58:13 +02:00
|
|
|
|
|
|
|
typedef union target_sigval {
|
|
|
|
int sival_int;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong sival_ptr;
|
2009-10-01 23:12:16 +02:00
|
|
|
} target_sigval_t;
|
2004-10-01 00:04:13 +02:00
|
|
|
#if 0
|
|
|
|
#if defined (TARGET_SPARC)
|
|
|
|
typedef struct {
|
|
|
|
struct {
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong psr;
|
|
|
|
abi_ulong pc;
|
|
|
|
abi_ulong npc;
|
|
|
|
abi_ulong y;
|
|
|
|
abi_ulong u_regs[16]; /* globals and ins */
|
2004-10-01 00:04:13 +02:00
|
|
|
} si_regs;
|
|
|
|
int si_mask;
|
|
|
|
} __siginfo_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
unsigned long si_float_regs [32];
|
|
|
|
unsigned long si_fsr;
|
|
|
|
unsigned long si_fpqdepth;
|
|
|
|
struct {
|
|
|
|
unsigned long *insn_addr;
|
|
|
|
unsigned long insn;
|
|
|
|
} si_fpqueue [16];
|
|
|
|
} __siginfo_fpu_t;
|
|
|
|
#endif
|
|
|
|
#endif
|
2003-06-15 21:58:13 +02:00
|
|
|
|
|
|
|
#define TARGET_SI_MAX_SIZE 128
|
2015-02-02 15:18:29 +01:00
|
|
|
|
|
|
|
#if TARGET_ABI_BITS == 32
|
|
|
|
#define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int))
|
|
|
|
#else
|
|
|
|
#define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int))
|
2003-06-15 21:58:13 +02:00
|
|
|
|
2016-05-27 16:51:59 +02:00
|
|
|
/* Within QEMU the top 16 bits of si_code indicate which of the parts of
|
|
|
|
* the union in target_siginfo is valid. This only applies between
|
|
|
|
* host_to_target_siginfo_noswap() and tswap_siginfo(); it does not
|
|
|
|
* appear either within host siginfo_t or in target_siginfo structures
|
|
|
|
* which we get from the guest userspace program. (The Linux kernel
|
|
|
|
* does a similar thing with using the top bits for its own internal
|
|
|
|
* purposes but not letting them be visible to userspace.)
|
|
|
|
*/
|
|
|
|
#define QEMU_SI_KILL 0
|
|
|
|
#define QEMU_SI_TIMER 1
|
|
|
|
#define QEMU_SI_POLL 2
|
|
|
|
#define QEMU_SI_FAULT 3
|
|
|
|
#define QEMU_SI_CHLD 4
|
|
|
|
#define QEMU_SI_RT 5
|
|
|
|
|
2003-06-15 21:58:13 +02:00
|
|
|
typedef struct target_siginfo {
|
2009-04-21 02:59:40 +02:00
|
|
|
#ifdef TARGET_MIPS
|
|
|
|
int si_signo;
|
|
|
|
int si_code;
|
|
|
|
int si_errno;
|
|
|
|
#else
|
2003-06-15 21:58:13 +02:00
|
|
|
int si_signo;
|
|
|
|
int si_errno;
|
|
|
|
int si_code;
|
2009-04-21 02:59:40 +02:00
|
|
|
#endif
|
2003-06-15 21:58:13 +02:00
|
|
|
|
|
|
|
union {
|
|
|
|
int _pad[TARGET_SI_PAD_SIZE];
|
|
|
|
|
|
|
|
/* kill() */
|
|
|
|
struct {
|
|
|
|
pid_t _pid; /* sender's pid */
|
|
|
|
uid_t _uid; /* sender's uid */
|
|
|
|
} _kill;
|
|
|
|
|
|
|
|
/* POSIX.1b timers */
|
|
|
|
struct {
|
|
|
|
unsigned int _timer1;
|
|
|
|
unsigned int _timer2;
|
|
|
|
} _timer;
|
|
|
|
|
|
|
|
/* POSIX.1b signals */
|
|
|
|
struct {
|
|
|
|
pid_t _pid; /* sender's pid */
|
|
|
|
uid_t _uid; /* sender's uid */
|
2009-10-01 23:12:16 +02:00
|
|
|
target_sigval_t _sigval;
|
2003-06-15 21:58:13 +02:00
|
|
|
} _rt;
|
|
|
|
|
|
|
|
/* SIGCHLD */
|
|
|
|
struct {
|
|
|
|
pid_t _pid; /* which child */
|
|
|
|
uid_t _uid; /* sender's uid */
|
|
|
|
int _status; /* exit code */
|
2009-10-01 23:12:16 +02:00
|
|
|
target_clock_t _utime;
|
|
|
|
target_clock_t _stime;
|
2003-06-15 21:58:13 +02:00
|
|
|
} _sigchld;
|
|
|
|
|
|
|
|
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
|
|
|
|
struct {
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong _addr; /* faulting insn/memory ref. */
|
2003-06-15 21:58:13 +02:00
|
|
|
} _sigfault;
|
|
|
|
|
|
|
|
/* SIGPOLL */
|
|
|
|
struct {
|
|
|
|
int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
|
|
|
|
int _fd;
|
|
|
|
} _sigpoll;
|
|
|
|
} _sifields;
|
2009-10-01 23:12:16 +02:00
|
|
|
} target_siginfo_t;
|
2003-06-15 21:58:13 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* si_code values
|
|
|
|
* Digital reserves positive values for kernel-generated signals.
|
|
|
|
*/
|
|
|
|
#define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */
|
|
|
|
#define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */
|
|
|
|
#define TARGET_SI_QUEUE -1 /* sent by sigqueue */
|
|
|
|
#define TARGET_SI_TIMER -2 /* sent by timer expiration */
|
|
|
|
#define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */
|
|
|
|
#define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */
|
|
|
|
#define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* SIGILL si_codes
|
|
|
|
*/
|
2004-01-05 00:57:22 +01:00
|
|
|
#define TARGET_ILL_ILLOPC (1) /* illegal opcode */
|
2003-06-15 21:58:13 +02:00
|
|
|
#define TARGET_ILL_ILLOPN (2) /* illegal operand */
|
2004-01-05 00:57:22 +01:00
|
|
|
#define TARGET_ILL_ILLADR (3) /* illegal addressing mode */
|
|
|
|
#define TARGET_ILL_ILLTRP (4) /* illegal trap */
|
|
|
|
#define TARGET_ILL_PRVOPC (5) /* privileged opcode */
|
|
|
|
#define TARGET_ILL_PRVREG (6) /* privileged register */
|
|
|
|
#define TARGET_ILL_COPROC (7) /* coprocessor error */
|
|
|
|
#define TARGET_ILL_BADSTK (8) /* internal stack error */
|
2015-09-26 06:10:05 +02:00
|
|
|
#ifdef TARGET_TILEGX
|
|
|
|
#define TARGET_ILL_DBLFLT (9) /* double fault */
|
|
|
|
#define TARGET_ILL_HARDWALL (10) /* user networks hardwall violation */
|
|
|
|
#endif
|
2003-06-15 21:58:13 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* SIGFPE si_codes
|
|
|
|
*/
|
|
|
|
#define TARGET_FPE_INTDIV (1) /* integer divide by zero */
|
|
|
|
#define TARGET_FPE_INTOVF (2) /* integer overflow */
|
|
|
|
#define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */
|
|
|
|
#define TARGET_FPE_FLTOVF (4) /* floating point overflow */
|
|
|
|
#define TARGET_FPE_FLTUND (5) /* floating point underflow */
|
|
|
|
#define TARGET_FPE_FLTRES (6) /* floating point inexact result */
|
|
|
|
#define TARGET_FPE_FLTINV (7) /* floating point invalid operation */
|
|
|
|
#define TARGET_FPE_FLTSUB (8) /* subscript out of range */
|
2019-04-27 00:20:51 +02:00
|
|
|
#define TARGET_FPE_FLTUNK (14) /* undiagnosed fp exception */
|
|
|
|
#define TARGET_NSIGFPE 15
|
2003-06-15 21:58:13 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* SIGSEGV si_codes
|
|
|
|
*/
|
|
|
|
#define TARGET_SEGV_MAPERR (1) /* address not mapped to object */
|
|
|
|
#define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */
|
2015-09-26 06:10:05 +02:00
|
|
|
#define TARGET_SEGV_BNDERR (3) /* failed address bound checks */
|
2003-06-15 21:58:13 +02:00
|
|
|
|
2004-01-05 00:57:22 +01:00
|
|
|
/*
|
|
|
|
* SIGBUS si_codes
|
|
|
|
*/
|
|
|
|
#define TARGET_BUS_ADRALN (1) /* invalid address alignment */
|
2011-11-22 11:06:17 +01:00
|
|
|
#define TARGET_BUS_ADRERR (2) /* non-existent physical address */
|
2004-01-05 00:57:22 +01:00
|
|
|
#define TARGET_BUS_OBJERR (3) /* object specific hardware error */
|
2015-09-26 06:10:05 +02:00
|
|
|
/* hardware memory error consumed on a machine check: action required */
|
|
|
|
#define TARGET_BUS_MCEERR_AR (4)
|
|
|
|
/* hardware memory error detected in process but not consumed: action optional*/
|
|
|
|
#define TARGET_BUS_MCEERR_AO (5)
|
2004-01-05 00:57:22 +01:00
|
|
|
|
2003-06-15 21:58:13 +02:00
|
|
|
/*
|
|
|
|
* SIGTRAP si_codes
|
|
|
|
*/
|
|
|
|
#define TARGET_TRAP_BRKPT (1) /* process breakpoint */
|
|
|
|
#define TARGET_TRAP_TRACE (2) /* process trace trap */
|
2015-09-26 06:10:05 +02:00
|
|
|
#define TARGET_TRAP_BRANCH (3) /* process taken branch trap */
|
|
|
|
#define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */
|
2003-06-15 21:58:13 +02:00
|
|
|
|
2003-03-23 17:49:39 +01:00
|
|
|
struct target_rlimit {
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong rlim_cur;
|
|
|
|
abi_ulong rlim_max;
|
2003-03-23 17:49:39 +01:00
|
|
|
};
|
|
|
|
|
2010-04-11 21:07:35 +02:00
|
|
|
#if defined(TARGET_ALPHA)
|
2010-05-19 18:30:53 +02:00
|
|
|
#define TARGET_RLIM_INFINITY 0x7fffffffffffffffull
|
2011-09-09 19:30:25 +02:00
|
|
|
#elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32)
|
2010-04-11 21:07:35 +02:00
|
|
|
#define TARGET_RLIM_INFINITY 0x7fffffffUL
|
|
|
|
#else
|
2011-09-09 19:31:17 +02:00
|
|
|
#define TARGET_RLIM_INFINITY ((abi_ulong)-1)
|
2010-04-11 21:07:35 +02:00
|
|
|
#endif
|
|
|
|
|
2011-07-12 13:42:00 +02:00
|
|
|
#if defined(TARGET_MIPS)
|
|
|
|
#define TARGET_RLIMIT_CPU 0
|
|
|
|
#define TARGET_RLIMIT_FSIZE 1
|
|
|
|
#define TARGET_RLIMIT_DATA 2
|
|
|
|
#define TARGET_RLIMIT_STACK 3
|
|
|
|
#define TARGET_RLIMIT_CORE 4
|
|
|
|
#define TARGET_RLIMIT_RSS 7
|
|
|
|
#define TARGET_RLIMIT_NPROC 8
|
|
|
|
#define TARGET_RLIMIT_NOFILE 5
|
|
|
|
#define TARGET_RLIMIT_MEMLOCK 9
|
|
|
|
#define TARGET_RLIMIT_AS 6
|
|
|
|
#define TARGET_RLIMIT_LOCKS 10
|
|
|
|
#define TARGET_RLIMIT_SIGPENDING 11
|
|
|
|
#define TARGET_RLIMIT_MSGQUEUE 12
|
|
|
|
#define TARGET_RLIMIT_NICE 13
|
|
|
|
#define TARGET_RLIMIT_RTPRIO 14
|
|
|
|
#else
|
|
|
|
#define TARGET_RLIMIT_CPU 0
|
|
|
|
#define TARGET_RLIMIT_FSIZE 1
|
|
|
|
#define TARGET_RLIMIT_DATA 2
|
|
|
|
#define TARGET_RLIMIT_STACK 3
|
|
|
|
#define TARGET_RLIMIT_CORE 4
|
|
|
|
#define TARGET_RLIMIT_RSS 5
|
2011-09-09 19:30:25 +02:00
|
|
|
#if defined(TARGET_SPARC)
|
|
|
|
#define TARGET_RLIMIT_NOFILE 6
|
|
|
|
#define TARGET_RLIMIT_NPROC 7
|
|
|
|
#else
|
2011-07-12 13:42:00 +02:00
|
|
|
#define TARGET_RLIMIT_NPROC 6
|
|
|
|
#define TARGET_RLIMIT_NOFILE 7
|
2011-09-09 19:30:25 +02:00
|
|
|
#endif
|
2011-07-12 13:42:00 +02:00
|
|
|
#define TARGET_RLIMIT_MEMLOCK 8
|
|
|
|
#define TARGET_RLIMIT_AS 9
|
|
|
|
#define TARGET_RLIMIT_LOCKS 10
|
|
|
|
#define TARGET_RLIMIT_SIGPENDING 11
|
|
|
|
#define TARGET_RLIMIT_MSGQUEUE 12
|
|
|
|
#define TARGET_RLIMIT_NICE 13
|
|
|
|
#define TARGET_RLIMIT_RTPRIO 14
|
|
|
|
#endif
|
|
|
|
|
2003-03-23 17:49:39 +01:00
|
|
|
struct target_pollfd {
|
|
|
|
int fd; /* file descriptor */
|
|
|
|
short events; /* requested events */
|
|
|
|
short revents; /* returned events */
|
|
|
|
};
|
|
|
|
|
2003-05-08 17:42:10 +02:00
|
|
|
/* virtual terminal ioctls */
|
2003-05-10 14:38:16 +02:00
|
|
|
#define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */
|
|
|
|
#define TARGET_KDMKTONE 0x4B30 /* generate tone */
|
2003-05-08 17:42:10 +02:00
|
|
|
#define TARGET_KDGKBTYPE 0x4b33
|
2009-10-16 17:00:44 +02:00
|
|
|
#define TARGET_KDSETMODE 0x4b3a
|
|
|
|
#define TARGET_KDGKBMODE 0x4b44
|
|
|
|
#define TARGET_KDSKBMODE 0x4b45
|
2003-05-10 14:38:16 +02:00
|
|
|
#define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */
|
|
|
|
#define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */
|
2011-06-29 15:09:09 +02:00
|
|
|
#define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */
|
|
|
|
#define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */
|
|
|
|
#define TARGET_KDGETLED 0x4B31 /* return current led state */
|
|
|
|
#define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */
|
2014-06-22 12:25:47 +02:00
|
|
|
#define TARGET_KDSIGACCEPT 0x4B4E
|
2003-05-08 17:42:10 +02:00
|
|
|
|
linux-user: Fix support for SIOCATMARK and SIOCGPGRP ioctls for xtensa
Fix support for the SIOCATMARK and SIOCGPGRP ioctls for xtensa by
correcting corresponding macro definition.
Values for TARGET_SIOCATMARK and TARGET_SIOCGPGRP are determined by
Linux kernel. Following relevant lines (obtained by grep) are from
the kernel source tree:
arch/ia64/include/uapi/asm/sockios.h:#define SIOCATMARK 0x8905
arch/mips/include/uapi/asm/sockios.h:#define SIOCATMARK _IOR('s', 7, int)
arch/parisc/include/uapi/asm/sockios.h:#define SIOCATMARK 0x8905
arch/sh/include/uapi/asm/sockios.h:#define SIOCATMARK _IOR('s', 7, int)
arch/xtensa/include/uapi/asm/sockios.h:#define SIOCATMARK _IOR('s', 7, int)
arch/alpha/include/uapi/asm/sockios.h:#define SIOCATMARK _IOR('s', 7, int)
arch/sparc/include/uapi/asm/sockios.h:#define SIOCATMARK 0x8905
include/uapi/asm-generic/sockios.h:#define SIOCATMARK 0x8905
arch/ia64/include/uapi/asm/sockios.h:#define SIOCGPGRP 0x8904
arch/mips/include/uapi/asm/sockios.h:#define SIOCGPGRP _IOR('s', 9, pid_t)
arch/parisc/include/uapi/asm/sockios.h:#define SIOCGPGRP 0x8904
arch/sh/include/uapi/asm/sockios.h:#define SIOCGPGRP _IOR('s', 9, pid_t)
arch/xtensa/include/uapi/asm/sockios.h:#define SIOCGPGRP _IOR('s', 9, pid_t)
arch/alpha/include/uapi/asm/sockios.h:#define SIOCGPGRP _IOR('s', 9, pid_t)
arch/sparc/include/uapi/asm/sockios.h:#define SIOCGPGRP 0x8904
include/uapi/asm-generic/sockios.h:#define SIOCGPGRP 0x8904
It is visible from above that xtensa should have the same definitions
as alpha, mips and sh4 already do. This patch brings QEMU to the accurate
state wrt these two ioctls.
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <1558282527-22183-2-git-send-email-aleksandar.markovic@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-19 18:15:22 +02:00
|
|
|
#if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) || \
|
|
|
|
defined(TARGET_XTENSA)
|
2016-09-19 13:44:38 +02:00
|
|
|
#define TARGET_SIOCATMARK TARGET_IOR('s', 7, int)
|
linux-user: Add support for SIOCSPGRP ioctl for all targets
Add support for setting the process (or process group) to receive SIGIO
or SIGURG signals when I/O becomes possible or urgent data is available,
using SIOCSPGRP ioctl.
The ioctl numeric values for SIOCSPGRP are platform-dependent and are
determined by following files in Linux kernel source tree:
arch/ia64/include/uapi/asm/sockios.h:#define SIOCSPGRP 0x8902
arch/mips/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_t)
arch/parisc/include/uapi/asm/sockios.h:#define SIOCSPGRP 0x8902
arch/sh/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_t)
arch/xtensa/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_t)
arch/alpha/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_t)
arch/sparc/include/uapi/asm/sockios.h:#define SIOCSPGRP 0x8902
include/uapi/asm-generic/sockios.h:#define SIOCSPGRP 0x8902
Hence the different definition for alpha, mips, sh4, and xtensa.
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <1558282527-22183-3-git-send-email-aleksandar.markovic@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-19 18:15:23 +02:00
|
|
|
#define TARGET_SIOCSPGRP TARGET_IOW('s', 8, pid_t)
|
2016-12-07 20:31:46 +01:00
|
|
|
#define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t)
|
2016-09-19 13:44:38 +02:00
|
|
|
#else
|
2003-06-15 21:58:13 +02:00
|
|
|
#define TARGET_SIOCATMARK 0x8905
|
linux-user: Add support for SIOCSPGRP ioctl for all targets
Add support for setting the process (or process group) to receive SIGIO
or SIGURG signals when I/O becomes possible or urgent data is available,
using SIOCSPGRP ioctl.
The ioctl numeric values for SIOCSPGRP are platform-dependent and are
determined by following files in Linux kernel source tree:
arch/ia64/include/uapi/asm/sockios.h:#define SIOCSPGRP 0x8902
arch/mips/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_t)
arch/parisc/include/uapi/asm/sockios.h:#define SIOCSPGRP 0x8902
arch/sh/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_t)
arch/xtensa/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_t)
arch/alpha/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_t)
arch/sparc/include/uapi/asm/sockios.h:#define SIOCSPGRP 0x8902
include/uapi/asm-generic/sockios.h:#define SIOCSPGRP 0x8902
Hence the different definition for alpha, mips, sh4, and xtensa.
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <1558282527-22183-3-git-send-email-aleksandar.markovic@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-19 18:15:23 +02:00
|
|
|
#define TARGET_SIOCSPGRP 0x8902
|
2016-12-07 20:31:46 +01:00
|
|
|
#define TARGET_SIOCGPGRP 0x8904
|
2016-09-19 13:44:38 +02:00
|
|
|
#endif
|
linux-user: Add support for SIOCSPGRP ioctl for all targets
Add support for setting the process (or process group) to receive SIGIO
or SIGURG signals when I/O becomes possible or urgent data is available,
using SIOCSPGRP ioctl.
The ioctl numeric values for SIOCSPGRP are platform-dependent and are
determined by following files in Linux kernel source tree:
arch/ia64/include/uapi/asm/sockios.h:#define SIOCSPGRP 0x8902
arch/mips/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_t)
arch/parisc/include/uapi/asm/sockios.h:#define SIOCSPGRP 0x8902
arch/sh/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_t)
arch/xtensa/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_t)
arch/alpha/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_t)
arch/sparc/include/uapi/asm/sockios.h:#define SIOCSPGRP 0x8902
include/uapi/asm-generic/sockios.h:#define SIOCSPGRP 0x8902
Hence the different definition for alpha, mips, sh4, and xtensa.
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <1558282527-22183-3-git-send-email-aleksandar.markovic@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-19 18:15:23 +02:00
|
|
|
|
2019-07-18 15:06:41 +02:00
|
|
|
#if defined(TARGET_SH4)
|
|
|
|
#define TARGET_SIOCGSTAMP_OLD TARGET_IOR('s', 100, struct target_timeval)
|
|
|
|
#define TARGET_SIOCGSTAMPNS_OLD TARGET_IOR('s', 101, struct target_timespec)
|
|
|
|
#else
|
|
|
|
#define TARGET_SIOCGSTAMP_OLD 0x8906
|
|
|
|
#define TARGET_SIOCGSTAMPNS_OLD 0x8907
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define TARGET_SIOCGSTAMP_NEW TARGET_IOR(0x89, 0x06, abi_llong[2])
|
|
|
|
#define TARGET_SIOCGSTAMPNS_NEW TARGET_IOR(0x89, 0x07, abi_llong[2])
|
2003-06-15 21:58:13 +02:00
|
|
|
|
2003-02-18 23:55:36 +01:00
|
|
|
/* Networking ioctls */
|
|
|
|
#define TARGET_SIOCADDRT 0x890B /* add routing table entry */
|
|
|
|
#define TARGET_SIOCDELRT 0x890C /* delete routing table entry */
|
|
|
|
#define TARGET_SIOCGIFNAME 0x8910 /* get iface name */
|
|
|
|
#define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */
|
|
|
|
#define TARGET_SIOCGIFCONF 0x8912 /* get iface list */
|
|
|
|
#define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */
|
|
|
|
#define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */
|
|
|
|
#define TARGET_SIOCGIFADDR 0x8915 /* get PA address */
|
|
|
|
#define TARGET_SIOCSIFADDR 0x8916 /* set PA address */
|
|
|
|
#define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */
|
|
|
|
#define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */
|
|
|
|
#define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */
|
|
|
|
#define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */
|
|
|
|
#define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */
|
|
|
|
#define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */
|
|
|
|
#define TARGET_SIOCGIFMETRIC 0x891d /* get metric */
|
|
|
|
#define TARGET_SIOCSIFMETRIC 0x891e /* set metric */
|
|
|
|
#define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */
|
|
|
|
#define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */
|
|
|
|
#define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */
|
|
|
|
#define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */
|
|
|
|
#define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */
|
|
|
|
#define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */
|
|
|
|
#define TARGET_SIOCSIFENCAP 0x8926
|
|
|
|
#define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */
|
|
|
|
#define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */
|
|
|
|
#define TARGET_SIOCSIFSLAVE 0x8930
|
|
|
|
#define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */
|
|
|
|
#define TARGET_SIOCDELMULTI 0x8932
|
2014-06-22 12:25:48 +02:00
|
|
|
#define TARGET_SIOCGIFINDEX 0x8933
|
2019-05-19 18:15:24 +02:00
|
|
|
#define TARGET_SIOCSIFPFLAGS 0x8934 /* set extended flags */
|
|
|
|
#define TARGET_SIOCGIFPFLAGS 0x8935 /* get extended flags */
|
2003-02-18 23:55:36 +01:00
|
|
|
|
|
|
|
/* Bridging control calls */
|
|
|
|
#define TARGET_SIOCGIFBR 0x8940 /* Bridging support */
|
|
|
|
#define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */
|
|
|
|
|
|
|
|
#define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */
|
|
|
|
#define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */
|
|
|
|
|
|
|
|
/* ARP cache control calls. */
|
|
|
|
#define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */
|
|
|
|
#define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */
|
|
|
|
#define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */
|
|
|
|
#define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */
|
|
|
|
#define TARGET_SIOCGARP 0x8954 /* get ARP table entry */
|
|
|
|
#define TARGET_SIOCSARP 0x8955 /* set ARP table entry */
|
|
|
|
|
|
|
|
/* RARP cache control calls. */
|
|
|
|
#define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */
|
|
|
|
#define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */
|
|
|
|
#define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */
|
|
|
|
|
|
|
|
/* Driver configuration calls */
|
|
|
|
#define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */
|
|
|
|
#define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */
|
|
|
|
|
|
|
|
/* DLCI configuration calls */
|
|
|
|
#define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */
|
|
|
|
#define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */
|
|
|
|
|
linux-user: add ioctl(SIOCGIWNAME, ...) support.
Allow to run properly following program from linux-user:
/* cc -o wifi wifi.c */
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/wireless.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
int main(int argc, char **argv)
{
int ret;
struct ifreq req;
struct sockaddr_in *addr;
int s;
if (argc != 2) {
fprintf(stderr, "Need an interface name (like wlan0)\n");
return 1;
}
s = socket( AF_INET, SOCK_DGRAM, 0 );
if (s < 0) {
perror("Cannot open socket");
return 1;
}
strncpy(req.ifr_name, argv[1], sizeof(req.ifr_name));
ret = ioctl( s, SIOCGIWNAME, &req );
if (ret < 0) {
fprintf(stderr, "No wireless extension\n");
return 1;
}
printf("%s\n", req.ifr_name);
printf("%s\n", req.ifr_newname);
return 0;
}
$ ./wifi eth0
No wireless extension
$ ./wifi wlan0
wlan0
IEEE 802.11bg
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-03-30 01:35:23 +02:00
|
|
|
/* From <linux/wireless.h> */
|
|
|
|
|
|
|
|
#define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */
|
2003-02-18 23:55:36 +01:00
|
|
|
|
2017-10-05 15:55:30 +02:00
|
|
|
/* From <linux/random.h> */
|
|
|
|
|
|
|
|
#define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, int)
|
|
|
|
#define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, int)
|
|
|
|
#define TARGET_RNDZAPENTCNT TARGET_IO('R', 0x04)
|
|
|
|
#define TARGET_RNDCLEARPOOL TARGET_IO('R', 0x06)
|
|
|
|
|
2003-02-18 23:55:36 +01:00
|
|
|
/* From <linux/fs.h> */
|
|
|
|
|
|
|
|
#define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */
|
|
|
|
#define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */
|
|
|
|
#define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */
|
|
|
|
#define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */
|
|
|
|
#define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */
|
|
|
|
#define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */
|
|
|
|
#define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */
|
|
|
|
#define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
|
|
|
|
#define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
|
|
|
|
#define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
|
|
|
|
#define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
|
|
|
|
#define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */
|
2014-01-18 07:38:30 +01:00
|
|
|
#define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */
|
2003-02-18 23:55:36 +01:00
|
|
|
/* A jump here: 108-111 have been used for various private purposes. */
|
2012-07-23 10:05:20 +02:00
|
|
|
#define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong)
|
|
|
|
#define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong)
|
2012-01-31 20:10:20 +01:00
|
|
|
#define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong)
|
|
|
|
/* return device size in bytes
|
|
|
|
(u64 *arg) */
|
2016-07-01 20:46:04 +02:00
|
|
|
|
|
|
|
#define TARGET_BLKDISCARD TARGET_IO(0x12, 119)
|
|
|
|
#define TARGET_BLKIOMIN TARGET_IO(0x12, 120)
|
|
|
|
#define TARGET_BLKIOOPT TARGET_IO(0x12, 121)
|
|
|
|
#define TARGET_BLKALIGNOFF TARGET_IO(0x12, 122)
|
|
|
|
#define TARGET_BLKPBSZGET TARGET_IO(0x12, 123)
|
|
|
|
#define TARGET_BLKDISCARDZEROES TARGET_IO(0x12, 124)
|
|
|
|
#define TARGET_BLKSECDISCARD TARGET_IO(0x12, 125)
|
|
|
|
#define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126)
|
|
|
|
#define TARGET_BLKZEROOUT TARGET_IO(0x12, 127)
|
|
|
|
|
2003-02-18 23:55:36 +01:00
|
|
|
#define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */
|
|
|
|
#define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */
|
2017-02-11 23:26:02 +01:00
|
|
|
|
|
|
|
#define TARGET_FICLONE TARGET_IOW(0x94, 9, int)
|
|
|
|
#define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range)
|
|
|
|
|
2016-07-15 19:44:45 +02:00
|
|
|
/* Note that the ioctl numbers claim type "long" but the actual type
|
|
|
|
* used by the kernel is "int".
|
|
|
|
*/
|
2017-10-12 17:30:44 +02:00
|
|
|
#define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, abi_long)
|
|
|
|
#define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, abi_long)
|
2016-07-15 19:44:45 +02:00
|
|
|
|
2011-01-06 16:04:18 +01:00
|
|
|
#define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap)
|
2003-02-18 23:55:36 +01:00
|
|
|
|
2018-10-08 18:35:20 +02:00
|
|
|
/* usb ioctls */
|
|
|
|
#define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0)
|
|
|
|
#define TARGET_USBDEVFS_BULK TARGET_IOWRU('U', 2)
|
|
|
|
#define TARGET_USBDEVFS_RESETEP TARGET_IORU('U', 3)
|
|
|
|
#define TARGET_USBDEVFS_SETINTERFACE TARGET_IORU('U', 4)
|
|
|
|
#define TARGET_USBDEVFS_SETCONFIGURATION TARGET_IORU('U', 5)
|
|
|
|
#define TARGET_USBDEVFS_GETDRIVER TARGET_IOWU('U', 8)
|
2018-10-08 18:35:21 +02:00
|
|
|
#define TARGET_USBDEVFS_SUBMITURB TARGET_IORU('U', 10)
|
|
|
|
#define TARGET_USBDEVFS_DISCARDURB TARGET_IO('U', 11)
|
|
|
|
#define TARGET_USBDEVFS_REAPURB TARGET_IOWU('U', 12)
|
|
|
|
#define TARGET_USBDEVFS_REAPURBNDELAY TARGET_IOWU('U', 13)
|
2018-10-08 18:35:20 +02:00
|
|
|
#define TARGET_USBDEVFS_DISCSIGNAL TARGET_IORU('U', 14)
|
|
|
|
#define TARGET_USBDEVFS_CLAIMINTERFACE TARGET_IORU('U', 15)
|
|
|
|
#define TARGET_USBDEVFS_RELEASEINTERFACE TARGET_IORU('U', 16)
|
|
|
|
#define TARGET_USBDEVFS_CONNECTINFO TARGET_IOWU('U', 17)
|
|
|
|
#define TARGET_USBDEVFS_IOCTL TARGET_IOWRU('U', 18)
|
|
|
|
#define TARGET_USBDEVFS_HUB_PORTINFO TARGET_IORU('U', 19)
|
|
|
|
#define TARGET_USBDEVFS_RESET TARGET_IO('U', 20)
|
|
|
|
#define TARGET_USBDEVFS_CLEAR_HALT TARGET_IORU('U', 21)
|
|
|
|
#define TARGET_USBDEVFS_DISCONNECT TARGET_IO('U', 22)
|
|
|
|
#define TARGET_USBDEVFS_CONNECT TARGET_IO('U', 23)
|
|
|
|
#define TARGET_USBDEVFS_CLAIM_PORT TARGET_IORU('U', 24)
|
|
|
|
#define TARGET_USBDEVFS_RELEASE_PORT TARGET_IORU('U', 25)
|
|
|
|
#define TARGET_USBDEVFS_GET_CAPABILITIES TARGET_IORU('U', 26)
|
|
|
|
#define TARGET_USBDEVFS_DISCONNECT_CLAIM TARGET_IORU('U', 27)
|
|
|
|
#define TARGET_USBDEVFS_DROP_PRIVILEGES TARGET_IOWU('U', 30)
|
|
|
|
#define TARGET_USBDEVFS_GET_SPEED TARGET_IO('U', 31)
|
|
|
|
|
2003-02-18 23:55:36 +01:00
|
|
|
/* cdrom commands */
|
2007-09-16 23:08:06 +02:00
|
|
|
#define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */
|
2003-02-18 23:55:36 +01:00
|
|
|
#define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */
|
|
|
|
#define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */
|
2007-09-16 23:08:06 +02:00
|
|
|
#define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index
|
2003-02-18 23:55:36 +01:00
|
|
|
(struct cdrom_ti) */
|
2007-09-16 23:08:06 +02:00
|
|
|
#define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header
|
2003-02-18 23:55:36 +01:00
|
|
|
(struct cdrom_tochdr) */
|
2007-09-16 23:08:06 +02:00
|
|
|
#define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry
|
2003-02-18 23:55:36 +01:00
|
|
|
(struct cdrom_tocentry) */
|
|
|
|
#define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */
|
|
|
|
#define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */
|
|
|
|
#define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */
|
2007-09-16 23:08:06 +02:00
|
|
|
#define TARGET_CDROMVOLCTRL 0x530a /* Control output volume
|
2003-02-18 23:55:36 +01:00
|
|
|
(struct cdrom_volctrl) */
|
2007-09-16 23:08:06 +02:00
|
|
|
#define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data
|
2003-02-18 23:55:36 +01:00
|
|
|
(struct cdrom_subchnl) */
|
2007-09-16 23:08:06 +02:00
|
|
|
#define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes)
|
2003-02-18 23:55:36 +01:00
|
|
|
(struct cdrom_read) */
|
|
|
|
#define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes)
|
|
|
|
(struct cdrom_read) */
|
|
|
|
#define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */
|
|
|
|
#define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */
|
2007-09-16 23:08:06 +02:00
|
|
|
#define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session
|
|
|
|
address of multi session disks
|
2003-02-18 23:55:36 +01:00
|
|
|
(struct cdrom_multisession) */
|
2007-09-16 23:08:06 +02:00
|
|
|
#define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code"
|
2003-02-18 23:55:36 +01:00
|
|
|
if available (struct cdrom_mcn) */
|
2015-09-08 23:45:14 +02:00
|
|
|
#define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated,
|
2011-11-22 11:06:17 +01:00
|
|
|
but here anyway for compatibility */
|
2003-02-18 23:55:36 +01:00
|
|
|
#define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */
|
2007-09-16 23:08:06 +02:00
|
|
|
#define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting
|
2003-02-18 23:55:36 +01:00
|
|
|
(struct cdrom_volctrl) */
|
|
|
|
#define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes)
|
|
|
|
(struct cdrom_read) */
|
2007-09-16 23:08:06 +02:00
|
|
|
/*
|
2003-02-18 23:55:36 +01:00
|
|
|
* These ioctls are used only used in aztcd.c and optcd.c
|
|
|
|
*/
|
|
|
|
#define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */
|
|
|
|
#define TARGET_CDROMSEEK 0x5316 /* seek msf address */
|
2007-09-17 10:09:54 +02:00
|
|
|
|
2003-02-18 23:55:36 +01:00
|
|
|
/*
|
2007-09-17 10:09:54 +02:00
|
|
|
* This ioctl is only used by the scsi-cd driver.
|
2003-02-18 23:55:36 +01:00
|
|
|
It is for playing audio in logical block addressing mode.
|
|
|
|
*/
|
|
|
|
#define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */
|
|
|
|
|
2007-09-16 23:08:06 +02:00
|
|
|
/*
|
2003-02-18 23:55:36 +01:00
|
|
|
* These ioctls are only used in optcd.c
|
|
|
|
*/
|
|
|
|
#define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */
|
|
|
|
|
2007-09-16 23:08:06 +02:00
|
|
|
/*
|
|
|
|
* These ioctls are (now) only in ide-cd.c for controlling
|
2003-02-18 23:55:36 +01:00
|
|
|
* drive spindown time. They should be implemented in the
|
|
|
|
* Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
|
|
|
|
* GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
|
|
|
|
* -Erik
|
|
|
|
*/
|
|
|
|
#define TARGET_CDROMGETSPINDOWN 0x531d
|
|
|
|
#define TARGET_CDROMSETSPINDOWN 0x531e
|
|
|
|
|
2007-09-16 23:08:06 +02:00
|
|
|
/*
|
2003-02-18 23:55:36 +01:00
|
|
|
* These ioctls are implemented through the uniform CD-ROM driver
|
|
|
|
* They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
|
|
|
|
* drivers are eventually ported to the uniform CD-ROM driver interface.
|
|
|
|
*/
|
|
|
|
#define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
|
|
|
|
#define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */
|
|
|
|
#define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */
|
|
|
|
#define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */
|
|
|
|
#define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */
|
|
|
|
#define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */
|
|
|
|
#define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
|
|
|
|
#define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */
|
|
|
|
#define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */
|
|
|
|
#define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */
|
|
|
|
#define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */
|
|
|
|
#define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */
|
|
|
|
|
|
|
|
/* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386.
|
|
|
|
* Future CDROM ioctls should be kept below 0x537F
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* This ioctl is only used by sbpcd at the moment */
|
|
|
|
#define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */
|
|
|
|
/* conflict with SCSI_IOCTL_GET_IDLUN */
|
|
|
|
|
|
|
|
/* DVD-ROM Specific ioctls */
|
|
|
|
#define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */
|
|
|
|
#define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */
|
|
|
|
#define TARGET_DVD_AUTH 0x5392 /* Authentication */
|
|
|
|
|
|
|
|
#define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */
|
|
|
|
#define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */
|
|
|
|
#define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */
|
|
|
|
|
|
|
|
/* HD commands */
|
|
|
|
|
|
|
|
/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
|
|
|
|
#define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */
|
|
|
|
#define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */
|
|
|
|
#define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */
|
|
|
|
#define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */
|
|
|
|
#define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */
|
|
|
|
#define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */
|
|
|
|
#define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */
|
2003-06-15 21:58:13 +02:00
|
|
|
#define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
|
2003-02-18 23:55:36 +01:00
|
|
|
#define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */
|
|
|
|
|
|
|
|
/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
|
|
|
|
#define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */
|
|
|
|
#define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */
|
|
|
|
#define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */
|
|
|
|
#define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */
|
|
|
|
#define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */
|
|
|
|
#define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */
|
|
|
|
#define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
|
2003-06-15 21:58:13 +02:00
|
|
|
|
2008-04-26 16:44:49 +02:00
|
|
|
/* loop ioctls */
|
|
|
|
#define TARGET_LOOP_SET_FD 0x4C00
|
|
|
|
#define TARGET_LOOP_CLR_FD 0x4C01
|
|
|
|
#define TARGET_LOOP_SET_STATUS 0x4C02
|
|
|
|
#define TARGET_LOOP_GET_STATUS 0x4C03
|
|
|
|
#define TARGET_LOOP_SET_STATUS64 0x4C04
|
|
|
|
#define TARGET_LOOP_GET_STATUS64 0x4C05
|
|
|
|
#define TARGET_LOOP_CHANGE_FD 0x4C06
|
2003-06-15 21:58:13 +02:00
|
|
|
|
2016-07-04 18:06:17 +02:00
|
|
|
#define TARGET_LOOP_CTL_ADD 0x4C80
|
|
|
|
#define TARGET_LOOP_CTL_REMOVE 0x4C81
|
|
|
|
#define TARGET_LOOP_CTL_GET_FREE 0x4C82
|
|
|
|
|
2009-10-16 17:00:44 +02:00
|
|
|
/* fb ioctls */
|
|
|
|
#define TARGET_FBIOGET_VSCREENINFO 0x4600
|
|
|
|
#define TARGET_FBIOPUT_VSCREENINFO 0x4601
|
|
|
|
#define TARGET_FBIOGET_FSCREENINFO 0x4602
|
2011-06-29 15:09:11 +02:00
|
|
|
#define TARGET_FBIOGETCMAP 0x4604
|
|
|
|
#define TARGET_FBIOPUTCMAP 0x4605
|
|
|
|
#define TARGET_FBIOPAN_DISPLAY 0x4606
|
|
|
|
#define TARGET_FBIOGET_CON2FBMAP 0x460F
|
|
|
|
#define TARGET_FBIOPUT_CON2FBMAP 0x4610
|
2009-10-16 17:00:44 +02:00
|
|
|
|
|
|
|
/* vt ioctls */
|
|
|
|
#define TARGET_VT_OPENQRY 0x5600
|
|
|
|
#define TARGET_VT_GETSTATE 0x5603
|
|
|
|
#define TARGET_VT_ACTIVATE 0x5606
|
|
|
|
#define TARGET_VT_WAITACTIVE 0x5607
|
|
|
|
#define TARGET_VT_LOCKSWITCH 0x560b
|
|
|
|
#define TARGET_VT_UNLOCKSWITCH 0x560c
|
2011-06-29 15:09:10 +02:00
|
|
|
#define TARGET_VT_GETMODE 0x5601
|
|
|
|
#define TARGET_VT_SETMODE 0x5602
|
|
|
|
#define TARGET_VT_RELDISP 0x5605
|
|
|
|
#define TARGET_VT_DISALLOCATE 0x5608
|
2009-10-16 17:00:44 +02:00
|
|
|
|
2012-01-31 18:42:06 +01:00
|
|
|
/* device mapper */
|
|
|
|
#define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00)
|
|
|
|
#define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01)
|
|
|
|
#define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02)
|
|
|
|
#define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03)
|
|
|
|
#define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04)
|
|
|
|
#define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05)
|
|
|
|
#define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06)
|
|
|
|
#define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07)
|
|
|
|
#define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08)
|
|
|
|
#define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09)
|
|
|
|
#define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a)
|
|
|
|
#define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b)
|
|
|
|
#define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c)
|
|
|
|
#define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d)
|
|
|
|
#define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e)
|
|
|
|
#define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f)
|
|
|
|
|
2003-06-15 21:58:13 +02:00
|
|
|
/* from asm/termbits.h */
|
|
|
|
|
2004-01-04 16:52:31 +01:00
|
|
|
#define TARGET_NCC 8
|
|
|
|
struct target_termio {
|
|
|
|
unsigned short c_iflag; /* input mode flags */
|
|
|
|
unsigned short c_oflag; /* output mode flags */
|
|
|
|
unsigned short c_cflag; /* control mode flags */
|
|
|
|
unsigned short c_lflag; /* local mode flags */
|
|
|
|
unsigned char c_line; /* line discipline */
|
|
|
|
unsigned char c_cc[TARGET_NCC]; /* control characters */
|
|
|
|
};
|
2003-06-15 21:58:13 +02:00
|
|
|
|
2004-01-04 16:52:31 +01:00
|
|
|
struct target_winsize {
|
|
|
|
unsigned short ws_row;
|
|
|
|
unsigned short ws_col;
|
|
|
|
unsigned short ws_xpixel;
|
|
|
|
unsigned short ws_ypixel;
|
2003-06-15 21:58:13 +02:00
|
|
|
};
|
|
|
|
|
2004-01-04 16:52:31 +01:00
|
|
|
#include "termbits.h"
|
2003-06-15 21:58:13 +02:00
|
|
|
|
2010-06-16 14:03:51 +02:00
|
|
|
#if defined(TARGET_MIPS)
|
|
|
|
#define TARGET_PROT_SEM 0x10
|
|
|
|
#else
|
|
|
|
#define TARGET_PROT_SEM 0x08
|
|
|
|
#endif
|
|
|
|
|
2008-09-29 19:23:09 +02:00
|
|
|
/* Common */
|
2003-06-15 21:58:13 +02:00
|
|
|
#define TARGET_MAP_SHARED 0x01 /* Share changes */
|
|
|
|
#define TARGET_MAP_PRIVATE 0x02 /* Changes are private */
|
2017-10-31 13:53:56 +01:00
|
|
|
#if defined(TARGET_HPPA)
|
|
|
|
#define TARGET_MAP_TYPE 0x03 /* Mask for type of mapping */
|
|
|
|
#else
|
|
|
|
#define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */
|
|
|
|
#endif
|
2008-09-29 19:23:09 +02:00
|
|
|
|
|
|
|
/* Target specific */
|
2005-11-26 19:47:20 +01:00
|
|
|
#if defined(TARGET_MIPS)
|
2008-09-29 19:23:09 +02:00
|
|
|
#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
|
2005-11-26 19:47:20 +01:00
|
|
|
#define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */
|
|
|
|
#define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */
|
|
|
|
#define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */
|
|
|
|
#define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */
|
|
|
|
#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */
|
|
|
|
#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */
|
2007-09-30 03:58:33 +02:00
|
|
|
#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
|
|
|
|
#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */
|
2017-10-31 13:53:58 +01:00
|
|
|
#define TARGET_MAP_STACK 0x40000 /* ignored */
|
|
|
|
#define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */
|
2008-09-29 19:23:09 +02:00
|
|
|
#elif defined(TARGET_PPC)
|
|
|
|
#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
|
2003-06-15 21:58:13 +02:00
|
|
|
#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */
|
|
|
|
#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */
|
|
|
|
#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */
|
|
|
|
#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */
|
2007-09-18 23:54:57 +02:00
|
|
|
#define TARGET_MAP_LOCKED 0x0080 /* pages are locked */
|
|
|
|
#define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */
|
2008-09-29 19:23:09 +02:00
|
|
|
#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
|
|
|
|
#define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */
|
2017-10-31 13:53:58 +01:00
|
|
|
#define TARGET_MAP_STACK 0x20000 /* ignored */
|
|
|
|
#define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */
|
2008-09-29 19:23:09 +02:00
|
|
|
#elif defined(TARGET_ALPHA)
|
|
|
|
#define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */
|
|
|
|
#define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */
|
|
|
|
#define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */
|
|
|
|
#define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */
|
|
|
|
#define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */
|
|
|
|
#define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */
|
|
|
|
#define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */
|
|
|
|
#define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */
|
|
|
|
#define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */
|
2017-10-31 13:53:58 +01:00
|
|
|
#define TARGET_MAP_STACK 0x80000 /* ignored */
|
|
|
|
#define TARGET_MAP_HUGETLB 0x100000 /* create a huge page mapping */
|
2016-12-15 18:56:41 +01:00
|
|
|
#elif defined(TARGET_HPPA)
|
|
|
|
#define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */
|
|
|
|
#define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly */
|
|
|
|
#define TARGET_MAP_GROWSDOWN 0x08000 /* stack-like segment */
|
|
|
|
#define TARGET_MAP_DENYWRITE 0x00800 /* ETXTBSY */
|
|
|
|
#define TARGET_MAP_EXECUTABLE 0x01000 /* mark it as an executable */
|
|
|
|
#define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */
|
|
|
|
#define TARGET_MAP_NORESERVE 0x04000 /* no check for reservations */
|
|
|
|
#define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetables */
|
|
|
|
#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */
|
2017-10-31 13:53:58 +01:00
|
|
|
#define TARGET_MAP_STACK 0x40000 /* ignored */
|
|
|
|
#define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */
|
2017-01-25 19:54:11 +01:00
|
|
|
#elif defined(TARGET_XTENSA)
|
|
|
|
#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
|
|
|
|
#define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */
|
|
|
|
#define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */
|
|
|
|
#define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */
|
|
|
|
#define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */
|
|
|
|
#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */
|
|
|
|
#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */
|
|
|
|
#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
|
|
|
|
#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */
|
|
|
|
#define TARGET_MAP_STACK 0x40000
|
|
|
|
#define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */
|
2007-09-18 23:54:57 +02:00
|
|
|
#else
|
2008-09-29 19:23:09 +02:00
|
|
|
#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
|
|
|
|
#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */
|
|
|
|
#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */
|
|
|
|
#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */
|
|
|
|
#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */
|
2003-06-15 21:58:13 +02:00
|
|
|
#define TARGET_MAP_LOCKED 0x2000 /* pages are locked */
|
|
|
|
#define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */
|
2007-09-30 03:58:33 +02:00
|
|
|
#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
|
|
|
|
#define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */
|
2017-10-31 13:53:58 +01:00
|
|
|
#define TARGET_MAP_STACK 0x20000 /* ignored */
|
|
|
|
#define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */
|
2011-02-07 07:05:52 +01:00
|
|
|
#define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */
|
2007-09-18 23:54:57 +02:00
|
|
|
#endif
|
2003-06-15 21:58:13 +02:00
|
|
|
|
2013-09-03 21:12:15 +02:00
|
|
|
#if (defined(TARGET_I386) && defined(TARGET_ABI32)) \
|
|
|
|
|| (defined(TARGET_ARM) && defined(TARGET_ABI32)) \
|
2018-03-08 15:47:32 +01:00
|
|
|
|| defined(TARGET_CRIS)
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
#define TARGET_STAT_HAVE_NSEC
|
2003-06-15 21:58:13 +02:00
|
|
|
struct target_stat {
|
|
|
|
unsigned short st_dev;
|
|
|
|
unsigned short __pad1;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_ino;
|
2003-06-15 21:58:13 +02:00
|
|
|
unsigned short st_mode;
|
|
|
|
unsigned short st_nlink;
|
|
|
|
unsigned short st_uid;
|
|
|
|
unsigned short st_gid;
|
|
|
|
unsigned short st_rdev;
|
|
|
|
unsigned short __pad2;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_size;
|
|
|
|
abi_ulong st_blksize;
|
|
|
|
abi_ulong st_blocks;
|
|
|
|
abi_ulong target_st_atime;
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
abi_ulong target_st_atime_nsec;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_mtime;
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
abi_ulong target_st_mtime_nsec;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_ctime;
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
abi_ulong target_st_ctime_nsec;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong __unused4;
|
|
|
|
abi_ulong __unused5;
|
2003-06-15 21:58:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* This matches struct stat64 in glibc2.1, hence the absolutely
|
|
|
|
* insane amounts of padding around dev_t's.
|
|
|
|
*/
|
2013-10-30 22:52:24 +01:00
|
|
|
#define TARGET_HAS_STRUCT_STAT64
|
2003-06-15 21:58:13 +02:00
|
|
|
struct target_stat64 {
|
|
|
|
unsigned short st_dev;
|
|
|
|
unsigned char __pad0[10];
|
|
|
|
|
|
|
|
#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong __st_ino;
|
2003-06-15 21:58:13 +02:00
|
|
|
|
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned int st_nlink;
|
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_uid;
|
|
|
|
abi_ulong st_gid;
|
2003-06-15 21:58:13 +02:00
|
|
|
|
|
|
|
unsigned short st_rdev;
|
|
|
|
unsigned char __pad3[10];
|
|
|
|
|
|
|
|
long long st_size;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_blksize;
|
2003-06-15 21:58:13 +02:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_blocks; /* Number 512-byte blocks allocated. */
|
|
|
|
abi_ulong __pad4; /* future possible st_blocks high bits */
|
2003-06-15 21:58:13 +02:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_atime;
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
abi_ulong target_st_atime_nsec;
|
2003-06-15 21:58:13 +02:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_mtime;
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
abi_ulong target_st_mtime_nsec;
|
2003-06-15 21:58:13 +02:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_ctime;
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
abi_ulong target_st_ctime_nsec;
|
2003-06-15 21:58:13 +02:00
|
|
|
|
|
|
|
unsigned long long st_ino;
|
2011-08-31 12:38:01 +02:00
|
|
|
} QEMU_PACKED;
|
2003-06-15 21:58:13 +02:00
|
|
|
|
2006-02-09 17:49:55 +01:00
|
|
|
#ifdef TARGET_ARM
|
2013-10-30 22:52:24 +01:00
|
|
|
#define TARGET_HAS_STRUCT_STAT64
|
2006-02-09 17:49:55 +01:00
|
|
|
struct target_eabi_stat64 {
|
|
|
|
unsigned long long st_dev;
|
|
|
|
unsigned int __pad1;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong __st_ino;
|
2006-02-09 17:49:55 +01:00
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned int st_nlink;
|
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_uid;
|
|
|
|
abi_ulong st_gid;
|
2006-02-09 17:49:55 +01:00
|
|
|
|
|
|
|
unsigned long long st_rdev;
|
|
|
|
unsigned int __pad2[2];
|
|
|
|
|
|
|
|
long long st_size;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_blksize;
|
2006-02-09 17:49:55 +01:00
|
|
|
unsigned int __pad3;
|
|
|
|
unsigned long long st_blocks;
|
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_atime;
|
|
|
|
abi_ulong target_st_atime_nsec;
|
2006-02-09 17:49:55 +01:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_mtime;
|
|
|
|
abi_ulong target_st_mtime_nsec;
|
2006-02-09 17:49:55 +01:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_ctime;
|
|
|
|
abi_ulong target_st_ctime_nsec;
|
2006-02-09 17:49:55 +01:00
|
|
|
|
|
|
|
unsigned long long st_ino;
|
2011-08-31 12:38:01 +02:00
|
|
|
} QEMU_PACKED;
|
2006-02-09 17:49:55 +01:00
|
|
|
#endif
|
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
#elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
|
2007-07-08 12:08:24 +02:00
|
|
|
struct target_stat {
|
|
|
|
unsigned int st_dev;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_ino;
|
2007-07-08 12:08:24 +02:00
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned int st_nlink;
|
|
|
|
unsigned int st_uid;
|
|
|
|
unsigned int st_gid;
|
|
|
|
unsigned int st_rdev;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long st_size;
|
|
|
|
abi_long target_st_atime;
|
|
|
|
abi_long target_st_mtime;
|
|
|
|
abi_long target_st_ctime;
|
|
|
|
abi_long st_blksize;
|
|
|
|
abi_long st_blocks;
|
|
|
|
abi_ulong __unused4[2];
|
2007-07-08 12:08:24 +02:00
|
|
|
};
|
|
|
|
|
2013-10-30 22:52:24 +01:00
|
|
|
#define TARGET_HAS_STRUCT_STAT64
|
2007-07-08 12:08:24 +02:00
|
|
|
struct target_stat64 {
|
|
|
|
unsigned char __pad0[6];
|
|
|
|
unsigned short st_dev;
|
|
|
|
|
|
|
|
uint64_t st_ino;
|
|
|
|
uint64_t st_nlink;
|
|
|
|
|
|
|
|
unsigned int st_mode;
|
|
|
|
|
|
|
|
unsigned int st_uid;
|
|
|
|
unsigned int st_gid;
|
|
|
|
|
|
|
|
unsigned char __pad2[6];
|
|
|
|
unsigned short st_rdev;
|
|
|
|
|
|
|
|
int64_t st_size;
|
|
|
|
int64_t st_blksize;
|
|
|
|
|
|
|
|
unsigned char __pad4[4];
|
|
|
|
unsigned int st_blocks;
|
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_atime;
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
abi_ulong target_st_atime_nsec;
|
2007-07-08 12:08:24 +02:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_mtime;
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
abi_ulong target_st_mtime_nsec;
|
2007-07-08 12:08:24 +02:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_ctime;
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
abi_ulong target_st_ctime_nsec;
|
2007-07-08 12:08:24 +02:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong __unused4[3];
|
2007-07-08 12:08:24 +02:00
|
|
|
};
|
|
|
|
|
2004-01-04 16:52:31 +01:00
|
|
|
#elif defined(TARGET_SPARC)
|
|
|
|
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
#define TARGET_STAT_HAVE_NSEC
|
2004-01-04 16:52:31 +01:00
|
|
|
struct target_stat {
|
|
|
|
unsigned short st_dev;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_ino;
|
2004-01-04 16:52:31 +01:00
|
|
|
unsigned short st_mode;
|
|
|
|
short st_nlink;
|
|
|
|
unsigned short st_uid;
|
|
|
|
unsigned short st_gid;
|
|
|
|
unsigned short st_rdev;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long st_size;
|
|
|
|
abi_long target_st_atime;
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
abi_ulong target_st_atime_nsec;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long target_st_mtime;
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
abi_ulong target_st_mtime_nsec;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long target_st_ctime;
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
abi_ulong target_st_ctime_nsec;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long st_blksize;
|
|
|
|
abi_long st_blocks;
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
abi_ulong __unused1[2];
|
2004-01-04 16:52:31 +01:00
|
|
|
};
|
|
|
|
|
2013-10-30 22:52:24 +01:00
|
|
|
#define TARGET_HAS_STRUCT_STAT64
|
2004-01-04 16:52:31 +01:00
|
|
|
struct target_stat64 {
|
|
|
|
unsigned char __pad0[6];
|
|
|
|
unsigned short st_dev;
|
|
|
|
|
|
|
|
uint64_t st_ino;
|
|
|
|
|
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned int st_nlink;
|
|
|
|
|
|
|
|
unsigned int st_uid;
|
|
|
|
unsigned int st_gid;
|
|
|
|
|
|
|
|
unsigned char __pad2[6];
|
|
|
|
unsigned short st_rdev;
|
|
|
|
|
|
|
|
unsigned char __pad3[8];
|
|
|
|
|
|
|
|
int64_t st_size;
|
|
|
|
unsigned int st_blksize;
|
|
|
|
|
|
|
|
unsigned char __pad4[8];
|
|
|
|
unsigned int st_blocks;
|
|
|
|
|
|
|
|
unsigned int target_st_atime;
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
unsigned int target_st_atime_nsec;
|
2004-01-04 16:52:31 +01:00
|
|
|
|
|
|
|
unsigned int target_st_mtime;
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
unsigned int target_st_mtime_nsec;
|
2004-01-04 16:52:31 +01:00
|
|
|
|
|
|
|
unsigned int target_st_ctime;
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
unsigned int target_st_ctime_nsec;
|
2004-01-04 16:52:31 +01:00
|
|
|
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
unsigned int __unused1;
|
|
|
|
unsigned int __unused2;
|
2004-01-04 16:52:31 +01:00
|
|
|
};
|
|
|
|
|
2003-11-23 18:05:30 +01:00
|
|
|
#elif defined(TARGET_PPC)
|
|
|
|
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
#define TARGET_STAT_HAVE_NSEC
|
2003-11-23 18:05:30 +01:00
|
|
|
struct target_stat {
|
2007-12-10 09:24:59 +01:00
|
|
|
abi_ulong st_dev;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_ino;
|
2007-11-21 14:06:54 +01:00
|
|
|
#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
|
2007-12-10 09:24:59 +01:00
|
|
|
abi_ulong st_nlink;
|
2007-11-21 14:06:54 +01:00
|
|
|
unsigned int st_mode;
|
|
|
|
#else
|
2003-11-23 18:05:30 +01:00
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned short st_nlink;
|
2007-11-21 14:06:54 +01:00
|
|
|
#endif
|
2003-11-23 18:05:30 +01:00
|
|
|
unsigned int st_uid;
|
|
|
|
unsigned int st_gid;
|
2007-12-10 09:24:59 +01:00
|
|
|
abi_ulong st_rdev;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_size;
|
|
|
|
abi_ulong st_blksize;
|
|
|
|
abi_ulong st_blocks;
|
|
|
|
abi_ulong target_st_atime;
|
2007-12-10 09:24:59 +01:00
|
|
|
abi_ulong target_st_atime_nsec;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_mtime;
|
2007-12-10 09:24:59 +01:00
|
|
|
abi_ulong target_st_mtime_nsec;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_ctime;
|
2007-12-10 09:24:59 +01:00
|
|
|
abi_ulong target_st_ctime_nsec;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong __unused4;
|
|
|
|
abi_ulong __unused5;
|
2007-11-21 14:06:54 +01:00
|
|
|
#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
|
|
|
|
abi_ulong __unused6;
|
|
|
|
#endif
|
2003-11-23 18:05:30 +01:00
|
|
|
};
|
|
|
|
|
2013-10-30 22:52:24 +01:00
|
|
|
#if !defined(TARGET_PPC64) || defined(TARGET_ABI32)
|
|
|
|
#define TARGET_HAS_STRUCT_STAT64
|
2011-08-31 12:38:01 +02:00
|
|
|
struct QEMU_PACKED target_stat64 {
|
2003-11-23 18:05:30 +01:00
|
|
|
unsigned long long st_dev;
|
|
|
|
unsigned long long st_ino;
|
2004-01-04 16:52:31 +01:00
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned int st_nlink;
|
2003-11-23 18:05:30 +01:00
|
|
|
unsigned int st_uid;
|
|
|
|
unsigned int st_gid;
|
2004-01-04 16:52:31 +01:00
|
|
|
unsigned long long st_rdev;
|
2009-01-30 20:48:32 +01:00
|
|
|
unsigned long long __pad0;
|
2007-12-10 09:24:59 +01:00
|
|
|
long long st_size;
|
|
|
|
int st_blksize;
|
2009-01-30 20:48:32 +01:00
|
|
|
unsigned int __pad1;
|
2009-09-01 21:27:47 +02:00
|
|
|
long long st_blocks; /* Number 512-byte blocks allocated. */
|
2007-12-10 09:24:59 +01:00
|
|
|
int target_st_atime;
|
|
|
|
unsigned int target_st_atime_nsec;
|
|
|
|
int target_st_mtime;
|
|
|
|
unsigned int target_st_mtime_nsec;
|
|
|
|
int target_st_ctime;
|
|
|
|
unsigned int target_st_ctime_nsec;
|
|
|
|
unsigned int __unused4;
|
|
|
|
unsigned int __unused5;
|
2003-11-23 18:05:30 +01:00
|
|
|
};
|
2013-10-30 22:52:24 +01:00
|
|
|
#endif
|
2003-11-23 18:05:30 +01:00
|
|
|
|
2009-05-20 21:31:33 +02:00
|
|
|
#elif defined(TARGET_MICROBLAZE)
|
|
|
|
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
#define TARGET_STAT_HAVE_NSEC
|
2009-05-20 21:31:33 +02:00
|
|
|
struct target_stat {
|
|
|
|
abi_ulong st_dev;
|
|
|
|
abi_ulong st_ino;
|
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned short st_nlink;
|
|
|
|
unsigned int st_uid;
|
|
|
|
unsigned int st_gid;
|
|
|
|
abi_ulong st_rdev;
|
|
|
|
abi_ulong st_size;
|
|
|
|
abi_ulong st_blksize;
|
|
|
|
abi_ulong st_blocks;
|
|
|
|
abi_ulong target_st_atime;
|
|
|
|
abi_ulong target_st_atime_nsec;
|
|
|
|
abi_ulong target_st_mtime;
|
|
|
|
abi_ulong target_st_mtime_nsec;
|
|
|
|
abi_ulong target_st_ctime;
|
|
|
|
abi_ulong target_st_ctime_nsec;
|
|
|
|
abi_ulong __unused4;
|
|
|
|
abi_ulong __unused5;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */
|
2013-10-30 22:52:24 +01:00
|
|
|
#define TARGET_HAS_STRUCT_STAT64
|
2011-08-31 12:38:01 +02:00
|
|
|
struct QEMU_PACKED target_stat64 {
|
2009-05-20 21:31:33 +02:00
|
|
|
uint64_t st_dev;
|
2010-08-09 10:13:33 +02:00
|
|
|
#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
|
|
|
|
uint32_t pad0;
|
|
|
|
uint32_t __st_ino;
|
|
|
|
|
2009-05-20 21:31:33 +02:00
|
|
|
uint32_t st_mode;
|
|
|
|
uint32_t st_nlink;
|
|
|
|
uint32_t st_uid;
|
|
|
|
uint32_t st_gid;
|
|
|
|
uint64_t st_rdev;
|
2009-06-23 19:19:33 +02:00
|
|
|
uint64_t __pad1;
|
2009-05-20 21:31:33 +02:00
|
|
|
|
|
|
|
int64_t st_size;
|
2009-06-23 19:19:33 +02:00
|
|
|
int32_t st_blksize;
|
|
|
|
uint32_t __pad2;
|
2009-05-20 21:31:33 +02:00
|
|
|
int64_t st_blocks; /* Number 512-byte blocks allocated. */
|
|
|
|
|
|
|
|
int target_st_atime;
|
2010-08-09 10:13:33 +02:00
|
|
|
unsigned int target_st_atime_nsec;
|
2009-05-20 21:31:33 +02:00
|
|
|
int target_st_mtime;
|
2010-08-09 10:13:33 +02:00
|
|
|
unsigned int target_st_mtime_nsec;
|
2009-05-20 21:31:33 +02:00
|
|
|
int target_st_ctime;
|
2010-08-09 10:13:33 +02:00
|
|
|
unsigned int target_st_ctime_nsec;
|
|
|
|
uint64_t st_ino;
|
2009-05-20 21:31:33 +02:00
|
|
|
};
|
|
|
|
|
2006-10-22 02:18:54 +02:00
|
|
|
#elif defined(TARGET_M68K)
|
|
|
|
|
|
|
|
struct target_stat {
|
|
|
|
unsigned short st_dev;
|
|
|
|
unsigned short __pad1;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_ino;
|
2006-10-22 02:18:54 +02:00
|
|
|
unsigned short st_mode;
|
|
|
|
unsigned short st_nlink;
|
|
|
|
unsigned short st_uid;
|
|
|
|
unsigned short st_gid;
|
|
|
|
unsigned short st_rdev;
|
|
|
|
unsigned short __pad2;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_size;
|
|
|
|
abi_ulong st_blksize;
|
|
|
|
abi_ulong st_blocks;
|
|
|
|
abi_ulong target_st_atime;
|
|
|
|
abi_ulong __unused1;
|
|
|
|
abi_ulong target_st_mtime;
|
|
|
|
abi_ulong __unused2;
|
|
|
|
abi_ulong target_st_ctime;
|
|
|
|
abi_ulong __unused3;
|
|
|
|
abi_ulong __unused4;
|
|
|
|
abi_ulong __unused5;
|
2006-10-22 02:18:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* This matches struct stat64 in glibc2.1, hence the absolutely
|
|
|
|
* insane amounts of padding around dev_t's.
|
|
|
|
*/
|
2013-10-30 22:52:24 +01:00
|
|
|
#define TARGET_HAS_STRUCT_STAT64
|
2006-10-22 02:18:54 +02:00
|
|
|
struct target_stat64 {
|
|
|
|
unsigned long long st_dev;
|
|
|
|
unsigned char __pad1[2];
|
|
|
|
|
|
|
|
#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong __st_ino;
|
2006-10-22 02:18:54 +02:00
|
|
|
|
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned int st_nlink;
|
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_uid;
|
|
|
|
abi_ulong st_gid;
|
2006-10-22 02:18:54 +02:00
|
|
|
|
|
|
|
unsigned long long st_rdev;
|
|
|
|
unsigned char __pad3[2];
|
|
|
|
|
|
|
|
long long st_size;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_blksize;
|
2006-10-22 02:18:54 +02:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong __pad4; /* future possible st_blocks high bits */
|
|
|
|
abi_ulong st_blocks; /* Number 512-byte blocks allocated. */
|
2006-10-22 02:18:54 +02:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_atime;
|
|
|
|
abi_ulong target_st_atime_nsec;
|
2006-10-22 02:18:54 +02:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_mtime;
|
|
|
|
abi_ulong target_st_mtime_nsec;
|
2006-10-22 02:18:54 +02:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_ctime;
|
|
|
|
abi_ulong target_st_ctime_nsec;
|
2006-10-22 02:18:54 +02:00
|
|
|
|
|
|
|
unsigned long long st_ino;
|
2011-08-31 12:38:01 +02:00
|
|
|
} QEMU_PACKED;
|
2006-10-22 02:18:54 +02:00
|
|
|
|
2007-11-08 19:05:37 +01:00
|
|
|
#elif defined(TARGET_ABI_MIPSN64)
|
2007-09-30 03:58:33 +02:00
|
|
|
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
#define TARGET_STAT_HAVE_NSEC
|
2007-09-30 03:58:33 +02:00
|
|
|
/* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
|
|
|
|
struct target_stat {
|
|
|
|
unsigned int st_dev;
|
|
|
|
unsigned int st_pad0[3]; /* Reserved for st_dev expansion */
|
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_ino;
|
2007-09-30 03:58:33 +02:00
|
|
|
|
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned int st_nlink;
|
|
|
|
|
|
|
|
int st_uid;
|
|
|
|
int st_gid;
|
|
|
|
|
|
|
|
unsigned int st_rdev;
|
|
|
|
unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */
|
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_size;
|
2007-09-30 03:58:33 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Actually this should be timestruc_t st_atime, st_mtime and st_ctime
|
|
|
|
* but we don't have it under Linux.
|
|
|
|
*/
|
|
|
|
unsigned int target_st_atime;
|
|
|
|
unsigned int target_st_atime_nsec;
|
|
|
|
|
|
|
|
unsigned int target_st_mtime;
|
|
|
|
unsigned int target_st_mtime_nsec;
|
|
|
|
|
|
|
|
unsigned int target_st_ctime;
|
|
|
|
unsigned int target_st_ctime_nsec;
|
|
|
|
|
|
|
|
unsigned int st_blksize;
|
|
|
|
unsigned int st_pad2;
|
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_blocks;
|
2007-09-30 03:58:33 +02:00
|
|
|
};
|
|
|
|
|
2007-11-08 19:05:37 +01:00
|
|
|
#elif defined(TARGET_ABI_MIPSN32)
|
2007-09-30 03:58:33 +02:00
|
|
|
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
#define TARGET_STAT_HAVE_NSEC
|
2007-09-30 03:58:33 +02:00
|
|
|
struct target_stat {
|
2015-01-30 16:08:05 +01:00
|
|
|
abi_ulong st_dev;
|
|
|
|
abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */
|
|
|
|
uint64_t st_ino;
|
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned int st_nlink;
|
|
|
|
int st_uid;
|
|
|
|
int st_gid;
|
|
|
|
abi_ulong st_rdev;
|
|
|
|
abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */
|
|
|
|
int64_t st_size;
|
|
|
|
abi_long target_st_atime;
|
|
|
|
abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */
|
|
|
|
abi_long target_st_mtime;
|
|
|
|
abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */
|
|
|
|
abi_long target_st_ctime;
|
|
|
|
abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */
|
|
|
|
abi_ulong st_blksize;
|
|
|
|
abi_ulong st_pad2;
|
|
|
|
int64_t st_blocks;
|
2007-09-30 03:58:33 +02:00
|
|
|
};
|
|
|
|
|
2007-11-08 19:05:37 +01:00
|
|
|
#elif defined(TARGET_ABI_MIPSO32)
|
2005-11-26 19:47:20 +01:00
|
|
|
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
#define TARGET_STAT_HAVE_NSEC
|
2005-11-26 19:47:20 +01:00
|
|
|
struct target_stat {
|
|
|
|
unsigned st_dev;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long st_pad1[3]; /* Reserved for network id */
|
|
|
|
abi_ulong st_ino;
|
2005-11-26 19:47:20 +01:00
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned int st_nlink;
|
|
|
|
int st_uid;
|
|
|
|
int st_gid;
|
|
|
|
unsigned st_rdev;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long st_pad2[2];
|
|
|
|
abi_long st_size;
|
|
|
|
abi_long st_pad3;
|
2005-11-26 19:47:20 +01:00
|
|
|
/*
|
|
|
|
* Actually this should be timestruc_t st_atime, st_mtime and st_ctime
|
|
|
|
* but we don't have it under Linux.
|
|
|
|
*/
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long target_st_atime;
|
|
|
|
abi_long target_st_atime_nsec;
|
|
|
|
abi_long target_st_mtime;
|
|
|
|
abi_long target_st_mtime_nsec;
|
|
|
|
abi_long target_st_ctime;
|
|
|
|
abi_long target_st_ctime_nsec;
|
|
|
|
abi_long st_blksize;
|
|
|
|
abi_long st_blocks;
|
|
|
|
abi_long st_pad4[14];
|
2005-11-26 19:47:20 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This matches struct stat64 in glibc2.1, hence the absolutely insane
|
|
|
|
* amounts of padding around dev_t's. The memory layout is the same as of
|
|
|
|
* struct stat of the 64-bit kernel.
|
|
|
|
*/
|
|
|
|
|
2013-10-30 22:52:24 +01:00
|
|
|
#define TARGET_HAS_STRUCT_STAT64
|
2005-11-26 19:47:20 +01:00
|
|
|
struct target_stat64 {
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_dev;
|
|
|
|
abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */
|
2005-11-26 19:47:20 +01:00
|
|
|
|
|
|
|
uint64_t st_ino;
|
|
|
|
|
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned int st_nlink;
|
|
|
|
|
|
|
|
int st_uid;
|
|
|
|
int st_gid;
|
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_rdev;
|
|
|
|
abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */
|
2005-11-26 19:47:20 +01:00
|
|
|
|
|
|
|
int64_t st_size;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Actually this should be timestruc_t st_atime, st_mtime and st_ctime
|
|
|
|
* but we don't have it under Linux.
|
|
|
|
*/
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long target_st_atime;
|
|
|
|
abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */
|
2005-11-26 19:47:20 +01:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long target_st_mtime;
|
|
|
|
abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */
|
2005-11-26 19:47:20 +01:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long target_st_ctime;
|
|
|
|
abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */
|
2005-11-26 19:47:20 +01:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_blksize;
|
|
|
|
abi_ulong st_pad2;
|
2005-11-26 19:47:20 +01:00
|
|
|
|
|
|
|
int64_t st_blocks;
|
|
|
|
};
|
2007-04-05 09:13:51 +02:00
|
|
|
|
|
|
|
#elif defined(TARGET_ALPHA)
|
|
|
|
|
|
|
|
struct target_stat {
|
|
|
|
unsigned int st_dev;
|
|
|
|
unsigned int st_ino;
|
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned int st_nlink;
|
|
|
|
unsigned int st_uid;
|
|
|
|
unsigned int st_gid;
|
|
|
|
unsigned int st_rdev;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long st_size;
|
|
|
|
abi_ulong target_st_atime;
|
|
|
|
abi_ulong target_st_mtime;
|
|
|
|
abi_ulong target_st_ctime;
|
2007-04-05 09:13:51 +02:00
|
|
|
unsigned int st_blksize;
|
|
|
|
unsigned int st_blocks;
|
|
|
|
unsigned int st_flags;
|
|
|
|
unsigned int st_gen;
|
|
|
|
};
|
|
|
|
|
2013-10-30 22:52:24 +01:00
|
|
|
#define TARGET_HAS_STRUCT_STAT64
|
2007-04-05 09:13:51 +02:00
|
|
|
struct target_stat64 {
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_dev;
|
|
|
|
abi_ulong st_ino;
|
|
|
|
abi_ulong st_rdev;
|
|
|
|
abi_long st_size;
|
|
|
|
abi_ulong st_blocks;
|
2007-04-05 09:13:51 +02:00
|
|
|
|
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned int st_uid;
|
|
|
|
unsigned int st_gid;
|
|
|
|
unsigned int st_blksize;
|
|
|
|
unsigned int st_nlink;
|
|
|
|
unsigned int __pad0;
|
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_atime;
|
|
|
|
abi_ulong target_st_atime_nsec;
|
|
|
|
abi_ulong target_st_mtime;
|
|
|
|
abi_ulong target_st_mtime_nsec;
|
|
|
|
abi_ulong target_st_ctime;
|
|
|
|
abi_ulong target_st_ctime_nsec;
|
|
|
|
abi_long __unused[3];
|
2007-04-05 09:13:51 +02:00
|
|
|
};
|
|
|
|
|
2007-06-22 12:15:10 +02:00
|
|
|
#elif defined(TARGET_SH4)
|
|
|
|
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
#define TARGET_STAT_HAVE_NSEC
|
2007-06-22 12:15:10 +02:00
|
|
|
struct target_stat {
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_dev;
|
|
|
|
abi_ulong st_ino;
|
2007-06-22 12:15:10 +02:00
|
|
|
unsigned short st_mode;
|
|
|
|
unsigned short st_nlink;
|
|
|
|
unsigned short st_uid;
|
|
|
|
unsigned short st_gid;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_rdev;
|
|
|
|
abi_ulong st_size;
|
|
|
|
abi_ulong st_blksize;
|
|
|
|
abi_ulong st_blocks;
|
|
|
|
abi_ulong target_st_atime;
|
|
|
|
abi_ulong target_st_atime_nsec;
|
|
|
|
abi_ulong target_st_mtime;
|
|
|
|
abi_ulong target_st_mtime_nsec;
|
|
|
|
abi_ulong target_st_ctime;
|
|
|
|
abi_ulong target_st_ctime_nsec;
|
|
|
|
abi_ulong __unused4;
|
|
|
|
abi_ulong __unused5;
|
2007-06-22 12:15:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* This matches struct stat64 in glibc2.1, hence the absolutely
|
|
|
|
* insane amounts of padding around dev_t's.
|
|
|
|
*/
|
2013-10-30 22:52:24 +01:00
|
|
|
#define TARGET_HAS_STRUCT_STAT64
|
2011-08-31 12:38:01 +02:00
|
|
|
struct QEMU_PACKED target_stat64 {
|
2007-06-22 12:15:10 +02:00
|
|
|
unsigned long long st_dev;
|
|
|
|
unsigned char __pad0[4];
|
|
|
|
|
|
|
|
#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong __st_ino;
|
2007-06-22 12:15:10 +02:00
|
|
|
|
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned int st_nlink;
|
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_uid;
|
|
|
|
abi_ulong st_gid;
|
2007-06-22 12:15:10 +02:00
|
|
|
|
|
|
|
unsigned long long st_rdev;
|
|
|
|
unsigned char __pad3[4];
|
|
|
|
|
|
|
|
long long st_size;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong st_blksize;
|
2007-06-22 12:15:10 +02:00
|
|
|
|
|
|
|
unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
|
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_atime;
|
|
|
|
abi_ulong target_st_atime_nsec;
|
2007-06-22 12:15:10 +02:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_mtime;
|
|
|
|
abi_ulong target_st_mtime_nsec;
|
2007-06-22 12:15:10 +02:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong target_st_ctime;
|
|
|
|
abi_ulong target_st_ctime_nsec;
|
2007-06-22 12:15:10 +02:00
|
|
|
|
|
|
|
unsigned long long st_ino;
|
|
|
|
};
|
|
|
|
|
2007-11-14 19:08:56 +01:00
|
|
|
#elif defined(TARGET_I386) && !defined(TARGET_ABI32)
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
#define TARGET_STAT_HAVE_NSEC
|
2007-11-14 19:08:56 +01:00
|
|
|
struct target_stat {
|
|
|
|
abi_ulong st_dev;
|
|
|
|
abi_ulong st_ino;
|
|
|
|
abi_ulong st_nlink;
|
|
|
|
|
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned int st_uid;
|
|
|
|
unsigned int st_gid;
|
|
|
|
unsigned int __pad0;
|
|
|
|
abi_ulong st_rdev;
|
|
|
|
abi_long st_size;
|
|
|
|
abi_long st_blksize;
|
2018-12-13 23:37:36 +01:00
|
|
|
abi_long st_blocks; /* Number 512-byte blocks allocated. */
|
2007-11-14 19:08:56 +01:00
|
|
|
|
|
|
|
abi_ulong target_st_atime;
|
|
|
|
abi_ulong target_st_atime_nsec;
|
|
|
|
abi_ulong target_st_mtime;
|
|
|
|
abi_ulong target_st_mtime_nsec;
|
|
|
|
abi_ulong target_st_ctime;
|
|
|
|
abi_ulong target_st_ctime_nsec;
|
|
|
|
|
2018-12-13 23:37:36 +01:00
|
|
|
abi_long __unused[3];
|
2007-11-14 19:08:56 +01:00
|
|
|
};
|
2009-07-24 16:57:31 +02:00
|
|
|
#elif defined(TARGET_S390X)
|
|
|
|
struct target_stat {
|
|
|
|
abi_ulong st_dev;
|
|
|
|
abi_ulong st_ino;
|
|
|
|
abi_ulong st_nlink;
|
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned int st_uid;
|
|
|
|
unsigned int st_gid;
|
|
|
|
unsigned int __pad1;
|
|
|
|
abi_ulong st_rdev;
|
|
|
|
abi_ulong st_size;
|
|
|
|
abi_ulong target_st_atime;
|
|
|
|
abi_ulong target_st_atime_nsec;
|
|
|
|
abi_ulong target_st_mtime;
|
|
|
|
abi_ulong target_st_mtime_nsec;
|
|
|
|
abi_ulong target_st_ctime;
|
|
|
|
abi_ulong target_st_ctime_nsec;
|
|
|
|
abi_ulong st_blksize;
|
|
|
|
abi_long st_blocks;
|
|
|
|
abi_ulong __unused[3];
|
|
|
|
};
|
2013-09-03 21:12:15 +02:00
|
|
|
#elif defined(TARGET_AARCH64)
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
#define TARGET_STAT_HAVE_NSEC
|
2013-09-03 21:12:15 +02:00
|
|
|
struct target_stat {
|
|
|
|
abi_ulong st_dev;
|
|
|
|
abi_ulong st_ino;
|
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned int st_nlink;
|
|
|
|
unsigned int st_uid;
|
|
|
|
unsigned int st_gid;
|
|
|
|
abi_ulong st_rdev;
|
|
|
|
abi_ulong _pad1;
|
|
|
|
abi_long st_size;
|
|
|
|
int st_blksize;
|
|
|
|
int __pad2;
|
|
|
|
abi_long st_blocks;
|
|
|
|
abi_long target_st_atime;
|
|
|
|
abi_ulong target_st_atime_nsec;
|
|
|
|
abi_long target_st_mtime;
|
|
|
|
abi_ulong target_st_mtime_nsec;
|
|
|
|
abi_long target_st_ctime;
|
|
|
|
abi_ulong target_st_ctime_nsec;
|
|
|
|
unsigned int __unused[2];
|
|
|
|
};
|
2017-01-25 19:54:11 +01:00
|
|
|
#elif defined(TARGET_XTENSA)
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
#define TARGET_STAT_HAVE_NSEC
|
2017-01-25 19:54:11 +01:00
|
|
|
struct target_stat {
|
|
|
|
abi_ulong st_dev;
|
|
|
|
abi_ulong st_ino;
|
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned int st_nlink;
|
|
|
|
unsigned int st_uid;
|
|
|
|
unsigned int st_gid;
|
|
|
|
abi_ulong st_rdev;
|
|
|
|
abi_long st_size;
|
|
|
|
abi_ulong st_blksize;
|
|
|
|
abi_ulong st_blocks;
|
|
|
|
abi_ulong target_st_atime;
|
|
|
|
abi_ulong target_st_atime_nsec;
|
|
|
|
abi_ulong target_st_mtime;
|
|
|
|
abi_ulong target_st_mtime_nsec;
|
|
|
|
abi_ulong target_st_ctime;
|
|
|
|
abi_ulong target_st_ctime_nsec;
|
|
|
|
abi_ulong __unused4;
|
|
|
|
abi_ulong __unused5;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define TARGET_HAS_STRUCT_STAT64
|
|
|
|
struct target_stat64 {
|
|
|
|
uint64_t st_dev; /* Device */
|
|
|
|
uint64_t st_ino; /* File serial number */
|
|
|
|
unsigned int st_mode; /* File mode. */
|
|
|
|
unsigned int st_nlink; /* Link count. */
|
|
|
|
unsigned int st_uid; /* User ID of the file's owner. */
|
|
|
|
unsigned int st_gid; /* Group ID of the file's group. */
|
|
|
|
uint64_t st_rdev; /* Device number, if device. */
|
|
|
|
int64_t st_size; /* Size of file, in bytes. */
|
|
|
|
abi_ulong st_blksize; /* Optimal block size for I/O. */
|
|
|
|
abi_ulong __unused2;
|
|
|
|
uint64_t st_blocks; /* Number 512-byte blocks allocated. */
|
|
|
|
abi_ulong target_st_atime; /* Time of last access. */
|
|
|
|
abi_ulong target_st_atime_nsec;
|
|
|
|
abi_ulong target_st_mtime; /* Time of last modification. */
|
|
|
|
abi_ulong target_st_mtime_nsec;
|
|
|
|
abi_ulong target_st_ctime; /* Time of last status change. */
|
|
|
|
abi_ulong target_st_ctime_nsec;
|
|
|
|
abi_ulong __unused4;
|
|
|
|
abi_ulong __unused5;
|
|
|
|
};
|
|
|
|
|
2017-01-18 23:01:42 +01:00
|
|
|
#elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) || \
|
2018-03-02 13:31:11 +01:00
|
|
|
defined(TARGET_NIOS2) || defined(TARGET_RISCV)
|
2013-07-06 22:44:53 +02:00
|
|
|
|
|
|
|
/* These are the asm-generic versions of the stat and stat64 structures */
|
|
|
|
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
#define TARGET_STAT_HAVE_NSEC
|
2012-07-20 09:50:52 +02:00
|
|
|
struct target_stat {
|
|
|
|
abi_ulong st_dev;
|
|
|
|
abi_ulong st_ino;
|
|
|
|
unsigned int st_mode;
|
2013-07-06 22:44:53 +02:00
|
|
|
unsigned int st_nlink;
|
2012-07-20 09:50:52 +02:00
|
|
|
unsigned int st_uid;
|
|
|
|
unsigned int st_gid;
|
|
|
|
abi_ulong st_rdev;
|
2013-07-06 22:44:53 +02:00
|
|
|
abi_ulong __pad1;
|
2012-07-20 09:50:52 +02:00
|
|
|
abi_long st_size;
|
2013-07-06 22:44:53 +02:00
|
|
|
int st_blksize;
|
|
|
|
int __pad2;
|
|
|
|
abi_long st_blocks;
|
|
|
|
abi_long target_st_atime;
|
2012-07-20 09:50:52 +02:00
|
|
|
abi_ulong target_st_atime_nsec;
|
2013-07-06 22:44:53 +02:00
|
|
|
abi_long target_st_mtime;
|
2012-07-20 09:50:52 +02:00
|
|
|
abi_ulong target_st_mtime_nsec;
|
2013-07-06 22:44:53 +02:00
|
|
|
abi_long target_st_ctime;
|
2012-07-20 09:50:52 +02:00
|
|
|
abi_ulong target_st_ctime_nsec;
|
2013-07-06 22:44:53 +02:00
|
|
|
unsigned int __unused4;
|
|
|
|
unsigned int __unused5;
|
|
|
|
};
|
2012-07-20 09:50:52 +02:00
|
|
|
|
2018-03-02 13:31:11 +01:00
|
|
|
#if !defined(TARGET_RISCV64)
|
2013-10-30 22:52:24 +01:00
|
|
|
#define TARGET_HAS_STRUCT_STAT64
|
2013-07-06 22:44:53 +02:00
|
|
|
struct target_stat64 {
|
|
|
|
uint64_t st_dev;
|
|
|
|
uint64_t st_ino;
|
|
|
|
unsigned int st_mode;
|
|
|
|
unsigned int st_nlink;
|
|
|
|
unsigned int st_uid;
|
|
|
|
unsigned int st_gid;
|
|
|
|
uint64_t st_rdev;
|
|
|
|
uint64_t __pad1;
|
|
|
|
int64_t st_size;
|
|
|
|
int st_blksize;
|
|
|
|
int __pad2;
|
|
|
|
int64_t st_blocks;
|
|
|
|
int target_st_atime;
|
|
|
|
unsigned int target_st_atime_nsec;
|
|
|
|
int target_st_mtime;
|
|
|
|
unsigned int target_st_mtime_nsec;
|
|
|
|
int target_st_ctime;
|
|
|
|
unsigned int target_st_ctime_nsec;
|
|
|
|
unsigned int __unused4;
|
|
|
|
unsigned int __unused5;
|
2012-07-20 09:50:52 +02:00
|
|
|
};
|
2018-03-02 13:31:11 +01:00
|
|
|
#endif
|
2013-07-06 22:44:53 +02:00
|
|
|
|
2016-12-15 18:56:41 +01:00
|
|
|
#elif defined(TARGET_HPPA)
|
|
|
|
|
linux-user: Pass through nanosecond timestamp components for stat syscalls
Since Linux 2.6 the stat syscalls have mostly supported nanosecond
components for each of the file-related timestamps.
QEMU user mode emulation currently does not pass through the nanosecond
portion of the timestamp, even when the host system fills in the value.
This results in a mismatch when run on subsecond resolution filesystems
such as ext4 or XFS.
An example of this leading to inconsistency is cross-debootstraping a
full desktop root filesystem of Debian Buster. Recent versions of
fontconfig store the full timestamp (instead of just the second portion)
of the directory in its per-directory cache file, and checks this against
the directory to see if the cache is up-to-date. With QEMU user mode
emulation, the timestamp stored is incorrect, and upon booting the rootfs
natively, fontconfig discovers the mismatch, and proceeds to rebuild the
cache on the comparatively slow machine (low-power ARM vs x86). This
stalls the first attempt to open whatever application that incorporates
fontconfig.
This patch renames the "unused" padding trailing each timestamp element
to its nanosecond counterpart name if such an element exists in the
kernel sources for the given platform. Not all do. Then have the syscall
wrapper fill in the nanosecond portion if the host supports it, as
specified by the _POSIX_C_SOURCE and _XOPEN_SOURCE feature macros.
Recent versions of glibc only use stat64 and newfstatat syscalls on
32-bit and 64-bit platforms respectively. The changes in this patch
were tested by directly calling the stat, stat64 and newfstatat syscalls
directly, in addition to the glibc wrapper, on arm and aarch64 little
endian targets.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Message-Id: <20190522162147.26303-1-wens@kernel.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-05-22 18:21:47 +02:00
|
|
|
#define TARGET_STAT_HAVE_NSEC
|
2016-12-15 18:56:41 +01:00
|
|
|
struct target_stat {
|
|
|
|
abi_uint st_dev;
|
|
|
|
abi_uint st_ino;
|
|
|
|
abi_ushort st_mode;
|
|
|
|
abi_ushort st_nlink;
|
|
|
|
abi_ushort _res1;
|
|
|
|
abi_ushort _res2;
|
|
|
|
abi_uint st_rdev;
|
|
|
|
abi_int st_size;
|
|
|
|
abi_int target_st_atime;
|
|
|
|
abi_uint target_st_atime_nsec;
|
|
|
|
abi_int target_st_mtime;
|
|
|
|
abi_uint target_st_mtime_nsec;
|
|
|
|
abi_int target_st_ctime;
|
|
|
|
abi_uint target_st_ctime_nsec;
|
|
|
|
abi_int st_blksize;
|
|
|
|
abi_int st_blocks;
|
|
|
|
abi_uint _unused1;
|
|
|
|
abi_uint _unused2;
|
|
|
|
abi_uint _unused3;
|
|
|
|
abi_uint _unused4;
|
|
|
|
abi_ushort _unused5;
|
|
|
|
abi_short st_fstype;
|
|
|
|
abi_uint st_realdev;
|
|
|
|
abi_ushort st_basemode;
|
|
|
|
abi_ushort _unused6;
|
|
|
|
abi_uint st_uid;
|
|
|
|
abi_uint st_gid;
|
|
|
|
abi_uint _unused7[3];
|
|
|
|
};
|
|
|
|
|
|
|
|
#define TARGET_HAS_STRUCT_STAT64
|
|
|
|
struct target_stat64 {
|
|
|
|
uint64_t st_dev;
|
|
|
|
abi_uint _pad1;
|
|
|
|
abi_uint _res1;
|
|
|
|
abi_uint st_mode;
|
|
|
|
abi_uint st_nlink;
|
|
|
|
abi_uint st_uid;
|
|
|
|
abi_uint st_gid;
|
|
|
|
uint64_t st_rdev;
|
|
|
|
abi_uint _pad2;
|
|
|
|
int64_t st_size;
|
|
|
|
abi_int st_blksize;
|
|
|
|
int64_t st_blocks;
|
|
|
|
abi_int target_st_atime;
|
|
|
|
abi_uint target_st_atime_nsec;
|
|
|
|
abi_int target_st_mtime;
|
|
|
|
abi_uint target_st_mtime_nsec;
|
|
|
|
abi_int target_st_ctime;
|
|
|
|
abi_uint target_st_ctime_nsec;
|
|
|
|
uint64_t st_ino;
|
|
|
|
};
|
|
|
|
|
2005-11-26 19:47:20 +01:00
|
|
|
#else
|
|
|
|
#error unsupported CPU
|
|
|
|
#endif
|
2003-06-15 21:58:13 +02:00
|
|
|
|
2007-07-20 17:54:27 +02:00
|
|
|
typedef struct {
|
|
|
|
int val[2];
|
2009-10-01 23:12:16 +02:00
|
|
|
} target_fsid_t;
|
2007-07-20 17:54:27 +02:00
|
|
|
|
2005-11-28 23:28:41 +01:00
|
|
|
#ifdef TARGET_MIPS
|
2007-11-08 19:05:37 +01:00
|
|
|
#ifdef TARGET_ABI_MIPSN32
|
2007-09-30 03:58:33 +02:00
|
|
|
struct target_statfs {
|
|
|
|
int32_t f_type;
|
|
|
|
int32_t f_bsize;
|
|
|
|
int32_t f_frsize; /* Fragment size - unsupported */
|
|
|
|
int32_t f_blocks;
|
|
|
|
int32_t f_bfree;
|
|
|
|
int32_t f_files;
|
|
|
|
int32_t f_ffree;
|
|
|
|
int32_t f_bavail;
|
|
|
|
|
|
|
|
/* Linux specials */
|
2009-10-01 23:12:16 +02:00
|
|
|
target_fsid_t f_fsid;
|
2007-09-30 03:58:33 +02:00
|
|
|
int32_t f_namelen;
|
2018-03-01 12:15:00 +01:00
|
|
|
int32_t f_flags;
|
|
|
|
int32_t f_spare[5];
|
2007-09-30 03:58:33 +02:00
|
|
|
};
|
|
|
|
#else
|
2005-11-28 23:28:41 +01:00
|
|
|
struct target_statfs {
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long f_type;
|
|
|
|
abi_long f_bsize;
|
|
|
|
abi_long f_frsize; /* Fragment size - unsupported */
|
|
|
|
abi_long f_blocks;
|
|
|
|
abi_long f_bfree;
|
|
|
|
abi_long f_files;
|
|
|
|
abi_long f_ffree;
|
|
|
|
abi_long f_bavail;
|
2005-11-28 23:28:41 +01:00
|
|
|
|
|
|
|
/* Linux specials */
|
2009-10-01 23:12:16 +02:00
|
|
|
target_fsid_t f_fsid;
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long f_namelen;
|
2018-03-01 12:15:00 +01:00
|
|
|
abi_long f_flags;
|
|
|
|
abi_long f_spare[5];
|
2005-11-28 23:28:41 +01:00
|
|
|
};
|
2007-09-30 03:58:33 +02:00
|
|
|
#endif
|
2005-11-28 23:28:41 +01:00
|
|
|
|
|
|
|
struct target_statfs64 {
|
|
|
|
uint32_t f_type;
|
|
|
|
uint32_t f_bsize;
|
|
|
|
uint32_t f_frsize; /* Fragment size - unsupported */
|
|
|
|
uint32_t __pad;
|
|
|
|
uint64_t f_blocks;
|
|
|
|
uint64_t f_bfree;
|
|
|
|
uint64_t f_files;
|
|
|
|
uint64_t f_ffree;
|
|
|
|
uint64_t f_bavail;
|
2009-10-01 23:12:16 +02:00
|
|
|
target_fsid_t f_fsid;
|
2005-11-28 23:28:41 +01:00
|
|
|
uint32_t f_namelen;
|
2018-03-01 12:15:00 +01:00
|
|
|
uint32_t f_flags;
|
|
|
|
uint32_t f_spare[5];
|
2005-11-28 23:28:41 +01:00
|
|
|
};
|
2008-07-19 11:38:52 +02:00
|
|
|
#elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \
|
2018-03-02 13:31:11 +01:00
|
|
|
defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \
|
|
|
|
defined(TARGET_RISCV)) && !defined(TARGET_ABI32)
|
2007-11-21 14:06:54 +01:00
|
|
|
struct target_statfs {
|
|
|
|
abi_long f_type;
|
|
|
|
abi_long f_bsize;
|
|
|
|
abi_long f_blocks;
|
|
|
|
abi_long f_bfree;
|
|
|
|
abi_long f_bavail;
|
|
|
|
abi_long f_files;
|
|
|
|
abi_long f_ffree;
|
2009-10-01 23:12:16 +02:00
|
|
|
target_fsid_t f_fsid;
|
2007-11-21 14:06:54 +01:00
|
|
|
abi_long f_namelen;
|
|
|
|
abi_long f_frsize;
|
2018-03-01 12:15:00 +01:00
|
|
|
abi_long f_flags;
|
|
|
|
abi_long f_spare[4];
|
2007-11-21 14:06:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct target_statfs64 {
|
|
|
|
abi_long f_type;
|
|
|
|
abi_long f_bsize;
|
|
|
|
abi_long f_blocks;
|
|
|
|
abi_long f_bfree;
|
|
|
|
abi_long f_bavail;
|
|
|
|
abi_long f_files;
|
|
|
|
abi_long f_ffree;
|
2009-10-01 23:12:16 +02:00
|
|
|
target_fsid_t f_fsid;
|
2007-11-21 14:06:54 +01:00
|
|
|
abi_long f_namelen;
|
|
|
|
abi_long f_frsize;
|
2018-03-01 12:15:00 +01:00
|
|
|
abi_long f_flags;
|
|
|
|
abi_long f_spare[4];
|
2007-11-21 14:06:54 +01:00
|
|
|
};
|
2009-07-24 16:57:31 +02:00
|
|
|
#elif defined(TARGET_S390X)
|
|
|
|
struct target_statfs {
|
|
|
|
int32_t f_type;
|
|
|
|
int32_t f_bsize;
|
|
|
|
abi_long f_blocks;
|
|
|
|
abi_long f_bfree;
|
|
|
|
abi_long f_bavail;
|
|
|
|
abi_long f_files;
|
|
|
|
abi_long f_ffree;
|
|
|
|
kernel_fsid_t f_fsid;
|
|
|
|
int32_t f_namelen;
|
|
|
|
int32_t f_frsize;
|
2018-03-01 12:15:00 +01:00
|
|
|
int32_t f_flags;
|
|
|
|
int32_t f_spare[4];
|
|
|
|
|
2009-07-24 16:57:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct target_statfs64 {
|
|
|
|
int32_t f_type;
|
|
|
|
int32_t f_bsize;
|
|
|
|
abi_long f_blocks;
|
|
|
|
abi_long f_bfree;
|
|
|
|
abi_long f_bavail;
|
|
|
|
abi_long f_files;
|
|
|
|
abi_long f_ffree;
|
|
|
|
kernel_fsid_t f_fsid;
|
|
|
|
int32_t f_namelen;
|
|
|
|
int32_t f_frsize;
|
2018-03-01 12:15:00 +01:00
|
|
|
int32_t f_flags;
|
|
|
|
int32_t f_spare[4];
|
2009-07-24 16:57:31 +02:00
|
|
|
};
|
2005-11-28 23:28:41 +01:00
|
|
|
#else
|
|
|
|
struct target_statfs {
|
|
|
|
uint32_t f_type;
|
|
|
|
uint32_t f_bsize;
|
|
|
|
uint32_t f_blocks;
|
|
|
|
uint32_t f_bfree;
|
|
|
|
uint32_t f_bavail;
|
|
|
|
uint32_t f_files;
|
|
|
|
uint32_t f_ffree;
|
2009-10-01 23:12:16 +02:00
|
|
|
target_fsid_t f_fsid;
|
2005-11-28 23:28:41 +01:00
|
|
|
uint32_t f_namelen;
|
|
|
|
uint32_t f_frsize;
|
2018-03-01 12:15:00 +01:00
|
|
|
uint32_t f_flags;
|
|
|
|
uint32_t f_spare[4];
|
2005-11-28 23:28:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct target_statfs64 {
|
|
|
|
uint32_t f_type;
|
|
|
|
uint32_t f_bsize;
|
|
|
|
uint64_t f_blocks;
|
|
|
|
uint64_t f_bfree;
|
|
|
|
uint64_t f_bavail;
|
|
|
|
uint64_t f_files;
|
|
|
|
uint64_t f_ffree;
|
2009-10-01 23:12:16 +02:00
|
|
|
target_fsid_t f_fsid;
|
2005-11-28 23:28:41 +01:00
|
|
|
uint32_t f_namelen;
|
|
|
|
uint32_t f_frsize;
|
2018-03-01 12:15:00 +01:00
|
|
|
uint32_t f_flags;
|
|
|
|
uint32_t f_spare[4];
|
2005-11-28 23:28:41 +01:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2009-07-24 19:10:27 +02:00
|
|
|
#define TARGET_F_LINUX_SPECIFIC_BASE 1024
|
|
|
|
#define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0)
|
|
|
|
#define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1)
|
|
|
|
#define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6)
|
2016-06-20 16:50:37 +02:00
|
|
|
#define TARGET_F_SETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 7)
|
|
|
|
#define TARGET_F_GETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 8)
|
2009-07-24 19:10:27 +02:00
|
|
|
#define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2)
|
|
|
|
|
2018-05-29 21:41:53 +02:00
|
|
|
#include "target_fcntl.h"
|
2014-03-07 15:24:08 +01:00
|
|
|
|
2003-06-15 21:58:13 +02:00
|
|
|
/* soundcard defines */
|
2015-09-08 23:45:14 +02:00
|
|
|
/* XXX: convert them all to arch independent entries */
|
2003-06-15 21:58:13 +02:00
|
|
|
#define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int);
|
|
|
|
#define TARGET_SNDCTL_COPR_LOAD 0xcfb04301
|
|
|
|
#define TARGET_SNDCTL_COPR_RCODE 0xc0144303
|
|
|
|
#define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309
|
|
|
|
#define TARGET_SNDCTL_COPR_RDATA 0xc0144302
|
|
|
|
#define TARGET_SNDCTL_COPR_RESET 0x00004300
|
|
|
|
#define TARGET_SNDCTL_COPR_RUN 0xc0144306
|
|
|
|
#define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308
|
|
|
|
#define TARGET_SNDCTL_COPR_WCODE 0x40144305
|
|
|
|
#define TARGET_SNDCTL_COPR_WDATA 0x40144304
|
|
|
|
#define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0)
|
|
|
|
#define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1)
|
|
|
|
#define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int)
|
|
|
|
#define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int)
|
|
|
|
#define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int)
|
|
|
|
#define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int)
|
|
|
|
#define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int)
|
|
|
|
#define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int)
|
|
|
|
#define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8)
|
|
|
|
#define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int)
|
|
|
|
#define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int)
|
|
|
|
#define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int)
|
|
|
|
#define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12)
|
|
|
|
#define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13)
|
|
|
|
#define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int)
|
|
|
|
#define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int)
|
|
|
|
#define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17)
|
|
|
|
#define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18)
|
2012-07-23 10:06:15 +02:00
|
|
|
#define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19)
|
|
|
|
#define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20)
|
2003-06-15 21:58:13 +02:00
|
|
|
#define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e
|
|
|
|
#define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005
|
|
|
|
#define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016
|
|
|
|
#define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015
|
|
|
|
#define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010
|
|
|
|
#define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f
|
|
|
|
#define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107
|
|
|
|
#define TARGET_SNDCTL_MIDI_INFO 0xc074510c
|
|
|
|
#define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02
|
|
|
|
#define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01
|
|
|
|
#define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00
|
|
|
|
#define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110
|
|
|
|
#define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001
|
|
|
|
#define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103
|
|
|
|
#define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105
|
|
|
|
#define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104
|
|
|
|
#define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b
|
|
|
|
#define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a
|
|
|
|
#define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112
|
|
|
|
#define TARGET_SNDCTL_SEQ_PANIC 0x00005111
|
|
|
|
#define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106
|
|
|
|
#define TARGET_SNDCTL_SEQ_RESET 0x00005100
|
|
|
|
#define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109
|
|
|
|
#define TARGET_SNDCTL_SEQ_SYNC 0x00005101
|
|
|
|
#define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108
|
|
|
|
#define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d
|
|
|
|
#define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d
|
|
|
|
#define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102
|
|
|
|
#define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e
|
|
|
|
#define TARGET_SNDCTL_TMR_CONTINUE 0x00005404
|
|
|
|
#define TARGET_SNDCTL_TMR_METRONOME 0x40045407
|
|
|
|
#define TARGET_SNDCTL_TMR_SELECT 0x40045408
|
|
|
|
#define TARGET_SNDCTL_TMR_SOURCE 0xc0045406
|
|
|
|
#define TARGET_SNDCTL_TMR_START 0x00005402
|
|
|
|
#define TARGET_SNDCTL_TMR_STOP 0x00005403
|
|
|
|
#define TARGET_SNDCTL_TMR_TEMPO 0xc0045405
|
|
|
|
#define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401
|
|
|
|
#define TARGET_SOUND_PCM_READ_RATE 0x80045002
|
|
|
|
#define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006
|
|
|
|
#define TARGET_SOUND_PCM_READ_BITS 0x80045005
|
|
|
|
#define TARGET_SOUND_PCM_READ_FILTER 0x80045007
|
|
|
|
#define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info)
|
|
|
|
#define TARGET_SOUND_MIXER_ACCESS 0xc0804d66
|
|
|
|
#define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int)
|
|
|
|
#define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int)
|
|
|
|
#define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int)
|
|
|
|
#define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int)
|
|
|
|
#define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int)
|
|
|
|
|
|
|
|
#define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int)
|
|
|
|
|
|
|
|
#define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3)
|
|
|
|
|
|
|
|
/* Obsolete macros */
|
|
|
|
#define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD)
|
|
|
|
|
|
|
|
#define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS)
|
|
|
|
#define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS)
|
|
|
|
|
|
|
|
#define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int)
|
|
|
|
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME)
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS)
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE)
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH)
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM)
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER)
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE)
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC)
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD)
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX)
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM)
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV)
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN)
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN)
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1)
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2)
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3)
|
|
|
|
|
|
|
|
/* Obsolete macros */
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE)
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE)
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD)
|
|
|
|
|
|
|
|
#define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)
|
|
|
|
|
|
|
|
/* vfat ioctls */
|
|
|
|
#define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1)
|
|
|
|
#define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2)
|
2004-06-19 18:59:03 +02:00
|
|
|
|
2017-10-12 17:30:45 +02:00
|
|
|
struct target_mtop {
|
|
|
|
abi_short mt_op;
|
|
|
|
abi_int mt_count;
|
|
|
|
};
|
|
|
|
|
|
|
|
#if defined(TARGET_SPARC) || defined(TARGET_MIPS)
|
|
|
|
typedef abi_long target_kernel_daddr_t;
|
|
|
|
#else
|
|
|
|
typedef abi_int target_kernel_daddr_t;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct target_mtget {
|
|
|
|
abi_long mt_type;
|
|
|
|
abi_long mt_resid;
|
|
|
|
abi_long mt_dsreg;
|
|
|
|
abi_long mt_gstat;
|
|
|
|
abi_long mt_erreg;
|
|
|
|
target_kernel_daddr_t mt_fileno;
|
|
|
|
target_kernel_daddr_t mt_blkno;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct target_mtpos {
|
|
|
|
abi_long mt_blkno;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct target_mtop)
|
|
|
|
#define TARGET_MTIOCGET TARGET_IOR('m', 2, struct target_mtget)
|
|
|
|
#define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct target_mtpos)
|
2008-09-20 05:03:09 +02:00
|
|
|
|
2004-06-19 18:59:03 +02:00
|
|
|
struct target_sysinfo {
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_long uptime; /* Seconds since boot */
|
|
|
|
abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */
|
|
|
|
abi_ulong totalram; /* Total usable main memory size */
|
|
|
|
abi_ulong freeram; /* Available memory size */
|
|
|
|
abi_ulong sharedram; /* Amount of shared memory */
|
|
|
|
abi_ulong bufferram; /* Memory used by buffers */
|
|
|
|
abi_ulong totalswap; /* Total swap space size */
|
|
|
|
abi_ulong freeswap; /* swap space still available */
|
2004-06-19 18:59:03 +02:00
|
|
|
unsigned short procs; /* Number of current processes */
|
|
|
|
unsigned short pad; /* explicit padding for m68k */
|
2007-10-14 18:27:31 +02:00
|
|
|
abi_ulong totalhigh; /* Total high memory size */
|
|
|
|
abi_ulong freehigh; /* Available high memory size */
|
2004-06-19 18:59:03 +02:00
|
|
|
unsigned int mem_unit; /* Memory unit size in bytes */
|
2007-10-14 18:27:31 +02:00
|
|
|
char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */
|
2004-06-19 18:59:03 +02:00
|
|
|
};
|
2006-06-24 17:06:03 +02:00
|
|
|
|
2008-10-13 23:08:17 +02:00
|
|
|
struct linux_dirent {
|
|
|
|
long d_ino;
|
|
|
|
unsigned long d_off;
|
|
|
|
unsigned short d_reclen;
|
|
|
|
char d_name[256]; /* We must not include limits.h! */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct linux_dirent64 {
|
|
|
|
uint64_t d_ino;
|
|
|
|
int64_t d_off;
|
|
|
|
unsigned short d_reclen;
|
|
|
|
unsigned char d_type;
|
|
|
|
char d_name[256];
|
|
|
|
};
|
|
|
|
|
2009-04-15 18:11:43 +02:00
|
|
|
struct target_mq_attr {
|
|
|
|
abi_long mq_flags;
|
|
|
|
abi_long mq_maxmsg;
|
|
|
|
abi_long mq_msgsize;
|
|
|
|
abi_long mq_curmsgs;
|
|
|
|
};
|
|
|
|
|
2006-06-24 17:06:03 +02:00
|
|
|
#include "socket.h"
|
2007-06-01 14:09:19 +02:00
|
|
|
|
|
|
|
#include "errno_defs.h"
|
2009-06-18 21:51:31 +02:00
|
|
|
|
|
|
|
#define FUTEX_WAIT 0
|
|
|
|
#define FUTEX_WAKE 1
|
|
|
|
#define FUTEX_FD 2
|
|
|
|
#define FUTEX_REQUEUE 3
|
|
|
|
#define FUTEX_CMP_REQUEUE 4
|
|
|
|
#define FUTEX_WAKE_OP 5
|
|
|
|
#define FUTEX_LOCK_PI 6
|
|
|
|
#define FUTEX_UNLOCK_PI 7
|
|
|
|
#define FUTEX_TRYLOCK_PI 8
|
|
|
|
#define FUTEX_WAIT_BITSET 9
|
|
|
|
#define FUTEX_WAKE_BITSET 10
|
|
|
|
|
|
|
|
#define FUTEX_PRIVATE_FLAG 128
|
|
|
|
#define FUTEX_CLOCK_REALTIME 256
|
|
|
|
#define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
|
|
|
|
|
2011-02-15 19:35:05 +01:00
|
|
|
#ifdef CONFIG_EPOLL
|
2015-10-03 17:14:06 +02:00
|
|
|
#if defined(TARGET_X86_64)
|
|
|
|
#define TARGET_EPOLL_PACKED QEMU_PACKED
|
|
|
|
#else
|
|
|
|
#define TARGET_EPOLL_PACKED
|
|
|
|
#endif
|
|
|
|
|
2011-02-15 19:35:05 +01:00
|
|
|
typedef union target_epoll_data {
|
|
|
|
abi_ulong ptr;
|
2015-10-03 17:14:06 +02:00
|
|
|
abi_int fd;
|
|
|
|
abi_uint u32;
|
|
|
|
abi_ullong u64;
|
2011-02-15 19:35:05 +01:00
|
|
|
} target_epoll_data_t;
|
|
|
|
|
|
|
|
struct target_epoll_event {
|
2015-10-03 17:14:06 +02:00
|
|
|
abi_uint events;
|
2011-02-15 19:35:05 +01:00
|
|
|
target_epoll_data_t data;
|
2015-10-03 17:14:06 +02:00
|
|
|
} TARGET_EPOLL_PACKED;
|
2016-07-18 16:35:59 +02:00
|
|
|
|
|
|
|
#define TARGET_EP_MAX_EVENTS (INT_MAX / sizeof(struct target_epoll_event))
|
|
|
|
|
2011-02-15 19:35:05 +01:00
|
|
|
#endif
|
2011-06-27 18:44:52 +02:00
|
|
|
struct target_rlimit64 {
|
|
|
|
uint64_t rlim_cur;
|
|
|
|
uint64_t rlim_max;
|
|
|
|
};
|
2011-11-14 14:09:49 +01:00
|
|
|
|
|
|
|
struct target_ucred {
|
|
|
|
uint32_t pid;
|
|
|
|
uint32_t uid;
|
|
|
|
uint32_t gid;
|
|
|
|
};
|
2012-12-06 12:15:58 +01:00
|
|
|
|
2014-11-10 21:33:03 +01:00
|
|
|
typedef int32_t target_timer_t;
|
2013-11-29 08:39:22 +01:00
|
|
|
|
2014-04-29 13:11:20 +02:00
|
|
|
#define TARGET_SIGEV_MAX_SIZE 64
|
|
|
|
|
|
|
|
/* This is architecture-specific but most architectures use the default */
|
|
|
|
#ifdef TARGET_MIPS
|
|
|
|
#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long))
|
|
|
|
#else
|
|
|
|
#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \
|
|
|
|
+ sizeof(target_sigval_t))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \
|
|
|
|
- TARGET_SIGEV_PREAMBLE_SIZE) \
|
|
|
|
/ sizeof(int32_t))
|
|
|
|
|
2013-11-29 08:39:22 +01:00
|
|
|
struct target_sigevent {
|
|
|
|
target_sigval_t sigev_value;
|
2016-09-02 19:40:01 +02:00
|
|
|
abi_int sigev_signo;
|
|
|
|
abi_int sigev_notify;
|
2013-11-29 08:39:22 +01:00
|
|
|
union {
|
2016-09-02 19:40:01 +02:00
|
|
|
abi_int _pad[TARGET_SIGEV_PAD_SIZE];
|
|
|
|
abi_int _tid;
|
2013-11-29 08:39:22 +01:00
|
|
|
|
2016-09-02 19:40:01 +02:00
|
|
|
/* The kernel (and thus QEMU) never looks at these;
|
|
|
|
* they're only used as part of the ABI between a
|
|
|
|
* userspace program and libc.
|
|
|
|
*/
|
2013-11-29 08:39:22 +01:00
|
|
|
struct {
|
2016-09-02 19:40:01 +02:00
|
|
|
abi_ulong _function;
|
|
|
|
abi_ulong _attribute;
|
2013-11-29 08:39:22 +01:00
|
|
|
} _sigev_thread;
|
|
|
|
} _sigev_un;
|
|
|
|
};
|
2014-03-17 13:15:35 +01:00
|
|
|
|
|
|
|
struct target_user_cap_header {
|
|
|
|
uint32_t version;
|
|
|
|
int pid;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct target_user_cap_data {
|
|
|
|
uint32_t effective;
|
|
|
|
uint32_t permitted;
|
|
|
|
uint32_t inheritable;
|
|
|
|
};
|
2016-06-29 15:54:17 +02:00
|
|
|
|
linux-user: Fix syslog() syscall support
There are currently several problems related to syslog() support.
For example, if the second argument "bufp" of target syslog() syscall
is NULL, the current implementation always returns error code EFAULT.
However, NULL is a perfectly valid value for the second argument for
many use cases of this syscall. This is, for example, visible from
this excerpt of man page for syslog(2):
> EINVAL Bad arguments (e.g., bad type; or for type 2, 3, or 4, buf is
> NULL, or len is less than zero; or for type 8, the level is
> outside the range 1 to 8).
Moreover, the argument "bufp" is ignored for all cases of values of the
first argument, except 2, 3 and 4. This means that for such cases
(the first argument is not 2, 3 or 4), there is no need to pass "buf"
between host and target, and it can be set to NULL while calling host's
syslog(), without loss of emulation accuracy.
Note also that if "bufp" is NULL and the first argument is 2, 3 or 4, the
correct returned error code is EINVAL, not EFAULT.
All these details are reflected in this patch.
"#ifdef TARGET_NR_syslog" is also proprerly inserted when needed.
Support for Qemu's "-strace" switch for syslog() syscall is included too.
LTP tests syslog11 and syslog12 pass with this patch (while fail without
it), on any platform.
Changes to original patch by Riku Voipio:
fixed error paths in TARGET_SYSLOG_ACTION_READ_ALL to match
http://lxr.free-electrons.com/source/kernel/printk/printk.c?v=4.7#L1335
Should fix also the build error in:
https://lists.gnu.org/archive/html/qemu-devel/2016-10/msg03721.html
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-09-22 18:56:58 +02:00
|
|
|
/* from kernel's include/linux/syslog.h */
|
|
|
|
|
|
|
|
/* Close the log. Currently a NOP. */
|
|
|
|
#define TARGET_SYSLOG_ACTION_CLOSE 0
|
|
|
|
/* Open the log. Currently a NOP. */
|
|
|
|
#define TARGET_SYSLOG_ACTION_OPEN 1
|
|
|
|
/* Read from the log. */
|
|
|
|
#define TARGET_SYSLOG_ACTION_READ 2
|
|
|
|
/* Read all messages remaining in the ring buffer. */
|
|
|
|
#define TARGET_SYSLOG_ACTION_READ_ALL 3
|
|
|
|
/* Read and clear all messages remaining in the ring buffer */
|
|
|
|
#define TARGET_SYSLOG_ACTION_READ_CLEAR 4
|
|
|
|
/* Clear ring buffer. */
|
|
|
|
#define TARGET_SYSLOG_ACTION_CLEAR 5
|
|
|
|
/* Disable printk's to console */
|
|
|
|
#define TARGET_SYSLOG_ACTION_CONSOLE_OFF 6
|
|
|
|
/* Enable printk's to console */
|
|
|
|
#define TARGET_SYSLOG_ACTION_CONSOLE_ON 7
|
|
|
|
/* Set level of messages printed to console */
|
|
|
|
#define TARGET_SYSLOG_ACTION_CONSOLE_LEVEL 8
|
|
|
|
/* Return number of unread characters in the log buffer */
|
|
|
|
#define TARGET_SYSLOG_ACTION_SIZE_UNREAD 9
|
|
|
|
/* Return size of the log buffer */
|
|
|
|
#define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10
|
|
|
|
|
linux-user: Add support for translation of statx() syscall
Implement support for translation of system call statx().
The implementation is based on "best effort" approach: if host
is capable of executing statx(), host statx() is used. If not,
the implementation includes invoking a more mature system call
fstatat() on the host side to achieve as close as possible
functionality.
Support for statx() in kernel and glibc was, however, introduced
at different points of time (the difference is more than a year):
- kernel: Linux 4.11 (30 April 2017)
- glibc: glibc 2.28 (1 Aug 2018)
In this patch, the availability of statx() support is established
via __NR_statx (if it is defined, statx() is considered available).
This coincedes with statx() introduction in kernel.
However, the structure statx definition may not be available in
any header for hosts with glibc older than 2.28 (and it is, by
design, to be defined in one of glibc headers), even though the
full statx() functionality may be supported in kernel. Hence, a
structure "target_statx" is defined in this patch, to remove that
dependency on glibc headers, and to use statx() functionality as
soon as the host kernel is capable of supporting it. Such statx
structure definition is used for both target and host structures
statx (of course, this doesn't mean the endian arrangement is
the same on target and host - the endian conversion is done in
all necessary cases).
Signed-off-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <1561718618-20218-2-git-send-email-aleksandar.markovic@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-06-28 12:43:34 +02:00
|
|
|
struct target_statx_timestamp {
|
|
|
|
int64_t tv_sec;
|
|
|
|
uint32_t tv_nsec;
|
|
|
|
int32_t __reserved;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct target_statx {
|
|
|
|
/* 0x00 */
|
|
|
|
uint32_t stx_mask; /* What results were written [uncond] */
|
|
|
|
uint32_t stx_blksize; /* Preferred general I/O size [uncond] */
|
|
|
|
uint64_t stx_attributes; /* Flags conveying information about the file */
|
|
|
|
/* 0x10 */
|
|
|
|
uint32_t stx_nlink; /* Number of hard links */
|
|
|
|
uint32_t stx_uid; /* User ID of owner */
|
|
|
|
uint32_t stx_gid; /* Group ID of owner */
|
|
|
|
uint16_t stx_mode; /* File mode */
|
|
|
|
uint16_t __spare0[1];
|
|
|
|
/* 0x20 */
|
|
|
|
uint64_t stx_ino; /* Inode number */
|
|
|
|
uint64_t stx_size; /* File size */
|
|
|
|
uint64_t stx_blocks; /* Number of 512-byte blocks allocated */
|
|
|
|
uint64_t stx_attributes_mask; /* Mask to show what is supported */
|
|
|
|
/* 0x40 */
|
|
|
|
struct target_statx_timestamp stx_atime; /* Last access time */
|
|
|
|
struct target_statx_timestamp stx_btime; /* File creation time */
|
|
|
|
struct target_statx_timestamp stx_ctime; /* Last attribute change time */
|
|
|
|
struct target_statx_timestamp stx_mtime; /* Last data modification time */
|
|
|
|
/* 0x80 */
|
|
|
|
uint32_t stx_rdev_major; /* Device ID of special file [if bdev/cdev] */
|
|
|
|
uint32_t stx_rdev_minor;
|
|
|
|
uint32_t stx_dev_major; /* ID of device containing file [uncond] */
|
|
|
|
uint32_t stx_dev_minor;
|
|
|
|
/* 0x90 */
|
|
|
|
uint64_t __spare2[14]; /* Spare space for future expansion */
|
|
|
|
/* 0x100 */
|
|
|
|
};
|
|
|
|
|
2016-06-29 15:54:17 +02:00
|
|
|
#endif
|