bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1 | /* common syscall defines for all architectures */ |
| 2 | |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 3 | /* Note: although the syscall numbers change between architectures, |
Dong Xu Wang | b4916d7 | 2011-11-22 18:06:17 +0800 | [diff] [blame] | 4 | most of them stay the same, so we handle it by putting ifdefs if |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 5 | necessary */ |
| 6 | |
Paolo Bonzini | cb9c377 | 2012-12-06 12:15:58 +0100 | [diff] [blame] | 7 | #ifndef SYSCALL_DEFS_H |
Markus Armbruster | 1b3c4fd | 2016-06-29 15:54:17 +0200 | [diff] [blame] | 8 | #define SYSCALL_DEFS_H |
Paolo Bonzini | cb9c377 | 2012-12-06 12:15:58 +0100 | [diff] [blame] | 9 | |
bellard | 6180a18 | 2003-09-30 21:04:53 +0000 | [diff] [blame] | 10 | #include "syscall_nr.h" |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 11 | |
Aleksandar Markovic | ff71a45 | 2016-09-22 18:56:57 +0200 | [diff] [blame] | 12 | |
| 13 | /* socket operations for socketcall() */ |
| 14 | #define TARGET_SYS_SOCKET 1 /* socket() */ |
| 15 | #define TARGET_SYS_BIND 2 /* bind() */ |
| 16 | #define TARGET_SYS_CONNECT 3 /* connect() */ |
| 17 | #define TARGET_SYS_LISTEN 4 /* listen() */ |
| 18 | #define TARGET_SYS_ACCEPT 5 /* accept() */ |
| 19 | #define TARGET_SYS_GETSOCKNAME 6 /* getsockname() */ |
| 20 | #define TARGET_SYS_GETPEERNAME 7 /* getpeername() */ |
| 21 | #define TARGET_SYS_SOCKETPAIR 8 /* socketpair() */ |
| 22 | #define TARGET_SYS_SEND 9 /* send() */ |
| 23 | #define TARGET_SYS_RECV 10 /* recv() */ |
| 24 | #define TARGET_SYS_SENDTO 11 /* sendto() */ |
| 25 | #define TARGET_SYS_RECVFROM 12 /* recvfrom() */ |
| 26 | #define TARGET_SYS_SHUTDOWN 13 /* shutdown() */ |
| 27 | #define TARGET_SYS_SETSOCKOPT 14 /* setsockopt() */ |
| 28 | #define TARGET_SYS_GETSOCKOPT 15 /* getsockopt() */ |
| 29 | #define TARGET_SYS_SENDMSG 16 /* sendmsg() */ |
| 30 | #define TARGET_SYS_RECVMSG 17 /* recvmsg() */ |
| 31 | #define TARGET_SYS_ACCEPT4 18 /* accept4() */ |
| 32 | #define TARGET_SYS_RECVMMSG 19 /* recvmmsg() */ |
| 33 | #define TARGET_SYS_SENDMMSG 20 /* sendmmsg() */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 34 | |
Laurent Vivier | 524fa34 | 2019-05-29 10:48:04 +0200 | [diff] [blame] | 35 | #define IPCOP_CALL(VERSION, OP) ((VERSION) << 16 | (OP)) |
bellard | 8853f86 | 2004-02-22 14:57:26 +0000 | [diff] [blame] | 36 | #define IPCOP_semop 1 |
| 37 | #define IPCOP_semget 2 |
| 38 | #define IPCOP_semctl 3 |
| 39 | #define IPCOP_semtimedop 4 |
| 40 | #define IPCOP_msgsnd 11 |
| 41 | #define IPCOP_msgrcv 12 |
| 42 | #define IPCOP_msgget 13 |
| 43 | #define IPCOP_msgctl 14 |
| 44 | #define IPCOP_shmat 21 |
| 45 | #define IPCOP_shmdt 22 |
| 46 | #define IPCOP_shmget 23 |
| 47 | #define IPCOP_shmctl 24 |
| 48 | |
Filip Bozuta | 0a7ec84 | 2020-08-18 20:07:22 +0200 | [diff] [blame] | 49 | #define TARGET_SEMOPM 500 |
| 50 | |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 51 | /* |
| 52 | * The following is for compatibility across the various Linux |
| 53 | * platforms. The i386 ioctl numbering scheme doesn't really enforce |
| 54 | * a type field. De facto, however, the top 8 bits of the lower 16 |
| 55 | * bits are indeed used as a type field, so we might just as well make |
| 56 | * this explicit here. Please be sure to use the decoding macros |
| 57 | * below from now on. |
| 58 | */ |
| 59 | #define TARGET_IOC_NRBITS 8 |
| 60 | #define TARGET_IOC_TYPEBITS 8 |
| 61 | |
Peter Maydell | 716f3fb | 2016-03-01 16:25:17 +0000 | [diff] [blame] | 62 | #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ |
| 63 | || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ |
Philippe Mathieu-Daudé | baead64 | 2022-12-28 20:10:41 +0000 | [diff] [blame] | 64 | || (defined(TARGET_SPARC) && defined(TARGET_ABI32)) \ |
Riku Voipio | 0c866a7 | 2011-04-18 15:23:06 +0300 | [diff] [blame] | 65 | || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) |
Mika Westerberg | 74d753a | 2009-04-07 16:57:29 +0300 | [diff] [blame] | 66 | /* 16 bit uid wrappers emulation */ |
| 67 | #define USE_UID16 |
Riku Voipio | 0c866a7 | 2011-04-18 15:23:06 +0300 | [diff] [blame] | 68 | #define target_id uint16_t |
| 69 | #else |
| 70 | #define target_id uint32_t |
Mika Westerberg | 74d753a | 2009-04-07 16:57:29 +0300 | [diff] [blame] | 71 | #endif |
| 72 | |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 73 | #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ |
Chen Gang | b16189b | 2015-08-21 05:36:37 +0800 | [diff] [blame] | 74 | || defined(TARGET_M68K) || defined(TARGET_CRIS) \ |
Thomas Huth | 2cc1a90 | 2021-02-24 19:39:52 +0100 | [diff] [blame] | 75 | || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \ |
Max Filippov | ba7651f | 2017-01-25 10:54:11 -0800 | [diff] [blame] | 76 | || defined(TARGET_NIOS2) || defined(TARGET_RISCV) \ |
Song Gao | 1f630196 | 2022-06-24 11:10:40 +0800 | [diff] [blame] | 77 | || defined(TARGET_XTENSA) || defined(TARGET_LOONGARCH64) |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 78 | |
| 79 | #define TARGET_IOC_SIZEBITS 14 |
| 80 | #define TARGET_IOC_DIRBITS 2 |
| 81 | |
| 82 | #define TARGET_IOC_NONE 0U |
| 83 | #define TARGET_IOC_WRITE 1U |
| 84 | #define TARGET_IOC_READ 2U |
| 85 | |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 86 | #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 87 | defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ |
| 88 | defined(TARGET_MIPS) |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 89 | |
| 90 | #define TARGET_IOC_SIZEBITS 13 |
| 91 | #define TARGET_IOC_DIRBITS 3 |
| 92 | |
| 93 | #define TARGET_IOC_NONE 1U |
| 94 | #define TARGET_IOC_READ 2U |
| 95 | #define TARGET_IOC_WRITE 4U |
| 96 | |
Richard Henderson | a10d1e5 | 2016-12-15 09:56:41 -0800 | [diff] [blame] | 97 | #elif defined(TARGET_HPPA) |
| 98 | |
| 99 | #define TARGET_IOC_SIZEBITS 14 |
| 100 | #define TARGET_IOC_DIRBITS 2 |
| 101 | |
| 102 | #define TARGET_IOC_NONE 0U |
| 103 | #define TARGET_IOC_WRITE 2U |
| 104 | #define TARGET_IOC_READ 1U |
| 105 | |
Taylor Simpson | d2a56bd | 2021-02-07 23:46:20 -0600 | [diff] [blame] | 106 | #elif defined(TARGET_HEXAGON) |
| 107 | |
| 108 | #define TARGET_IOC_SIZEBITS 14 |
| 109 | |
| 110 | #define TARGET_IOC_NONE 0U |
| 111 | #define TARGET_IOC_WRITE 1U |
| 112 | #define TARGET_IOC_READ 2U |
| 113 | |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 114 | #else |
| 115 | #error unsupported CPU |
| 116 | #endif |
| 117 | |
| 118 | #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) |
| 119 | #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) |
| 120 | #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) |
| 121 | #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) |
| 122 | |
| 123 | #define TARGET_IOC_NRSHIFT 0 |
| 124 | #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) |
| 125 | #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) |
| 126 | #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) |
| 127 | |
| 128 | #define TARGET_IOC(dir,type,nr,size) \ |
| 129 | (((dir) << TARGET_IOC_DIRSHIFT) | \ |
| 130 | ((type) << TARGET_IOC_TYPESHIFT) | \ |
| 131 | ((nr) << TARGET_IOC_NRSHIFT) | \ |
| 132 | ((size) << TARGET_IOC_SIZESHIFT)) |
| 133 | |
| 134 | /* used to create numbers */ |
| 135 | #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) |
| 136 | #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) |
| 137 | #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) |
| 138 | #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) |
| 139 | |
| 140 | /* the size is automatically computed for these defines */ |
| 141 | #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) |
| 142 | #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) |
| 143 | #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) |
| 144 | |
bellard | 7854b05 | 2003-03-29 17:22:23 +0000 | [diff] [blame] | 145 | struct target_sockaddr { |
Philippe Mathieu-Daudé | 9a68960 | 2019-10-21 13:48:57 +0200 | [diff] [blame] | 146 | abi_ushort sa_family; |
bellard | 7854b05 | 2003-03-29 17:22:23 +0000 | [diff] [blame] | 147 | uint8_t sa_data[14]; |
| 148 | }; |
| 149 | |
Joakim Tjernlund | 33a29b5 | 2014-07-12 15:47:07 +0200 | [diff] [blame] | 150 | struct target_sockaddr_ll { |
Philippe Mathieu-Daudé | 9a68960 | 2019-10-21 13:48:57 +0200 | [diff] [blame] | 151 | abi_ushort sll_family; /* Always AF_PACKET */ |
| 152 | abi_ushort sll_protocol; /* Physical layer protocol */ |
| 153 | abi_int sll_ifindex; /* Interface number */ |
| 154 | abi_ushort sll_hatype; /* ARP hardware type */ |
| 155 | uint8_t sll_pkttype; /* Packet type */ |
| 156 | uint8_t sll_halen; /* Length of address */ |
| 157 | uint8_t sll_addr[8]; /* Physical layer address */ |
Joakim Tjernlund | 33a29b5 | 2014-07-12 15:47:07 +0200 | [diff] [blame] | 158 | }; |
| 159 | |
Laurent Vivier | fb3aabf | 2016-06-11 02:19:45 +0200 | [diff] [blame] | 160 | struct target_sockaddr_un { |
Philippe Mathieu-Daudé | 9a68960 | 2019-10-21 13:48:57 +0200 | [diff] [blame] | 161 | abi_ushort su_family; |
Laurent Vivier | fb3aabf | 2016-06-11 02:19:45 +0200 | [diff] [blame] | 162 | uint8_t sun_path[108]; |
| 163 | }; |
| 164 | |
Philippe Mathieu-Daudé | a47401b | 2019-10-21 13:48:52 +0200 | [diff] [blame] | 165 | struct target_sockaddr_nl { |
| 166 | abi_ushort nl_family; /* AF_NETLINK */ |
| 167 | abi_ushort __pad; |
| 168 | abi_uint nl_pid; |
| 169 | abi_uint nl_groups; |
| 170 | }; |
| 171 | |
Laurent Vivier | fb3aabf | 2016-06-11 02:19:45 +0200 | [diff] [blame] | 172 | struct target_in_addr { |
Philippe Mathieu-Daudé | 9a68960 | 2019-10-21 13:48:57 +0200 | [diff] [blame] | 173 | abi_uint s_addr; /* big endian */ |
Laurent Vivier | fb3aabf | 2016-06-11 02:19:45 +0200 | [diff] [blame] | 174 | }; |
| 175 | |
| 176 | struct target_sockaddr_in { |
Philippe Mathieu-Daudé | 9a68960 | 2019-10-21 13:48:57 +0200 | [diff] [blame] | 177 | abi_ushort sin_family; |
| 178 | abi_short sin_port; /* big endian */ |
Laurent Vivier | fb3aabf | 2016-06-11 02:19:45 +0200 | [diff] [blame] | 179 | struct target_in_addr sin_addr; |
| 180 | uint8_t __pad[sizeof(struct target_sockaddr) - |
Philippe Mathieu-Daudé | 9a68960 | 2019-10-21 13:48:57 +0200 | [diff] [blame] | 181 | sizeof(abi_ushort) - sizeof(abi_short) - |
Laurent Vivier | fb3aabf | 2016-06-11 02:19:45 +0200 | [diff] [blame] | 182 | sizeof(struct target_in_addr)]; |
| 183 | }; |
| 184 | |
Helge Deller | ee1ac3a | 2017-02-18 23:31:30 +0100 | [diff] [blame] | 185 | struct target_sockaddr_in6 { |
Philippe Mathieu-Daudé | 9a68960 | 2019-10-21 13:48:57 +0200 | [diff] [blame] | 186 | abi_ushort sin6_family; |
| 187 | abi_ushort sin6_port; /* big endian */ |
| 188 | abi_uint sin6_flowinfo; /* big endian */ |
Helge Deller | ee1ac3a | 2017-02-18 23:31:30 +0100 | [diff] [blame] | 189 | struct in6_addr sin6_addr; /* IPv6 address, big endian */ |
Philippe Mathieu-Daudé | 9a68960 | 2019-10-21 13:48:57 +0200 | [diff] [blame] | 190 | abi_uint sin6_scope_id; |
Helge Deller | ee1ac3a | 2017-02-18 23:31:30 +0100 | [diff] [blame] | 191 | }; |
| 192 | |
Laurent Vivier | f57d419 | 2013-08-30 01:46:41 +0200 | [diff] [blame] | 193 | struct target_sock_filter { |
| 194 | abi_ushort code; |
| 195 | uint8_t jt; |
| 196 | uint8_t jf; |
| 197 | abi_uint k; |
| 198 | }; |
| 199 | |
| 200 | struct target_sock_fprog { |
| 201 | abi_ushort len; |
| 202 | abi_ulong filter; |
| 203 | }; |
| 204 | |
Lionel Landwerlin | b975b83 | 2009-04-25 23:30:19 +0200 | [diff] [blame] | 205 | struct target_ip_mreq { |
| 206 | struct target_in_addr imr_multiaddr; |
| 207 | struct target_in_addr imr_address; |
| 208 | }; |
| 209 | |
| 210 | struct target_ip_mreqn { |
| 211 | struct target_in_addr imr_multiaddr; |
| 212 | struct target_in_addr imr_address; |
| 213 | abi_long imr_ifindex; |
| 214 | }; |
| 215 | |
Lionel Landwerlin | 6e3cb58 | 2009-04-25 23:31:18 +0200 | [diff] [blame] | 216 | struct target_ip_mreq_source { |
| 217 | /* big endian */ |
| 218 | uint32_t imr_multiaddr; |
| 219 | uint32_t imr_interface; |
| 220 | uint32_t imr_sourceaddr; |
| 221 | }; |
| 222 | |
Carlo Marcelo Arenas Belón | 83eb6e5 | 2018-08-24 01:56:01 -0700 | [diff] [blame] | 223 | struct target_linger { |
| 224 | abi_int l_onoff; /* Linger active */ |
| 225 | abi_int l_linger; /* How long to linger for */ |
| 226 | }; |
| 227 | |
Daniel P. Berrangé | 6d5d5dd | 2019-07-18 15:06:41 +0200 | [diff] [blame] | 228 | #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) |
| 229 | struct target_timeval { |
| 230 | abi_long tv_sec; |
| 231 | abi_int tv_usec; |
| 232 | }; |
| 233 | #define target__kernel_sock_timeval target_timeval |
| 234 | #else |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 235 | struct target_timeval { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 236 | abi_long tv_sec; |
| 237 | abi_long tv_usec; |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 238 | }; |
| 239 | |
Daniel P. Berrangé | 6d5d5dd | 2019-07-18 15:06:41 +0200 | [diff] [blame] | 240 | struct target__kernel_sock_timeval { |
| 241 | abi_llong tv_sec; |
| 242 | abi_llong tv_usec; |
| 243 | }; |
| 244 | #endif |
| 245 | |
bellard | 1b6b029 | 2003-03-22 17:31:38 +0000 | [diff] [blame] | 246 | struct target_timespec { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 247 | abi_long tv_sec; |
| 248 | abi_long tv_nsec; |
bellard | 1b6b029 | 2003-03-22 17:31:38 +0000 | [diff] [blame] | 249 | }; |
| 250 | |
Daniel P. Berrangé | 6d5d5dd | 2019-07-18 15:06:41 +0200 | [diff] [blame] | 251 | struct target__kernel_timespec { |
| 252 | abi_llong tv_sec; |
| 253 | abi_llong tv_nsec; |
| 254 | }; |
| 255 | |
Paul Burton | ef4467e | 2014-06-22 11:25:40 +0100 | [diff] [blame] | 256 | struct target_timezone { |
| 257 | abi_int tz_minuteswest; |
| 258 | abi_int tz_dsttime; |
| 259 | }; |
| 260 | |
bellard | 66fb976 | 2003-03-23 01:06:05 +0000 | [diff] [blame] | 261 | struct target_itimerval { |
| 262 | struct target_timeval it_interval; |
| 263 | struct target_timeval it_value; |
| 264 | }; |
| 265 | |
Erik de Castro Lopo | 905bba1 | 2013-11-29 18:39:22 +1100 | [diff] [blame] | 266 | struct target_itimerspec { |
| 267 | struct target_timespec it_interval; |
| 268 | struct target_timespec it_value; |
| 269 | }; |
| 270 | |
Filip Bozuta | 828cb3a | 2020-07-22 17:34:21 +0200 | [diff] [blame] | 271 | struct target__kernel_itimerspec { |
| 272 | struct target__kernel_timespec it_interval; |
| 273 | struct target__kernel_timespec it_value; |
| 274 | }; |
| 275 | |
Aleksandar Markovic | 19f59bc | 2016-09-22 18:56:50 +0200 | [diff] [blame] | 276 | struct target_timex { |
| 277 | abi_uint modes; /* Mode selector */ |
| 278 | abi_long offset; /* Time offset */ |
| 279 | abi_long freq; /* Frequency offset */ |
| 280 | abi_long maxerror; /* Maximum error (microseconds) */ |
| 281 | abi_long esterror; /* Estimated error (microseconds) */ |
| 282 | abi_int status; /* Clock command/status */ |
| 283 | abi_long constant; /* PLL (phase-locked loop) time constant */ |
| 284 | abi_long precision; /* Clock precision (microseconds, ro) */ |
| 285 | abi_long tolerance; /* Clock freq. tolerance (ppm, ro) */ |
| 286 | struct target_timeval time; /* Current time */ |
| 287 | abi_long tick; /* Microseconds between clock ticks */ |
| 288 | abi_long ppsfreq; /* PPS (pulse per second) frequency */ |
| 289 | abi_long jitter; /* PPS jitter (ro); nanoseconds */ |
| 290 | abi_int shift; /* PPS interval duration (seconds) */ |
| 291 | abi_long stabil; /* PPS stability */ |
| 292 | abi_long jitcnt; /* PPS jitter limit exceeded (ro) */ |
| 293 | abi_long calcnt; /* PPS calibration intervals */ |
| 294 | abi_long errcnt; /* PPS calibration errors */ |
| 295 | abi_long stbcnt; /* PPS stability limit exceeded */ |
| 296 | abi_int tai; /* TAI offset */ |
| 297 | |
| 298 | /* Further padding bytes to allow for future expansion */ |
| 299 | abi_int:32; abi_int:32; abi_int:32; abi_int:32; |
| 300 | abi_int:32; abi_int:32; abi_int:32; abi_int:32; |
| 301 | abi_int:32; abi_int:32; abi_int:32; |
| 302 | }; |
| 303 | |
Filip Bozuta | 6ac03b2 | 2020-08-24 21:21:15 +0200 | [diff] [blame] | 304 | struct target__kernel_timex { |
| 305 | abi_uint modes; /* Mode selector */ |
| 306 | abi_int: 32; /* pad */ |
| 307 | abi_llong offset; /* Time offset */ |
| 308 | abi_llong freq; /* Frequency offset */ |
| 309 | abi_llong maxerror; /* Maximum error (microseconds) */ |
| 310 | abi_llong esterror; /* Estimated error (microseconds) */ |
| 311 | abi_int status; /* Clock command/status */ |
| 312 | abi_int: 32; /* pad */ |
| 313 | abi_llong constant; /* PLL (phase-locked loop) time constant */ |
| 314 | abi_llong precision; /* Clock precision (microseconds, ro) */ |
| 315 | abi_llong tolerance; /* Clock freq. tolerance (ppm, ro) */ |
| 316 | struct target__kernel_sock_timeval time; /* Current time */ |
| 317 | abi_llong tick; /* Microseconds between clock ticks */ |
| 318 | abi_llong ppsfreq; /* PPS (pulse per second) frequency */ |
| 319 | abi_llong jitter; /* PPS jitter (ro); nanoseconds */ |
| 320 | abi_int shift; /* PPS interval duration (seconds) */ |
| 321 | abi_int: 32; /* pad */ |
| 322 | abi_llong stabil; /* PPS stability */ |
| 323 | abi_llong jitcnt; /* PPS jitter limit exceeded (ro) */ |
| 324 | abi_llong calcnt; /* PPS calibration intervals */ |
| 325 | abi_llong errcnt; /* PPS calibration errors */ |
| 326 | abi_llong stbcnt; /* PPS stability limit exceeded */ |
| 327 | abi_int tai; /* TAI offset */ |
| 328 | |
| 329 | /* Further padding bytes to allow for future expansion */ |
| 330 | abi_int:32; abi_int:32; abi_int:32; abi_int:32; |
| 331 | abi_int:32; abi_int:32; abi_int:32; abi_int:32; |
| 332 | abi_int:32; abi_int:32; abi_int:32; |
| 333 | }; |
| 334 | |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 335 | typedef abi_long target_clock_t; |
bellard | 32f36bc | 2003-03-30 21:29:48 +0000 | [diff] [blame] | 336 | |
bellard | c596ed1 | 2003-07-13 17:32:31 +0000 | [diff] [blame] | 337 | #define TARGET_HZ 100 |
| 338 | |
bellard | 32f36bc | 2003-03-30 21:29:48 +0000 | [diff] [blame] | 339 | struct target_tms { |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 340 | target_clock_t tms_utime; |
| 341 | target_clock_t tms_stime; |
| 342 | target_clock_t tms_cutime; |
| 343 | target_clock_t tms_cstime; |
bellard | 32f36bc | 2003-03-30 21:29:48 +0000 | [diff] [blame] | 344 | }; |
| 345 | |
bellard | 6180a18 | 2003-09-30 21:04:53 +0000 | [diff] [blame] | 346 | struct target_utimbuf { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 347 | abi_long actime; |
| 348 | abi_long modtime; |
bellard | 6180a18 | 2003-09-30 21:04:53 +0000 | [diff] [blame] | 349 | }; |
| 350 | |
bellard | f2674e3 | 2003-07-09 12:26:09 +0000 | [diff] [blame] | 351 | struct target_sel_arg_struct { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 352 | abi_long n; |
| 353 | abi_long inp, outp, exp; |
| 354 | abi_long tvp; |
bellard | f2674e3 | 2003-07-09 12:26:09 +0000 | [diff] [blame] | 355 | }; |
| 356 | |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 357 | struct target_iovec { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 358 | abi_long iov_base; /* Starting address */ |
| 359 | abi_long iov_len; /* Number of bytes */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 360 | }; |
| 361 | |
bellard | 1a9353d | 2003-03-16 20:28:50 +0000 | [diff] [blame] | 362 | struct target_msghdr { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 363 | abi_long msg_name; /* Socket name */ |
| 364 | int msg_namelen; /* Length of name */ |
| 365 | abi_long msg_iov; /* Data blocks */ |
| 366 | abi_long msg_iovlen; /* Number of blocks */ |
| 367 | abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ |
| 368 | abi_long msg_controllen; /* Length of cmsg list */ |
bellard | 1a9353d | 2003-03-16 20:28:50 +0000 | [diff] [blame] | 369 | unsigned int msg_flags; |
| 370 | }; |
| 371 | |
bellard | 7854b05 | 2003-03-29 17:22:23 +0000 | [diff] [blame] | 372 | struct target_cmsghdr { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 373 | abi_long cmsg_len; |
bellard | 7854b05 | 2003-03-29 17:22:23 +0000 | [diff] [blame] | 374 | int cmsg_level; |
| 375 | int cmsg_type; |
| 376 | }; |
| 377 | |
| 378 | #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) |
Jonathan Neuschäfer | ee10458 | 2015-09-03 07:27:26 +0200 | [diff] [blame] | 379 | #define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \ |
| 380 | __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 381 | #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ |
| 382 | & (size_t) ~(sizeof (abi_long) - 1)) |
Peter Maydell | ad762b9 | 2017-12-15 13:52:56 +0000 | [diff] [blame] | 383 | #define TARGET_CMSG_SPACE(len) (sizeof(struct target_cmsghdr) + \ |
| 384 | TARGET_CMSG_ALIGN(len)) |
| 385 | #define TARGET_CMSG_LEN(len) (sizeof(struct target_cmsghdr) + (len)) |
bellard | 7854b05 | 2003-03-29 17:22:23 +0000 | [diff] [blame] | 386 | |
| 387 | static __inline__ struct target_cmsghdr * |
Jonathan Neuschäfer | ee10458 | 2015-09-03 07:27:26 +0200 | [diff] [blame] | 388 | __target_cmsg_nxthdr(struct target_msghdr *__mhdr, |
| 389 | struct target_cmsghdr *__cmsg, |
| 390 | struct target_cmsghdr *__cmsg_start) |
bellard | 7854b05 | 2003-03-29 17:22:23 +0000 | [diff] [blame] | 391 | { |
ths | 2b8bdef | 2007-05-28 21:35:23 +0000 | [diff] [blame] | 392 | struct target_cmsghdr *__ptr; |
bellard | 7854b05 | 2003-03-29 17:22:23 +0000 | [diff] [blame] | 393 | |
ths | 2b8bdef | 2007-05-28 21:35:23 +0000 | [diff] [blame] | 394 | __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg |
Matthias Braun | cbb21ee | 2011-08-12 19:57:41 +0200 | [diff] [blame] | 395 | + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); |
Jonathan Neuschäfer | ee10458 | 2015-09-03 07:27:26 +0200 | [diff] [blame] | 396 | if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start) |
| 397 | > tswapal(__mhdr->msg_controllen)) { |
bellard | 7854b05 | 2003-03-29 17:22:23 +0000 | [diff] [blame] | 398 | /* No more entries. */ |
ths | 2b8bdef | 2007-05-28 21:35:23 +0000 | [diff] [blame] | 399 | return (struct target_cmsghdr *)0; |
Jonathan Neuschäfer | ee10458 | 2015-09-03 07:27:26 +0200 | [diff] [blame] | 400 | } |
| 401 | return __ptr; |
bellard | 7854b05 | 2003-03-29 17:22:23 +0000 | [diff] [blame] | 402 | } |
| 403 | |
Alexander Graf | f19e00d | 2014-03-02 19:36:42 +0000 | [diff] [blame] | 404 | struct target_mmsghdr { |
| 405 | struct target_msghdr msg_hdr; /* Message header */ |
| 406 | unsigned int msg_len; /* Number of bytes transmitted */ |
| 407 | }; |
bellard | 7854b05 | 2003-03-29 17:22:23 +0000 | [diff] [blame] | 408 | |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 409 | struct target_rusage { |
| 410 | struct target_timeval ru_utime; /* user time used */ |
| 411 | struct target_timeval ru_stime; /* system time used */ |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 412 | abi_long ru_maxrss; /* maximum resident set size */ |
| 413 | abi_long ru_ixrss; /* integral shared memory size */ |
| 414 | abi_long ru_idrss; /* integral unshared data size */ |
| 415 | abi_long ru_isrss; /* integral unshared stack size */ |
| 416 | abi_long ru_minflt; /* page reclaims */ |
| 417 | abi_long ru_majflt; /* page faults */ |
| 418 | abi_long ru_nswap; /* swaps */ |
| 419 | abi_long ru_inblock; /* block input operations */ |
| 420 | abi_long ru_oublock; /* block output operations */ |
| 421 | abi_long ru_msgsnd; /* messages sent */ |
| 422 | abi_long ru_msgrcv; /* messages received */ |
| 423 | abi_long ru_nsignals; /* signals received */ |
| 424 | abi_long ru_nvcsw; /* voluntary context switches */ |
| 425 | abi_long ru_nivcsw; /* involuntary " */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 426 | }; |
| 427 | |
| 428 | typedef struct { |
| 429 | int val[2]; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 430 | } kernel_fsid_t; |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 431 | |
bellard | dab2ed9 | 2003-03-22 15:23:14 +0000 | [diff] [blame] | 432 | struct target_dirent { |
Dmitry V. Levin | 333858b | 2012-08-21 02:13:12 +0400 | [diff] [blame] | 433 | abi_long d_ino; |
| 434 | abi_long d_off; |
| 435 | unsigned short d_reclen; |
| 436 | char d_name[]; |
bellard | dab2ed9 | 2003-03-22 15:23:14 +0000 | [diff] [blame] | 437 | }; |
| 438 | |
| 439 | struct target_dirent64 { |
Richard Henderson | 1962cb0 | 2021-11-14 11:35:38 +0100 | [diff] [blame] | 440 | abi_ullong d_ino; |
| 441 | abi_llong d_off; |
| 442 | abi_ushort d_reclen; |
bellard | dab2ed9 | 2003-03-22 15:23:14 +0000 | [diff] [blame] | 443 | unsigned char d_type; |
Richard Henderson | 540a736 | 2021-11-14 11:35:37 +0100 | [diff] [blame] | 444 | char d_name[]; |
bellard | dab2ed9 | 2003-03-22 15:23:14 +0000 | [diff] [blame] | 445 | }; |
| 446 | |
| 447 | |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 448 | /* mostly generic signal stuff */ |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 449 | #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ |
| 450 | #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ |
| 451 | #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 452 | |
| 453 | #ifdef TARGET_MIPS |
| 454 | #define TARGET_NSIG 128 |
| 455 | #else |
| 456 | #define TARGET_NSIG 64 |
| 457 | #endif |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 458 | #define TARGET_NSIG_BPW TARGET_ABI_BITS |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 459 | #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) |
| 460 | |
| 461 | typedef struct { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 462 | abi_ulong sig[TARGET_NSIG_WORDS]; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 463 | } target_sigset_t; |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 464 | |
bellard | 66fb976 | 2003-03-23 01:06:05 +0000 | [diff] [blame] | 465 | #ifdef BSWAP_NEEDED |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 466 | static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) |
bellard | 66fb976 | 2003-03-23 01:06:05 +0000 | [diff] [blame] | 467 | { |
| 468 | int i; |
| 469 | for(i = 0;i < TARGET_NSIG_WORDS; i++) |
Matthias Braun | cbb21ee | 2011-08-12 19:57:41 +0200 | [diff] [blame] | 470 | d->sig[i] = tswapal(s->sig[i]); |
bellard | 66fb976 | 2003-03-23 01:06:05 +0000 | [diff] [blame] | 471 | } |
| 472 | #else |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 473 | static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) |
bellard | 66fb976 | 2003-03-23 01:06:05 +0000 | [diff] [blame] | 474 | { |
| 475 | *d = *s; |
| 476 | } |
| 477 | #endif |
| 478 | |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 479 | static inline void target_siginitset(target_sigset_t *d, abi_ulong set) |
bellard | 66fb976 | 2003-03-23 01:06:05 +0000 | [diff] [blame] | 480 | { |
| 481 | int i; |
| 482 | d->sig[0] = set; |
| 483 | for(i = 1;i < TARGET_NSIG_WORDS; i++) |
| 484 | d->sig[i] = 0; |
| 485 | } |
| 486 | |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 487 | void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); |
| 488 | void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 489 | void host_to_target_old_sigset(abi_ulong *old_sigset, |
bellard | 66fb976 | 2003-03-23 01:06:05 +0000 | [diff] [blame] | 490 | const sigset_t *sigset); |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 491 | void target_to_host_old_sigset(sigset_t *sigset, |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 492 | const abi_ulong *old_sigset); |
bellard | 66fb976 | 2003-03-23 01:06:05 +0000 | [diff] [blame] | 493 | struct target_sigaction; |
| 494 | int do_sigaction(int sig, const struct target_sigaction *act, |
Richard Henderson | 02fb28e | 2021-04-22 16:02:23 -0700 | [diff] [blame] | 495 | struct target_sigaction *oact, abi_ulong ka_restorer); |
bellard | 66fb976 | 2003-03-23 01:06:05 +0000 | [diff] [blame] | 496 | |
Laurent Vivier | 9850f9f | 2018-05-29 21:42:00 +0200 | [diff] [blame] | 497 | #include "target_signal.h" |
| 498 | |
Richard Henderson | 7f047de | 2017-10-31 13:53:52 +0100 | [diff] [blame] | 499 | #ifdef TARGET_SA_RESTORER |
| 500 | #define TARGET_ARCH_HAS_SA_RESTORER 1 |
| 501 | #endif |
| 502 | |
Richard Henderson | 6049f4f | 2009-12-27 18:30:03 -0800 | [diff] [blame] | 503 | #if defined(TARGET_ALPHA) |
Richard Henderson | 02d0de1 | 2021-04-22 16:02:26 -0700 | [diff] [blame] | 504 | typedef int32_t target_old_sa_flags; |
| 505 | #else |
| 506 | typedef abi_ulong target_old_sa_flags; |
| 507 | #endif |
bellard | 106ec87 | 2006-06-27 21:08:10 +0000 | [diff] [blame] | 508 | |
Richard Henderson | 02d0de1 | 2021-04-22 16:02:26 -0700 | [diff] [blame] | 509 | #if defined(TARGET_MIPS) |
bellard | 106ec87 | 2006-06-27 21:08:10 +0000 | [diff] [blame] | 510 | struct target_sigaction { |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 511 | uint32_t sa_flags; |
ths | d26bc21 | 2007-11-08 18:05:37 +0000 | [diff] [blame] | 512 | #if defined(TARGET_ABI_MIPSN32) |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 513 | uint32_t _sa_handler; |
| 514 | #else |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 515 | abi_ulong _sa_handler; |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 516 | #endif |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 517 | target_sigset_t sa_mask; |
Richard Henderson | 7f047de | 2017-10-31 13:53:52 +0100 | [diff] [blame] | 518 | #ifdef TARGET_ARCH_HAS_SA_RESTORER |
| 519 | /* ??? This is always present, but ignored unless O32. */ |
| 520 | abi_ulong sa_restorer; |
| 521 | #endif |
bellard | 106ec87 | 2006-06-27 21:08:10 +0000 | [diff] [blame] | 522 | }; |
bellard | 106ec87 | 2006-06-27 21:08:10 +0000 | [diff] [blame] | 523 | #else |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 524 | struct target_old_sigaction { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 525 | abi_ulong _sa_handler; |
| 526 | abi_ulong sa_mask; |
Richard Henderson | 02d0de1 | 2021-04-22 16:02:26 -0700 | [diff] [blame] | 527 | target_old_sa_flags sa_flags; |
Richard Henderson | 7f047de | 2017-10-31 13:53:52 +0100 | [diff] [blame] | 528 | #ifdef TARGET_ARCH_HAS_SA_RESTORER |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 529 | abi_ulong sa_restorer; |
Richard Henderson | 7f047de | 2017-10-31 13:53:52 +0100 | [diff] [blame] | 530 | #endif |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 531 | }; |
| 532 | |
| 533 | struct target_sigaction { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 534 | abi_ulong _sa_handler; |
| 535 | abi_ulong sa_flags; |
Richard Henderson | 7f047de | 2017-10-31 13:53:52 +0100 | [diff] [blame] | 536 | #ifdef TARGET_ARCH_HAS_SA_RESTORER |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 537 | abi_ulong sa_restorer; |
Richard Henderson | 7f047de | 2017-10-31 13:53:52 +0100 | [diff] [blame] | 538 | #endif |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 539 | target_sigset_t sa_mask; |
Laurent Vivier | 5de154e | 2018-04-02 12:24:52 +0200 | [diff] [blame] | 540 | #ifdef TARGET_ARCH_HAS_KA_RESTORER |
| 541 | abi_ulong ka_restorer; |
| 542 | #endif |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 543 | }; |
bellard | 106ec87 | 2006-06-27 21:08:10 +0000 | [diff] [blame] | 544 | #endif |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 545 | |
| 546 | typedef union target_sigval { |
| 547 | int sival_int; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 548 | abi_ulong sival_ptr; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 549 | } target_sigval_t; |
bellard | 6d5e216 | 2004-09-30 22:04:13 +0000 | [diff] [blame] | 550 | #if 0 |
| 551 | #if defined (TARGET_SPARC) |
| 552 | typedef struct { |
| 553 | struct { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 554 | abi_ulong psr; |
| 555 | abi_ulong pc; |
| 556 | abi_ulong npc; |
| 557 | abi_ulong y; |
| 558 | abi_ulong u_regs[16]; /* globals and ins */ |
bellard | 6d5e216 | 2004-09-30 22:04:13 +0000 | [diff] [blame] | 559 | } si_regs; |
| 560 | int si_mask; |
| 561 | } __siginfo_t; |
| 562 | |
| 563 | typedef struct { |
| 564 | unsigned long si_float_regs [32]; |
| 565 | unsigned long si_fsr; |
| 566 | unsigned long si_fpqdepth; |
| 567 | struct { |
| 568 | unsigned long *insn_addr; |
| 569 | unsigned long insn; |
| 570 | } si_fpqueue [16]; |
| 571 | } __siginfo_fpu_t; |
| 572 | #endif |
| 573 | #endif |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 574 | |
| 575 | #define TARGET_SI_MAX_SIZE 128 |
Maxim Ostapenko | aa5e03d | 2015-02-02 18:18:29 +0400 | [diff] [blame] | 576 | |
| 577 | #if TARGET_ABI_BITS == 32 |
| 578 | #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) |
| 579 | #else |
| 580 | #define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int)) |
| 581 | #endif |
| 582 | |
| 583 | #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int)) |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 584 | |
Peter Maydell | a70dadc | 2016-05-27 15:51:59 +0100 | [diff] [blame] | 585 | /* Within QEMU the top 16 bits of si_code indicate which of the parts of |
| 586 | * the union in target_siginfo is valid. This only applies between |
| 587 | * host_to_target_siginfo_noswap() and tswap_siginfo(); it does not |
| 588 | * appear either within host siginfo_t or in target_siginfo structures |
| 589 | * which we get from the guest userspace program. (The Linux kernel |
| 590 | * does a similar thing with using the top bits for its own internal |
| 591 | * purposes but not letting them be visible to userspace.) |
| 592 | */ |
| 593 | #define QEMU_SI_KILL 0 |
| 594 | #define QEMU_SI_TIMER 1 |
| 595 | #define QEMU_SI_POLL 2 |
| 596 | #define QEMU_SI_FAULT 3 |
| 597 | #define QEMU_SI_CHLD 4 |
| 598 | #define QEMU_SI_RT 5 |
| 599 | |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 600 | typedef struct target_siginfo { |
pbrook | 3f53d54 | 2009-04-21 00:59:40 +0000 | [diff] [blame] | 601 | #ifdef TARGET_MIPS |
| 602 | int si_signo; |
| 603 | int si_code; |
| 604 | int si_errno; |
| 605 | #else |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 606 | int si_signo; |
| 607 | int si_errno; |
| 608 | int si_code; |
pbrook | 3f53d54 | 2009-04-21 00:59:40 +0000 | [diff] [blame] | 609 | #endif |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 610 | |
| 611 | union { |
| 612 | int _pad[TARGET_SI_PAD_SIZE]; |
| 613 | |
| 614 | /* kill() */ |
| 615 | struct { |
| 616 | pid_t _pid; /* sender's pid */ |
| 617 | uid_t _uid; /* sender's uid */ |
| 618 | } _kill; |
| 619 | |
| 620 | /* POSIX.1b timers */ |
| 621 | struct { |
| 622 | unsigned int _timer1; |
| 623 | unsigned int _timer2; |
| 624 | } _timer; |
| 625 | |
| 626 | /* POSIX.1b signals */ |
| 627 | struct { |
| 628 | pid_t _pid; /* sender's pid */ |
| 629 | uid_t _uid; /* sender's uid */ |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 630 | target_sigval_t _sigval; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 631 | } _rt; |
| 632 | |
| 633 | /* SIGCHLD */ |
| 634 | struct { |
| 635 | pid_t _pid; /* which child */ |
| 636 | uid_t _uid; /* sender's uid */ |
| 637 | int _status; /* exit code */ |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 638 | target_clock_t _utime; |
| 639 | target_clock_t _stime; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 640 | } _sigchld; |
| 641 | |
| 642 | /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ |
| 643 | struct { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 644 | abi_ulong _addr; /* faulting insn/memory ref. */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 645 | } _sigfault; |
| 646 | |
| 647 | /* SIGPOLL */ |
| 648 | struct { |
| 649 | int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ |
| 650 | int _fd; |
| 651 | } _sigpoll; |
| 652 | } _sifields; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 653 | } target_siginfo_t; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 654 | |
| 655 | /* |
| 656 | * si_code values |
| 657 | * Digital reserves positive values for kernel-generated signals. |
| 658 | */ |
| 659 | #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ |
| 660 | #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ |
| 661 | #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ |
| 662 | #define TARGET_SI_TIMER -2 /* sent by timer expiration */ |
| 663 | #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ |
| 664 | #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ |
| 665 | #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ |
| 666 | |
| 667 | /* |
| 668 | * SIGILL si_codes |
| 669 | */ |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 670 | #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 671 | #define TARGET_ILL_ILLOPN (2) /* illegal operand */ |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 672 | #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ |
| 673 | #define TARGET_ILL_ILLTRP (4) /* illegal trap */ |
| 674 | #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ |
| 675 | #define TARGET_ILL_PRVREG (6) /* privileged register */ |
| 676 | #define TARGET_ILL_COPROC (7) /* coprocessor error */ |
| 677 | #define TARGET_ILL_BADSTK (8) /* internal stack error */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 678 | |
| 679 | /* |
| 680 | * SIGFPE si_codes |
| 681 | */ |
| 682 | #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ |
| 683 | #define TARGET_FPE_INTOVF (2) /* integer overflow */ |
| 684 | #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ |
| 685 | #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ |
| 686 | #define TARGET_FPE_FLTUND (5) /* floating point underflow */ |
| 687 | #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ |
| 688 | #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ |
| 689 | #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ |
Richard Henderson | 21ba856 | 2019-04-26 15:20:51 -0700 | [diff] [blame] | 690 | #define TARGET_FPE_FLTUNK (14) /* undiagnosed fp exception */ |
Richard Henderson | 0edf34c | 2022-01-07 13:32:27 -0800 | [diff] [blame] | 691 | #define TARGET_FPE_CONDTRAP (15) /* trap on condition */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 692 | |
| 693 | /* |
| 694 | * SIGSEGV si_codes |
| 695 | */ |
| 696 | #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ |
| 697 | #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ |
Chen Gang | de2fdd5 | 2015-09-26 12:10:05 +0800 | [diff] [blame] | 698 | #define TARGET_SEGV_BNDERR (3) /* failed address bound checks */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 699 | |
| 700 | /* |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 701 | * SIGBUS si_codes |
| 702 | */ |
| 703 | #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ |
Dong Xu Wang | b4916d7 | 2011-11-22 18:06:17 +0800 | [diff] [blame] | 704 | #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 705 | #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ |
Chen Gang | de2fdd5 | 2015-09-26 12:10:05 +0800 | [diff] [blame] | 706 | /* hardware memory error consumed on a machine check: action required */ |
| 707 | #define TARGET_BUS_MCEERR_AR (4) |
| 708 | /* hardware memory error detected in process but not consumed: action optional*/ |
| 709 | #define TARGET_BUS_MCEERR_AO (5) |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 710 | |
| 711 | /* |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 712 | * SIGTRAP si_codes |
| 713 | */ |
| 714 | #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ |
| 715 | #define TARGET_TRAP_TRACE (2) /* process trace trap */ |
Chen Gang | de2fdd5 | 2015-09-26 12:10:05 +0800 | [diff] [blame] | 716 | #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */ |
| 717 | #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ |
Richard Henderson | d010b8b | 2022-01-07 13:32:20 -0800 | [diff] [blame] | 718 | #define TARGET_TRAP_UNK (5) /* undiagnosed trap */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 719 | |
Richard Henderson | e64c6d4 | 2023-02-15 19:45:16 -1000 | [diff] [blame] | 720 | /* |
| 721 | * SIGEMT si_codes |
| 722 | */ |
| 723 | #define TARGET_EMT_TAGOVF 1 /* tag overflow */ |
| 724 | |
Serge Belyshev | b13e49b | 2022-01-29 22:46:59 +0300 | [diff] [blame] | 725 | #include "target_resource.h" |
Wesley W. Terpstra | e22b701 | 2011-07-12 14:42:00 +0300 | [diff] [blame] | 726 | |
bellard | 9de5e44 | 2003-03-23 16:49:39 +0000 | [diff] [blame] | 727 | struct target_pollfd { |
| 728 | int fd; /* file descriptor */ |
| 729 | short events; /* requested events */ |
| 730 | short revents; /* returned events */ |
| 731 | }; |
| 732 | |
bellard | 8e5a066 | 2003-05-08 15:42:10 +0000 | [diff] [blame] | 733 | /* virtual terminal ioctls */ |
bellard | 0221cfc | 2003-05-10 12:38:16 +0000 | [diff] [blame] | 734 | #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ |
| 735 | #define TARGET_KDMKTONE 0x4B30 /* generate tone */ |
bellard | 8e5a066 | 2003-05-08 15:42:10 +0000 | [diff] [blame] | 736 | #define TARGET_KDGKBTYPE 0x4b33 |
Ulrich Hecht | f7680a5 | 2009-10-16 17:00:44 +0200 | [diff] [blame] | 737 | #define TARGET_KDSETMODE 0x4b3a |
| 738 | #define TARGET_KDGKBMODE 0x4b44 |
| 739 | #define TARGET_KDSKBMODE 0x4b45 |
bellard | 0221cfc | 2003-05-10 12:38:16 +0000 | [diff] [blame] | 740 | #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ |
| 741 | #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ |
Cédric VINCENT | e6fe18f | 2011-06-29 15:09:09 +0200 | [diff] [blame] | 742 | #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ |
| 743 | #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ |
| 744 | #define TARGET_KDGETLED 0x4B31 /* return current led state */ |
| 745 | #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ |
Paul Burton | ca56f5b | 2014-06-22 11:25:47 +0100 | [diff] [blame] | 746 | #define TARGET_KDSIGACCEPT 0x4B4E |
bellard | 8e5a066 | 2003-05-08 15:42:10 +0000 | [diff] [blame] | 747 | |
Filip Bozuta | 373b067 | 2020-01-15 20:36:39 +0100 | [diff] [blame] | 748 | struct target_rtc_pll_info { |
| 749 | int pll_ctrl; |
| 750 | int pll_value; |
| 751 | int pll_max; |
| 752 | int pll_min; |
| 753 | int pll_posmult; |
| 754 | int pll_negmult; |
| 755 | abi_long pll_clock; |
| 756 | }; |
| 757 | |
Filip Bozuta | 68365f9 | 2020-01-15 20:36:35 +0100 | [diff] [blame] | 758 | /* real time clock ioctls */ |
| 759 | #define TARGET_RTC_AIE_ON TARGET_IO('p', 0x01) |
| 760 | #define TARGET_RTC_AIE_OFF TARGET_IO('p', 0x02) |
| 761 | #define TARGET_RTC_UIE_ON TARGET_IO('p', 0x03) |
| 762 | #define TARGET_RTC_UIE_OFF TARGET_IO('p', 0x04) |
| 763 | #define TARGET_RTC_PIE_ON TARGET_IO('p', 0x05) |
| 764 | #define TARGET_RTC_PIE_OFF TARGET_IO('p', 0x06) |
| 765 | #define TARGET_RTC_WIE_ON TARGET_IO('p', 0x0f) |
| 766 | #define TARGET_RTC_WIE_OFF TARGET_IO('p', 0x10) |
Filip Bozuta | 178b14a | 2020-01-15 20:36:36 +0100 | [diff] [blame] | 767 | #define TARGET_RTC_ALM_READ TARGET_IOR('p', 0x08, struct rtc_time) |
| 768 | #define TARGET_RTC_ALM_SET TARGET_IOW('p', 0x07, struct rtc_time) |
| 769 | #define TARGET_RTC_RD_TIME TARGET_IOR('p', 0x09, struct rtc_time) |
| 770 | #define TARGET_RTC_SET_TIME TARGET_IOW('p', 0x0a, struct rtc_time) |
Filip Bozuta | fa857eb | 2020-01-15 20:36:37 +0100 | [diff] [blame] | 771 | #define TARGET_RTC_IRQP_READ TARGET_IOR('p', 0x0b, abi_ulong) |
| 772 | #define TARGET_RTC_IRQP_SET TARGET_IOW('p', 0x0c, abi_ulong) |
| 773 | #define TARGET_RTC_EPOCH_READ TARGET_IOR('p', 0x0d, abi_ulong) |
| 774 | #define TARGET_RTC_EPOCH_SET TARGET_IOW('p', 0x0e, abi_ulong) |
Filip Bozuta | abc81bf | 2020-01-15 20:36:38 +0100 | [diff] [blame] | 775 | #define TARGET_RTC_WKALM_RD TARGET_IOR('p', 0x10, struct rtc_wkalrm) |
| 776 | #define TARGET_RTC_WKALM_SET TARGET_IOW('p', 0x0f, struct rtc_wkalrm) |
Filip Bozuta | 373b067 | 2020-01-15 20:36:39 +0100 | [diff] [blame] | 777 | #define TARGET_RTC_PLL_GET TARGET_IOR('p', 0x11, \ |
| 778 | struct target_rtc_pll_info) |
| 779 | #define TARGET_RTC_PLL_SET TARGET_IOW('p', 0x12, \ |
| 780 | struct target_rtc_pll_info) |
Filip Bozuta | a7b0974 | 2020-01-15 20:36:40 +0100 | [diff] [blame] | 781 | #define TARGET_RTC_VL_READ TARGET_IOR('p', 0x13, int) |
| 782 | #define TARGET_RTC_VL_CLR TARGET_IO('p', 0x14) |
Filip Bozuta | 68365f9 | 2020-01-15 20:36:35 +0100 | [diff] [blame] | 783 | |
Aleksandar Markovic | d14eabb | 2019-05-19 18:15:22 +0200 | [diff] [blame] | 784 | #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) || \ |
| 785 | defined(TARGET_XTENSA) |
Aleksandar Markovic | 4e4b173 | 2019-09-04 14:59:23 +0200 | [diff] [blame] | 786 | #define TARGET_FIOGETOWN TARGET_IOR('f', 123, int) |
| 787 | #define TARGET_FIOSETOWN TARGET_IOW('f', 124, int) |
Aleksandar Markovic | e1be160 | 2016-09-19 13:44:38 +0200 | [diff] [blame] | 788 | #define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) |
Aleksandar Markovic | c495a79 | 2019-05-19 18:15:23 +0200 | [diff] [blame] | 789 | #define TARGET_SIOCSPGRP TARGET_IOW('s', 8, pid_t) |
Helge Deller | 405b491 | 2016-12-07 11:31:46 -0800 | [diff] [blame] | 790 | #define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t) |
Aleksandar Markovic | e1be160 | 2016-09-19 13:44:38 +0200 | [diff] [blame] | 791 | #else |
Aleksandar Markovic | 4e4b173 | 2019-09-04 14:59:23 +0200 | [diff] [blame] | 792 | #define TARGET_FIOGETOWN 0x8903 |
| 793 | #define TARGET_FIOSETOWN 0x8901 |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 794 | #define TARGET_SIOCATMARK 0x8905 |
Aleksandar Markovic | c495a79 | 2019-05-19 18:15:23 +0200 | [diff] [blame] | 795 | #define TARGET_SIOCSPGRP 0x8902 |
Helge Deller | 405b491 | 2016-12-07 11:31:46 -0800 | [diff] [blame] | 796 | #define TARGET_SIOCGPGRP 0x8904 |
Aleksandar Markovic | e1be160 | 2016-09-19 13:44:38 +0200 | [diff] [blame] | 797 | #endif |
Aleksandar Markovic | c495a79 | 2019-05-19 18:15:23 +0200 | [diff] [blame] | 798 | |
Daniel P. Berrangé | 6d5d5dd | 2019-07-18 15:06:41 +0200 | [diff] [blame] | 799 | #if defined(TARGET_SH4) |
| 800 | #define TARGET_SIOCGSTAMP_OLD TARGET_IOR('s', 100, struct target_timeval) |
| 801 | #define TARGET_SIOCGSTAMPNS_OLD TARGET_IOR('s', 101, struct target_timespec) |
| 802 | #else |
| 803 | #define TARGET_SIOCGSTAMP_OLD 0x8906 |
| 804 | #define TARGET_SIOCGSTAMPNS_OLD 0x8907 |
| 805 | #endif |
| 806 | |
| 807 | #define TARGET_SIOCGSTAMP_NEW TARGET_IOR(0x89, 0x06, abi_llong[2]) |
| 808 | #define TARGET_SIOCGSTAMPNS_NEW TARGET_IOR(0x89, 0x07, abi_llong[2]) |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 809 | |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 810 | /* Networking ioctls */ |
| 811 | #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ |
| 812 | #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ |
| 813 | #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ |
| 814 | #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ |
| 815 | #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ |
| 816 | #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ |
| 817 | #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ |
| 818 | #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ |
| 819 | #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ |
| 820 | #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ |
| 821 | #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ |
| 822 | #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ |
| 823 | #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ |
| 824 | #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ |
| 825 | #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ |
| 826 | #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ |
| 827 | #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ |
| 828 | #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ |
| 829 | #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ |
| 830 | #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ |
| 831 | #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ |
| 832 | #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ |
| 833 | #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ |
| 834 | #define TARGET_SIOCSIFENCAP 0x8926 |
| 835 | #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ |
| 836 | #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ |
| 837 | #define TARGET_SIOCSIFSLAVE 0x8930 |
| 838 | #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ |
| 839 | #define TARGET_SIOCDELMULTI 0x8932 |
Paul Burton | f63eb01 | 2014-06-22 11:25:48 +0100 | [diff] [blame] | 840 | #define TARGET_SIOCGIFINDEX 0x8933 |
Neng Chen | 4bdcd79 | 2019-05-19 18:15:24 +0200 | [diff] [blame] | 841 | #define TARGET_SIOCSIFPFLAGS 0x8934 /* set extended flags */ |
| 842 | #define TARGET_SIOCGIFPFLAGS 0x8935 /* get extended flags */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 843 | |
| 844 | /* Bridging control calls */ |
| 845 | #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ |
| 846 | #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ |
| 847 | |
| 848 | #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ |
| 849 | #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ |
| 850 | |
| 851 | /* ARP cache control calls. */ |
| 852 | #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ |
| 853 | #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ |
| 854 | #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ |
| 855 | #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ |
| 856 | #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ |
| 857 | #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ |
| 858 | |
| 859 | /* RARP cache control calls. */ |
| 860 | #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ |
| 861 | #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ |
| 862 | #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ |
| 863 | |
| 864 | /* Driver configuration calls */ |
| 865 | #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ |
| 866 | #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ |
| 867 | |
| 868 | /* DLCI configuration calls */ |
| 869 | #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ |
| 870 | #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ |
| 871 | |
Laurent Vivier | 86fcd94 | 2011-03-30 01:35:23 +0200 | [diff] [blame] | 872 | /* From <linux/wireless.h> */ |
| 873 | |
| 874 | #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 875 | |
Shu-Chun Weng | 6addf06 | 2020-09-28 18:48:01 -0700 | [diff] [blame] | 876 | /* From <linux/if_tun.h> */ |
| 877 | |
| 878 | #define TARGET_TUNSETDEBUG TARGET_IOW('T', 201, int) |
| 879 | #define TARGET_TUNSETIFF TARGET_IOW('T', 202, int) |
| 880 | #define TARGET_TUNSETPERSIST TARGET_IOW('T', 203, int) |
| 881 | #define TARGET_TUNSETOWNER TARGET_IOW('T', 204, int) |
| 882 | #define TARGET_TUNSETLINK TARGET_IOW('T', 205, int) |
| 883 | #define TARGET_TUNSETGROUP TARGET_IOW('T', 206, int) |
| 884 | #define TARGET_TUNGETFEATURES TARGET_IOR('T', 207, unsigned int) |
| 885 | #define TARGET_TUNSETOFFLOAD TARGET_IOW('T', 208, unsigned int) |
| 886 | #define TARGET_TUNSETTXFILTER TARGET_IOW('T', 209, unsigned int) |
| 887 | #define TARGET_TUNGETIFF TARGET_IOR('T', 210, unsigned int) |
| 888 | #define TARGET_TUNGETSNDBUF TARGET_IOR('T', 211, int) |
| 889 | #define TARGET_TUNSETSNDBUF TARGET_IOW('T', 212, int) |
| 890 | /* |
| 891 | * TUNATTACHFILTER and TUNDETACHFILTER are not supported. Linux kernel keeps a |
| 892 | * user pointer in TUNATTACHFILTER, which we are not able to correctly handle. |
| 893 | */ |
| 894 | #define TARGET_TUNGETVNETHDRSZ TARGET_IOR('T', 215, int) |
| 895 | #define TARGET_TUNSETVNETHDRSZ TARGET_IOW('T', 216, int) |
| 896 | #define TARGET_TUNSETQUEUE TARGET_IOW('T', 217, int) |
| 897 | #define TARGET_TUNSETIFINDEX TARGET_IOW('T', 218, unsigned int) |
| 898 | /* TUNGETFILTER is not supported: see TUNATTACHFILTER. */ |
| 899 | #define TARGET_TUNSETVNETLE TARGET_IOW('T', 220, int) |
| 900 | #define TARGET_TUNGETVNETLE TARGET_IOR('T', 221, int) |
| 901 | #define TARGET_TUNSETVNETBE TARGET_IOW('T', 222, int) |
| 902 | #define TARGET_TUNGETVNETBE TARGET_IOR('T', 223, int) |
| 903 | #define TARGET_TUNSETSTEERINGEBPF TARGET_IOR('T', 224, int) |
| 904 | #define TARGET_TUNSETFILTEREBPF TARGET_IOR('T', 225, int) |
| 905 | #define TARGET_TUNSETCARRIER TARGET_IOW('T', 226, int) |
| 906 | #define TARGET_TUNGETDEVNETNS TARGET_IO('T', 227) |
| 907 | |
Marco A L Barbosa | d6d6d6f | 2017-10-05 10:55:30 -0300 | [diff] [blame] | 908 | /* From <linux/random.h> */ |
| 909 | |
| 910 | #define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, int) |
| 911 | #define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, int) |
| 912 | #define TARGET_RNDZAPENTCNT TARGET_IO('R', 0x04) |
| 913 | #define TARGET_RNDCLEARPOOL TARGET_IO('R', 0x06) |
Aleksandar Markovic | 92c096f | 2019-09-04 14:59:22 +0200 | [diff] [blame] | 914 | #define TARGET_RNDRESEEDCRNG TARGET_IO('R', 0x07) |
Marco A L Barbosa | d6d6d6f | 2017-10-05 10:55:30 -0300 | [diff] [blame] | 915 | |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 916 | /* From <linux/fs.h> */ |
| 917 | |
| 918 | #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ |
| 919 | #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ |
| 920 | #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ |
| 921 | #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ |
| 922 | #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ |
| 923 | #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ |
| 924 | #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ |
| 925 | #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ |
| 926 | #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ |
| 927 | #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ |
| 928 | #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ |
| 929 | #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ |
Andreas Färber | fff8c53 | 2014-01-18 07:38:30 +0100 | [diff] [blame] | 930 | #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 931 | /* A jump here: 108-111 have been used for various private purposes. */ |
Peter Maydell | c8b0bf5 | 2012-07-23 08:05:20 +0000 | [diff] [blame] | 932 | #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) |
| 933 | #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) |
Alexander Graf | edafea1 | 2012-01-31 20:10:20 +0100 | [diff] [blame] | 934 | #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) |
| 935 | /* return device size in bytes |
| 936 | (u64 *arg) */ |
Peter Maydell | 4715856 | 2016-07-01 19:46:04 +0100 | [diff] [blame] | 937 | |
| 938 | #define TARGET_BLKDISCARD TARGET_IO(0x12, 119) |
| 939 | #define TARGET_BLKIOMIN TARGET_IO(0x12, 120) |
| 940 | #define TARGET_BLKIOOPT TARGET_IO(0x12, 121) |
| 941 | #define TARGET_BLKALIGNOFF TARGET_IO(0x12, 122) |
| 942 | #define TARGET_BLKPBSZGET TARGET_IO(0x12, 123) |
| 943 | #define TARGET_BLKDISCARDZEROES TARGET_IO(0x12, 124) |
| 944 | #define TARGET_BLKSECDISCARD TARGET_IO(0x12, 125) |
| 945 | #define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126) |
| 946 | #define TARGET_BLKZEROOUT TARGET_IO(0x12, 127) |
| 947 | |
Yunqiang Su | ab22b4d | 2019-09-04 14:59:24 +0200 | [diff] [blame] | 948 | /* From <linux/fd.h> */ |
| 949 | |
Aleksandar Markovic | 7e35fc8 | 2019-09-04 14:59:25 +0200 | [diff] [blame] | 950 | #define TARGET_FDMSGON TARGET_IO(2, 0x45) |
| 951 | #define TARGET_FDMSGOFF TARGET_IO(2, 0x46) |
Aleksandar Markovic | 08e3ce5 | 2020-01-16 23:49:47 +0100 | [diff] [blame] | 952 | #define TARGET_FDFMTBEG TARGET_IO(2, 0x47) |
| 953 | #define TARGET_FDFMTTRK TARGET_IOW(2, 0x48, struct format_descr) |
| 954 | #define TARGET_FDFMTEND TARGET_IO(2, 0x49) |
Aleksandar Markovic | 81eb1a3 | 2020-01-16 23:49:46 +0100 | [diff] [blame] | 955 | #define TARGET_FDSETEMSGTRESH TARGET_IO(2, 0x4a) |
Yunqiang Su | ab22b4d | 2019-09-04 14:59:24 +0200 | [diff] [blame] | 956 | #define TARGET_FDFLUSH TARGET_IO(2, 0x4b) |
Aleksandar Markovic | 81eb1a3 | 2020-01-16 23:49:46 +0100 | [diff] [blame] | 957 | #define TARGET_FDSETMAXERRS TARGET_IOW(2, 0x4c, struct floppy_max_errors) |
| 958 | #define TARGET_FDGETMAXERRS TARGET_IOR(2, 0x0e, struct floppy_max_errors) |
Aleksandar Markovic | 5eea942 | 2019-09-04 14:59:26 +0200 | [diff] [blame] | 959 | #define TARGET_FDRESET TARGET_IO(2, 0x54) |
| 960 | #define TARGET_FDRAWCMD TARGET_IO(2, 0x58) |
| 961 | #define TARGET_FDTWADDLE TARGET_IO(2, 0x59) |
| 962 | #define TARGET_FDEJECT TARGET_IO(2, 0x5a) |
Yunqiang Su | ab22b4d | 2019-09-04 14:59:24 +0200 | [diff] [blame] | 963 | |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 964 | #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ |
| 965 | #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ |
Helge Deller | 21992cb | 2017-02-11 23:26:02 +0100 | [diff] [blame] | 966 | |
| 967 | #define TARGET_FICLONE TARGET_IOW(0x94, 9, int) |
| 968 | #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range) |
| 969 | |
Aleksandar Markovic | 5ae774a | 2020-01-16 23:49:40 +0100 | [diff] [blame] | 970 | /* |
| 971 | * Note that the ioctl numbers for FS_IOC_<GET|SET><FLAGS|VERSION> |
| 972 | * claim type "long" but the actual type used by the kernel is "int". |
Peter Maydell | 6080723 | 2016-07-15 18:44:45 +0100 | [diff] [blame] | 973 | */ |
Peter Maydell | 1847b7b | 2017-10-12 16:30:44 +0100 | [diff] [blame] | 974 | #define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, abi_long) |
| 975 | #define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, abi_long) |
Aleksandar Markovic | 5ae774a | 2020-01-16 23:49:40 +0100 | [diff] [blame] | 976 | #define TARGET_FS_IOC_GETVERSION TARGET_IOR('v', 1, abi_long) |
| 977 | #define TARGET_FS_IOC_SETVERSION TARGET_IOW('v', 2, abi_long) |
Peter Maydell | 285da2b | 2011-01-06 15:04:18 +0000 | [diff] [blame] | 978 | #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) |
Aleksandar Markovic | 0b471ba | 2020-01-16 23:49:41 +0100 | [diff] [blame] | 979 | #define TARGET_FS_IOC32_GETFLAGS TARGET_IOR('f', 1, int) |
| 980 | #define TARGET_FS_IOC32_SETFLAGS TARGET_IOW('f', 2, int) |
Aleksandar Markovic | 0d899cd | 2020-01-16 23:49:42 +0100 | [diff] [blame] | 981 | #define TARGET_FS_IOC32_GETVERSION TARGET_IOR('v', 1, int) |
| 982 | #define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int) |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 983 | |
Filip Bozuta | d6092e0 | 2020-08-23 21:50:07 +0200 | [diff] [blame] | 984 | /* btrfs ioctls */ |
Thomas Huth | 48f670e | 2020-11-18 18:10:52 +0100 | [diff] [blame] | 985 | #ifdef HAVE_BTRFS_H |
Filip Bozuta | 527e8d8 | 2020-08-23 21:50:08 +0200 | [diff] [blame] | 986 | #define TARGET_BTRFS_IOC_SNAP_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC, 1) |
Filip Bozuta | 9bbd60e | 2020-08-23 21:50:09 +0200 | [diff] [blame] | 987 | #define TARGET_BTRFS_IOC_SCAN_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 4) |
| 988 | #define TARGET_BTRFS_IOC_FORGET_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 5) |
| 989 | #define TARGET_BTRFS_IOC_ADD_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 10) |
| 990 | #define TARGET_BTRFS_IOC_RM_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 11) |
Filip Bozuta | d6092e0 | 2020-08-23 21:50:07 +0200 | [diff] [blame] | 991 | #define TARGET_BTRFS_IOC_SUBVOL_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC, 14) |
Filip Bozuta | 527e8d8 | 2020-08-23 21:50:08 +0200 | [diff] [blame] | 992 | #define TARGET_BTRFS_IOC_SNAP_DESTROY TARGET_IOWU(BTRFS_IOCTL_MAGIC, 15) |
Filip Bozuta | 0ff496a | 2020-08-23 21:50:11 +0200 | [diff] [blame] | 993 | #define TARGET_BTRFS_IOC_INO_LOOKUP TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 18) |
Filip Bozuta | 784c08c | 2020-08-23 21:50:12 +0200 | [diff] [blame] | 994 | #define TARGET_BTRFS_IOC_DEFAULT_SUBVOL TARGET_IOW(BTRFS_IOCTL_MAGIC, 19,\ |
| 995 | abi_ullong) |
Filip Bozuta | d6092e0 | 2020-08-23 21:50:07 +0200 | [diff] [blame] | 996 | #define TARGET_BTRFS_IOC_SUBVOL_GETFLAGS TARGET_IOR(BTRFS_IOCTL_MAGIC, 25,\ |
| 997 | abi_ullong) |
| 998 | #define TARGET_BTRFS_IOC_SUBVOL_SETFLAGS TARGET_IOW(BTRFS_IOCTL_MAGIC, 26,\ |
| 999 | abi_ullong) |
Filip Bozuta | 9a5a5a0 | 2020-08-23 21:50:14 +0200 | [diff] [blame] | 1000 | #define TARGET_BTRFS_IOC_SCRUB TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 27) |
| 1001 | #define TARGET_BTRFS_IOC_SCRUB_CANCEL TARGET_IO(BTRFS_IOCTL_MAGIC, 28) |
| 1002 | #define TARGET_BTRFS_IOC_SCRUB_PROGRESS TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 29) |
Filip Bozuta | 9bbd60e | 2020-08-23 21:50:09 +0200 | [diff] [blame] | 1003 | #define TARGET_BTRFS_IOC_DEV_INFO TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 30) |
Filip Bozuta | 0ff496a | 2020-08-23 21:50:11 +0200 | [diff] [blame] | 1004 | #define TARGET_BTRFS_IOC_INO_PATHS TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 35) |
| 1005 | #define TARGET_BTRFS_IOC_LOGICAL_INO TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 36) |
Filip Bozuta | 53906f6 | 2020-08-23 21:50:13 +0200 | [diff] [blame] | 1006 | #define TARGET_BTRFS_IOC_QUOTA_CTL TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 40) |
| 1007 | #define TARGET_BTRFS_IOC_QGROUP_ASSIGN TARGET_IOWU(BTRFS_IOCTL_MAGIC, 41) |
| 1008 | #define TARGET_BTRFS_IOC_QGROUP_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC, 42) |
| 1009 | #define TARGET_BTRFS_IOC_QGROUP_LIMIT TARGET_IORU(BTRFS_IOCTL_MAGIC, 43) |
| 1010 | #define TARGET_BTRFS_IOC_QUOTA_RESCAN TARGET_IOWU(BTRFS_IOCTL_MAGIC, 44) |
| 1011 | #define TARGET_BTRFS_IOC_QUOTA_RESCAN_STATUS TARGET_IORU(BTRFS_IOCTL_MAGIC, 45) |
| 1012 | #define TARGET_BTRFS_IOC_QUOTA_RESCAN_WAIT TARGET_IO(BTRFS_IOCTL_MAGIC, 46) |
Filip Bozuta | 9bbd60e | 2020-08-23 21:50:09 +0200 | [diff] [blame] | 1013 | #define TARGET_BTRFS_IOC_GET_DEV_STATS TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 52) |
Filip Bozuta | 49b422a | 2020-08-23 21:50:10 +0200 | [diff] [blame] | 1014 | #define TARGET_BTRFS_IOC_GET_FEATURES TARGET_IORU(BTRFS_IOCTL_MAGIC, 57) |
| 1015 | #define TARGET_BTRFS_IOC_SET_FEATURES TARGET_IOWU(BTRFS_IOCTL_MAGIC, 57) |
| 1016 | #define TARGET_BTRFS_IOC_GET_SUPPORTED_FEATURES TARGET_IORU(BTRFS_IOCTL_MAGIC, 57) |
Filip Bozuta | 0ff496a | 2020-08-23 21:50:11 +0200 | [diff] [blame] | 1017 | #define TARGET_BTRFS_IOC_LOGICAL_INO_V2 TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 59) |
Filip Bozuta | d6092e0 | 2020-08-23 21:50:07 +0200 | [diff] [blame] | 1018 | #define TARGET_BTRFS_IOC_GET_SUBVOL_INFO TARGET_IORU(BTRFS_IOCTL_MAGIC, 60) |
Filip Bozuta | 784c08c | 2020-08-23 21:50:12 +0200 | [diff] [blame] | 1019 | #define TARGET_BTRFS_IOC_GET_SUBVOL_ROOTREF TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 61) |
Filip Bozuta | 0ff496a | 2020-08-23 21:50:11 +0200 | [diff] [blame] | 1020 | #define TARGET_BTRFS_IOC_INO_LOOKUP_USER TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 62) |
Filip Bozuta | 5d5d175 | 2020-09-05 18:38:02 +0200 | [diff] [blame] | 1021 | #endif |
Filip Bozuta | d6092e0 | 2020-08-23 21:50:07 +0200 | [diff] [blame] | 1022 | |
Cortland Tölva | 6c753a6 | 2018-10-08 09:35:20 -0700 | [diff] [blame] | 1023 | /* usb ioctls */ |
| 1024 | #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0) |
| 1025 | #define TARGET_USBDEVFS_BULK TARGET_IOWRU('U', 2) |
| 1026 | #define TARGET_USBDEVFS_RESETEP TARGET_IORU('U', 3) |
| 1027 | #define TARGET_USBDEVFS_SETINTERFACE TARGET_IORU('U', 4) |
| 1028 | #define TARGET_USBDEVFS_SETCONFIGURATION TARGET_IORU('U', 5) |
| 1029 | #define TARGET_USBDEVFS_GETDRIVER TARGET_IOWU('U', 8) |
Cortland Tölva | a133367 | 2018-10-08 09:35:21 -0700 | [diff] [blame] | 1030 | #define TARGET_USBDEVFS_SUBMITURB TARGET_IORU('U', 10) |
| 1031 | #define TARGET_USBDEVFS_DISCARDURB TARGET_IO('U', 11) |
| 1032 | #define TARGET_USBDEVFS_REAPURB TARGET_IOWU('U', 12) |
| 1033 | #define TARGET_USBDEVFS_REAPURBNDELAY TARGET_IOWU('U', 13) |
Cortland Tölva | 6c753a6 | 2018-10-08 09:35:20 -0700 | [diff] [blame] | 1034 | #define TARGET_USBDEVFS_DISCSIGNAL TARGET_IORU('U', 14) |
| 1035 | #define TARGET_USBDEVFS_CLAIMINTERFACE TARGET_IORU('U', 15) |
| 1036 | #define TARGET_USBDEVFS_RELEASEINTERFACE TARGET_IORU('U', 16) |
| 1037 | #define TARGET_USBDEVFS_CONNECTINFO TARGET_IOWU('U', 17) |
| 1038 | #define TARGET_USBDEVFS_IOCTL TARGET_IOWRU('U', 18) |
| 1039 | #define TARGET_USBDEVFS_HUB_PORTINFO TARGET_IORU('U', 19) |
| 1040 | #define TARGET_USBDEVFS_RESET TARGET_IO('U', 20) |
| 1041 | #define TARGET_USBDEVFS_CLEAR_HALT TARGET_IORU('U', 21) |
| 1042 | #define TARGET_USBDEVFS_DISCONNECT TARGET_IO('U', 22) |
| 1043 | #define TARGET_USBDEVFS_CONNECT TARGET_IO('U', 23) |
| 1044 | #define TARGET_USBDEVFS_CLAIM_PORT TARGET_IORU('U', 24) |
| 1045 | #define TARGET_USBDEVFS_RELEASE_PORT TARGET_IORU('U', 25) |
| 1046 | #define TARGET_USBDEVFS_GET_CAPABILITIES TARGET_IORU('U', 26) |
| 1047 | #define TARGET_USBDEVFS_DISCONNECT_CLAIM TARGET_IORU('U', 27) |
| 1048 | #define TARGET_USBDEVFS_DROP_PRIVILEGES TARGET_IOWU('U', 30) |
| 1049 | #define TARGET_USBDEVFS_GET_SPEED TARGET_IO('U', 31) |
| 1050 | |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1051 | /* cdrom commands */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 1052 | #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1053 | #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ |
| 1054 | #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 1055 | #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1056 | (struct cdrom_ti) */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 1057 | #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1058 | (struct cdrom_tochdr) */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 1059 | #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1060 | (struct cdrom_tocentry) */ |
| 1061 | #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ |
| 1062 | #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ |
| 1063 | #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 1064 | #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1065 | (struct cdrom_volctrl) */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 1066 | #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1067 | (struct cdrom_subchnl) */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 1068 | #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1069 | (struct cdrom_read) */ |
| 1070 | #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) |
| 1071 | (struct cdrom_read) */ |
| 1072 | #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ |
| 1073 | #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 1074 | #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session |
| 1075 | address of multi session disks |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1076 | (struct cdrom_multisession) */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 1077 | #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1078 | if available (struct cdrom_mcn) */ |
Veres Lajos | 67cc32e | 2015-09-08 22:45:14 +0100 | [diff] [blame] | 1079 | #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated, |
Dong Xu Wang | b4916d7 | 2011-11-22 18:06:17 +0800 | [diff] [blame] | 1080 | but here anyway for compatibility */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1081 | #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 1082 | #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1083 | (struct cdrom_volctrl) */ |
| 1084 | #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) |
| 1085 | (struct cdrom_read) */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 1086 | /* |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1087 | * These ioctls are used only used in aztcd.c and optcd.c |
| 1088 | */ |
| 1089 | #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ |
| 1090 | #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ |
ths | 3b46e62 | 2007-09-17 08:09:54 +0000 | [diff] [blame] | 1091 | |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1092 | /* |
ths | 3b46e62 | 2007-09-17 08:09:54 +0000 | [diff] [blame] | 1093 | * This ioctl is only used by the scsi-cd driver. |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1094 | It is for playing audio in logical block addressing mode. |
| 1095 | */ |
| 1096 | #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ |
| 1097 | |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 1098 | /* |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1099 | * These ioctls are only used in optcd.c |
| 1100 | */ |
| 1101 | #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ |
| 1102 | |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 1103 | /* |
| 1104 | * These ioctls are (now) only in ide-cd.c for controlling |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1105 | * drive spindown time. They should be implemented in the |
| 1106 | * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, |
| 1107 | * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... |
| 1108 | * -Erik |
| 1109 | */ |
| 1110 | #define TARGET_CDROMGETSPINDOWN 0x531d |
| 1111 | #define TARGET_CDROMSETSPINDOWN 0x531e |
| 1112 | |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 1113 | /* |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1114 | * These ioctls are implemented through the uniform CD-ROM driver |
| 1115 | * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM |
| 1116 | * drivers are eventually ported to the uniform CD-ROM driver interface. |
| 1117 | */ |
| 1118 | #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ |
| 1119 | #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ |
| 1120 | #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ |
| 1121 | #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ |
| 1122 | #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ |
| 1123 | #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ |
| 1124 | #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ |
| 1125 | #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ |
| 1126 | #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ |
| 1127 | #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ |
| 1128 | #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ |
| 1129 | #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ |
| 1130 | |
| 1131 | /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. |
| 1132 | * Future CDROM ioctls should be kept below 0x537F |
| 1133 | */ |
| 1134 | |
| 1135 | /* This ioctl is only used by sbpcd at the moment */ |
| 1136 | #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ |
| 1137 | /* conflict with SCSI_IOCTL_GET_IDLUN */ |
| 1138 | |
| 1139 | /* DVD-ROM Specific ioctls */ |
| 1140 | #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ |
| 1141 | #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ |
| 1142 | #define TARGET_DVD_AUTH 0x5392 /* Authentication */ |
| 1143 | |
| 1144 | #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ |
| 1145 | #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ |
| 1146 | #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ |
| 1147 | |
| 1148 | /* HD commands */ |
| 1149 | |
| 1150 | /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ |
| 1151 | #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ |
| 1152 | #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ |
| 1153 | #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1154 | #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ |
| 1155 | #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ |
| 1156 | #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ |
| 1157 | #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1158 | #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1159 | #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ |
| 1160 | |
| 1161 | /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ |
| 1162 | #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ |
| 1163 | #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ |
| 1164 | #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ |
| 1165 | #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ |
| 1166 | #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ |
| 1167 | #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ |
| 1168 | #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1169 | |
balrog | b800591 | 2008-04-26 14:44:49 +0000 | [diff] [blame] | 1170 | /* loop ioctls */ |
| 1171 | #define TARGET_LOOP_SET_FD 0x4C00 |
| 1172 | #define TARGET_LOOP_CLR_FD 0x4C01 |
| 1173 | #define TARGET_LOOP_SET_STATUS 0x4C02 |
| 1174 | #define TARGET_LOOP_GET_STATUS 0x4C03 |
| 1175 | #define TARGET_LOOP_SET_STATUS64 0x4C04 |
| 1176 | #define TARGET_LOOP_GET_STATUS64 0x4C05 |
| 1177 | #define TARGET_LOOP_CHANGE_FD 0x4C06 |
Andreas Schwab | 0a761ce | 2021-11-22 16:56:02 +0100 | [diff] [blame] | 1178 | #define TARGET_LOOP_SET_CAPACITY 0x4C07 |
| 1179 | #define TARGET_LOOP_SET_DIRECT_IO 0x4C08 |
| 1180 | #define TARGET_LOOP_SET_BLOCK_SIZE 0x4C09 |
| 1181 | #define TARGET_LOOP_CONFIGURE 0x4C0A |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1182 | |
Peter Maydell | 884cdc4 | 2016-07-04 17:06:17 +0100 | [diff] [blame] | 1183 | #define TARGET_LOOP_CTL_ADD 0x4C80 |
| 1184 | #define TARGET_LOOP_CTL_REMOVE 0x4C81 |
| 1185 | #define TARGET_LOOP_CTL_GET_FREE 0x4C82 |
| 1186 | |
Ulrich Hecht | f7680a5 | 2009-10-16 17:00:44 +0200 | [diff] [blame] | 1187 | /* fb ioctls */ |
| 1188 | #define TARGET_FBIOGET_VSCREENINFO 0x4600 |
| 1189 | #define TARGET_FBIOPUT_VSCREENINFO 0x4601 |
| 1190 | #define TARGET_FBIOGET_FSCREENINFO 0x4602 |
Cédric VINCENT | 12b81b7 | 2011-06-29 15:09:11 +0200 | [diff] [blame] | 1191 | #define TARGET_FBIOGETCMAP 0x4604 |
| 1192 | #define TARGET_FBIOPUTCMAP 0x4605 |
| 1193 | #define TARGET_FBIOPAN_DISPLAY 0x4606 |
| 1194 | #define TARGET_FBIOGET_CON2FBMAP 0x460F |
| 1195 | #define TARGET_FBIOPUT_CON2FBMAP 0x4610 |
Ulrich Hecht | f7680a5 | 2009-10-16 17:00:44 +0200 | [diff] [blame] | 1196 | |
| 1197 | /* vt ioctls */ |
| 1198 | #define TARGET_VT_OPENQRY 0x5600 |
| 1199 | #define TARGET_VT_GETSTATE 0x5603 |
| 1200 | #define TARGET_VT_ACTIVATE 0x5606 |
| 1201 | #define TARGET_VT_WAITACTIVE 0x5607 |
| 1202 | #define TARGET_VT_LOCKSWITCH 0x560b |
| 1203 | #define TARGET_VT_UNLOCKSWITCH 0x560c |
Cédric VINCENT | 774750c | 2011-06-29 15:09:10 +0200 | [diff] [blame] | 1204 | #define TARGET_VT_GETMODE 0x5601 |
| 1205 | #define TARGET_VT_SETMODE 0x5602 |
| 1206 | #define TARGET_VT_RELDISP 0x5605 |
| 1207 | #define TARGET_VT_DISALLOCATE 0x5608 |
Ulrich Hecht | f7680a5 | 2009-10-16 17:00:44 +0200 | [diff] [blame] | 1208 | |
Alexander Graf | 56e904e | 2012-01-31 18:42:06 +0100 | [diff] [blame] | 1209 | /* device mapper */ |
| 1210 | #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) |
| 1211 | #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) |
| 1212 | #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) |
| 1213 | #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) |
| 1214 | #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) |
| 1215 | #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) |
| 1216 | #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) |
| 1217 | #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) |
| 1218 | #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) |
| 1219 | #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) |
| 1220 | #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) |
| 1221 | #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) |
| 1222 | #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) |
| 1223 | #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) |
| 1224 | #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) |
| 1225 | #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) |
| 1226 | |
Chen Gang | e865b97 | 2020-06-05 09:32:21 +0800 | [diff] [blame] | 1227 | /* drm ioctls */ |
| 1228 | #define TARGET_DRM_IOCTL_VERSION TARGET_IOWRU('d', 0x00) |
| 1229 | |
Chen Gang | 913b03c | 2020-08-02 21:39:38 +0800 | [diff] [blame] | 1230 | /* drm i915 ioctls */ |
| 1231 | #define TARGET_DRM_IOCTL_I915_GETPARAM TARGET_IOWRU('d', 0x46) |
| 1232 | |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1233 | /* from asm/termbits.h */ |
| 1234 | |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1235 | #define TARGET_NCC 8 |
| 1236 | struct target_termio { |
| 1237 | unsigned short c_iflag; /* input mode flags */ |
| 1238 | unsigned short c_oflag; /* output mode flags */ |
| 1239 | unsigned short c_cflag; /* control mode flags */ |
| 1240 | unsigned short c_lflag; /* local mode flags */ |
| 1241 | unsigned char c_line; /* line discipline */ |
| 1242 | unsigned char c_cc[TARGET_NCC]; /* control characters */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1243 | }; |
| 1244 | |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1245 | struct target_winsize { |
| 1246 | unsigned short ws_row; |
| 1247 | unsigned short ws_col; |
| 1248 | unsigned short ws_xpixel; |
| 1249 | unsigned short ws_ypixel; |
| 1250 | }; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1251 | |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1252 | #include "termbits.h" |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1253 | |
Helge Deller | d124853 | 2022-09-24 13:44:55 +0200 | [diff] [blame] | 1254 | #if defined(TARGET_MIPS) || defined(TARGET_XTENSA) |
Paul Brook | 9e0b74a | 2010-06-16 13:03:51 +0100 | [diff] [blame] | 1255 | #define TARGET_PROT_SEM 0x10 |
| 1256 | #else |
| 1257 | #define TARGET_PROT_SEM 0x08 |
| 1258 | #endif |
| 1259 | |
Richard Henderson | be5d6f4 | 2020-10-21 10:37:39 -0700 | [diff] [blame] | 1260 | #ifdef TARGET_AARCH64 |
| 1261 | #define TARGET_PROT_BTI 0x10 |
Richard Henderson | d109b46 | 2021-02-12 10:48:55 -0800 | [diff] [blame] | 1262 | #define TARGET_PROT_MTE 0x20 |
Richard Henderson | be5d6f4 | 2020-10-21 10:37:39 -0700 | [diff] [blame] | 1263 | #endif |
| 1264 | |
aurel32 | e44a3e7 | 2008-09-29 17:23:09 +0000 | [diff] [blame] | 1265 | /* Common */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1266 | #define TARGET_MAP_SHARED 0x01 /* Share changes */ |
| 1267 | #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ |
Helge Deller | e65be6a | 2017-10-31 13:53:56 +0100 | [diff] [blame] | 1268 | #if defined(TARGET_HPPA) |
| 1269 | #define TARGET_MAP_TYPE 0x03 /* Mask for type of mapping */ |
| 1270 | #else |
| 1271 | #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ |
| 1272 | #endif |
aurel32 | e44a3e7 | 2008-09-29 17:23:09 +0000 | [diff] [blame] | 1273 | |
| 1274 | /* Target specific */ |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1275 | #if defined(TARGET_MIPS) |
aurel32 | e44a3e7 | 2008-09-29 17:23:09 +0000 | [diff] [blame] | 1276 | #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1277 | #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ |
| 1278 | #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ |
| 1279 | #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ |
| 1280 | #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ |
| 1281 | #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ |
| 1282 | #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1283 | #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ |
| 1284 | #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ |
Helge Deller | 541e169 | 2017-10-31 13:53:58 +0100 | [diff] [blame] | 1285 | #define TARGET_MAP_STACK 0x40000 /* ignored */ |
| 1286 | #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ |
aurel32 | e44a3e7 | 2008-09-29 17:23:09 +0000 | [diff] [blame] | 1287 | #elif defined(TARGET_PPC) |
| 1288 | #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1289 | #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1290 | #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ |
| 1291 | #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ |
| 1292 | #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ |
j_mayer | 7ec93196 | 2007-09-18 21:54:57 +0000 | [diff] [blame] | 1293 | #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ |
| 1294 | #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ |
aurel32 | e44a3e7 | 2008-09-29 17:23:09 +0000 | [diff] [blame] | 1295 | #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
| 1296 | #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ |
Helge Deller | 541e169 | 2017-10-31 13:53:58 +0100 | [diff] [blame] | 1297 | #define TARGET_MAP_STACK 0x20000 /* ignored */ |
| 1298 | #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ |
aurel32 | e44a3e7 | 2008-09-29 17:23:09 +0000 | [diff] [blame] | 1299 | #elif defined(TARGET_ALPHA) |
| 1300 | #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ |
| 1301 | #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ |
| 1302 | #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ |
| 1303 | #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ |
| 1304 | #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ |
| 1305 | #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ |
| 1306 | #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ |
| 1307 | #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ |
| 1308 | #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ |
Helge Deller | 541e169 | 2017-10-31 13:53:58 +0100 | [diff] [blame] | 1309 | #define TARGET_MAP_STACK 0x80000 /* ignored */ |
| 1310 | #define TARGET_MAP_HUGETLB 0x100000 /* create a huge page mapping */ |
Richard Henderson | a10d1e5 | 2016-12-15 09:56:41 -0800 | [diff] [blame] | 1311 | #elif defined(TARGET_HPPA) |
| 1312 | #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ |
| 1313 | #define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly */ |
| 1314 | #define TARGET_MAP_GROWSDOWN 0x08000 /* stack-like segment */ |
| 1315 | #define TARGET_MAP_DENYWRITE 0x00800 /* ETXTBSY */ |
| 1316 | #define TARGET_MAP_EXECUTABLE 0x01000 /* mark it as an executable */ |
| 1317 | #define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */ |
| 1318 | #define TARGET_MAP_NORESERVE 0x04000 /* no check for reservations */ |
| 1319 | #define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetables */ |
| 1320 | #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ |
Helge Deller | 541e169 | 2017-10-31 13:53:58 +0100 | [diff] [blame] | 1321 | #define TARGET_MAP_STACK 0x40000 /* ignored */ |
| 1322 | #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ |
Max Filippov | ba7651f | 2017-01-25 10:54:11 -0800 | [diff] [blame] | 1323 | #elif defined(TARGET_XTENSA) |
| 1324 | #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ |
| 1325 | #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ |
| 1326 | #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ |
| 1327 | #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ |
| 1328 | #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ |
| 1329 | #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ |
| 1330 | #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ |
| 1331 | #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ |
| 1332 | #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ |
| 1333 | #define TARGET_MAP_STACK 0x40000 |
| 1334 | #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ |
j_mayer | 7ec93196 | 2007-09-18 21:54:57 +0000 | [diff] [blame] | 1335 | #else |
aurel32 | e44a3e7 | 2008-09-29 17:23:09 +0000 | [diff] [blame] | 1336 | #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ |
| 1337 | #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ |
| 1338 | #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ |
| 1339 | #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ |
| 1340 | #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1341 | #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ |
| 1342 | #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1343 | #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
| 1344 | #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ |
Helge Deller | 541e169 | 2017-10-31 13:53:58 +0100 | [diff] [blame] | 1345 | #define TARGET_MAP_STACK 0x20000 /* ignored */ |
| 1346 | #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ |
Mike Frysinger | 906c1b8 | 2011-02-07 01:05:52 -0500 | [diff] [blame] | 1347 | #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ |
j_mayer | 7ec93196 | 2007-09-18 21:54:57 +0000 | [diff] [blame] | 1348 | #endif |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1349 | |
Alexander Graf | 0970119 | 2013-09-03 20:12:15 +0100 | [diff] [blame] | 1350 | #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ |
| 1351 | || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ |
Peter Maydell | daa4374 | 2018-03-08 14:47:32 +0000 | [diff] [blame] | 1352 | || defined(TARGET_CRIS) |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1353 | #define TARGET_STAT_HAVE_NSEC |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1354 | struct target_stat { |
| 1355 | unsigned short st_dev; |
| 1356 | unsigned short __pad1; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1357 | abi_ulong st_ino; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1358 | unsigned short st_mode; |
| 1359 | unsigned short st_nlink; |
| 1360 | unsigned short st_uid; |
| 1361 | unsigned short st_gid; |
| 1362 | unsigned short st_rdev; |
| 1363 | unsigned short __pad2; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1364 | abi_ulong st_size; |
| 1365 | abi_ulong st_blksize; |
| 1366 | abi_ulong st_blocks; |
| 1367 | abi_ulong target_st_atime; |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1368 | abi_ulong target_st_atime_nsec; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1369 | abi_ulong target_st_mtime; |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1370 | abi_ulong target_st_mtime_nsec; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1371 | abi_ulong target_st_ctime; |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1372 | abi_ulong target_st_ctime_nsec; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1373 | abi_ulong __unused4; |
| 1374 | abi_ulong __unused5; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1375 | }; |
| 1376 | |
| 1377 | /* This matches struct stat64 in glibc2.1, hence the absolutely |
| 1378 | * insane amounts of padding around dev_t's. |
| 1379 | */ |
Stefan Weil | 20d155b | 2013-10-30 22:52:24 +0100 | [diff] [blame] | 1380 | #define TARGET_HAS_STRUCT_STAT64 |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1381 | struct target_stat64 { |
| 1382 | unsigned short st_dev; |
| 1383 | unsigned char __pad0[10]; |
| 1384 | |
| 1385 | #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1386 | abi_ulong __st_ino; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1387 | |
| 1388 | unsigned int st_mode; |
| 1389 | unsigned int st_nlink; |
| 1390 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1391 | abi_ulong st_uid; |
| 1392 | abi_ulong st_gid; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1393 | |
| 1394 | unsigned short st_rdev; |
| 1395 | unsigned char __pad3[10]; |
| 1396 | |
| 1397 | long long st_size; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1398 | abi_ulong st_blksize; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1399 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1400 | abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ |
| 1401 | abi_ulong __pad4; /* future possible st_blocks high bits */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1402 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1403 | abi_ulong target_st_atime; |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1404 | abi_ulong target_st_atime_nsec; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1405 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1406 | abi_ulong target_st_mtime; |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1407 | abi_ulong target_st_mtime_nsec; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1408 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1409 | abi_ulong target_st_ctime; |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1410 | abi_ulong target_st_ctime_nsec; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1411 | |
| 1412 | unsigned long long st_ino; |
Stefan Weil | 541dc0d | 2011-08-31 12:38:01 +0200 | [diff] [blame] | 1413 | } QEMU_PACKED; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1414 | |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 1415 | #ifdef TARGET_ARM |
Stefan Weil | 20d155b | 2013-10-30 22:52:24 +0100 | [diff] [blame] | 1416 | #define TARGET_HAS_STRUCT_STAT64 |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 1417 | struct target_eabi_stat64 { |
| 1418 | unsigned long long st_dev; |
| 1419 | unsigned int __pad1; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1420 | abi_ulong __st_ino; |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 1421 | unsigned int st_mode; |
| 1422 | unsigned int st_nlink; |
| 1423 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1424 | abi_ulong st_uid; |
| 1425 | abi_ulong st_gid; |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 1426 | |
| 1427 | unsigned long long st_rdev; |
| 1428 | unsigned int __pad2[2]; |
| 1429 | |
| 1430 | long long st_size; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1431 | abi_ulong st_blksize; |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 1432 | unsigned int __pad3; |
| 1433 | unsigned long long st_blocks; |
| 1434 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1435 | abi_ulong target_st_atime; |
| 1436 | abi_ulong target_st_atime_nsec; |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 1437 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1438 | abi_ulong target_st_mtime; |
| 1439 | abi_ulong target_st_mtime_nsec; |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 1440 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1441 | abi_ulong target_st_ctime; |
| 1442 | abi_ulong target_st_ctime_nsec; |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 1443 | |
| 1444 | unsigned long long st_ino; |
Stefan Weil | 541dc0d | 2011-08-31 12:38:01 +0200 | [diff] [blame] | 1445 | } QEMU_PACKED; |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 1446 | #endif |
| 1447 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1448 | #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) |
blueswir1 | 1b8dd64 | 2007-07-08 10:08:24 +0000 | [diff] [blame] | 1449 | struct target_stat { |
| 1450 | unsigned int st_dev; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1451 | abi_ulong st_ino; |
blueswir1 | 1b8dd64 | 2007-07-08 10:08:24 +0000 | [diff] [blame] | 1452 | unsigned int st_mode; |
| 1453 | unsigned int st_nlink; |
| 1454 | unsigned int st_uid; |
| 1455 | unsigned int st_gid; |
| 1456 | unsigned int st_rdev; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1457 | abi_long st_size; |
| 1458 | abi_long target_st_atime; |
| 1459 | abi_long target_st_mtime; |
| 1460 | abi_long target_st_ctime; |
| 1461 | abi_long st_blksize; |
| 1462 | abi_long st_blocks; |
| 1463 | abi_ulong __unused4[2]; |
blueswir1 | 1b8dd64 | 2007-07-08 10:08:24 +0000 | [diff] [blame] | 1464 | }; |
| 1465 | |
Stefan Weil | 20d155b | 2013-10-30 22:52:24 +0100 | [diff] [blame] | 1466 | #define TARGET_HAS_STRUCT_STAT64 |
blueswir1 | 1b8dd64 | 2007-07-08 10:08:24 +0000 | [diff] [blame] | 1467 | struct target_stat64 { |
| 1468 | unsigned char __pad0[6]; |
| 1469 | unsigned short st_dev; |
| 1470 | |
| 1471 | uint64_t st_ino; |
| 1472 | uint64_t st_nlink; |
| 1473 | |
| 1474 | unsigned int st_mode; |
| 1475 | |
| 1476 | unsigned int st_uid; |
| 1477 | unsigned int st_gid; |
| 1478 | |
| 1479 | unsigned char __pad2[6]; |
| 1480 | unsigned short st_rdev; |
| 1481 | |
| 1482 | int64_t st_size; |
| 1483 | int64_t st_blksize; |
| 1484 | |
| 1485 | unsigned char __pad4[4]; |
| 1486 | unsigned int st_blocks; |
| 1487 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1488 | abi_ulong target_st_atime; |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1489 | abi_ulong target_st_atime_nsec; |
blueswir1 | 1b8dd64 | 2007-07-08 10:08:24 +0000 | [diff] [blame] | 1490 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1491 | abi_ulong target_st_mtime; |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1492 | abi_ulong target_st_mtime_nsec; |
blueswir1 | 1b8dd64 | 2007-07-08 10:08:24 +0000 | [diff] [blame] | 1493 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1494 | abi_ulong target_st_ctime; |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1495 | abi_ulong target_st_ctime_nsec; |
blueswir1 | 1b8dd64 | 2007-07-08 10:08:24 +0000 | [diff] [blame] | 1496 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1497 | abi_ulong __unused4[3]; |
blueswir1 | 1b8dd64 | 2007-07-08 10:08:24 +0000 | [diff] [blame] | 1498 | }; |
| 1499 | |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1500 | #elif defined(TARGET_SPARC) |
| 1501 | |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1502 | #define TARGET_STAT_HAVE_NSEC |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1503 | struct target_stat { |
| 1504 | unsigned short st_dev; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1505 | abi_ulong st_ino; |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1506 | unsigned short st_mode; |
| 1507 | short st_nlink; |
| 1508 | unsigned short st_uid; |
| 1509 | unsigned short st_gid; |
| 1510 | unsigned short st_rdev; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1511 | abi_long st_size; |
| 1512 | abi_long target_st_atime; |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1513 | abi_ulong target_st_atime_nsec; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1514 | abi_long target_st_mtime; |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1515 | abi_ulong target_st_mtime_nsec; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1516 | abi_long target_st_ctime; |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1517 | abi_ulong target_st_ctime_nsec; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1518 | abi_long st_blksize; |
| 1519 | abi_long st_blocks; |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1520 | abi_ulong __unused1[2]; |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1521 | }; |
| 1522 | |
Stefan Weil | 20d155b | 2013-10-30 22:52:24 +0100 | [diff] [blame] | 1523 | #define TARGET_HAS_STRUCT_STAT64 |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1524 | struct target_stat64 { |
| 1525 | unsigned char __pad0[6]; |
| 1526 | unsigned short st_dev; |
| 1527 | |
| 1528 | uint64_t st_ino; |
| 1529 | |
| 1530 | unsigned int st_mode; |
| 1531 | unsigned int st_nlink; |
| 1532 | |
| 1533 | unsigned int st_uid; |
| 1534 | unsigned int st_gid; |
| 1535 | |
| 1536 | unsigned char __pad2[6]; |
| 1537 | unsigned short st_rdev; |
| 1538 | |
| 1539 | unsigned char __pad3[8]; |
| 1540 | |
| 1541 | int64_t st_size; |
| 1542 | unsigned int st_blksize; |
| 1543 | |
| 1544 | unsigned char __pad4[8]; |
| 1545 | unsigned int st_blocks; |
| 1546 | |
| 1547 | unsigned int target_st_atime; |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1548 | unsigned int target_st_atime_nsec; |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1549 | |
| 1550 | unsigned int target_st_mtime; |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1551 | unsigned int target_st_mtime_nsec; |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1552 | |
| 1553 | unsigned int target_st_ctime; |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1554 | unsigned int target_st_ctime_nsec; |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1555 | |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1556 | unsigned int __unused1; |
| 1557 | unsigned int __unused2; |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1558 | }; |
| 1559 | |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 1560 | #elif defined(TARGET_PPC) |
| 1561 | |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1562 | #define TARGET_STAT_HAVE_NSEC |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 1563 | struct target_stat { |
j_mayer | e32448e | 2007-12-10 08:24:59 +0000 | [diff] [blame] | 1564 | abi_ulong st_dev; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1565 | abi_ulong st_ino; |
Thomas Huth | 74154d7 | 2022-01-12 11:27:22 +0000 | [diff] [blame] | 1566 | #if defined(TARGET_PPC64) |
j_mayer | e32448e | 2007-12-10 08:24:59 +0000 | [diff] [blame] | 1567 | abi_ulong st_nlink; |
j_mayer | 325e651 | 2007-11-21 13:06:54 +0000 | [diff] [blame] | 1568 | unsigned int st_mode; |
| 1569 | #else |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 1570 | unsigned int st_mode; |
| 1571 | unsigned short st_nlink; |
j_mayer | 325e651 | 2007-11-21 13:06:54 +0000 | [diff] [blame] | 1572 | #endif |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 1573 | unsigned int st_uid; |
| 1574 | unsigned int st_gid; |
j_mayer | e32448e | 2007-12-10 08:24:59 +0000 | [diff] [blame] | 1575 | abi_ulong st_rdev; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1576 | abi_ulong st_size; |
| 1577 | abi_ulong st_blksize; |
| 1578 | abi_ulong st_blocks; |
| 1579 | abi_ulong target_st_atime; |
j_mayer | e32448e | 2007-12-10 08:24:59 +0000 | [diff] [blame] | 1580 | abi_ulong target_st_atime_nsec; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1581 | abi_ulong target_st_mtime; |
j_mayer | e32448e | 2007-12-10 08:24:59 +0000 | [diff] [blame] | 1582 | abi_ulong target_st_mtime_nsec; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1583 | abi_ulong target_st_ctime; |
j_mayer | e32448e | 2007-12-10 08:24:59 +0000 | [diff] [blame] | 1584 | abi_ulong target_st_ctime_nsec; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1585 | abi_ulong __unused4; |
| 1586 | abi_ulong __unused5; |
Thomas Huth | 74154d7 | 2022-01-12 11:27:22 +0000 | [diff] [blame] | 1587 | #if defined(TARGET_PPC64) |
j_mayer | 325e651 | 2007-11-21 13:06:54 +0000 | [diff] [blame] | 1588 | abi_ulong __unused6; |
| 1589 | #endif |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 1590 | }; |
| 1591 | |
Thomas Huth | 74154d7 | 2022-01-12 11:27:22 +0000 | [diff] [blame] | 1592 | #if !defined(TARGET_PPC64) |
Stefan Weil | 20d155b | 2013-10-30 22:52:24 +0100 | [diff] [blame] | 1593 | #define TARGET_HAS_STRUCT_STAT64 |
Stefan Weil | 541dc0d | 2011-08-31 12:38:01 +0200 | [diff] [blame] | 1594 | struct QEMU_PACKED target_stat64 { |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 1595 | unsigned long long st_dev; |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 1596 | unsigned long long st_ino; |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1597 | unsigned int st_mode; |
| 1598 | unsigned int st_nlink; |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 1599 | unsigned int st_uid; |
| 1600 | unsigned int st_gid; |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1601 | unsigned long long st_rdev; |
aurel32 | e1ce5e4 | 2009-01-30 19:48:32 +0000 | [diff] [blame] | 1602 | unsigned long long __pad0; |
j_mayer | e32448e | 2007-12-10 08:24:59 +0000 | [diff] [blame] | 1603 | long long st_size; |
| 1604 | int st_blksize; |
aurel32 | e1ce5e4 | 2009-01-30 19:48:32 +0000 | [diff] [blame] | 1605 | unsigned int __pad1; |
Max Filippov | 61322e9 | 2009-09-01 23:27:47 +0400 | [diff] [blame] | 1606 | long long st_blocks; /* Number 512-byte blocks allocated. */ |
j_mayer | e32448e | 2007-12-10 08:24:59 +0000 | [diff] [blame] | 1607 | int target_st_atime; |
| 1608 | unsigned int target_st_atime_nsec; |
| 1609 | int target_st_mtime; |
| 1610 | unsigned int target_st_mtime_nsec; |
| 1611 | int target_st_ctime; |
| 1612 | unsigned int target_st_ctime_nsec; |
| 1613 | unsigned int __unused4; |
| 1614 | unsigned int __unused5; |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 1615 | }; |
Stefan Weil | 20d155b | 2013-10-30 22:52:24 +0100 | [diff] [blame] | 1616 | #endif |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 1617 | |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 1618 | #elif defined(TARGET_MICROBLAZE) |
| 1619 | |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1620 | #define TARGET_STAT_HAVE_NSEC |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 1621 | struct target_stat { |
| 1622 | abi_ulong st_dev; |
| 1623 | abi_ulong st_ino; |
| 1624 | unsigned int st_mode; |
| 1625 | unsigned short st_nlink; |
| 1626 | unsigned int st_uid; |
| 1627 | unsigned int st_gid; |
| 1628 | abi_ulong st_rdev; |
| 1629 | abi_ulong st_size; |
| 1630 | abi_ulong st_blksize; |
| 1631 | abi_ulong st_blocks; |
| 1632 | abi_ulong target_st_atime; |
| 1633 | abi_ulong target_st_atime_nsec; |
| 1634 | abi_ulong target_st_mtime; |
| 1635 | abi_ulong target_st_mtime_nsec; |
| 1636 | abi_ulong target_st_ctime; |
| 1637 | abi_ulong target_st_ctime_nsec; |
| 1638 | abi_ulong __unused4; |
| 1639 | abi_ulong __unused5; |
| 1640 | }; |
| 1641 | |
| 1642 | /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ |
Stefan Weil | 20d155b | 2013-10-30 22:52:24 +0100 | [diff] [blame] | 1643 | #define TARGET_HAS_STRUCT_STAT64 |
Stefan Weil | 541dc0d | 2011-08-31 12:38:01 +0200 | [diff] [blame] | 1644 | struct QEMU_PACKED target_stat64 { |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 1645 | uint64_t st_dev; |
Edgar E. Iglesias | a523eb0 | 2010-08-09 10:13:33 +0200 | [diff] [blame] | 1646 | #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 |
| 1647 | uint32_t pad0; |
| 1648 | uint32_t __st_ino; |
| 1649 | |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 1650 | uint32_t st_mode; |
| 1651 | uint32_t st_nlink; |
| 1652 | uint32_t st_uid; |
| 1653 | uint32_t st_gid; |
| 1654 | uint64_t st_rdev; |
Edgar E. Iglesias | 21ebeb2 | 2009-06-23 19:19:33 +0200 | [diff] [blame] | 1655 | uint64_t __pad1; |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 1656 | |
| 1657 | int64_t st_size; |
Edgar E. Iglesias | 21ebeb2 | 2009-06-23 19:19:33 +0200 | [diff] [blame] | 1658 | int32_t st_blksize; |
| 1659 | uint32_t __pad2; |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 1660 | int64_t st_blocks; /* Number 512-byte blocks allocated. */ |
| 1661 | |
| 1662 | int target_st_atime; |
Edgar E. Iglesias | a523eb0 | 2010-08-09 10:13:33 +0200 | [diff] [blame] | 1663 | unsigned int target_st_atime_nsec; |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 1664 | int target_st_mtime; |
Edgar E. Iglesias | a523eb0 | 2010-08-09 10:13:33 +0200 | [diff] [blame] | 1665 | unsigned int target_st_mtime_nsec; |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 1666 | int target_st_ctime; |
Edgar E. Iglesias | a523eb0 | 2010-08-09 10:13:33 +0200 | [diff] [blame] | 1667 | unsigned int target_st_ctime_nsec; |
| 1668 | uint64_t st_ino; |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 1669 | }; |
| 1670 | |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1671 | #elif defined(TARGET_M68K) |
| 1672 | |
| 1673 | struct target_stat { |
| 1674 | unsigned short st_dev; |
| 1675 | unsigned short __pad1; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1676 | abi_ulong st_ino; |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1677 | unsigned short st_mode; |
| 1678 | unsigned short st_nlink; |
| 1679 | unsigned short st_uid; |
| 1680 | unsigned short st_gid; |
| 1681 | unsigned short st_rdev; |
| 1682 | unsigned short __pad2; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1683 | abi_ulong st_size; |
| 1684 | abi_ulong st_blksize; |
| 1685 | abi_ulong st_blocks; |
| 1686 | abi_ulong target_st_atime; |
| 1687 | abi_ulong __unused1; |
| 1688 | abi_ulong target_st_mtime; |
| 1689 | abi_ulong __unused2; |
| 1690 | abi_ulong target_st_ctime; |
| 1691 | abi_ulong __unused3; |
| 1692 | abi_ulong __unused4; |
| 1693 | abi_ulong __unused5; |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1694 | }; |
| 1695 | |
| 1696 | /* This matches struct stat64 in glibc2.1, hence the absolutely |
| 1697 | * insane amounts of padding around dev_t's. |
| 1698 | */ |
Stefan Weil | 20d155b | 2013-10-30 22:52:24 +0100 | [diff] [blame] | 1699 | #define TARGET_HAS_STRUCT_STAT64 |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1700 | struct target_stat64 { |
| 1701 | unsigned long long st_dev; |
| 1702 | unsigned char __pad1[2]; |
| 1703 | |
| 1704 | #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1705 | abi_ulong __st_ino; |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1706 | |
| 1707 | unsigned int st_mode; |
| 1708 | unsigned int st_nlink; |
| 1709 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1710 | abi_ulong st_uid; |
| 1711 | abi_ulong st_gid; |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1712 | |
| 1713 | unsigned long long st_rdev; |
| 1714 | unsigned char __pad3[2]; |
| 1715 | |
| 1716 | long long st_size; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1717 | abi_ulong st_blksize; |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1718 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1719 | abi_ulong __pad4; /* future possible st_blocks high bits */ |
| 1720 | abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1721 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1722 | abi_ulong target_st_atime; |
| 1723 | abi_ulong target_st_atime_nsec; |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1724 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1725 | abi_ulong target_st_mtime; |
| 1726 | abi_ulong target_st_mtime_nsec; |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1727 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1728 | abi_ulong target_st_ctime; |
| 1729 | abi_ulong target_st_ctime_nsec; |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1730 | |
| 1731 | unsigned long long st_ino; |
Stefan Weil | 541dc0d | 2011-08-31 12:38:01 +0200 | [diff] [blame] | 1732 | } QEMU_PACKED; |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1733 | |
ths | d26bc21 | 2007-11-08 18:05:37 +0000 | [diff] [blame] | 1734 | #elif defined(TARGET_ABI_MIPSN64) |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1735 | |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1736 | #define TARGET_STAT_HAVE_NSEC |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1737 | /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ |
| 1738 | struct target_stat { |
| 1739 | unsigned int st_dev; |
| 1740 | unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ |
| 1741 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1742 | abi_ulong st_ino; |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1743 | |
| 1744 | unsigned int st_mode; |
| 1745 | unsigned int st_nlink; |
| 1746 | |
| 1747 | int st_uid; |
| 1748 | int st_gid; |
| 1749 | |
| 1750 | unsigned int st_rdev; |
| 1751 | unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ |
| 1752 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1753 | abi_ulong st_size; |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1754 | |
| 1755 | /* |
| 1756 | * Actually this should be timestruc_t st_atime, st_mtime and st_ctime |
| 1757 | * but we don't have it under Linux. |
| 1758 | */ |
| 1759 | unsigned int target_st_atime; |
| 1760 | unsigned int target_st_atime_nsec; |
| 1761 | |
| 1762 | unsigned int target_st_mtime; |
| 1763 | unsigned int target_st_mtime_nsec; |
| 1764 | |
| 1765 | unsigned int target_st_ctime; |
| 1766 | unsigned int target_st_ctime_nsec; |
| 1767 | |
| 1768 | unsigned int st_blksize; |
| 1769 | unsigned int st_pad2; |
| 1770 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1771 | abi_ulong st_blocks; |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1772 | }; |
| 1773 | |
ths | d26bc21 | 2007-11-08 18:05:37 +0000 | [diff] [blame] | 1774 | #elif defined(TARGET_ABI_MIPSN32) |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1775 | |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1776 | #define TARGET_STAT_HAVE_NSEC |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1777 | struct target_stat { |
Leon Alrae | 1ab2aea | 2015-01-30 15:08:05 +0000 | [diff] [blame] | 1778 | abi_ulong st_dev; |
| 1779 | abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ |
| 1780 | uint64_t st_ino; |
| 1781 | unsigned int st_mode; |
| 1782 | unsigned int st_nlink; |
| 1783 | int st_uid; |
| 1784 | int st_gid; |
| 1785 | abi_ulong st_rdev; |
| 1786 | abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ |
| 1787 | int64_t st_size; |
| 1788 | abi_long target_st_atime; |
| 1789 | abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ |
| 1790 | abi_long target_st_mtime; |
| 1791 | abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ |
| 1792 | abi_long target_st_ctime; |
| 1793 | abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ |
| 1794 | abi_ulong st_blksize; |
| 1795 | abi_ulong st_pad2; |
| 1796 | int64_t st_blocks; |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1797 | }; |
| 1798 | |
ths | d26bc21 | 2007-11-08 18:05:37 +0000 | [diff] [blame] | 1799 | #elif defined(TARGET_ABI_MIPSO32) |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1800 | |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1801 | #define TARGET_STAT_HAVE_NSEC |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1802 | struct target_stat { |
| 1803 | unsigned st_dev; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1804 | abi_long st_pad1[3]; /* Reserved for network id */ |
| 1805 | abi_ulong st_ino; |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1806 | unsigned int st_mode; |
| 1807 | unsigned int st_nlink; |
| 1808 | int st_uid; |
| 1809 | int st_gid; |
| 1810 | unsigned st_rdev; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1811 | abi_long st_pad2[2]; |
| 1812 | abi_long st_size; |
| 1813 | abi_long st_pad3; |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1814 | /* |
| 1815 | * Actually this should be timestruc_t st_atime, st_mtime and st_ctime |
| 1816 | * but we don't have it under Linux. |
| 1817 | */ |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1818 | abi_long target_st_atime; |
| 1819 | abi_long target_st_atime_nsec; |
| 1820 | abi_long target_st_mtime; |
| 1821 | abi_long target_st_mtime_nsec; |
| 1822 | abi_long target_st_ctime; |
| 1823 | abi_long target_st_ctime_nsec; |
| 1824 | abi_long st_blksize; |
| 1825 | abi_long st_blocks; |
| 1826 | abi_long st_pad4[14]; |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1827 | }; |
| 1828 | |
| 1829 | /* |
| 1830 | * This matches struct stat64 in glibc2.1, hence the absolutely insane |
| 1831 | * amounts of padding around dev_t's. The memory layout is the same as of |
| 1832 | * struct stat of the 64-bit kernel. |
| 1833 | */ |
| 1834 | |
Stefan Weil | 20d155b | 2013-10-30 22:52:24 +0100 | [diff] [blame] | 1835 | #define TARGET_HAS_STRUCT_STAT64 |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1836 | struct target_stat64 { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1837 | abi_ulong st_dev; |
| 1838 | abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1839 | |
| 1840 | uint64_t st_ino; |
| 1841 | |
| 1842 | unsigned int st_mode; |
| 1843 | unsigned int st_nlink; |
| 1844 | |
| 1845 | int st_uid; |
| 1846 | int st_gid; |
| 1847 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1848 | abi_ulong st_rdev; |
| 1849 | abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1850 | |
| 1851 | int64_t st_size; |
| 1852 | |
| 1853 | /* |
| 1854 | * Actually this should be timestruc_t st_atime, st_mtime and st_ctime |
| 1855 | * but we don't have it under Linux. |
| 1856 | */ |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1857 | abi_long target_st_atime; |
| 1858 | abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1859 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1860 | abi_long target_st_mtime; |
| 1861 | abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1862 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1863 | abi_long target_st_ctime; |
| 1864 | abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1865 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1866 | abi_ulong st_blksize; |
| 1867 | abi_ulong st_pad2; |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1868 | |
| 1869 | int64_t st_blocks; |
| 1870 | }; |
j_mayer | 7a3148a | 2007-04-05 07:13:51 +0000 | [diff] [blame] | 1871 | |
| 1872 | #elif defined(TARGET_ALPHA) |
| 1873 | |
| 1874 | struct target_stat { |
| 1875 | unsigned int st_dev; |
| 1876 | unsigned int st_ino; |
| 1877 | unsigned int st_mode; |
| 1878 | unsigned int st_nlink; |
| 1879 | unsigned int st_uid; |
| 1880 | unsigned int st_gid; |
| 1881 | unsigned int st_rdev; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1882 | abi_long st_size; |
| 1883 | abi_ulong target_st_atime; |
| 1884 | abi_ulong target_st_mtime; |
| 1885 | abi_ulong target_st_ctime; |
j_mayer | 7a3148a | 2007-04-05 07:13:51 +0000 | [diff] [blame] | 1886 | unsigned int st_blksize; |
| 1887 | unsigned int st_blocks; |
| 1888 | unsigned int st_flags; |
| 1889 | unsigned int st_gen; |
| 1890 | }; |
| 1891 | |
Stefan Weil | 20d155b | 2013-10-30 22:52:24 +0100 | [diff] [blame] | 1892 | #define TARGET_HAS_STRUCT_STAT64 |
j_mayer | 7a3148a | 2007-04-05 07:13:51 +0000 | [diff] [blame] | 1893 | struct target_stat64 { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1894 | abi_ulong st_dev; |
| 1895 | abi_ulong st_ino; |
| 1896 | abi_ulong st_rdev; |
| 1897 | abi_long st_size; |
| 1898 | abi_ulong st_blocks; |
j_mayer | 7a3148a | 2007-04-05 07:13:51 +0000 | [diff] [blame] | 1899 | |
| 1900 | unsigned int st_mode; |
| 1901 | unsigned int st_uid; |
| 1902 | unsigned int st_gid; |
| 1903 | unsigned int st_blksize; |
| 1904 | unsigned int st_nlink; |
| 1905 | unsigned int __pad0; |
| 1906 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1907 | abi_ulong target_st_atime; |
| 1908 | abi_ulong target_st_atime_nsec; |
| 1909 | abi_ulong target_st_mtime; |
| 1910 | abi_ulong target_st_mtime_nsec; |
| 1911 | abi_ulong target_st_ctime; |
| 1912 | abi_ulong target_st_ctime_nsec; |
| 1913 | abi_long __unused[3]; |
j_mayer | 7a3148a | 2007-04-05 07:13:51 +0000 | [diff] [blame] | 1914 | }; |
| 1915 | |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1916 | #elif defined(TARGET_SH4) |
| 1917 | |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1918 | #define TARGET_STAT_HAVE_NSEC |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1919 | struct target_stat { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1920 | abi_ulong st_dev; |
| 1921 | abi_ulong st_ino; |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1922 | unsigned short st_mode; |
| 1923 | unsigned short st_nlink; |
| 1924 | unsigned short st_uid; |
| 1925 | unsigned short st_gid; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1926 | abi_ulong st_rdev; |
| 1927 | abi_ulong st_size; |
| 1928 | abi_ulong st_blksize; |
| 1929 | abi_ulong st_blocks; |
| 1930 | abi_ulong target_st_atime; |
| 1931 | abi_ulong target_st_atime_nsec; |
| 1932 | abi_ulong target_st_mtime; |
| 1933 | abi_ulong target_st_mtime_nsec; |
| 1934 | abi_ulong target_st_ctime; |
| 1935 | abi_ulong target_st_ctime_nsec; |
| 1936 | abi_ulong __unused4; |
| 1937 | abi_ulong __unused5; |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1938 | }; |
| 1939 | |
| 1940 | /* This matches struct stat64 in glibc2.1, hence the absolutely |
| 1941 | * insane amounts of padding around dev_t's. |
| 1942 | */ |
Stefan Weil | 20d155b | 2013-10-30 22:52:24 +0100 | [diff] [blame] | 1943 | #define TARGET_HAS_STRUCT_STAT64 |
Stefan Weil | 541dc0d | 2011-08-31 12:38:01 +0200 | [diff] [blame] | 1944 | struct QEMU_PACKED target_stat64 { |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1945 | unsigned long long st_dev; |
| 1946 | unsigned char __pad0[4]; |
| 1947 | |
| 1948 | #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1949 | abi_ulong __st_ino; |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1950 | |
| 1951 | unsigned int st_mode; |
| 1952 | unsigned int st_nlink; |
| 1953 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1954 | abi_ulong st_uid; |
| 1955 | abi_ulong st_gid; |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1956 | |
| 1957 | unsigned long long st_rdev; |
| 1958 | unsigned char __pad3[4]; |
| 1959 | |
| 1960 | long long st_size; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1961 | abi_ulong st_blksize; |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1962 | |
| 1963 | unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ |
| 1964 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1965 | abi_ulong target_st_atime; |
| 1966 | abi_ulong target_st_atime_nsec; |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1967 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1968 | abi_ulong target_st_mtime; |
| 1969 | abi_ulong target_st_mtime_nsec; |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1970 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1971 | abi_ulong target_st_ctime; |
| 1972 | abi_ulong target_st_ctime_nsec; |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1973 | |
| 1974 | unsigned long long st_ino; |
| 1975 | }; |
| 1976 | |
bellard | d2fd1af | 2007-11-14 18:08:56 +0000 | [diff] [blame] | 1977 | #elif defined(TARGET_I386) && !defined(TARGET_ABI32) |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 1978 | #define TARGET_STAT_HAVE_NSEC |
bellard | d2fd1af | 2007-11-14 18:08:56 +0000 | [diff] [blame] | 1979 | struct target_stat { |
| 1980 | abi_ulong st_dev; |
| 1981 | abi_ulong st_ino; |
| 1982 | abi_ulong st_nlink; |
| 1983 | |
| 1984 | unsigned int st_mode; |
| 1985 | unsigned int st_uid; |
| 1986 | unsigned int st_gid; |
| 1987 | unsigned int __pad0; |
| 1988 | abi_ulong st_rdev; |
| 1989 | abi_long st_size; |
| 1990 | abi_long st_blksize; |
Paolo Bonzini | 72e21db | 2018-12-13 23:37:36 +0100 | [diff] [blame] | 1991 | abi_long st_blocks; /* Number 512-byte blocks allocated. */ |
bellard | d2fd1af | 2007-11-14 18:08:56 +0000 | [diff] [blame] | 1992 | |
| 1993 | abi_ulong target_st_atime; |
| 1994 | abi_ulong target_st_atime_nsec; |
| 1995 | abi_ulong target_st_mtime; |
| 1996 | abi_ulong target_st_mtime_nsec; |
| 1997 | abi_ulong target_st_ctime; |
| 1998 | abi_ulong target_st_ctime_nsec; |
| 1999 | |
Paolo Bonzini | 72e21db | 2018-12-13 23:37:36 +0100 | [diff] [blame] | 2000 | abi_long __unused[3]; |
bellard | d2fd1af | 2007-11-14 18:08:56 +0000 | [diff] [blame] | 2001 | }; |
Ulrich Hecht | a4c075f | 2009-07-24 16:57:31 +0200 | [diff] [blame] | 2002 | #elif defined(TARGET_S390X) |
| 2003 | struct target_stat { |
| 2004 | abi_ulong st_dev; |
| 2005 | abi_ulong st_ino; |
| 2006 | abi_ulong st_nlink; |
| 2007 | unsigned int st_mode; |
| 2008 | unsigned int st_uid; |
| 2009 | unsigned int st_gid; |
| 2010 | unsigned int __pad1; |
| 2011 | abi_ulong st_rdev; |
| 2012 | abi_ulong st_size; |
| 2013 | abi_ulong target_st_atime; |
| 2014 | abi_ulong target_st_atime_nsec; |
| 2015 | abi_ulong target_st_mtime; |
| 2016 | abi_ulong target_st_mtime_nsec; |
| 2017 | abi_ulong target_st_ctime; |
| 2018 | abi_ulong target_st_ctime_nsec; |
| 2019 | abi_ulong st_blksize; |
| 2020 | abi_long st_blocks; |
| 2021 | abi_ulong __unused[3]; |
| 2022 | }; |
Alexander Graf | 0970119 | 2013-09-03 20:12:15 +0100 | [diff] [blame] | 2023 | #elif defined(TARGET_AARCH64) |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 2024 | #define TARGET_STAT_HAVE_NSEC |
Alexander Graf | 0970119 | 2013-09-03 20:12:15 +0100 | [diff] [blame] | 2025 | struct target_stat { |
| 2026 | abi_ulong st_dev; |
| 2027 | abi_ulong st_ino; |
| 2028 | unsigned int st_mode; |
| 2029 | unsigned int st_nlink; |
| 2030 | unsigned int st_uid; |
| 2031 | unsigned int st_gid; |
| 2032 | abi_ulong st_rdev; |
| 2033 | abi_ulong _pad1; |
| 2034 | abi_long st_size; |
| 2035 | int st_blksize; |
| 2036 | int __pad2; |
| 2037 | abi_long st_blocks; |
| 2038 | abi_long target_st_atime; |
| 2039 | abi_ulong target_st_atime_nsec; |
| 2040 | abi_long target_st_mtime; |
| 2041 | abi_ulong target_st_mtime_nsec; |
| 2042 | abi_long target_st_ctime; |
| 2043 | abi_ulong target_st_ctime_nsec; |
| 2044 | unsigned int __unused[2]; |
| 2045 | }; |
Max Filippov | ba7651f | 2017-01-25 10:54:11 -0800 | [diff] [blame] | 2046 | #elif defined(TARGET_XTENSA) |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 2047 | #define TARGET_STAT_HAVE_NSEC |
Max Filippov | ba7651f | 2017-01-25 10:54:11 -0800 | [diff] [blame] | 2048 | struct target_stat { |
| 2049 | abi_ulong st_dev; |
| 2050 | abi_ulong st_ino; |
| 2051 | unsigned int st_mode; |
| 2052 | unsigned int st_nlink; |
| 2053 | unsigned int st_uid; |
| 2054 | unsigned int st_gid; |
| 2055 | abi_ulong st_rdev; |
| 2056 | abi_long st_size; |
| 2057 | abi_ulong st_blksize; |
| 2058 | abi_ulong st_blocks; |
| 2059 | abi_ulong target_st_atime; |
| 2060 | abi_ulong target_st_atime_nsec; |
| 2061 | abi_ulong target_st_mtime; |
| 2062 | abi_ulong target_st_mtime_nsec; |
| 2063 | abi_ulong target_st_ctime; |
| 2064 | abi_ulong target_st_ctime_nsec; |
| 2065 | abi_ulong __unused4; |
| 2066 | abi_ulong __unused5; |
| 2067 | }; |
| 2068 | |
| 2069 | #define TARGET_HAS_STRUCT_STAT64 |
| 2070 | struct target_stat64 { |
| 2071 | uint64_t st_dev; /* Device */ |
| 2072 | uint64_t st_ino; /* File serial number */ |
| 2073 | unsigned int st_mode; /* File mode. */ |
| 2074 | unsigned int st_nlink; /* Link count. */ |
| 2075 | unsigned int st_uid; /* User ID of the file's owner. */ |
| 2076 | unsigned int st_gid; /* Group ID of the file's group. */ |
| 2077 | uint64_t st_rdev; /* Device number, if device. */ |
| 2078 | int64_t st_size; /* Size of file, in bytes. */ |
| 2079 | abi_ulong st_blksize; /* Optimal block size for I/O. */ |
| 2080 | abi_ulong __unused2; |
| 2081 | uint64_t st_blocks; /* Number 512-byte blocks allocated. */ |
| 2082 | abi_ulong target_st_atime; /* Time of last access. */ |
| 2083 | abi_ulong target_st_atime_nsec; |
| 2084 | abi_ulong target_st_mtime; /* Time of last modification. */ |
| 2085 | abi_ulong target_st_mtime_nsec; |
| 2086 | abi_ulong target_st_ctime; /* Time of last status change. */ |
| 2087 | abi_ulong target_st_ctime_nsec; |
| 2088 | abi_ulong __unused4; |
| 2089 | abi_ulong __unused5; |
| 2090 | }; |
| 2091 | |
Philippe Mathieu-Daudé | be23b0e | 2021-11-16 22:09:19 +0100 | [diff] [blame] | 2092 | #elif defined(TARGET_OPENRISC) || defined(TARGET_NIOS2) \ |
| 2093 | || defined(TARGET_RISCV) || defined(TARGET_HEXAGON) |
Peter Maydell | c7819df | 2013-07-06 21:44:53 +0100 | [diff] [blame] | 2094 | |
| 2095 | /* These are the asm-generic versions of the stat and stat64 structures */ |
| 2096 | |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 2097 | #define TARGET_STAT_HAVE_NSEC |
Jia Liu | d962783 | 2012-07-20 15:50:52 +0800 | [diff] [blame] | 2098 | struct target_stat { |
| 2099 | abi_ulong st_dev; |
| 2100 | abi_ulong st_ino; |
Jia Liu | d962783 | 2012-07-20 15:50:52 +0800 | [diff] [blame] | 2101 | unsigned int st_mode; |
Peter Maydell | c7819df | 2013-07-06 21:44:53 +0100 | [diff] [blame] | 2102 | unsigned int st_nlink; |
Jia Liu | d962783 | 2012-07-20 15:50:52 +0800 | [diff] [blame] | 2103 | unsigned int st_uid; |
| 2104 | unsigned int st_gid; |
Jia Liu | d962783 | 2012-07-20 15:50:52 +0800 | [diff] [blame] | 2105 | abi_ulong st_rdev; |
Peter Maydell | c7819df | 2013-07-06 21:44:53 +0100 | [diff] [blame] | 2106 | abi_ulong __pad1; |
Jia Liu | d962783 | 2012-07-20 15:50:52 +0800 | [diff] [blame] | 2107 | abi_long st_size; |
Peter Maydell | c7819df | 2013-07-06 21:44:53 +0100 | [diff] [blame] | 2108 | int st_blksize; |
| 2109 | int __pad2; |
| 2110 | abi_long st_blocks; |
| 2111 | abi_long target_st_atime; |
Jia Liu | d962783 | 2012-07-20 15:50:52 +0800 | [diff] [blame] | 2112 | abi_ulong target_st_atime_nsec; |
Peter Maydell | c7819df | 2013-07-06 21:44:53 +0100 | [diff] [blame] | 2113 | abi_long target_st_mtime; |
Jia Liu | d962783 | 2012-07-20 15:50:52 +0800 | [diff] [blame] | 2114 | abi_ulong target_st_mtime_nsec; |
Peter Maydell | c7819df | 2013-07-06 21:44:53 +0100 | [diff] [blame] | 2115 | abi_long target_st_ctime; |
Jia Liu | d962783 | 2012-07-20 15:50:52 +0800 | [diff] [blame] | 2116 | abi_ulong target_st_ctime_nsec; |
Peter Maydell | c7819df | 2013-07-06 21:44:53 +0100 | [diff] [blame] | 2117 | unsigned int __unused4; |
| 2118 | unsigned int __unused5; |
Jia Liu | d962783 | 2012-07-20 15:50:52 +0800 | [diff] [blame] | 2119 | }; |
Peter Maydell | c7819df | 2013-07-06 21:44:53 +0100 | [diff] [blame] | 2120 | |
Michael Clark | 47ae93c | 2018-03-03 01:31:11 +1300 | [diff] [blame] | 2121 | #if !defined(TARGET_RISCV64) |
Stefan Weil | 20d155b | 2013-10-30 22:52:24 +0100 | [diff] [blame] | 2122 | #define TARGET_HAS_STRUCT_STAT64 |
Peter Maydell | c7819df | 2013-07-06 21:44:53 +0100 | [diff] [blame] | 2123 | struct target_stat64 { |
| 2124 | uint64_t st_dev; |
| 2125 | uint64_t st_ino; |
| 2126 | unsigned int st_mode; |
| 2127 | unsigned int st_nlink; |
| 2128 | unsigned int st_uid; |
| 2129 | unsigned int st_gid; |
| 2130 | uint64_t st_rdev; |
| 2131 | uint64_t __pad1; |
| 2132 | int64_t st_size; |
| 2133 | int st_blksize; |
| 2134 | int __pad2; |
| 2135 | int64_t st_blocks; |
| 2136 | int target_st_atime; |
| 2137 | unsigned int target_st_atime_nsec; |
| 2138 | int target_st_mtime; |
| 2139 | unsigned int target_st_mtime_nsec; |
| 2140 | int target_st_ctime; |
| 2141 | unsigned int target_st_ctime_nsec; |
| 2142 | unsigned int __unused4; |
| 2143 | unsigned int __unused5; |
| 2144 | }; |
Michael Clark | 47ae93c | 2018-03-03 01:31:11 +1300 | [diff] [blame] | 2145 | #endif |
Peter Maydell | c7819df | 2013-07-06 21:44:53 +0100 | [diff] [blame] | 2146 | |
Richard Henderson | a10d1e5 | 2016-12-15 09:56:41 -0800 | [diff] [blame] | 2147 | #elif defined(TARGET_HPPA) |
| 2148 | |
Chen-Yu Tsai | 5f992db | 2019-05-23 00:21:47 +0800 | [diff] [blame] | 2149 | #define TARGET_STAT_HAVE_NSEC |
Richard Henderson | a10d1e5 | 2016-12-15 09:56:41 -0800 | [diff] [blame] | 2150 | struct target_stat { |
| 2151 | abi_uint st_dev; |
| 2152 | abi_uint st_ino; |
| 2153 | abi_ushort st_mode; |
| 2154 | abi_ushort st_nlink; |
| 2155 | abi_ushort _res1; |
| 2156 | abi_ushort _res2; |
| 2157 | abi_uint st_rdev; |
| 2158 | abi_int st_size; |
| 2159 | abi_int target_st_atime; |
| 2160 | abi_uint target_st_atime_nsec; |
| 2161 | abi_int target_st_mtime; |
| 2162 | abi_uint target_st_mtime_nsec; |
| 2163 | abi_int target_st_ctime; |
| 2164 | abi_uint target_st_ctime_nsec; |
| 2165 | abi_int st_blksize; |
| 2166 | abi_int st_blocks; |
| 2167 | abi_uint _unused1; |
| 2168 | abi_uint _unused2; |
| 2169 | abi_uint _unused3; |
| 2170 | abi_uint _unused4; |
| 2171 | abi_ushort _unused5; |
| 2172 | abi_short st_fstype; |
| 2173 | abi_uint st_realdev; |
| 2174 | abi_ushort st_basemode; |
| 2175 | abi_ushort _unused6; |
| 2176 | abi_uint st_uid; |
| 2177 | abi_uint st_gid; |
| 2178 | abi_uint _unused7[3]; |
| 2179 | }; |
| 2180 | |
| 2181 | #define TARGET_HAS_STRUCT_STAT64 |
| 2182 | struct target_stat64 { |
| 2183 | uint64_t st_dev; |
| 2184 | abi_uint _pad1; |
| 2185 | abi_uint _res1; |
| 2186 | abi_uint st_mode; |
| 2187 | abi_uint st_nlink; |
| 2188 | abi_uint st_uid; |
| 2189 | abi_uint st_gid; |
| 2190 | uint64_t st_rdev; |
| 2191 | abi_uint _pad2; |
| 2192 | int64_t st_size; |
| 2193 | abi_int st_blksize; |
| 2194 | int64_t st_blocks; |
| 2195 | abi_int target_st_atime; |
| 2196 | abi_uint target_st_atime_nsec; |
| 2197 | abi_int target_st_mtime; |
| 2198 | abi_uint target_st_mtime_nsec; |
| 2199 | abi_int target_st_ctime; |
| 2200 | abi_uint target_st_ctime_nsec; |
| 2201 | uint64_t st_ino; |
| 2202 | }; |
| 2203 | |
Song Gao | 1f630196 | 2022-06-24 11:10:40 +0800 | [diff] [blame] | 2204 | #elif defined(TARGET_LOONGARCH64) |
| 2205 | |
| 2206 | /* LoongArch no newfstatat/fstat syscall. */ |
| 2207 | |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 2208 | #else |
| 2209 | #error unsupported CPU |
| 2210 | #endif |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 2211 | |
ths | 4ce6f8d | 2007-07-20 15:54:27 +0000 | [diff] [blame] | 2212 | typedef struct { |
| 2213 | int val[2]; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 2214 | } target_fsid_t; |
ths | 4ce6f8d | 2007-07-20 15:54:27 +0000 | [diff] [blame] | 2215 | |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 2216 | #ifdef TARGET_MIPS |
ths | d26bc21 | 2007-11-08 18:05:37 +0000 | [diff] [blame] | 2217 | #ifdef TARGET_ABI_MIPSN32 |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 2218 | struct target_statfs { |
| 2219 | int32_t f_type; |
| 2220 | int32_t f_bsize; |
| 2221 | int32_t f_frsize; /* Fragment size - unsupported */ |
| 2222 | int32_t f_blocks; |
| 2223 | int32_t f_bfree; |
| 2224 | int32_t f_files; |
| 2225 | int32_t f_ffree; |
| 2226 | int32_t f_bavail; |
| 2227 | |
| 2228 | /* Linux specials */ |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 2229 | target_fsid_t f_fsid; |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 2230 | int32_t f_namelen; |
Shea Levy | d4247ec | 2018-03-01 06:15:00 -0500 | [diff] [blame] | 2231 | int32_t f_flags; |
| 2232 | int32_t f_spare[5]; |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 2233 | }; |
| 2234 | #else |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 2235 | struct target_statfs { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 2236 | abi_long f_type; |
| 2237 | abi_long f_bsize; |
| 2238 | abi_long f_frsize; /* Fragment size - unsupported */ |
| 2239 | abi_long f_blocks; |
| 2240 | abi_long f_bfree; |
| 2241 | abi_long f_files; |
| 2242 | abi_long f_ffree; |
| 2243 | abi_long f_bavail; |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 2244 | |
| 2245 | /* Linux specials */ |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 2246 | target_fsid_t f_fsid; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 2247 | abi_long f_namelen; |
Shea Levy | d4247ec | 2018-03-01 06:15:00 -0500 | [diff] [blame] | 2248 | abi_long f_flags; |
| 2249 | abi_long f_spare[5]; |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 2250 | }; |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 2251 | #endif |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 2252 | |
| 2253 | struct target_statfs64 { |
| 2254 | uint32_t f_type; |
| 2255 | uint32_t f_bsize; |
| 2256 | uint32_t f_frsize; /* Fragment size - unsupported */ |
| 2257 | uint32_t __pad; |
| 2258 | uint64_t f_blocks; |
| 2259 | uint64_t f_bfree; |
| 2260 | uint64_t f_files; |
| 2261 | uint64_t f_ffree; |
| 2262 | uint64_t f_bavail; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 2263 | target_fsid_t f_fsid; |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 2264 | uint32_t f_namelen; |
Shea Levy | d4247ec | 2018-03-01 06:15:00 -0500 | [diff] [blame] | 2265 | uint32_t f_flags; |
| 2266 | uint32_t f_spare[5]; |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 2267 | }; |
balrog | c4d1062 | 2008-07-19 09:38:52 +0000 | [diff] [blame] | 2268 | #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ |
Michael Clark | 47ae93c | 2018-03-03 01:31:11 +1300 | [diff] [blame] | 2269 | defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \ |
WANG Xuerui | 7bf36a5 | 2022-10-06 18:07:10 +0800 | [diff] [blame] | 2270 | defined(TARGET_RISCV) || defined(TARGET_LOONGARCH64)) && \ |
| 2271 | !defined(TARGET_ABI32) |
j_mayer | 325e651 | 2007-11-21 13:06:54 +0000 | [diff] [blame] | 2272 | struct target_statfs { |
| 2273 | abi_long f_type; |
| 2274 | abi_long f_bsize; |
| 2275 | abi_long f_blocks; |
| 2276 | abi_long f_bfree; |
| 2277 | abi_long f_bavail; |
| 2278 | abi_long f_files; |
| 2279 | abi_long f_ffree; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 2280 | target_fsid_t f_fsid; |
j_mayer | 325e651 | 2007-11-21 13:06:54 +0000 | [diff] [blame] | 2281 | abi_long f_namelen; |
| 2282 | abi_long f_frsize; |
Shea Levy | d4247ec | 2018-03-01 06:15:00 -0500 | [diff] [blame] | 2283 | abi_long f_flags; |
| 2284 | abi_long f_spare[4]; |
j_mayer | 325e651 | 2007-11-21 13:06:54 +0000 | [diff] [blame] | 2285 | }; |
| 2286 | |
| 2287 | struct target_statfs64 { |
| 2288 | abi_long f_type; |
| 2289 | abi_long f_bsize; |
| 2290 | abi_long f_blocks; |
| 2291 | abi_long f_bfree; |
| 2292 | abi_long f_bavail; |
| 2293 | abi_long f_files; |
| 2294 | abi_long f_ffree; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 2295 | target_fsid_t f_fsid; |
j_mayer | 325e651 | 2007-11-21 13:06:54 +0000 | [diff] [blame] | 2296 | abi_long f_namelen; |
| 2297 | abi_long f_frsize; |
Shea Levy | d4247ec | 2018-03-01 06:15:00 -0500 | [diff] [blame] | 2298 | abi_long f_flags; |
| 2299 | abi_long f_spare[4]; |
j_mayer | 325e651 | 2007-11-21 13:06:54 +0000 | [diff] [blame] | 2300 | }; |
Ulrich Hecht | a4c075f | 2009-07-24 16:57:31 +0200 | [diff] [blame] | 2301 | #elif defined(TARGET_S390X) |
| 2302 | struct target_statfs { |
| 2303 | int32_t f_type; |
| 2304 | int32_t f_bsize; |
| 2305 | abi_long f_blocks; |
| 2306 | abi_long f_bfree; |
| 2307 | abi_long f_bavail; |
| 2308 | abi_long f_files; |
| 2309 | abi_long f_ffree; |
| 2310 | kernel_fsid_t f_fsid; |
| 2311 | int32_t f_namelen; |
| 2312 | int32_t f_frsize; |
Shea Levy | d4247ec | 2018-03-01 06:15:00 -0500 | [diff] [blame] | 2313 | int32_t f_flags; |
| 2314 | int32_t f_spare[4]; |
| 2315 | |
Ulrich Hecht | a4c075f | 2009-07-24 16:57:31 +0200 | [diff] [blame] | 2316 | }; |
| 2317 | |
| 2318 | struct target_statfs64 { |
| 2319 | int32_t f_type; |
| 2320 | int32_t f_bsize; |
| 2321 | abi_long f_blocks; |
| 2322 | abi_long f_bfree; |
| 2323 | abi_long f_bavail; |
| 2324 | abi_long f_files; |
| 2325 | abi_long f_ffree; |
| 2326 | kernel_fsid_t f_fsid; |
| 2327 | int32_t f_namelen; |
| 2328 | int32_t f_frsize; |
Shea Levy | d4247ec | 2018-03-01 06:15:00 -0500 | [diff] [blame] | 2329 | int32_t f_flags; |
| 2330 | int32_t f_spare[4]; |
Ulrich Hecht | a4c075f | 2009-07-24 16:57:31 +0200 | [diff] [blame] | 2331 | }; |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 2332 | #else |
| 2333 | struct target_statfs { |
| 2334 | uint32_t f_type; |
| 2335 | uint32_t f_bsize; |
| 2336 | uint32_t f_blocks; |
| 2337 | uint32_t f_bfree; |
| 2338 | uint32_t f_bavail; |
| 2339 | uint32_t f_files; |
| 2340 | uint32_t f_ffree; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 2341 | target_fsid_t f_fsid; |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 2342 | uint32_t f_namelen; |
| 2343 | uint32_t f_frsize; |
Shea Levy | d4247ec | 2018-03-01 06:15:00 -0500 | [diff] [blame] | 2344 | uint32_t f_flags; |
| 2345 | uint32_t f_spare[4]; |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 2346 | }; |
| 2347 | |
| 2348 | struct target_statfs64 { |
| 2349 | uint32_t f_type; |
| 2350 | uint32_t f_bsize; |
| 2351 | uint64_t f_blocks; |
| 2352 | uint64_t f_bfree; |
| 2353 | uint64_t f_bavail; |
| 2354 | uint64_t f_files; |
| 2355 | uint64_t f_ffree; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 2356 | target_fsid_t f_fsid; |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 2357 | uint32_t f_namelen; |
| 2358 | uint32_t f_frsize; |
Shea Levy | d4247ec | 2018-03-01 06:15:00 -0500 | [diff] [blame] | 2359 | uint32_t f_flags; |
| 2360 | uint32_t f_spare[4]; |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 2361 | }; |
| 2362 | #endif |
| 2363 | |
Ulrich Hecht | 7e22e54 | 2009-07-24 19:10:27 +0200 | [diff] [blame] | 2364 | #define TARGET_F_LINUX_SPECIFIC_BASE 1024 |
Shu-Chun Weng | 2bb963f | 2020-12-18 11:32:10 -0800 | [diff] [blame] | 2365 | #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) |
| 2366 | #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) |
| 2367 | #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) |
| 2368 | #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE + 2) |
| 2369 | #define TARGET_F_SETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 7) |
| 2370 | #define TARGET_F_GETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 8) |
| 2371 | #define TARGET_F_ADD_SEALS (TARGET_F_LINUX_SPECIFIC_BASE + 9) |
| 2372 | #define TARGET_F_GET_SEALS (TARGET_F_LINUX_SPECIFIC_BASE + 10) |
Ulrich Hecht | 7e22e54 | 2009-07-24 19:10:27 +0200 | [diff] [blame] | 2373 | |
Laurent Vivier | 5de7706 | 2018-05-29 21:41:53 +0200 | [diff] [blame] | 2374 | #include "target_fcntl.h" |
Andreas Schwab | 8d5d300 | 2014-03-07 15:24:08 +0100 | [diff] [blame] | 2375 | |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 2376 | /* soundcard defines */ |
Veres Lajos | 67cc32e | 2015-09-08 22:45:14 +0100 | [diff] [blame] | 2377 | /* XXX: convert them all to arch independent entries */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 2378 | #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); |
| 2379 | #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 |
| 2380 | #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 |
| 2381 | #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 |
| 2382 | #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 |
| 2383 | #define TARGET_SNDCTL_COPR_RESET 0x00004300 |
| 2384 | #define TARGET_SNDCTL_COPR_RUN 0xc0144306 |
| 2385 | #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 |
| 2386 | #define TARGET_SNDCTL_COPR_WCODE 0x40144305 |
| 2387 | #define TARGET_SNDCTL_COPR_WDATA 0x40144304 |
| 2388 | #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) |
| 2389 | #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) |
| 2390 | #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) |
| 2391 | #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) |
| 2392 | #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) |
| 2393 | #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) |
| 2394 | #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) |
| 2395 | #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) |
| 2396 | #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) |
| 2397 | #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) |
| 2398 | #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) |
| 2399 | #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) |
| 2400 | #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) |
| 2401 | #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) |
| 2402 | #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) |
| 2403 | #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) |
| 2404 | #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) |
| 2405 | #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) |
Peter Maydell | 5f72307 | 2012-07-23 08:06:15 +0000 | [diff] [blame] | 2406 | #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) |
| 2407 | #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 2408 | #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e |
| 2409 | #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 |
| 2410 | #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 |
| 2411 | #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 |
| 2412 | #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 |
| 2413 | #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f |
| 2414 | #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 |
| 2415 | #define TARGET_SNDCTL_MIDI_INFO 0xc074510c |
| 2416 | #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 |
| 2417 | #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 |
| 2418 | #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 |
| 2419 | #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 |
| 2420 | #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 |
| 2421 | #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 |
| 2422 | #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 |
| 2423 | #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 |
| 2424 | #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b |
| 2425 | #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a |
| 2426 | #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 |
| 2427 | #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 |
| 2428 | #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 |
| 2429 | #define TARGET_SNDCTL_SEQ_RESET 0x00005100 |
| 2430 | #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 |
| 2431 | #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 |
| 2432 | #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 |
| 2433 | #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d |
| 2434 | #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d |
| 2435 | #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 |
| 2436 | #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e |
| 2437 | #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 |
| 2438 | #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 |
| 2439 | #define TARGET_SNDCTL_TMR_SELECT 0x40045408 |
| 2440 | #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 |
| 2441 | #define TARGET_SNDCTL_TMR_START 0x00005402 |
| 2442 | #define TARGET_SNDCTL_TMR_STOP 0x00005403 |
| 2443 | #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 |
| 2444 | #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 |
| 2445 | #define TARGET_SOUND_PCM_READ_RATE 0x80045002 |
| 2446 | #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 |
| 2447 | #define TARGET_SOUND_PCM_READ_BITS 0x80045005 |
| 2448 | #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 |
| 2449 | #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) |
| 2450 | #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 |
| 2451 | #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) |
| 2452 | #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) |
| 2453 | #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) |
| 2454 | #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) |
| 2455 | #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) |
| 2456 | |
| 2457 | #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) |
| 2458 | |
| 2459 | #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) |
| 2460 | #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) |
| 2461 | #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) |
| 2462 | #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) |
| 2463 | #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) |
| 2464 | #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) |
| 2465 | #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) |
| 2466 | #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) |
| 2467 | #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) |
| 2468 | #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) |
| 2469 | #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) |
| 2470 | #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) |
| 2471 | #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) |
| 2472 | #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) |
| 2473 | #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) |
| 2474 | #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) |
| 2475 | #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) |
| 2476 | |
| 2477 | /* Obsolete macros */ |
| 2478 | #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) |
| 2479 | #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) |
| 2480 | #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) |
| 2481 | |
| 2482 | #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) |
| 2483 | #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) |
| 2484 | #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) |
| 2485 | #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) |
| 2486 | #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) |
| 2487 | |
| 2488 | #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) |
| 2489 | |
| 2490 | #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) |
| 2491 | #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) |
| 2492 | #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) |
| 2493 | #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) |
| 2494 | #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) |
| 2495 | #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) |
| 2496 | #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) |
| 2497 | #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) |
| 2498 | #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) |
| 2499 | #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) |
| 2500 | #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) |
| 2501 | #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) |
| 2502 | #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) |
| 2503 | #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) |
| 2504 | #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) |
| 2505 | #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) |
| 2506 | #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) |
| 2507 | |
| 2508 | /* Obsolete macros */ |
| 2509 | #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) |
| 2510 | #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) |
| 2511 | #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) |
| 2512 | |
| 2513 | #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) |
| 2514 | |
Filip Bozuta | aca7708 | 2020-01-15 20:36:43 +0100 | [diff] [blame] | 2515 | struct target_snd_timer_id { |
| 2516 | int dev_class; |
| 2517 | int dev_sclass; |
| 2518 | int card; |
| 2519 | int device; |
| 2520 | int subdevice; |
| 2521 | }; |
| 2522 | |
| 2523 | struct target_snd_timer_ginfo { |
| 2524 | struct target_snd_timer_id tid; |
| 2525 | unsigned int flags; |
| 2526 | int card; |
| 2527 | unsigned char id[64]; |
| 2528 | unsigned char name[80]; |
| 2529 | abi_ulong reserved0; |
| 2530 | abi_ulong resolution; |
| 2531 | abi_ulong resolution_min; |
| 2532 | abi_ulong resolution_max; |
| 2533 | unsigned int clients; |
| 2534 | unsigned char reserved[32]; |
| 2535 | }; |
| 2536 | |
| 2537 | struct target_snd_timer_gparams { |
| 2538 | struct target_snd_timer_id tid; |
| 2539 | abi_ulong period_num; |
| 2540 | abi_ulong period_den; |
| 2541 | unsigned char reserved[32]; |
| 2542 | }; |
| 2543 | |
| 2544 | struct target_snd_timer_gstatus { |
| 2545 | struct target_snd_timer_id tid; |
| 2546 | abi_ulong resolution; |
| 2547 | abi_ulong resolution_num; |
| 2548 | abi_ulong resolution_den; |
| 2549 | unsigned char reserved[32]; |
| 2550 | }; |
| 2551 | |
Filip Bozuta | d22edf0 | 2020-01-15 20:36:44 +0100 | [diff] [blame] | 2552 | struct target_snd_timer_select { |
| 2553 | struct target_snd_timer_id id; |
| 2554 | unsigned char reserved[32]; |
| 2555 | }; |
| 2556 | |
Filip Bozuta | fe33302 | 2020-01-15 20:36:45 +0100 | [diff] [blame] | 2557 | struct target_snd_timer_info { |
| 2558 | unsigned int flags; |
| 2559 | int card; |
| 2560 | unsigned char id[64]; |
| 2561 | unsigned char name[80]; |
| 2562 | abi_ulong reserved0; |
| 2563 | abi_ulong resolution; |
| 2564 | unsigned char reserved[64]; |
| 2565 | }; |
| 2566 | |
| 2567 | struct target_snd_timer_status { |
| 2568 | struct target_timespec tstamp; |
| 2569 | unsigned int resolution; |
| 2570 | unsigned int lost; |
| 2571 | unsigned int overrun; |
| 2572 | unsigned int queue; |
| 2573 | unsigned char reserved[64]; |
| 2574 | }; |
| 2575 | |
Filip Bozuta | 1c4c6fc | 2020-01-15 20:36:41 +0100 | [diff] [blame] | 2576 | /* alsa timer ioctls */ |
| 2577 | #define TARGET_SNDRV_TIMER_IOCTL_PVERSION TARGET_IOR('T', 0x00, int) |
| 2578 | #define TARGET_SNDRV_TIMER_IOCTL_NEXT_DEVICE TARGET_IOWR('T', 0x01, \ |
| 2579 | struct snd_timer_id) |
Filip Bozuta | aca7708 | 2020-01-15 20:36:43 +0100 | [diff] [blame] | 2580 | #define TARGET_SNDRV_TIMER_IOCTL_GINFO TARGET_IOWR('T', 0x03, \ |
| 2581 | struct target_snd_timer_ginfo) |
| 2582 | #define TARGET_SNDRV_TIMER_IOCTL_GPARAMS TARGET_IOW('T', 0x04, \ |
| 2583 | struct target_snd_timer_gparams) |
| 2584 | #define TARGET_SNDRV_TIMER_IOCTL_GSTATUS TARGET_IOWR('T', 0x05, \ |
| 2585 | struct target_snd_timer_gstatus) |
Filip Bozuta | d22edf0 | 2020-01-15 20:36:44 +0100 | [diff] [blame] | 2586 | #define TARGET_SNDRV_TIMER_IOCTL_SELECT TARGET_IOW('T', 0x10, \ |
| 2587 | struct target_snd_timer_select) |
Filip Bozuta | fe33302 | 2020-01-15 20:36:45 +0100 | [diff] [blame] | 2588 | #define TARGET_SNDRV_TIMER_IOCTL_INFO TARGET_IOR('T', 0x11, \ |
| 2589 | struct target_snd_timer_info) |
| 2590 | #define TARGET_SNDRV_TIMER_IOCTL_PARAMS TARGET_IOW('T', 0x12, \ |
| 2591 | struct snd_timer_params) |
| 2592 | #define TARGET_SNDRV_TIMER_IOCTL_STATUS TARGET_IOR('T', 0x14, \ |
| 2593 | struct target_snd_timer_status) |
Filip Bozuta | 045823a | 2020-01-15 20:36:46 +0100 | [diff] [blame] | 2594 | #define TARGET_SNDRV_TIMER_IOCTL_START TARGET_IO('T', 0xa0) |
| 2595 | #define TARGET_SNDRV_TIMER_IOCTL_STOP TARGET_IO('T', 0xa1) |
| 2596 | #define TARGET_SNDRV_TIMER_IOCTL_CONTINUE TARGET_IO('T', 0xa2) |
| 2597 | #define TARGET_SNDRV_TIMER_IOCTL_PAUSE TARGET_IO('T', 0xa3) |
Filip Bozuta | 1c4c6fc | 2020-01-15 20:36:41 +0100 | [diff] [blame] | 2598 | |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 2599 | /* vfat ioctls */ |
| 2600 | #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) |
| 2601 | #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) |
bellard | a5448a7 | 2004-06-19 16:59:03 +0000 | [diff] [blame] | 2602 | |
Peter Maydell | f443e39 | 2017-10-12 16:30:45 +0100 | [diff] [blame] | 2603 | struct target_mtop { |
| 2604 | abi_short mt_op; |
| 2605 | abi_int mt_count; |
| 2606 | }; |
| 2607 | |
| 2608 | #if defined(TARGET_SPARC) || defined(TARGET_MIPS) |
| 2609 | typedef abi_long target_kernel_daddr_t; |
| 2610 | #else |
| 2611 | typedef abi_int target_kernel_daddr_t; |
| 2612 | #endif |
| 2613 | |
| 2614 | struct target_mtget { |
| 2615 | abi_long mt_type; |
| 2616 | abi_long mt_resid; |
| 2617 | abi_long mt_dsreg; |
| 2618 | abi_long mt_gstat; |
| 2619 | abi_long mt_erreg; |
| 2620 | target_kernel_daddr_t mt_fileno; |
| 2621 | target_kernel_daddr_t mt_blkno; |
| 2622 | }; |
| 2623 | |
| 2624 | struct target_mtpos { |
| 2625 | abi_long mt_blkno; |
| 2626 | }; |
| 2627 | |
| 2628 | #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct target_mtop) |
| 2629 | #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct target_mtget) |
| 2630 | #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct target_mtpos) |
balrog | 8fbd6b5 | 2008-09-20 03:03:09 +0000 | [diff] [blame] | 2631 | |
Aleksandar Markovic | bd27e67 | 2020-01-16 23:49:50 +0100 | [diff] [blame] | 2632 | /* kcov ioctls */ |
| 2633 | #define TARGET_KCOV_ENABLE TARGET_IO('c', 100) |
| 2634 | #define TARGET_KCOV_DISABLE TARGET_IO('c', 101) |
Aleksandar Markovic | f7dbd8f | 2020-01-16 23:49:51 +0100 | [diff] [blame] | 2635 | #define TARGET_KCOV_INIT_TRACE TARGET_IOR('c', 1, abi_ulong) |
Aleksandar Markovic | bd27e67 | 2020-01-16 23:49:50 +0100 | [diff] [blame] | 2636 | |
bellard | a5448a7 | 2004-06-19 16:59:03 +0000 | [diff] [blame] | 2637 | struct target_sysinfo { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 2638 | abi_long uptime; /* Seconds since boot */ |
| 2639 | abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ |
| 2640 | abi_ulong totalram; /* Total usable main memory size */ |
| 2641 | abi_ulong freeram; /* Available memory size */ |
| 2642 | abi_ulong sharedram; /* Amount of shared memory */ |
| 2643 | abi_ulong bufferram; /* Memory used by buffers */ |
| 2644 | abi_ulong totalswap; /* Total swap space size */ |
| 2645 | abi_ulong freeswap; /* swap space still available */ |
bellard | a5448a7 | 2004-06-19 16:59:03 +0000 | [diff] [blame] | 2646 | unsigned short procs; /* Number of current processes */ |
| 2647 | unsigned short pad; /* explicit padding for m68k */ |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 2648 | abi_ulong totalhigh; /* Total high memory size */ |
| 2649 | abi_ulong freehigh; /* Available high memory size */ |
bellard | a5448a7 | 2004-06-19 16:59:03 +0000 | [diff] [blame] | 2650 | unsigned int mem_unit; /* Memory unit size in bytes */ |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 2651 | char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ |
bellard | a5448a7 | 2004-06-19 16:59:03 +0000 | [diff] [blame] | 2652 | }; |
bellard | 3532fa7 | 2006-06-24 15:06:03 +0000 | [diff] [blame] | 2653 | |
aurel32 | 6556a83 | 2008-10-13 21:08:17 +0000 | [diff] [blame] | 2654 | struct linux_dirent { |
| 2655 | long d_ino; |
| 2656 | unsigned long d_off; |
| 2657 | unsigned short d_reclen; |
Richard Henderson | 540a736 | 2021-11-14 11:35:37 +0100 | [diff] [blame] | 2658 | char d_name[]; |
aurel32 | 6556a83 | 2008-10-13 21:08:17 +0000 | [diff] [blame] | 2659 | }; |
| 2660 | |
| 2661 | struct linux_dirent64 { |
| 2662 | uint64_t d_ino; |
| 2663 | int64_t d_off; |
| 2664 | unsigned short d_reclen; |
| 2665 | unsigned char d_type; |
Richard Henderson | 540a736 | 2021-11-14 11:35:37 +0100 | [diff] [blame] | 2666 | char d_name[]; |
aurel32 | 6556a83 | 2008-10-13 21:08:17 +0000 | [diff] [blame] | 2667 | }; |
| 2668 | |
aurel32 | 24e1003 | 2009-04-15 16:11:43 +0000 | [diff] [blame] | 2669 | struct target_mq_attr { |
| 2670 | abi_long mq_flags; |
| 2671 | abi_long mq_maxmsg; |
| 2672 | abi_long mq_msgsize; |
| 2673 | abi_long mq_curmsgs; |
| 2674 | }; |
| 2675 | |
Chen Gang | e865b97 | 2020-06-05 09:32:21 +0800 | [diff] [blame] | 2676 | struct target_drm_version { |
| 2677 | int version_major; |
| 2678 | int version_minor; |
| 2679 | int version_patchlevel; |
| 2680 | abi_ulong name_len; |
| 2681 | abi_ulong name; |
| 2682 | abi_ulong date_len; |
| 2683 | abi_ulong date; |
| 2684 | abi_ulong desc_len; |
| 2685 | abi_ulong desc; |
| 2686 | }; |
| 2687 | |
Chen Gang | 913b03c | 2020-08-02 21:39:38 +0800 | [diff] [blame] | 2688 | struct target_drm_i915_getparam { |
| 2689 | int param; |
| 2690 | abi_ulong value; |
| 2691 | }; |
| 2692 | |
bellard | 3532fa7 | 2006-06-24 15:06:03 +0000 | [diff] [blame] | 2693 | #include "socket.h" |
ths | 637947f | 2007-06-01 12:09:19 +0000 | [diff] [blame] | 2694 | |
Philippe Mathieu-Daudé | 8f968b6 | 2021-07-08 19:05:45 +0200 | [diff] [blame] | 2695 | #include "target_errno_defs.h" |
Riku Voipio | 03dfe9f | 2009-06-18 22:51:31 +0300 | [diff] [blame] | 2696 | |
| 2697 | #define FUTEX_WAIT 0 |
| 2698 | #define FUTEX_WAKE 1 |
| 2699 | #define FUTEX_FD 2 |
| 2700 | #define FUTEX_REQUEUE 3 |
| 2701 | #define FUTEX_CMP_REQUEUE 4 |
| 2702 | #define FUTEX_WAKE_OP 5 |
| 2703 | #define FUTEX_LOCK_PI 6 |
| 2704 | #define FUTEX_UNLOCK_PI 7 |
| 2705 | #define FUTEX_TRYLOCK_PI 8 |
| 2706 | #define FUTEX_WAIT_BITSET 9 |
| 2707 | #define FUTEX_WAKE_BITSET 10 |
Richard Henderson | c72a90d | 2022-08-28 19:10:03 -0700 | [diff] [blame] | 2708 | #define FUTEX_WAIT_REQUEUE_PI 11 |
| 2709 | #define FUTEX_CMP_REQUEUE_PI 12 |
| 2710 | #define FUTEX_LOCK_PI2 13 |
Riku Voipio | 03dfe9f | 2009-06-18 22:51:31 +0300 | [diff] [blame] | 2711 | |
| 2712 | #define FUTEX_PRIVATE_FLAG 128 |
| 2713 | #define FUTEX_CLOCK_REALTIME 256 |
| 2714 | #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) |
| 2715 | |
Peter Maydell | 3b6edd1 | 2011-02-15 18:35:05 +0000 | [diff] [blame] | 2716 | #ifdef CONFIG_EPOLL |
Laurent Vivier | 928bed6 | 2015-10-03 17:14:06 +0200 | [diff] [blame] | 2717 | #if defined(TARGET_X86_64) |
| 2718 | #define TARGET_EPOLL_PACKED QEMU_PACKED |
| 2719 | #else |
| 2720 | #define TARGET_EPOLL_PACKED |
| 2721 | #endif |
| 2722 | |
Peter Maydell | 3b6edd1 | 2011-02-15 18:35:05 +0000 | [diff] [blame] | 2723 | typedef union target_epoll_data { |
| 2724 | abi_ulong ptr; |
Laurent Vivier | 928bed6 | 2015-10-03 17:14:06 +0200 | [diff] [blame] | 2725 | abi_int fd; |
| 2726 | abi_uint u32; |
| 2727 | abi_ullong u64; |
Peter Maydell | 3b6edd1 | 2011-02-15 18:35:05 +0000 | [diff] [blame] | 2728 | } target_epoll_data_t; |
| 2729 | |
| 2730 | struct target_epoll_event { |
Laurent Vivier | 928bed6 | 2015-10-03 17:14:06 +0200 | [diff] [blame] | 2731 | abi_uint events; |
Peter Maydell | 3b6edd1 | 2011-02-15 18:35:05 +0000 | [diff] [blame] | 2732 | target_epoll_data_t data; |
Laurent Vivier | 928bed6 | 2015-10-03 17:14:06 +0200 | [diff] [blame] | 2733 | } TARGET_EPOLL_PACKED; |
Peter Maydell | 2ba7fae3 | 2016-07-18 15:35:59 +0100 | [diff] [blame] | 2734 | |
| 2735 | #define TARGET_EP_MAX_EVENTS (INT_MAX / sizeof(struct target_epoll_event)) |
| 2736 | |
Peter Maydell | 3b6edd1 | 2011-02-15 18:35:05 +0000 | [diff] [blame] | 2737 | #endif |
Akos PASZTORY | 583359a | 2011-11-14 15:09:49 +0200 | [diff] [blame] | 2738 | |
| 2739 | struct target_ucred { |
| 2740 | uint32_t pid; |
| 2741 | uint32_t uid; |
| 2742 | uint32_t gid; |
| 2743 | }; |
Paolo Bonzini | cb9c377 | 2012-12-06 12:15:58 +0100 | [diff] [blame] | 2744 | |
Alexander Graf | aecc886 | 2014-11-10 21:33:03 +0100 | [diff] [blame] | 2745 | typedef int32_t target_timer_t; |
Erik de Castro Lopo | 905bba1 | 2013-11-29 18:39:22 +1100 | [diff] [blame] | 2746 | |
Natanael Copa | 34d6086 | 2014-04-29 13:11:20 +0200 | [diff] [blame] | 2747 | #define TARGET_SIGEV_MAX_SIZE 64 |
| 2748 | |
| 2749 | /* This is architecture-specific but most architectures use the default */ |
| 2750 | #ifdef TARGET_MIPS |
| 2751 | #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) |
| 2752 | #else |
| 2753 | #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ |
| 2754 | + sizeof(target_sigval_t)) |
| 2755 | #endif |
| 2756 | |
| 2757 | #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ |
| 2758 | - TARGET_SIGEV_PREAMBLE_SIZE) \ |
| 2759 | / sizeof(int32_t)) |
| 2760 | |
Erik de Castro Lopo | 905bba1 | 2013-11-29 18:39:22 +1100 | [diff] [blame] | 2761 | struct target_sigevent { |
| 2762 | target_sigval_t sigev_value; |
Peter Maydell | 17351c3 | 2016-09-02 18:40:01 +0100 | [diff] [blame] | 2763 | abi_int sigev_signo; |
| 2764 | abi_int sigev_notify; |
Erik de Castro Lopo | 905bba1 | 2013-11-29 18:39:22 +1100 | [diff] [blame] | 2765 | union { |
Peter Maydell | 17351c3 | 2016-09-02 18:40:01 +0100 | [diff] [blame] | 2766 | abi_int _pad[TARGET_SIGEV_PAD_SIZE]; |
| 2767 | abi_int _tid; |
Erik de Castro Lopo | 905bba1 | 2013-11-29 18:39:22 +1100 | [diff] [blame] | 2768 | |
Peter Maydell | 17351c3 | 2016-09-02 18:40:01 +0100 | [diff] [blame] | 2769 | /* The kernel (and thus QEMU) never looks at these; |
| 2770 | * they're only used as part of the ABI between a |
| 2771 | * userspace program and libc. |
| 2772 | */ |
Erik de Castro Lopo | 905bba1 | 2013-11-29 18:39:22 +1100 | [diff] [blame] | 2773 | struct { |
Peter Maydell | 17351c3 | 2016-09-02 18:40:01 +0100 | [diff] [blame] | 2774 | abi_ulong _function; |
| 2775 | abi_ulong _attribute; |
Erik de Castro Lopo | 905bba1 | 2013-11-29 18:39:22 +1100 | [diff] [blame] | 2776 | } _sigev_thread; |
| 2777 | } _sigev_un; |
| 2778 | }; |
Peter Maydell | e0eb210 | 2014-03-17 12:15:35 +0000 | [diff] [blame] | 2779 | |
| 2780 | struct target_user_cap_header { |
| 2781 | uint32_t version; |
| 2782 | int pid; |
| 2783 | }; |
| 2784 | |
| 2785 | struct target_user_cap_data { |
| 2786 | uint32_t effective; |
| 2787 | uint32_t permitted; |
| 2788 | uint32_t inheritable; |
| 2789 | }; |
Markus Armbruster | 1b3c4fd | 2016-06-29 15:54:17 +0200 | [diff] [blame] | 2790 | |
Aleksandar Markovic | da2c8ad | 2016-09-22 18:56:58 +0200 | [diff] [blame] | 2791 | /* from kernel's include/linux/syslog.h */ |
| 2792 | |
| 2793 | /* Close the log. Currently a NOP. */ |
| 2794 | #define TARGET_SYSLOG_ACTION_CLOSE 0 |
| 2795 | /* Open the log. Currently a NOP. */ |
| 2796 | #define TARGET_SYSLOG_ACTION_OPEN 1 |
| 2797 | /* Read from the log. */ |
| 2798 | #define TARGET_SYSLOG_ACTION_READ 2 |
| 2799 | /* Read all messages remaining in the ring buffer. */ |
| 2800 | #define TARGET_SYSLOG_ACTION_READ_ALL 3 |
| 2801 | /* Read and clear all messages remaining in the ring buffer */ |
| 2802 | #define TARGET_SYSLOG_ACTION_READ_CLEAR 4 |
| 2803 | /* Clear ring buffer. */ |
| 2804 | #define TARGET_SYSLOG_ACTION_CLEAR 5 |
| 2805 | /* Disable printk's to console */ |
| 2806 | #define TARGET_SYSLOG_ACTION_CONSOLE_OFF 6 |
| 2807 | /* Enable printk's to console */ |
| 2808 | #define TARGET_SYSLOG_ACTION_CONSOLE_ON 7 |
| 2809 | /* Set level of messages printed to console */ |
| 2810 | #define TARGET_SYSLOG_ACTION_CONSOLE_LEVEL 8 |
| 2811 | /* Return number of unread characters in the log buffer */ |
| 2812 | #define TARGET_SYSLOG_ACTION_SIZE_UNREAD 9 |
| 2813 | /* Return size of the log buffer */ |
| 2814 | #define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10 |
| 2815 | |
Aleksandar Rikalo | efa9218 | 2019-06-28 12:43:34 +0200 | [diff] [blame] | 2816 | struct target_statx_timestamp { |
| 2817 | int64_t tv_sec; |
| 2818 | uint32_t tv_nsec; |
| 2819 | int32_t __reserved; |
| 2820 | }; |
| 2821 | |
| 2822 | struct target_statx { |
| 2823 | /* 0x00 */ |
| 2824 | uint32_t stx_mask; /* What results were written [uncond] */ |
| 2825 | uint32_t stx_blksize; /* Preferred general I/O size [uncond] */ |
| 2826 | uint64_t stx_attributes; /* Flags conveying information about the file */ |
| 2827 | /* 0x10 */ |
| 2828 | uint32_t stx_nlink; /* Number of hard links */ |
| 2829 | uint32_t stx_uid; /* User ID of owner */ |
| 2830 | uint32_t stx_gid; /* Group ID of owner */ |
| 2831 | uint16_t stx_mode; /* File mode */ |
| 2832 | uint16_t __spare0[1]; |
| 2833 | /* 0x20 */ |
| 2834 | uint64_t stx_ino; /* Inode number */ |
| 2835 | uint64_t stx_size; /* File size */ |
| 2836 | uint64_t stx_blocks; /* Number of 512-byte blocks allocated */ |
| 2837 | uint64_t stx_attributes_mask; /* Mask to show what is supported */ |
| 2838 | /* 0x40 */ |
| 2839 | struct target_statx_timestamp stx_atime; /* Last access time */ |
| 2840 | struct target_statx_timestamp stx_btime; /* File creation time */ |
| 2841 | struct target_statx_timestamp stx_ctime; /* Last attribute change time */ |
| 2842 | struct target_statx_timestamp stx_mtime; /* Last data modification time */ |
| 2843 | /* 0x80 */ |
| 2844 | uint32_t stx_rdev_major; /* Device ID of special file [if bdev/cdev] */ |
| 2845 | uint32_t stx_rdev_minor; |
| 2846 | uint32_t stx_dev_major; /* ID of device containing file [uncond] */ |
| 2847 | uint32_t stx_dev_minor; |
| 2848 | /* 0x90 */ |
| 2849 | uint64_t __spare2[14]; /* Spare space for future expansion */ |
| 2850 | /* 0x100 */ |
| 2851 | }; |
| 2852 | |
Tonis Tiigi | 45ad761 | 2022-01-04 20:18:18 -0800 | [diff] [blame] | 2853 | /* from kernel's include/linux/sched/types.h */ |
| 2854 | struct target_sched_attr { |
| 2855 | abi_uint size; |
| 2856 | abi_uint sched_policy; |
| 2857 | abi_ullong sched_flags; |
| 2858 | abi_int sched_nice; |
| 2859 | abi_uint sched_priority; |
| 2860 | abi_ullong sched_runtime; |
| 2861 | abi_ullong sched_deadline; |
| 2862 | abi_ullong sched_period; |
| 2863 | abi_uint sched_util_min; |
| 2864 | abi_uint sched_util_max; |
| 2865 | }; |
| 2866 | |
Tonis Tiigi | 407a119 | 2022-01-04 20:18:19 -0800 | [diff] [blame] | 2867 | struct target_sched_param { |
| 2868 | abi_int sched_priority; |
| 2869 | }; |
| 2870 | |
Markus Armbruster | 1b3c4fd | 2016-06-29 15:54:17 +0200 | [diff] [blame] | 2871 | #endif |