1 /* common syscall defines for all architectures */
3 /* Note: although the syscall numbers change between architectures,
4 most of them stay the same, so we handle it by putting ifdefs if
10 #include "syscall_nr.h"
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() */
36 #define IPCOP_semget 2
37 #define IPCOP_semctl 3
38 #define IPCOP_semtimedop 4
39 #define IPCOP_msgsnd 11
40 #define IPCOP_msgrcv 12
41 #define IPCOP_msgget 13
42 #define IPCOP_msgctl 14
43 #define IPCOP_shmat 21
44 #define IPCOP_shmdt 22
45 #define IPCOP_shmget 23
46 #define IPCOP_shmctl 24
49 * The following is for compatibility across the various Linux
50 * platforms. The i386 ioctl numbering scheme doesn't really enforce
51 * a type field. De facto, however, the top 8 bits of the lower 16
52 * bits are indeed used as a type field, so we might just as well make
53 * this explicit here. Please be sure to use the decoding macros
56 #define TARGET_IOC_NRBITS 8
57 #define TARGET_IOC_TYPEBITS 8
59 #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \
60 || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \
61 || defined(TARGET_SPARC) \
62 || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
63 /* 16 bit uid wrappers emulation */
65 #define target_id uint16_t
67 #define target_id uint32_t
70 #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
71 || defined(TARGET_M68K) || defined(TARGET_CRIS) \
72 || defined(TARGET_UNICORE32) || defined(TARGET_S390X) \
73 || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) \
74 || defined(TARGET_NIOS2)
76 #define TARGET_IOC_SIZEBITS 14
77 #define TARGET_IOC_DIRBITS 2
79 #define TARGET_IOC_NONE 0U
80 #define TARGET_IOC_WRITE 1U
81 #define TARGET_IOC_READ 2U
83 #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \
84 defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \
87 #define TARGET_IOC_SIZEBITS 13
88 #define TARGET_IOC_DIRBITS 3
90 #define TARGET_IOC_NONE 1U
91 #define TARGET_IOC_READ 2U
92 #define TARGET_IOC_WRITE 4U
94 #elif defined(TARGET_HPPA)
96 #define TARGET_IOC_SIZEBITS 14
97 #define TARGET_IOC_DIRBITS 2
99 #define TARGET_IOC_NONE 0U
100 #define TARGET_IOC_WRITE 2U
101 #define TARGET_IOC_READ 1U
104 #error unsupported CPU
107 #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1)
108 #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1)
109 #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1)
110 #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1)
112 #define TARGET_IOC_NRSHIFT 0
113 #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS)
114 #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS)
115 #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS)
117 #define TARGET_IOC(dir,type,nr,size) \
118 (((dir) << TARGET_IOC_DIRSHIFT) | \
119 ((type) << TARGET_IOC_TYPESHIFT) | \
120 ((nr) << TARGET_IOC_NRSHIFT) | \
121 ((size) << TARGET_IOC_SIZESHIFT))
123 /* used to create numbers */
124 #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0)
125 #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size))
126 #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size))
127 #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size))
129 /* the size is automatically computed for these defines */
130 #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK)
131 #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
132 #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
134 struct target_sockaddr
{
139 struct target_sockaddr_ll
{
140 uint16_t sll_family
; /* Always AF_PACKET */
141 uint16_t sll_protocol
; /* Physical layer protocol */
142 int sll_ifindex
; /* Interface number */
143 uint16_t sll_hatype
; /* ARP hardware type */
144 uint8_t sll_pkttype
; /* Packet type */
145 uint8_t sll_halen
; /* Length of address */
146 uint8_t sll_addr
[8]; /* Physical layer address */
149 struct target_sockaddr_un
{
151 uint8_t sun_path
[108];
154 struct target_in_addr
{
155 uint32_t s_addr
; /* big endian */
158 struct target_sockaddr_in
{
160 int16_t sin_port
; /* big endian */
161 struct target_in_addr sin_addr
;
162 uint8_t __pad
[sizeof(struct target_sockaddr
) -
163 sizeof(uint16_t) - sizeof(int16_t) -
164 sizeof(struct target_in_addr
)];
167 struct target_sockaddr_in6
{
168 uint16_t sin6_family
;
169 uint16_t sin6_port
; /* big endian */
170 uint32_t sin6_flowinfo
; /* big endian */
171 struct in6_addr sin6_addr
; /* IPv6 address, big endian */
172 uint32_t sin6_scope_id
;
175 struct target_sock_filter
{
182 struct target_sock_fprog
{
187 struct target_ip_mreq
{
188 struct target_in_addr imr_multiaddr
;
189 struct target_in_addr imr_address
;
192 struct target_ip_mreqn
{
193 struct target_in_addr imr_multiaddr
;
194 struct target_in_addr imr_address
;
195 abi_long imr_ifindex
;
198 struct target_ip_mreq_source
{
200 uint32_t imr_multiaddr
;
201 uint32_t imr_interface
;
202 uint32_t imr_sourceaddr
;
205 struct target_timeval
{
210 struct target_timespec
{
215 struct target_timezone
{
216 abi_int tz_minuteswest
;
220 struct target_itimerval
{
221 struct target_timeval it_interval
;
222 struct target_timeval it_value
;
225 struct target_itimerspec
{
226 struct target_timespec it_interval
;
227 struct target_timespec it_value
;
230 struct target_timex
{
231 abi_uint modes
; /* Mode selector */
232 abi_long offset
; /* Time offset */
233 abi_long freq
; /* Frequency offset */
234 abi_long maxerror
; /* Maximum error (microseconds) */
235 abi_long esterror
; /* Estimated error (microseconds) */
236 abi_int status
; /* Clock command/status */
237 abi_long constant
; /* PLL (phase-locked loop) time constant */
238 abi_long precision
; /* Clock precision (microseconds, ro) */
239 abi_long tolerance
; /* Clock freq. tolerance (ppm, ro) */
240 struct target_timeval time
; /* Current time */
241 abi_long tick
; /* Microseconds between clock ticks */
242 abi_long ppsfreq
; /* PPS (pulse per second) frequency */
243 abi_long jitter
; /* PPS jitter (ro); nanoseconds */
244 abi_int shift
; /* PPS interval duration (seconds) */
245 abi_long stabil
; /* PPS stability */
246 abi_long jitcnt
; /* PPS jitter limit exceeded (ro) */
247 abi_long calcnt
; /* PPS calibration intervals */
248 abi_long errcnt
; /* PPS calibration errors */
249 abi_long stbcnt
; /* PPS stability limit exceeded */
250 abi_int tai
; /* TAI offset */
252 /* Further padding bytes to allow for future expansion */
253 abi_int
:32; abi_int
:32; abi_int
:32; abi_int
:32;
254 abi_int
:32; abi_int
:32; abi_int
:32; abi_int
:32;
255 abi_int
:32; abi_int
:32; abi_int
:32;
258 typedef abi_long target_clock_t
;
260 #define TARGET_HZ 100
263 target_clock_t tms_utime
;
264 target_clock_t tms_stime
;
265 target_clock_t tms_cutime
;
266 target_clock_t tms_cstime
;
269 struct target_utimbuf
{
274 struct target_sel_arg_struct
{
276 abi_long inp
, outp
, exp
;
280 struct target_iovec
{
281 abi_long iov_base
; /* Starting address */
282 abi_long iov_len
; /* Number of bytes */
285 struct target_msghdr
{
286 abi_long msg_name
; /* Socket name */
287 int msg_namelen
; /* Length of name */
288 abi_long msg_iov
; /* Data blocks */
289 abi_long msg_iovlen
; /* Number of blocks */
290 abi_long msg_control
; /* Per protocol magic (eg BSD file descriptor passing) */
291 abi_long msg_controllen
; /* Length of cmsg list */
292 unsigned int msg_flags
;
295 struct target_cmsghdr
{
301 #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1))
302 #define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \
303 __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start)
304 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \
305 & (size_t) ~(sizeof (abi_long) - 1))
306 #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \
307 + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)))
308 #define TARGET_CMSG_LEN(len) (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len))
310 static __inline__
struct target_cmsghdr
*
311 __target_cmsg_nxthdr(struct target_msghdr
*__mhdr
,
312 struct target_cmsghdr
*__cmsg
,
313 struct target_cmsghdr
*__cmsg_start
)
315 struct target_cmsghdr
*__ptr
;
317 __ptr
= (struct target_cmsghdr
*)((unsigned char *) __cmsg
318 + TARGET_CMSG_ALIGN (tswapal(__cmsg
->cmsg_len
)));
319 if ((unsigned long)((char *)(__ptr
+1) - (char *)__cmsg_start
)
320 > tswapal(__mhdr
->msg_controllen
)) {
321 /* No more entries. */
322 return (struct target_cmsghdr
*)0;
327 struct target_mmsghdr
{
328 struct target_msghdr msg_hdr
; /* Message header */
329 unsigned int msg_len
; /* Number of bytes transmitted */
332 struct target_rusage
{
333 struct target_timeval ru_utime
; /* user time used */
334 struct target_timeval ru_stime
; /* system time used */
335 abi_long ru_maxrss
; /* maximum resident set size */
336 abi_long ru_ixrss
; /* integral shared memory size */
337 abi_long ru_idrss
; /* integral unshared data size */
338 abi_long ru_isrss
; /* integral unshared stack size */
339 abi_long ru_minflt
; /* page reclaims */
340 abi_long ru_majflt
; /* page faults */
341 abi_long ru_nswap
; /* swaps */
342 abi_long ru_inblock
; /* block input operations */
343 abi_long ru_oublock
; /* block output operations */
344 abi_long ru_msgsnd
; /* messages sent */
345 abi_long ru_msgrcv
; /* messages received */
346 abi_long ru_nsignals
; /* signals received */
347 abi_long ru_nvcsw
; /* voluntary context switches */
348 abi_long ru_nivcsw
; /* involuntary " */
355 struct kernel_statfs
{
363 kernel_fsid_t f_fsid
;
368 struct target_dirent
{
371 unsigned short d_reclen
;
375 struct target_dirent64
{
378 unsigned short d_reclen
;
379 unsigned char d_type
;
384 /* mostly generic signal stuff */
385 #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */
386 #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */
387 #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */
390 #define TARGET_NSIG 128
392 #define TARGET_NSIG 64
394 #define TARGET_NSIG_BPW TARGET_ABI_BITS
395 #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW)
398 abi_ulong sig
[TARGET_NSIG_WORDS
];
402 static inline void tswap_sigset(target_sigset_t
*d
, const target_sigset_t
*s
)
405 for(i
= 0;i
< TARGET_NSIG_WORDS
; i
++)
406 d
->sig
[i
] = tswapal(s
->sig
[i
]);
409 static inline void tswap_sigset(target_sigset_t
*d
, const target_sigset_t
*s
)
415 static inline void target_siginitset(target_sigset_t
*d
, abi_ulong set
)
419 for(i
= 1;i
< TARGET_NSIG_WORDS
; i
++)
423 void host_to_target_sigset(target_sigset_t
*d
, const sigset_t
*s
);
424 void target_to_host_sigset(sigset_t
*d
, const target_sigset_t
*s
);
425 void host_to_target_old_sigset(abi_ulong
*old_sigset
,
426 const sigset_t
*sigset
);
427 void target_to_host_old_sigset(sigset_t
*sigset
,
428 const abi_ulong
*old_sigset
);
429 struct target_sigaction
;
430 int do_sigaction(int sig
, const struct target_sigaction
*act
,
431 struct target_sigaction
*oact
);
433 #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
434 || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined(TARGET_SH4) \
435 || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) \
436 || defined(TARGET_MICROBLAZE) || defined(TARGET_UNICORE32) \
437 || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \
438 || defined(TARGET_TILEGX) || defined(TARGET_HPPA) || defined(TARGET_NIOS2)
440 #if defined(TARGET_SPARC)
441 #define TARGET_SA_NOCLDSTOP 8u
442 #define TARGET_SA_NOCLDWAIT 0x100u
443 #define TARGET_SA_SIGINFO 0x200u
444 #define TARGET_SA_ONSTACK 1u
445 #define TARGET_SA_RESTART 2u
446 #define TARGET_SA_NODEFER 0x20u
447 #define TARGET_SA_RESETHAND 4u
448 #elif defined(TARGET_MIPS)
449 #define TARGET_SA_NOCLDSTOP 0x00000001
450 #define TARGET_SA_NOCLDWAIT 0x00010000
451 #define TARGET_SA_SIGINFO 0x00000008
452 #define TARGET_SA_ONSTACK 0x08000000
453 #define TARGET_SA_NODEFER 0x40000000
454 #define TARGET_SA_RESTART 0x10000000
455 #define TARGET_SA_RESETHAND 0x80000000
456 #if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64)
457 #define TARGET_SA_RESTORER 0x04000000 /* Only for O32 */
459 #elif defined(TARGET_OPENRISC)
460 #define TARGET_SA_NOCLDSTOP 0x00000001
461 #define TARGET_SA_NOCLDWAIT 0x00000002
462 #define TARGET_SA_SIGINFO 0x00000004
463 #define TARGET_SA_ONSTACK 0x08000000
464 #define TARGET_SA_RESTART 0x10000000
465 #define TARGET_SA_NODEFER 0x40000000
466 #define TARGET_SA_RESETHAND 0x80000000
467 #elif defined(TARGET_ALPHA)
468 #define TARGET_SA_ONSTACK 0x00000001
469 #define TARGET_SA_RESTART 0x00000002
470 #define TARGET_SA_NOCLDSTOP 0x00000004
471 #define TARGET_SA_NODEFER 0x00000008
472 #define TARGET_SA_RESETHAND 0x00000010
473 #define TARGET_SA_NOCLDWAIT 0x00000020 /* not supported yet */
474 #define TARGET_SA_SIGINFO 0x00000040
476 #define TARGET_SA_NOCLDSTOP 0x00000001
477 #define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */
478 #define TARGET_SA_SIGINFO 0x00000004
479 #define TARGET_SA_ONSTACK 0x08000000
480 #define TARGET_SA_RESTART 0x10000000
481 #define TARGET_SA_NODEFER 0x40000000
482 #define TARGET_SA_RESETHAND 0x80000000
483 #define TARGET_SA_RESTORER 0x04000000
486 #if defined(TARGET_ALPHA)
488 #define TARGET_SIGHUP 1
489 #define TARGET_SIGINT 2
490 #define TARGET_SIGQUIT 3
491 #define TARGET_SIGILL 4
492 #define TARGET_SIGTRAP 5
493 #define TARGET_SIGABRT 6
494 #define TARGET_SIGSTKFLT 7 /* actually SIGEMT */
495 #define TARGET_SIGFPE 8
496 #define TARGET_SIGKILL 9
497 #define TARGET_SIGBUS 10
498 #define TARGET_SIGSEGV 11
499 #define TARGET_SIGSYS 12
500 #define TARGET_SIGPIPE 13
501 #define TARGET_SIGALRM 14
502 #define TARGET_SIGTERM 15
503 #define TARGET_SIGURG 16
504 #define TARGET_SIGSTOP 17
505 #define TARGET_SIGTSTP 18
506 #define TARGET_SIGCONT 19
507 #define TARGET_SIGCHLD 20
508 #define TARGET_SIGTTIN 21
509 #define TARGET_SIGTTOU 22
510 #define TARGET_SIGIO 23
511 #define TARGET_SIGXCPU 24
512 #define TARGET_SIGXFSZ 25
513 #define TARGET_SIGVTALRM 26
514 #define TARGET_SIGPROF 27
515 #define TARGET_SIGWINCH 28
516 #define TARGET_SIGPWR 29 /* actually SIGINFO */
517 #define TARGET_SIGUSR1 30
518 #define TARGET_SIGUSR2 31
519 #define TARGET_SIGRTMIN 32
521 #define TARGET_SIG_BLOCK 1
522 #define TARGET_SIG_UNBLOCK 2
523 #define TARGET_SIG_SETMASK 3
525 #elif defined(TARGET_SPARC)
527 #define TARGET_SIGHUP 1
528 #define TARGET_SIGINT 2
529 #define TARGET_SIGQUIT 3
530 #define TARGET_SIGILL 4
531 #define TARGET_SIGTRAP 5
532 #define TARGET_SIGABRT 6
533 #define TARGET_SIGIOT 6
534 #define TARGET_SIGSTKFLT 7 /* actually EMT */
535 #define TARGET_SIGFPE 8
536 #define TARGET_SIGKILL 9
537 #define TARGET_SIGBUS 10
538 #define TARGET_SIGSEGV 11
539 #define TARGET_SIGSYS 12
540 #define TARGET_SIGPIPE 13
541 #define TARGET_SIGALRM 14
542 #define TARGET_SIGTERM 15
543 #define TARGET_SIGURG 16
544 #define TARGET_SIGSTOP 17
545 #define TARGET_SIGTSTP 18
546 #define TARGET_SIGCONT 19
547 #define TARGET_SIGCHLD 20
548 #define TARGET_SIGTTIN 21
549 #define TARGET_SIGTTOU 22
550 #define TARGET_SIGIO 23
551 #define TARGET_SIGXCPU 24
552 #define TARGET_SIGXFSZ 25
553 #define TARGET_SIGVTALRM 26
554 #define TARGET_SIGPROF 27
555 #define TARGET_SIGWINCH 28
556 #define TARGET_SIGPWR 29
557 #define TARGET_SIGUSR1 30
558 #define TARGET_SIGUSR2 31
559 #define TARGET_SIGRTMIN 32
561 #define TARGET_SIG_BLOCK 0x01 /* for blocking signals */
562 #define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */
563 #define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */
565 #elif defined(TARGET_MIPS)
567 #define TARGET_SIGHUP 1 /* Hangup (POSIX). */
568 #define TARGET_SIGINT 2 /* Interrupt (ANSI). */
569 #define TARGET_SIGQUIT 3 /* Quit (POSIX). */
570 #define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */
571 #define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */
572 #define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */
573 #define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */
574 #define TARGET_SIGEMT 7
575 #define TARGET_SIGSTKFLT 7 /* XXX: incorrect */
576 #define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */
577 #define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */
578 #define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */
579 #define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */
580 #define TARGET_SIGSYS 12
581 #define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */
582 #define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */
583 #define TARGET_SIGTERM 15 /* Termination (ANSI). */
584 #define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */
585 #define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */
586 #define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */
587 #define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */
588 #define TARGET_SIGPWR 19 /* Power failure restart (System V). */
589 #define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */
590 #define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */
591 #define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */
592 #define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */
593 #define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */
594 #define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */
595 #define TARGET_SIGCONT 25 /* Continue (POSIX). */
596 #define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */
597 #define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */
598 #define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */
599 #define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */
600 #define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */
601 #define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */
602 #define TARGET_SIGRTMIN 32
604 #define TARGET_SIG_BLOCK 1 /* for blocking signals */
605 #define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */
606 #define TARGET_SIG_SETMASK 3 /* for setting the signal mask */
608 #elif defined(TARGET_HPPA)
610 #define TARGET_SIGHUP 1
611 #define TARGET_SIGINT 2
612 #define TARGET_SIGQUIT 3
613 #define TARGET_SIGILL 4
614 #define TARGET_SIGTRAP 5
615 #define TARGET_SIGABRT 6
616 #define TARGET_SIGIOT 6
617 #define TARGET_SIGSTKFLT 7
618 #define TARGET_SIGFPE 8
619 #define TARGET_SIGKILL 9
620 #define TARGET_SIGBUS 10
621 #define TARGET_SIGSEGV 11
622 #define TARGET_SIGXCPU 12
623 #define TARGET_SIGPIPE 13
624 #define TARGET_SIGALRM 14
625 #define TARGET_SIGTERM 15
626 #define TARGET_SIGUSR1 16
627 #define TARGET_SIGUSR2 17
628 #define TARGET_SIGCHLD 18
629 #define TARGET_SIGPWR 19
630 #define TARGET_SIGVTALRM 20
631 #define TARGET_SIGPROF 21
632 #define TARGET_SIGIO 22
633 #define TARGET_SIGPOLL TARGET_SIGIO
634 #define TARGET_SIGWINCH 23
635 #define TARGET_SIGSTOP 24
636 #define TARGET_SIGTSTP 25
637 #define TARGET_SIGCONT 26
638 #define TARGET_SIGTTIN 27
639 #define TARGET_SIGTTOU 28
640 #define TARGET_SIGURG 29
641 #define TARGET_SIGXFSZ 30
642 #define TARGET_SIGSYS 31
644 #define TARGET_SIG_BLOCK 0
645 #define TARGET_SIG_UNBLOCK 1
646 #define TARGET_SIG_SETMASK 2
650 /* OpenRISC Using the general signals */
651 #define TARGET_SIGHUP 1
652 #define TARGET_SIGINT 2
653 #define TARGET_SIGQUIT 3
654 #define TARGET_SIGILL 4
655 #define TARGET_SIGTRAP 5
656 #define TARGET_SIGABRT 6
657 #define TARGET_SIGIOT 6
658 #define TARGET_SIGBUS 7
659 #define TARGET_SIGFPE 8
660 #define TARGET_SIGKILL 9
661 #define TARGET_SIGUSR1 10
662 #define TARGET_SIGSEGV 11
663 #define TARGET_SIGUSR2 12
664 #define TARGET_SIGPIPE 13
665 #define TARGET_SIGALRM 14
666 #define TARGET_SIGTERM 15
667 #define TARGET_SIGSTKFLT 16
668 #define TARGET_SIGCHLD 17
669 #define TARGET_SIGCONT 18
670 #define TARGET_SIGSTOP 19
671 #define TARGET_SIGTSTP 20
672 #define TARGET_SIGTTIN 21
673 #define TARGET_SIGTTOU 22
674 #define TARGET_SIGURG 23
675 #define TARGET_SIGXCPU 24
676 #define TARGET_SIGXFSZ 25
677 #define TARGET_SIGVTALRM 26
678 #define TARGET_SIGPROF 27
679 #define TARGET_SIGWINCH 28
680 #define TARGET_SIGIO 29
681 #define TARGET_SIGPWR 30
682 #define TARGET_SIGSYS 31
683 #define TARGET_SIGRTMIN 32
685 #define TARGET_SIG_BLOCK 0 /* for blocking signals */
686 #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */
687 #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */
691 #if defined(TARGET_ALPHA)
692 struct target_old_sigaction
{
693 abi_ulong _sa_handler
;
698 struct target_rt_sigaction
{
699 abi_ulong _sa_handler
;
701 target_sigset_t sa_mask
;
704 /* This is the struct used inside the kernel. The ka_restorer
705 field comes from the 5th argument to sys_rt_sigaction. */
706 struct target_sigaction
{
707 abi_ulong _sa_handler
;
709 target_sigset_t sa_mask
;
710 abi_ulong sa_restorer
;
712 #elif defined(TARGET_MIPS)
713 struct target_sigaction
{
715 #if defined(TARGET_ABI_MIPSN32)
716 uint32_t _sa_handler
;
718 abi_ulong _sa_handler
;
720 target_sigset_t sa_mask
;
723 struct target_old_sigaction
{
724 abi_ulong _sa_handler
;
727 abi_ulong sa_restorer
;
730 struct target_sigaction
{
731 abi_ulong _sa_handler
;
733 abi_ulong sa_restorer
;
734 target_sigset_t sa_mask
;
738 typedef union target_sigval
{
743 #if defined (TARGET_SPARC)
750 abi_ulong u_regs
[16]; /* globals and ins */
756 unsigned long si_float_regs
[32];
757 unsigned long si_fsr
;
758 unsigned long si_fpqdepth
;
760 unsigned long *insn_addr
;
767 #define TARGET_SI_MAX_SIZE 128
769 #if TARGET_ABI_BITS == 32
770 #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int))
772 #define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int))
775 #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int))
777 /* Within QEMU the top 16 bits of si_code indicate which of the parts of
778 * the union in target_siginfo is valid. This only applies between
779 * host_to_target_siginfo_noswap() and tswap_siginfo(); it does not
780 * appear either within host siginfo_t or in target_siginfo structures
781 * which we get from the guest userspace program. (The Linux kernel
782 * does a similar thing with using the top bits for its own internal
783 * purposes but not letting them be visible to userspace.)
785 #define QEMU_SI_KILL 0
786 #define QEMU_SI_TIMER 1
787 #define QEMU_SI_POLL 2
788 #define QEMU_SI_FAULT 3
789 #define QEMU_SI_CHLD 4
792 typedef struct target_siginfo
{
804 int _pad
[TARGET_SI_PAD_SIZE
];
808 pid_t _pid
; /* sender's pid */
809 uid_t _uid
; /* sender's uid */
812 /* POSIX.1b timers */
814 unsigned int _timer1
;
815 unsigned int _timer2
;
818 /* POSIX.1b signals */
820 pid_t _pid
; /* sender's pid */
821 uid_t _uid
; /* sender's uid */
822 target_sigval_t _sigval
;
827 pid_t _pid
; /* which child */
828 uid_t _uid
; /* sender's uid */
829 int _status
; /* exit code */
830 target_clock_t _utime
;
831 target_clock_t _stime
;
834 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
836 abi_ulong _addr
; /* faulting insn/memory ref. */
841 int _band
; /* POLL_IN, POLL_OUT, POLL_MSG */
849 * Digital reserves positive values for kernel-generated signals.
851 #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */
852 #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */
853 #define TARGET_SI_QUEUE -1 /* sent by sigqueue */
854 #define TARGET_SI_TIMER -2 /* sent by timer expiration */
855 #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */
856 #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */
857 #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */
862 #define TARGET_ILL_ILLOPC (1) /* illegal opcode */
863 #define TARGET_ILL_ILLOPN (2) /* illegal operand */
864 #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */
865 #define TARGET_ILL_ILLTRP (4) /* illegal trap */
866 #define TARGET_ILL_PRVOPC (5) /* privileged opcode */
867 #define TARGET_ILL_PRVREG (6) /* privileged register */
868 #define TARGET_ILL_COPROC (7) /* coprocessor error */
869 #define TARGET_ILL_BADSTK (8) /* internal stack error */
871 #define TARGET_ILL_DBLFLT (9) /* double fault */
872 #define TARGET_ILL_HARDWALL (10) /* user networks hardwall violation */
878 #define TARGET_FPE_INTDIV (1) /* integer divide by zero */
879 #define TARGET_FPE_INTOVF (2) /* integer overflow */
880 #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */
881 #define TARGET_FPE_FLTOVF (4) /* floating point overflow */
882 #define TARGET_FPE_FLTUND (5) /* floating point underflow */
883 #define TARGET_FPE_FLTRES (6) /* floating point inexact result */
884 #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */
885 #define TARGET_FPE_FLTSUB (8) /* subscript out of range */
886 #define TARGET_NSIGFPE 8
891 #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */
892 #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */
893 #define TARGET_SEGV_BNDERR (3) /* failed address bound checks */
898 #define TARGET_BUS_ADRALN (1) /* invalid address alignment */
899 #define TARGET_BUS_ADRERR (2) /* non-existent physical address */
900 #define TARGET_BUS_OBJERR (3) /* object specific hardware error */
901 /* hardware memory error consumed on a machine check: action required */
902 #define TARGET_BUS_MCEERR_AR (4)
903 /* hardware memory error detected in process but not consumed: action optional*/
904 #define TARGET_BUS_MCEERR_AO (5)
909 #define TARGET_TRAP_BRKPT (1) /* process breakpoint */
910 #define TARGET_TRAP_TRACE (2) /* process trace trap */
911 #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */
912 #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */
914 #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */
916 struct target_rlimit
{
921 #if defined(TARGET_ALPHA)
922 #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull
923 #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32)
924 #define TARGET_RLIM_INFINITY 0x7fffffffUL
926 #define TARGET_RLIM_INFINITY ((abi_ulong)-1)
929 #if defined(TARGET_MIPS)
930 #define TARGET_RLIMIT_CPU 0
931 #define TARGET_RLIMIT_FSIZE 1
932 #define TARGET_RLIMIT_DATA 2
933 #define TARGET_RLIMIT_STACK 3
934 #define TARGET_RLIMIT_CORE 4
935 #define TARGET_RLIMIT_RSS 7
936 #define TARGET_RLIMIT_NPROC 8
937 #define TARGET_RLIMIT_NOFILE 5
938 #define TARGET_RLIMIT_MEMLOCK 9
939 #define TARGET_RLIMIT_AS 6
940 #define TARGET_RLIMIT_LOCKS 10
941 #define TARGET_RLIMIT_SIGPENDING 11
942 #define TARGET_RLIMIT_MSGQUEUE 12
943 #define TARGET_RLIMIT_NICE 13
944 #define TARGET_RLIMIT_RTPRIO 14
946 #define TARGET_RLIMIT_CPU 0
947 #define TARGET_RLIMIT_FSIZE 1
948 #define TARGET_RLIMIT_DATA 2
949 #define TARGET_RLIMIT_STACK 3
950 #define TARGET_RLIMIT_CORE 4
951 #define TARGET_RLIMIT_RSS 5
952 #if defined(TARGET_SPARC)
953 #define TARGET_RLIMIT_NOFILE 6
954 #define TARGET_RLIMIT_NPROC 7
956 #define TARGET_RLIMIT_NPROC 6
957 #define TARGET_RLIMIT_NOFILE 7
959 #define TARGET_RLIMIT_MEMLOCK 8
960 #define TARGET_RLIMIT_AS 9
961 #define TARGET_RLIMIT_LOCKS 10
962 #define TARGET_RLIMIT_SIGPENDING 11
963 #define TARGET_RLIMIT_MSGQUEUE 12
964 #define TARGET_RLIMIT_NICE 13
965 #define TARGET_RLIMIT_RTPRIO 14
968 struct target_pollfd
{
969 int fd
; /* file descriptor */
970 short events
; /* requested events */
971 short revents
; /* returned events */
974 /* virtual terminal ioctls */
975 #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */
976 #define TARGET_KDMKTONE 0x4B30 /* generate tone */
977 #define TARGET_KDGKBTYPE 0x4b33
978 #define TARGET_KDSETMODE 0x4b3a
979 #define TARGET_KDGKBMODE 0x4b44
980 #define TARGET_KDSKBMODE 0x4b45
981 #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */
982 #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */
983 #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */
984 #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */
985 #define TARGET_KDGETLED 0x4B31 /* return current led state */
986 #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */
987 #define TARGET_KDSIGACCEPT 0x4B4E
989 #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4)
990 #define TARGET_SIOCATMARK TARGET_IOR('s', 7, int)
991 #define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t)
993 #define TARGET_SIOCATMARK 0x8905
994 #define TARGET_SIOCGPGRP 0x8904
996 #define TARGET_SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
997 #define TARGET_SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
999 /* Networking ioctls */
1000 #define TARGET_SIOCADDRT 0x890B /* add routing table entry */
1001 #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */
1002 #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */
1003 #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */
1004 #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */
1005 #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */
1006 #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */
1007 #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */
1008 #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */
1009 #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */
1010 #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */
1011 #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */
1012 #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */
1013 #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */
1014 #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */
1015 #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */
1016 #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */
1017 #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */
1018 #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */
1019 #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */
1020 #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */
1021 #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */
1022 #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */
1023 #define TARGET_SIOCSIFENCAP 0x8926
1024 #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */
1025 #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */
1026 #define TARGET_SIOCSIFSLAVE 0x8930
1027 #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */
1028 #define TARGET_SIOCDELMULTI 0x8932
1029 #define TARGET_SIOCGIFINDEX 0x8933
1031 /* Bridging control calls */
1032 #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */
1033 #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */
1035 #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */
1036 #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */
1038 /* ARP cache control calls. */
1039 #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */
1040 #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */
1041 #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */
1042 #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */
1043 #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */
1044 #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */
1046 /* RARP cache control calls. */
1047 #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */
1048 #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */
1049 #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */
1051 /* Driver configuration calls */
1052 #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */
1053 #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */
1055 /* DLCI configuration calls */
1056 #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */
1057 #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */
1059 /* From <linux/wireless.h> */
1061 #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */
1063 /* From <linux/fs.h> */
1065 #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */
1066 #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */
1067 #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */
1068 #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */
1069 #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */
1070 #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */
1071 #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */
1072 #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
1073 #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
1074 #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
1075 #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
1076 #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */
1077 #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */
1078 /* A jump here: 108-111 have been used for various private purposes. */
1079 #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong)
1080 #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong)
1081 #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong)
1082 /* return device size in bytes
1085 #define TARGET_BLKDISCARD TARGET_IO(0x12, 119)
1086 #define TARGET_BLKIOMIN TARGET_IO(0x12, 120)
1087 #define TARGET_BLKIOOPT TARGET_IO(0x12, 121)
1088 #define TARGET_BLKALIGNOFF TARGET_IO(0x12, 122)
1089 #define TARGET_BLKPBSZGET TARGET_IO(0x12, 123)
1090 #define TARGET_BLKDISCARDZEROES TARGET_IO(0x12, 124)
1091 #define TARGET_BLKSECDISCARD TARGET_IO(0x12, 125)
1092 #define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126)
1093 #define TARGET_BLKZEROOUT TARGET_IO(0x12, 127)
1095 #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */
1096 #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */
1098 #define TARGET_FICLONE TARGET_IOW(0x94, 9, int)
1099 #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range)
1101 /* Note that the ioctl numbers claim type "long" but the actual type
1102 * used by the kernel is "int".
1104 #define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, long)
1105 #define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, long)
1107 #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap)
1109 /* cdrom commands */
1110 #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */
1111 #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */
1112 #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */
1113 #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index
1114 (struct cdrom_ti) */
1115 #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header
1116 (struct cdrom_tochdr) */
1117 #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry
1118 (struct cdrom_tocentry) */
1119 #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */
1120 #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */
1121 #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */
1122 #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume
1123 (struct cdrom_volctrl) */
1124 #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data
1125 (struct cdrom_subchnl) */
1126 #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes)
1127 (struct cdrom_read) */
1128 #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes)
1129 (struct cdrom_read) */
1130 #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */
1131 #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */
1132 #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session
1133 address of multi session disks
1134 (struct cdrom_multisession) */
1135 #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code"
1136 if available (struct cdrom_mcn) */
1137 #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated,
1138 but here anyway for compatibility */
1139 #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */
1140 #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting
1141 (struct cdrom_volctrl) */
1142 #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes)
1143 (struct cdrom_read) */
1145 * These ioctls are used only used in aztcd.c and optcd.c
1147 #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */
1148 #define TARGET_CDROMSEEK 0x5316 /* seek msf address */
1151 * This ioctl is only used by the scsi-cd driver.
1152 It is for playing audio in logical block addressing mode.
1154 #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */
1157 * These ioctls are only used in optcd.c
1159 #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */
1162 * These ioctls are (now) only in ide-cd.c for controlling
1163 * drive spindown time. They should be implemented in the
1164 * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
1165 * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
1168 #define TARGET_CDROMGETSPINDOWN 0x531d
1169 #define TARGET_CDROMSETSPINDOWN 0x531e
1172 * These ioctls are implemented through the uniform CD-ROM driver
1173 * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
1174 * drivers are eventually ported to the uniform CD-ROM driver interface.
1176 #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
1177 #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */
1178 #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */
1179 #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */
1180 #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */
1181 #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */
1182 #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
1183 #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */
1184 #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */
1185 #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */
1186 #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */
1187 #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */
1189 /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386.
1190 * Future CDROM ioctls should be kept below 0x537F
1193 /* This ioctl is only used by sbpcd at the moment */
1194 #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */
1195 /* conflict with SCSI_IOCTL_GET_IDLUN */
1197 /* DVD-ROM Specific ioctls */
1198 #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */
1199 #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */
1200 #define TARGET_DVD_AUTH 0x5392 /* Authentication */
1202 #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */
1203 #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */
1204 #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */
1208 /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
1209 #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */
1210 #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */
1211 #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */
1212 #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */
1213 #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */
1214 #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */
1215 #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */
1216 #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
1217 #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */
1219 /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
1220 #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */
1221 #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */
1222 #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */
1223 #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */
1224 #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */
1225 #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */
1226 #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
1229 #define TARGET_LOOP_SET_FD 0x4C00
1230 #define TARGET_LOOP_CLR_FD 0x4C01
1231 #define TARGET_LOOP_SET_STATUS 0x4C02
1232 #define TARGET_LOOP_GET_STATUS 0x4C03
1233 #define TARGET_LOOP_SET_STATUS64 0x4C04
1234 #define TARGET_LOOP_GET_STATUS64 0x4C05
1235 #define TARGET_LOOP_CHANGE_FD 0x4C06
1237 #define TARGET_LOOP_CTL_ADD 0x4C80
1238 #define TARGET_LOOP_CTL_REMOVE 0x4C81
1239 #define TARGET_LOOP_CTL_GET_FREE 0x4C82
1242 #define TARGET_FBIOGET_VSCREENINFO 0x4600
1243 #define TARGET_FBIOPUT_VSCREENINFO 0x4601
1244 #define TARGET_FBIOGET_FSCREENINFO 0x4602
1245 #define TARGET_FBIOGETCMAP 0x4604
1246 #define TARGET_FBIOPUTCMAP 0x4605
1247 #define TARGET_FBIOPAN_DISPLAY 0x4606
1248 #define TARGET_FBIOGET_CON2FBMAP 0x460F
1249 #define TARGET_FBIOPUT_CON2FBMAP 0x4610
1252 #define TARGET_VT_OPENQRY 0x5600
1253 #define TARGET_VT_GETSTATE 0x5603
1254 #define TARGET_VT_ACTIVATE 0x5606
1255 #define TARGET_VT_WAITACTIVE 0x5607
1256 #define TARGET_VT_LOCKSWITCH 0x560b
1257 #define TARGET_VT_UNLOCKSWITCH 0x560c
1258 #define TARGET_VT_GETMODE 0x5601
1259 #define TARGET_VT_SETMODE 0x5602
1260 #define TARGET_VT_RELDISP 0x5605
1261 #define TARGET_VT_DISALLOCATE 0x5608
1264 #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00)
1265 #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01)
1266 #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02)
1267 #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03)
1268 #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04)
1269 #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05)
1270 #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06)
1271 #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07)
1272 #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08)
1273 #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09)
1274 #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a)
1275 #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b)
1276 #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c)
1277 #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d)
1278 #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e)
1279 #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f)
1281 /* from asm/termbits.h */
1283 #define TARGET_NCC 8
1284 struct target_termio
{
1285 unsigned short c_iflag
; /* input mode flags */
1286 unsigned short c_oflag
; /* output mode flags */
1287 unsigned short c_cflag
; /* control mode flags */
1288 unsigned short c_lflag
; /* local mode flags */
1289 unsigned char c_line
; /* line discipline */
1290 unsigned char c_cc
[TARGET_NCC
]; /* control characters */
1293 struct target_winsize
{
1294 unsigned short ws_row
;
1295 unsigned short ws_col
;
1296 unsigned short ws_xpixel
;
1297 unsigned short ws_ypixel
;
1300 #include "termbits.h"
1302 #if defined(TARGET_MIPS)
1303 #define TARGET_PROT_SEM 0x10
1305 #define TARGET_PROT_SEM 0x08
1309 #define TARGET_MAP_SHARED 0x01 /* Share changes */
1310 #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */
1311 #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */
1313 /* Target specific */
1314 #if defined(TARGET_MIPS)
1315 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
1316 #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */
1317 #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */
1318 #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */
1319 #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */
1320 #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */
1321 #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */
1322 #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
1323 #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */
1324 #elif defined(TARGET_PPC)
1325 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
1326 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */
1327 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */
1328 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */
1329 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */
1330 #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */
1331 #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */
1332 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
1333 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */
1334 #elif defined(TARGET_ALPHA)
1335 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */
1336 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */
1337 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */
1338 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */
1339 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */
1340 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */
1341 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */
1342 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */
1343 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */
1344 #elif defined(TARGET_HPPA)
1345 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */
1346 #define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly */
1347 #define TARGET_MAP_GROWSDOWN 0x08000 /* stack-like segment */
1348 #define TARGET_MAP_DENYWRITE 0x00800 /* ETXTBSY */
1349 #define TARGET_MAP_EXECUTABLE 0x01000 /* mark it as an executable */
1350 #define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */
1351 #define TARGET_MAP_NORESERVE 0x04000 /* no check for reservations */
1352 #define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetables */
1353 #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */
1355 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
1356 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */
1357 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */
1358 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */
1359 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */
1360 #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */
1361 #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */
1362 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
1363 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */
1364 #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */
1367 #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \
1368 || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \
1369 || defined(TARGET_CRIS) || defined(TARGET_UNICORE32)
1370 struct target_stat
{
1371 unsigned short st_dev
;
1372 unsigned short __pad1
;
1374 unsigned short st_mode
;
1375 unsigned short st_nlink
;
1376 unsigned short st_uid
;
1377 unsigned short st_gid
;
1378 unsigned short st_rdev
;
1379 unsigned short __pad2
;
1381 abi_ulong st_blksize
;
1382 abi_ulong st_blocks
;
1383 abi_ulong target_st_atime
;
1384 abi_ulong __unused1
;
1385 abi_ulong target_st_mtime
;
1386 abi_ulong __unused2
;
1387 abi_ulong target_st_ctime
;
1388 abi_ulong __unused3
;
1389 abi_ulong __unused4
;
1390 abi_ulong __unused5
;
1393 /* This matches struct stat64 in glibc2.1, hence the absolutely
1394 * insane amounts of padding around dev_t's.
1396 #define TARGET_HAS_STRUCT_STAT64
1397 struct target_stat64
{
1398 unsigned short st_dev
;
1399 unsigned char __pad0
[10];
1401 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
1404 unsigned int st_mode
;
1405 unsigned int st_nlink
;
1410 unsigned short st_rdev
;
1411 unsigned char __pad3
[10];
1414 abi_ulong st_blksize
;
1416 abi_ulong st_blocks
; /* Number 512-byte blocks allocated. */
1417 abi_ulong __pad4
; /* future possible st_blocks high bits */
1419 abi_ulong target_st_atime
;
1422 abi_ulong target_st_mtime
;
1425 abi_ulong target_st_ctime
;
1426 abi_ulong __pad7
; /* will be high 32 bits of ctime someday */
1428 unsigned long long st_ino
;
1432 #define TARGET_HAS_STRUCT_STAT64
1433 struct target_eabi_stat64
{
1434 unsigned long long st_dev
;
1435 unsigned int __pad1
;
1437 unsigned int st_mode
;
1438 unsigned int st_nlink
;
1443 unsigned long long st_rdev
;
1444 unsigned int __pad2
[2];
1447 abi_ulong st_blksize
;
1448 unsigned int __pad3
;
1449 unsigned long long st_blocks
;
1451 abi_ulong target_st_atime
;
1452 abi_ulong target_st_atime_nsec
;
1454 abi_ulong target_st_mtime
;
1455 abi_ulong target_st_mtime_nsec
;
1457 abi_ulong target_st_ctime
;
1458 abi_ulong target_st_ctime_nsec
;
1460 unsigned long long st_ino
;
1464 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
1465 struct target_stat
{
1466 unsigned int st_dev
;
1468 unsigned int st_mode
;
1469 unsigned int st_nlink
;
1470 unsigned int st_uid
;
1471 unsigned int st_gid
;
1472 unsigned int st_rdev
;
1474 abi_long target_st_atime
;
1475 abi_long target_st_mtime
;
1476 abi_long target_st_ctime
;
1477 abi_long st_blksize
;
1479 abi_ulong __unused4
[2];
1482 #define TARGET_HAS_STRUCT_STAT64
1483 struct target_stat64
{
1484 unsigned char __pad0
[6];
1485 unsigned short st_dev
;
1490 unsigned int st_mode
;
1492 unsigned int st_uid
;
1493 unsigned int st_gid
;
1495 unsigned char __pad2
[6];
1496 unsigned short st_rdev
;
1501 unsigned char __pad4
[4];
1502 unsigned int st_blocks
;
1504 abi_ulong target_st_atime
;
1505 abi_ulong __unused1
;
1507 abi_ulong target_st_mtime
;
1508 abi_ulong __unused2
;
1510 abi_ulong target_st_ctime
;
1511 abi_ulong __unused3
;
1513 abi_ulong __unused4
[3];
1516 #elif defined(TARGET_SPARC)
1518 struct target_stat
{
1519 unsigned short st_dev
;
1521 unsigned short st_mode
;
1523 unsigned short st_uid
;
1524 unsigned short st_gid
;
1525 unsigned short st_rdev
;
1527 abi_long target_st_atime
;
1528 abi_ulong __unused1
;
1529 abi_long target_st_mtime
;
1530 abi_ulong __unused2
;
1531 abi_long target_st_ctime
;
1532 abi_ulong __unused3
;
1533 abi_long st_blksize
;
1535 abi_ulong __unused4
[2];
1538 #define TARGET_HAS_STRUCT_STAT64
1539 struct target_stat64
{
1540 unsigned char __pad0
[6];
1541 unsigned short st_dev
;
1545 unsigned int st_mode
;
1546 unsigned int st_nlink
;
1548 unsigned int st_uid
;
1549 unsigned int st_gid
;
1551 unsigned char __pad2
[6];
1552 unsigned short st_rdev
;
1554 unsigned char __pad3
[8];
1557 unsigned int st_blksize
;
1559 unsigned char __pad4
[8];
1560 unsigned int st_blocks
;
1562 unsigned int target_st_atime
;
1563 unsigned int __unused1
;
1565 unsigned int target_st_mtime
;
1566 unsigned int __unused2
;
1568 unsigned int target_st_ctime
;
1569 unsigned int __unused3
;
1571 unsigned int __unused4
;
1572 unsigned int __unused5
;
1575 #elif defined(TARGET_PPC)
1577 struct target_stat
{
1580 #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
1582 unsigned int st_mode
;
1584 unsigned int st_mode
;
1585 unsigned short st_nlink
;
1587 unsigned int st_uid
;
1588 unsigned int st_gid
;
1591 abi_ulong st_blksize
;
1592 abi_ulong st_blocks
;
1593 abi_ulong target_st_atime
;
1594 abi_ulong target_st_atime_nsec
;
1595 abi_ulong target_st_mtime
;
1596 abi_ulong target_st_mtime_nsec
;
1597 abi_ulong target_st_ctime
;
1598 abi_ulong target_st_ctime_nsec
;
1599 abi_ulong __unused4
;
1600 abi_ulong __unused5
;
1601 #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
1602 abi_ulong __unused6
;
1606 #if !defined(TARGET_PPC64) || defined(TARGET_ABI32)
1607 #define TARGET_HAS_STRUCT_STAT64
1608 struct QEMU_PACKED target_stat64
{
1609 unsigned long long st_dev
;
1610 unsigned long long st_ino
;
1611 unsigned int st_mode
;
1612 unsigned int st_nlink
;
1613 unsigned int st_uid
;
1614 unsigned int st_gid
;
1615 unsigned long long st_rdev
;
1616 unsigned long long __pad0
;
1619 unsigned int __pad1
;
1620 long long st_blocks
; /* Number 512-byte blocks allocated. */
1621 int target_st_atime
;
1622 unsigned int target_st_atime_nsec
;
1623 int target_st_mtime
;
1624 unsigned int target_st_mtime_nsec
;
1625 int target_st_ctime
;
1626 unsigned int target_st_ctime_nsec
;
1627 unsigned int __unused4
;
1628 unsigned int __unused5
;
1632 #elif defined(TARGET_MICROBLAZE)
1634 struct target_stat
{
1637 unsigned int st_mode
;
1638 unsigned short st_nlink
;
1639 unsigned int st_uid
;
1640 unsigned int st_gid
;
1643 abi_ulong st_blksize
;
1644 abi_ulong st_blocks
;
1645 abi_ulong target_st_atime
;
1646 abi_ulong target_st_atime_nsec
;
1647 abi_ulong target_st_mtime
;
1648 abi_ulong target_st_mtime_nsec
;
1649 abi_ulong target_st_ctime
;
1650 abi_ulong target_st_ctime_nsec
;
1651 abi_ulong __unused4
;
1652 abi_ulong __unused5
;
1655 /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */
1656 #define TARGET_HAS_STRUCT_STAT64
1657 struct QEMU_PACKED target_stat64
{
1659 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
1673 int64_t st_blocks
; /* Number 512-byte blocks allocated. */
1675 int target_st_atime
;
1676 unsigned int target_st_atime_nsec
;
1677 int target_st_mtime
;
1678 unsigned int target_st_mtime_nsec
;
1679 int target_st_ctime
;
1680 unsigned int target_st_ctime_nsec
;
1684 #elif defined(TARGET_M68K)
1686 struct target_stat
{
1687 unsigned short st_dev
;
1688 unsigned short __pad1
;
1690 unsigned short st_mode
;
1691 unsigned short st_nlink
;
1692 unsigned short st_uid
;
1693 unsigned short st_gid
;
1694 unsigned short st_rdev
;
1695 unsigned short __pad2
;
1697 abi_ulong st_blksize
;
1698 abi_ulong st_blocks
;
1699 abi_ulong target_st_atime
;
1700 abi_ulong __unused1
;
1701 abi_ulong target_st_mtime
;
1702 abi_ulong __unused2
;
1703 abi_ulong target_st_ctime
;
1704 abi_ulong __unused3
;
1705 abi_ulong __unused4
;
1706 abi_ulong __unused5
;
1709 /* This matches struct stat64 in glibc2.1, hence the absolutely
1710 * insane amounts of padding around dev_t's.
1712 #define TARGET_HAS_STRUCT_STAT64
1713 struct target_stat64
{
1714 unsigned long long st_dev
;
1715 unsigned char __pad1
[2];
1717 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
1720 unsigned int st_mode
;
1721 unsigned int st_nlink
;
1726 unsigned long long st_rdev
;
1727 unsigned char __pad3
[2];
1730 abi_ulong st_blksize
;
1732 abi_ulong __pad4
; /* future possible st_blocks high bits */
1733 abi_ulong st_blocks
; /* Number 512-byte blocks allocated. */
1735 abi_ulong target_st_atime
;
1736 abi_ulong target_st_atime_nsec
;
1738 abi_ulong target_st_mtime
;
1739 abi_ulong target_st_mtime_nsec
;
1741 abi_ulong target_st_ctime
;
1742 abi_ulong target_st_ctime_nsec
;
1744 unsigned long long st_ino
;
1747 #elif defined(TARGET_ABI_MIPSN64)
1749 /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
1750 struct target_stat
{
1751 unsigned int st_dev
;
1752 unsigned int st_pad0
[3]; /* Reserved for st_dev expansion */
1756 unsigned int st_mode
;
1757 unsigned int st_nlink
;
1762 unsigned int st_rdev
;
1763 unsigned int st_pad1
[3]; /* Reserved for st_rdev expansion */
1768 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1769 * but we don't have it under Linux.
1771 unsigned int target_st_atime
;
1772 unsigned int target_st_atime_nsec
;
1774 unsigned int target_st_mtime
;
1775 unsigned int target_st_mtime_nsec
;
1777 unsigned int target_st_ctime
;
1778 unsigned int target_st_ctime_nsec
;
1780 unsigned int st_blksize
;
1781 unsigned int st_pad2
;
1783 abi_ulong st_blocks
;
1786 #elif defined(TARGET_ABI_MIPSN32)
1788 struct target_stat
{
1790 abi_ulong st_pad0
[3]; /* Reserved for st_dev expansion */
1792 unsigned int st_mode
;
1793 unsigned int st_nlink
;
1797 abi_ulong st_pad1
[3]; /* Reserved for st_rdev expansion */
1799 abi_long target_st_atime
;
1800 abi_ulong target_st_atime_nsec
; /* Reserved for st_atime expansion */
1801 abi_long target_st_mtime
;
1802 abi_ulong target_st_mtime_nsec
; /* Reserved for st_mtime expansion */
1803 abi_long target_st_ctime
;
1804 abi_ulong target_st_ctime_nsec
; /* Reserved for st_ctime expansion */
1805 abi_ulong st_blksize
;
1810 #elif defined(TARGET_ABI_MIPSO32)
1812 struct target_stat
{
1814 abi_long st_pad1
[3]; /* Reserved for network id */
1816 unsigned int st_mode
;
1817 unsigned int st_nlink
;
1821 abi_long st_pad2
[2];
1825 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1826 * but we don't have it under Linux.
1828 abi_long target_st_atime
;
1829 abi_long target_st_atime_nsec
;
1830 abi_long target_st_mtime
;
1831 abi_long target_st_mtime_nsec
;
1832 abi_long target_st_ctime
;
1833 abi_long target_st_ctime_nsec
;
1834 abi_long st_blksize
;
1836 abi_long st_pad4
[14];
1840 * This matches struct stat64 in glibc2.1, hence the absolutely insane
1841 * amounts of padding around dev_t's. The memory layout is the same as of
1842 * struct stat of the 64-bit kernel.
1845 #define TARGET_HAS_STRUCT_STAT64
1846 struct target_stat64
{
1848 abi_ulong st_pad0
[3]; /* Reserved for st_dev expansion */
1852 unsigned int st_mode
;
1853 unsigned int st_nlink
;
1859 abi_ulong st_pad1
[3]; /* Reserved for st_rdev expansion */
1864 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1865 * but we don't have it under Linux.
1867 abi_long target_st_atime
;
1868 abi_ulong target_st_atime_nsec
; /* Reserved for st_atime expansion */
1870 abi_long target_st_mtime
;
1871 abi_ulong target_st_mtime_nsec
; /* Reserved for st_mtime expansion */
1873 abi_long target_st_ctime
;
1874 abi_ulong target_st_ctime_nsec
; /* Reserved for st_ctime expansion */
1876 abi_ulong st_blksize
;
1882 #elif defined(TARGET_ALPHA)
1884 struct target_stat
{
1885 unsigned int st_dev
;
1886 unsigned int st_ino
;
1887 unsigned int st_mode
;
1888 unsigned int st_nlink
;
1889 unsigned int st_uid
;
1890 unsigned int st_gid
;
1891 unsigned int st_rdev
;
1893 abi_ulong target_st_atime
;
1894 abi_ulong target_st_mtime
;
1895 abi_ulong target_st_ctime
;
1896 unsigned int st_blksize
;
1897 unsigned int st_blocks
;
1898 unsigned int st_flags
;
1899 unsigned int st_gen
;
1902 #define TARGET_HAS_STRUCT_STAT64
1903 struct target_stat64
{
1908 abi_ulong st_blocks
;
1910 unsigned int st_mode
;
1911 unsigned int st_uid
;
1912 unsigned int st_gid
;
1913 unsigned int st_blksize
;
1914 unsigned int st_nlink
;
1915 unsigned int __pad0
;
1917 abi_ulong target_st_atime
;
1918 abi_ulong target_st_atime_nsec
;
1919 abi_ulong target_st_mtime
;
1920 abi_ulong target_st_mtime_nsec
;
1921 abi_ulong target_st_ctime
;
1922 abi_ulong target_st_ctime_nsec
;
1923 abi_long __unused
[3];
1926 #elif defined(TARGET_SH4)
1928 struct target_stat
{
1931 unsigned short st_mode
;
1932 unsigned short st_nlink
;
1933 unsigned short st_uid
;
1934 unsigned short st_gid
;
1937 abi_ulong st_blksize
;
1938 abi_ulong st_blocks
;
1939 abi_ulong target_st_atime
;
1940 abi_ulong target_st_atime_nsec
;
1941 abi_ulong target_st_mtime
;
1942 abi_ulong target_st_mtime_nsec
;
1943 abi_ulong target_st_ctime
;
1944 abi_ulong target_st_ctime_nsec
;
1945 abi_ulong __unused4
;
1946 abi_ulong __unused5
;
1949 /* This matches struct stat64 in glibc2.1, hence the absolutely
1950 * insane amounts of padding around dev_t's.
1952 #define TARGET_HAS_STRUCT_STAT64
1953 struct QEMU_PACKED target_stat64
{
1954 unsigned long long st_dev
;
1955 unsigned char __pad0
[4];
1957 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
1960 unsigned int st_mode
;
1961 unsigned int st_nlink
;
1966 unsigned long long st_rdev
;
1967 unsigned char __pad3
[4];
1970 abi_ulong st_blksize
;
1972 unsigned long long st_blocks
; /* Number 512-byte blocks allocated. */
1974 abi_ulong target_st_atime
;
1975 abi_ulong target_st_atime_nsec
;
1977 abi_ulong target_st_mtime
;
1978 abi_ulong target_st_mtime_nsec
;
1980 abi_ulong target_st_ctime
;
1981 abi_ulong target_st_ctime_nsec
;
1983 unsigned long long st_ino
;
1986 #elif defined(TARGET_I386) && !defined(TARGET_ABI32)
1987 struct target_stat
{
1992 unsigned int st_mode
;
1993 unsigned int st_uid
;
1994 unsigned int st_gid
;
1995 unsigned int __pad0
;
1998 abi_long st_blksize
;
1999 abi_long st_blocks
; /* Number 512-byte blocks allocated. */
2001 abi_ulong target_st_atime
;
2002 abi_ulong target_st_atime_nsec
;
2003 abi_ulong target_st_mtime
;
2004 abi_ulong target_st_mtime_nsec
;
2005 abi_ulong target_st_ctime
;
2006 abi_ulong target_st_ctime_nsec
;
2008 abi_long __unused
[3];
2010 #elif defined(TARGET_S390X)
2011 struct target_stat
{
2015 unsigned int st_mode
;
2016 unsigned int st_uid
;
2017 unsigned int st_gid
;
2018 unsigned int __pad1
;
2021 abi_ulong target_st_atime
;
2022 abi_ulong target_st_atime_nsec
;
2023 abi_ulong target_st_mtime
;
2024 abi_ulong target_st_mtime_nsec
;
2025 abi_ulong target_st_ctime
;
2026 abi_ulong target_st_ctime_nsec
;
2027 abi_ulong st_blksize
;
2029 abi_ulong __unused
[3];
2031 #elif defined(TARGET_AARCH64)
2032 struct target_stat
{
2035 unsigned int st_mode
;
2036 unsigned int st_nlink
;
2037 unsigned int st_uid
;
2038 unsigned int st_gid
;
2045 abi_long target_st_atime
;
2046 abi_ulong target_st_atime_nsec
;
2047 abi_long target_st_mtime
;
2048 abi_ulong target_st_mtime_nsec
;
2049 abi_long target_st_ctime
;
2050 abi_ulong target_st_ctime_nsec
;
2051 unsigned int __unused
[2];
2053 #elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) || \
2054 defined(TARGET_NIOS2)
2056 /* These are the asm-generic versions of the stat and stat64 structures */
2058 struct target_stat
{
2061 unsigned int st_mode
;
2062 unsigned int st_nlink
;
2063 unsigned int st_uid
;
2064 unsigned int st_gid
;
2071 abi_long target_st_atime
;
2072 abi_ulong target_st_atime_nsec
;
2073 abi_long target_st_mtime
;
2074 abi_ulong target_st_mtime_nsec
;
2075 abi_long target_st_ctime
;
2076 abi_ulong target_st_ctime_nsec
;
2077 unsigned int __unused4
;
2078 unsigned int __unused5
;
2081 #define TARGET_HAS_STRUCT_STAT64
2082 struct target_stat64
{
2085 unsigned int st_mode
;
2086 unsigned int st_nlink
;
2087 unsigned int st_uid
;
2088 unsigned int st_gid
;
2095 int target_st_atime
;
2096 unsigned int target_st_atime_nsec
;
2097 int target_st_mtime
;
2098 unsigned int target_st_mtime_nsec
;
2099 int target_st_ctime
;
2100 unsigned int target_st_ctime_nsec
;
2101 unsigned int __unused4
;
2102 unsigned int __unused5
;
2105 #elif defined(TARGET_HPPA)
2107 struct target_stat
{
2111 abi_ushort st_nlink
;
2116 abi_int target_st_atime
;
2117 abi_uint target_st_atime_nsec
;
2118 abi_int target_st_mtime
;
2119 abi_uint target_st_mtime_nsec
;
2120 abi_int target_st_ctime
;
2121 abi_uint target_st_ctime_nsec
;
2128 abi_ushort _unused5
;
2129 abi_short st_fstype
;
2130 abi_uint st_realdev
;
2131 abi_ushort st_basemode
;
2132 abi_ushort _unused6
;
2135 abi_uint _unused7
[3];
2138 #define TARGET_HAS_STRUCT_STAT64
2139 struct target_stat64
{
2152 abi_int target_st_atime
;
2153 abi_uint target_st_atime_nsec
;
2154 abi_int target_st_mtime
;
2155 abi_uint target_st_mtime_nsec
;
2156 abi_int target_st_ctime
;
2157 abi_uint target_st_ctime_nsec
;
2162 #error unsupported CPU
2170 #ifdef TARGET_ABI_MIPSN32
2171 struct target_statfs
{
2174 int32_t f_frsize
; /* Fragment size - unsupported */
2181 /* Linux specials */
2182 target_fsid_t f_fsid
;
2187 struct target_statfs
{
2190 abi_long f_frsize
; /* Fragment size - unsupported */
2197 /* Linux specials */
2198 target_fsid_t f_fsid
;
2200 abi_long f_spare
[6];
2204 struct target_statfs64
{
2207 uint32_t f_frsize
; /* Fragment size - unsupported */
2214 target_fsid_t f_fsid
;
2216 uint32_t f_spare
[6];
2218 #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \
2219 defined(TARGET_SPARC64) || defined(TARGET_AARCH64)) && \
2220 !defined(TARGET_ABI32)
2221 struct target_statfs
{
2229 target_fsid_t f_fsid
;
2232 abi_long f_spare
[5];
2235 struct target_statfs64
{
2243 target_fsid_t f_fsid
;
2246 abi_long f_spare
[5];
2248 #elif defined(TARGET_S390X)
2249 struct target_statfs
{
2257 kernel_fsid_t f_fsid
;
2263 struct target_statfs64
{
2271 kernel_fsid_t f_fsid
;
2277 struct target_statfs
{
2285 target_fsid_t f_fsid
;
2288 uint32_t f_spare
[5];
2291 struct target_statfs64
{
2299 target_fsid_t f_fsid
;
2302 uint32_t f_spare
[5];
2307 #define TARGET_F_DUPFD 0 /* dup */
2308 #define TARGET_F_GETFD 1 /* get close_on_exec */
2309 #define TARGET_F_SETFD 2 /* set/clear close_on_exec */
2310 #define TARGET_F_GETFL 3 /* get file->f_flags */
2311 #define TARGET_F_SETFL 4 /* set file->f_flags */
2313 #if defined(TARGET_ALPHA)
2314 #define TARGET_F_GETLK 7
2315 #define TARGET_F_SETLK 8
2316 #define TARGET_F_SETLKW 9
2317 #define TARGET_F_SETOWN 5 /* for sockets. */
2318 #define TARGET_F_GETOWN 6 /* for sockets. */
2320 #define TARGET_F_RDLCK 1
2321 #define TARGET_F_WRLCK 2
2322 #define TARGET_F_UNLCK 8
2323 #define TARGET_F_EXLCK 16
2324 #define TARGET_F_SHLCK 32
2325 #elif defined(TARGET_MIPS)
2326 #define TARGET_F_GETLK 14
2327 #define TARGET_F_SETLK 6
2328 #define TARGET_F_SETLKW 7
2329 #define TARGET_F_SETOWN 24 /* for sockets. */
2330 #define TARGET_F_GETOWN 23 /* for sockets. */
2331 #elif defined(TARGET_HPPA)
2332 #define TARGET_F_GETLK 5
2333 #define TARGET_F_SETLK 6
2334 #define TARGET_F_SETLKW 7
2335 #define TARGET_F_GETOWN 11 /* for sockets. */
2336 #define TARGET_F_SETOWN 12 /* for sockets. */
2338 #define TARGET_F_GETLK 5
2339 #define TARGET_F_SETLK 6
2340 #define TARGET_F_SETLKW 7
2341 #define TARGET_F_SETOWN 8 /* for sockets. */
2342 #define TARGET_F_GETOWN 9 /* for sockets. */
2344 #define TARGET_F_SETOWN_EX 15
2345 #define TARGET_F_GETOWN_EX 16
2347 #ifndef TARGET_F_RDLCK
2348 #define TARGET_F_RDLCK 0
2349 #define TARGET_F_WRLCK 1
2350 #define TARGET_F_UNLCK 2
2353 #ifndef TARGET_F_EXLCK
2354 #define TARGET_F_EXLCK 4
2355 #define TARGET_F_SHLCK 8
2359 #if defined(TARGET_HPPA)
2360 #define TARGET_F_SETSIG 13 /* for sockets. */
2361 #define TARGET_F_GETSIG 14 /* for sockets. */
2363 #define TARGET_F_SETSIG 10 /* for sockets. */
2364 #define TARGET_F_GETSIG 11 /* for sockets. */
2367 #if defined(TARGET_MIPS)
2368 #define TARGET_F_GETLK64 33 /* using 'struct flock64' */
2369 #define TARGET_F_SETLK64 34
2370 #define TARGET_F_SETLKW64 35
2371 #elif defined(TARGET_HPPA)
2372 #define TARGET_F_GETLK64 8 /* using 'struct flock64' */
2373 #define TARGET_F_SETLK64 9
2374 #define TARGET_F_SETLKW64 10
2376 #define TARGET_F_GETLK64 12 /* using 'struct flock64' */
2377 #define TARGET_F_SETLK64 13
2378 #define TARGET_F_SETLKW64 14
2381 #define TARGET_F_LINUX_SPECIFIC_BASE 1024
2382 #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0)
2383 #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1)
2384 #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6)
2385 #define TARGET_F_SETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 7)
2386 #define TARGET_F_GETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 8)
2387 #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2)
2389 #if defined(TARGET_ALPHA)
2390 #define TARGET_O_NONBLOCK 04
2391 #define TARGET_O_APPEND 010
2392 #define TARGET_O_CREAT 01000 /* not fcntl */
2393 #define TARGET_O_TRUNC 02000 /* not fcntl */
2394 #define TARGET_O_EXCL 04000 /* not fcntl */
2395 #define TARGET_O_NOCTTY 010000 /* not fcntl */
2396 #define TARGET_O_DSYNC 040000
2397 #define TARGET_O_LARGEFILE 0 /* not necessary, always 64-bit */
2398 #define TARGET_O_DIRECTORY 0100000 /* must be a directory */
2399 #define TARGET_O_NOFOLLOW 0200000 /* don't follow links */
2400 #define TARGET_O_DIRECT 02000000 /* direct disk access hint */
2401 #define TARGET_O_NOATIME 04000000
2402 #define TARGET_O_CLOEXEC 010000000
2403 #define TARGET___O_SYNC 020000000
2404 #define TARGET_O_PATH 040000000
2405 #elif defined(TARGET_HPPA)
2406 #define TARGET_O_NONBLOCK 000200004 /* HPUX has separate NDELAY & NONBLOCK */
2407 #define TARGET_O_APPEND 000000010
2408 #define TARGET_O_CREAT 000000400 /* not fcntl */
2409 #define TARGET_O_EXCL 000002000 /* not fcntl */
2410 #define TARGET_O_NOCTTY 000400000 /* not fcntl */
2411 #define TARGET_O_DSYNC 001000000
2412 #define TARGET_O_LARGEFILE 000004000
2413 #define TARGET_O_DIRECTORY 000010000 /* must be a directory */
2414 #define TARGET_O_NOFOLLOW 000000200 /* don't follow links */
2415 #define TARGET_O_NOATIME 004000000
2416 #define TARGET_O_CLOEXEC 010000000
2417 #define TARGET___O_SYNC 000100000
2418 #define TARGET_O_PATH 020000000
2419 #elif defined(TARGET_ARM) || defined(TARGET_M68K)
2420 #define TARGET_O_DIRECTORY 040000 /* must be a directory */
2421 #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
2422 #define TARGET_O_DIRECT 0200000 /* direct disk access hint */
2423 #define TARGET_O_LARGEFILE 0400000
2424 #elif defined(TARGET_MIPS)
2425 #define TARGET_O_APPEND 0x0008
2426 #define TARGET_O_DSYNC 0x0010
2427 #define TARGET_O_NONBLOCK 0x0080
2428 #define TARGET_O_CREAT 0x0100 /* not fcntl */
2429 #define TARGET_O_TRUNC 0x0200 /* not fcntl */
2430 #define TARGET_O_EXCL 0x0400 /* not fcntl */
2431 #define TARGET_O_NOCTTY 0x0800 /* not fcntl */
2432 #define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */
2433 #define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */
2434 #define TARGET___O_SYNC 0x4000
2435 #define TARGET_O_DIRECT 0x8000 /* direct disk access hint */
2436 #elif defined (TARGET_PPC)
2437 #define TARGET_O_DIRECTORY 040000 /* must be a directory */
2438 #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
2439 #define TARGET_O_LARGEFILE 0200000
2440 #define TARGET_O_DIRECT 0400000 /* direct disk access hint */
2441 #elif defined (TARGET_SPARC)
2442 #define TARGET_O_APPEND 0x0008
2443 #define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */
2444 #define TARGET_O_CREAT 0x0200 /* not fcntl */
2445 #define TARGET_O_TRUNC 0x0400 /* not fcntl */
2446 #define TARGET_O_EXCL 0x0800 /* not fcntl */
2447 #define TARGET_O_DSYNC 0x2000
2448 #define TARGET_O_NONBLOCK 0x4000
2449 # ifdef TARGET_SPARC64
2450 # define TARGET_O_NDELAY 0x0004
2452 # define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK)
2454 #define TARGET_O_NOCTTY 0x8000 /* not fcntl */
2455 #define TARGET_O_LARGEFILE 0x40000
2456 #define TARGET_O_DIRECT 0x100000 /* direct disk access hint */
2457 #define TARGET_O_NOATIME 0x200000
2458 #define TARGET_O_CLOEXEC 0x400000
2459 #define TARGET___O_SYNC 0x800000
2460 #define TARGET_O_PATH 0x1000000
2463 /* <asm-generic/fcntl.h> values follow. */
2464 #define TARGET_O_ACCMODE 0003
2465 #define TARGET_O_RDONLY 00
2466 #define TARGET_O_WRONLY 01
2467 #define TARGET_O_RDWR 02
2468 #ifndef TARGET_O_CREAT
2469 #define TARGET_O_CREAT 0100 /* not fcntl */
2471 #ifndef TARGET_O_EXCL
2472 #define TARGET_O_EXCL 0200 /* not fcntl */
2474 #ifndef TARGET_O_NOCTTY
2475 #define TARGET_O_NOCTTY 0400 /* not fcntl */
2477 #ifndef TARGET_O_TRUNC
2478 #define TARGET_O_TRUNC 01000 /* not fcntl */
2480 #ifndef TARGET_O_APPEND
2481 #define TARGET_O_APPEND 02000
2483 #ifndef TARGET_O_NONBLOCK
2484 #define TARGET_O_NONBLOCK 04000
2486 #ifndef TARGET_O_DSYNC
2487 #define TARGET_O_DSYNC 010000
2489 #ifndef TARGET_FASYNC
2490 #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
2492 #ifndef TARGET_O_DIRECT
2493 #define TARGET_O_DIRECT 040000 /* direct disk access hint */
2495 #ifndef TARGET_O_LARGEFILE
2496 #define TARGET_O_LARGEFILE 0100000
2498 #ifndef TARGET_O_DIRECTORY
2499 #define TARGET_O_DIRECTORY 0200000 /* must be a directory */
2501 #ifndef TARGET_O_NOFOLLOW
2502 #define TARGET_O_NOFOLLOW 0400000 /* don't follow links */
2504 #ifndef TARGET_O_NOATIME
2505 #define TARGET_O_NOATIME 01000000
2507 #ifndef TARGET_O_CLOEXEC
2508 #define TARGET_O_CLOEXEC 02000000
2510 #ifndef TARGET___O_SYNC
2511 #define TARGET___O_SYNC 04000000
2513 #ifndef TARGET_O_PATH
2514 #define TARGET_O_PATH 010000000
2516 #ifndef TARGET_O_NDELAY
2517 #define TARGET_O_NDELAY TARGET_O_NONBLOCK
2519 #ifndef TARGET_O_SYNC
2520 #define TARGET_O_SYNC (TARGET___O_SYNC | TARGET_O_DSYNC)
2523 struct target_flock
{
2528 #if defined(TARGET_MIPS)
2532 #if defined(TARGET_MIPS)
2537 struct target_flock64
{
2540 #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) \
2541 || defined(TARGET_SPARC) || defined(TARGET_HPPA) \
2542 || defined(TARGET_MICROBLAZE) || defined(TARGET_TILEGX)
2551 struct target_eabi_flock64
{
2561 struct target_f_owner_ex
{
2562 int type
; /* Owner type of ID. */
2563 int pid
; /* ID of owner. */
2566 /* soundcard defines */
2567 /* XXX: convert them all to arch independent entries */
2568 #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int);
2569 #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301
2570 #define TARGET_SNDCTL_COPR_RCODE 0xc0144303
2571 #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309
2572 #define TARGET_SNDCTL_COPR_RDATA 0xc0144302
2573 #define TARGET_SNDCTL_COPR_RESET 0x00004300
2574 #define TARGET_SNDCTL_COPR_RUN 0xc0144306
2575 #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308
2576 #define TARGET_SNDCTL_COPR_WCODE 0x40144305
2577 #define TARGET_SNDCTL_COPR_WDATA 0x40144304
2578 #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0)
2579 #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1)
2580 #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int)
2581 #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int)
2582 #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int)
2583 #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int)
2584 #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int)
2585 #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int)
2586 #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8)
2587 #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int)
2588 #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int)
2589 #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int)
2590 #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12)
2591 #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13)
2592 #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int)
2593 #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int)
2594 #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17)
2595 #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18)
2596 #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19)
2597 #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20)
2598 #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e
2599 #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005
2600 #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016
2601 #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015
2602 #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010
2603 #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f
2604 #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107
2605 #define TARGET_SNDCTL_MIDI_INFO 0xc074510c
2606 #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02
2607 #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01
2608 #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00
2609 #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110
2610 #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001
2611 #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103
2612 #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105
2613 #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104
2614 #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b
2615 #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a
2616 #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112
2617 #define TARGET_SNDCTL_SEQ_PANIC 0x00005111
2618 #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106
2619 #define TARGET_SNDCTL_SEQ_RESET 0x00005100
2620 #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109
2621 #define TARGET_SNDCTL_SEQ_SYNC 0x00005101
2622 #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108
2623 #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d
2624 #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d
2625 #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102
2626 #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e
2627 #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404
2628 #define TARGET_SNDCTL_TMR_METRONOME 0x40045407
2629 #define TARGET_SNDCTL_TMR_SELECT 0x40045408
2630 #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406
2631 #define TARGET_SNDCTL_TMR_START 0x00005402
2632 #define TARGET_SNDCTL_TMR_STOP 0x00005403
2633 #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405
2634 #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401
2635 #define TARGET_SOUND_PCM_READ_RATE 0x80045002
2636 #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006
2637 #define TARGET_SOUND_PCM_READ_BITS 0x80045005
2638 #define TARGET_SOUND_PCM_READ_FILTER 0x80045007
2639 #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info)
2640 #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66
2641 #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int)
2642 #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int)
2643 #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int)
2644 #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int)
2645 #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int)
2647 #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int)
2649 #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME)
2650 #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS)
2651 #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE)
2652 #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH)
2653 #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM)
2654 #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER)
2655 #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE)
2656 #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC)
2657 #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD)
2658 #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX)
2659 #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM)
2660 #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV)
2661 #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN)
2662 #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN)
2663 #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1)
2664 #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2)
2665 #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3)
2667 /* Obsolete macros */
2668 #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE)
2669 #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE)
2670 #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD)
2672 #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC)
2673 #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK)
2674 #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK)
2675 #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS)
2676 #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS)
2678 #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int)
2680 #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME)
2681 #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS)
2682 #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE)
2683 #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH)
2684 #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM)
2685 #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER)
2686 #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE)
2687 #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC)
2688 #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD)
2689 #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX)
2690 #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM)
2691 #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV)
2692 #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN)
2693 #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN)
2694 #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1)
2695 #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2)
2696 #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3)
2698 /* Obsolete macros */
2699 #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE)
2700 #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE)
2701 #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD)
2703 #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)
2706 #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1)
2707 #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2)
2709 #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct mtop)
2710 #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct mtget)
2711 #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct mtpos)
2713 struct target_sysinfo
{
2714 abi_long uptime
; /* Seconds since boot */
2715 abi_ulong loads
[3]; /* 1, 5, and 15 minute load averages */
2716 abi_ulong totalram
; /* Total usable main memory size */
2717 abi_ulong freeram
; /* Available memory size */
2718 abi_ulong sharedram
; /* Amount of shared memory */
2719 abi_ulong bufferram
; /* Memory used by buffers */
2720 abi_ulong totalswap
; /* Total swap space size */
2721 abi_ulong freeswap
; /* swap space still available */
2722 unsigned short procs
; /* Number of current processes */
2723 unsigned short pad
; /* explicit padding for m68k */
2724 abi_ulong totalhigh
; /* Total high memory size */
2725 abi_ulong freehigh
; /* Available high memory size */
2726 unsigned int mem_unit
; /* Memory unit size in bytes */
2727 char _f
[20-2*sizeof(abi_long
)-sizeof(int)]; /* Padding: libc5 uses this.. */
2730 struct linux_dirent
{
2732 unsigned long d_off
;
2733 unsigned short d_reclen
;
2734 char d_name
[256]; /* We must not include limits.h! */
2737 struct linux_dirent64
{
2740 unsigned short d_reclen
;
2741 unsigned char d_type
;
2745 struct target_mq_attr
{
2748 abi_long mq_msgsize
;
2749 abi_long mq_curmsgs
;
2754 #include "errno_defs.h"
2756 #define FUTEX_WAIT 0
2757 #define FUTEX_WAKE 1
2759 #define FUTEX_REQUEUE 3
2760 #define FUTEX_CMP_REQUEUE 4
2761 #define FUTEX_WAKE_OP 5
2762 #define FUTEX_LOCK_PI 6
2763 #define FUTEX_UNLOCK_PI 7
2764 #define FUTEX_TRYLOCK_PI 8
2765 #define FUTEX_WAIT_BITSET 9
2766 #define FUTEX_WAKE_BITSET 10
2768 #define FUTEX_PRIVATE_FLAG 128
2769 #define FUTEX_CLOCK_REALTIME 256
2770 #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
2773 #if defined(TARGET_X86_64)
2774 #define TARGET_EPOLL_PACKED QEMU_PACKED
2776 #define TARGET_EPOLL_PACKED
2779 typedef union target_epoll_data
{
2784 } target_epoll_data_t
;
2786 struct target_epoll_event
{
2788 target_epoll_data_t data
;
2789 } TARGET_EPOLL_PACKED
;
2791 #define TARGET_EP_MAX_EVENTS (INT_MAX / sizeof(struct target_epoll_event))
2794 struct target_rlimit64
{
2799 struct target_ucred
{
2805 typedef int32_t target_timer_t
;
2807 #define TARGET_SIGEV_MAX_SIZE 64
2809 /* This is architecture-specific but most architectures use the default */
2811 #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long))
2813 #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \
2814 + sizeof(target_sigval_t))
2817 #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \
2818 - TARGET_SIGEV_PREAMBLE_SIZE) \
2821 struct target_sigevent
{
2822 target_sigval_t sigev_value
;
2823 abi_int sigev_signo
;
2824 abi_int sigev_notify
;
2826 abi_int _pad
[TARGET_SIGEV_PAD_SIZE
];
2829 /* The kernel (and thus QEMU) never looks at these;
2830 * they're only used as part of the ABI between a
2831 * userspace program and libc.
2834 abi_ulong _function
;
2835 abi_ulong _attribute
;
2840 struct target_user_cap_header
{
2845 struct target_user_cap_data
{
2848 uint32_t inheritable
;
2851 /* from kernel's include/linux/syslog.h */
2853 /* Close the log. Currently a NOP. */
2854 #define TARGET_SYSLOG_ACTION_CLOSE 0
2855 /* Open the log. Currently a NOP. */
2856 #define TARGET_SYSLOG_ACTION_OPEN 1
2857 /* Read from the log. */
2858 #define TARGET_SYSLOG_ACTION_READ 2
2859 /* Read all messages remaining in the ring buffer. */
2860 #define TARGET_SYSLOG_ACTION_READ_ALL 3
2861 /* Read and clear all messages remaining in the ring buffer */
2862 #define TARGET_SYSLOG_ACTION_READ_CLEAR 4
2863 /* Clear ring buffer. */
2864 #define TARGET_SYSLOG_ACTION_CLEAR 5
2865 /* Disable printk's to console */
2866 #define TARGET_SYSLOG_ACTION_CONSOLE_OFF 6
2867 /* Enable printk's to console */
2868 #define TARGET_SYSLOG_ACTION_CONSOLE_ON 7
2869 /* Set level of messages printed to console */
2870 #define TARGET_SYSLOG_ACTION_CONSOLE_LEVEL 8
2871 /* Return number of unread characters in the log buffer */
2872 #define TARGET_SYSLOG_ACTION_SIZE_UNREAD 9
2873 /* Return size of the log buffer */
2874 #define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10