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