Handle init/sipi in a main cpu exec loop. (v2)
[qemu/mdroth.git] / linux-user / syscall_defs.h
blobacb781f4b6e3513ffeb5ff173778ec5b315761f3
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 puting ifdefs if
5 necessary */
7 #include "syscall_nr.h"
9 #define SOCKOP_socket 1
10 #define SOCKOP_bind 2
11 #define SOCKOP_connect 3
12 #define SOCKOP_listen 4
13 #define SOCKOP_accept 5
14 #define SOCKOP_getsockname 6
15 #define SOCKOP_getpeername 7
16 #define SOCKOP_socketpair 8
17 #define SOCKOP_send 9
18 #define SOCKOP_recv 10
19 #define SOCKOP_sendto 11
20 #define SOCKOP_recvfrom 12
21 #define SOCKOP_shutdown 13
22 #define SOCKOP_setsockopt 14
23 #define SOCKOP_getsockopt 15
24 #define SOCKOP_sendmsg 16
25 #define SOCKOP_recvmsg 17
27 #define IPCOP_semop 1
28 #define IPCOP_semget 2
29 #define IPCOP_semctl 3
30 #define IPCOP_semtimedop 4
31 #define IPCOP_msgsnd 11
32 #define IPCOP_msgrcv 12
33 #define IPCOP_msgget 13
34 #define IPCOP_msgctl 14
35 #define IPCOP_shmat 21
36 #define IPCOP_shmdt 22
37 #define IPCOP_shmget 23
38 #define IPCOP_shmctl 24
41 * The following is for compatibility across the various Linux
42 * platforms. The i386 ioctl numbering scheme doesn't really enforce
43 * a type field. De facto, however, the top 8 bits of the lower 16
44 * bits are indeed used as a type field, so we might just as well make
45 * this explicit here. Please be sure to use the decoding macros
46 * below from now on.
48 #define TARGET_IOC_NRBITS 8
49 #define TARGET_IOC_TYPEBITS 8
51 #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
52 || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
53 /* 16 bit uid wrappers emulation */
54 #define USE_UID16
55 #endif
57 #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
58 || defined(TARGET_M68K) || defined(TARGET_CRIS)
60 #define TARGET_IOC_SIZEBITS 14
61 #define TARGET_IOC_DIRBITS 2
63 #define TARGET_IOC_NONE 0U
64 #define TARGET_IOC_WRITE 1U
65 #define TARGET_IOC_READ 2U
67 #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \
68 defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \
69 defined(TARGET_MIPS)
71 #define TARGET_IOC_SIZEBITS 13
72 #define TARGET_IOC_DIRBITS 3
74 #define TARGET_IOC_NONE 1U
75 #define TARGET_IOC_READ 2U
76 #define TARGET_IOC_WRITE 4U
78 #else
79 #error unsupported CPU
80 #endif
82 #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1)
83 #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1)
84 #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1)
85 #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1)
87 #define TARGET_IOC_NRSHIFT 0
88 #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS)
89 #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS)
90 #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS)
92 #define TARGET_IOC(dir,type,nr,size) \
93 (((dir) << TARGET_IOC_DIRSHIFT) | \
94 ((type) << TARGET_IOC_TYPESHIFT) | \
95 ((nr) << TARGET_IOC_NRSHIFT) | \
96 ((size) << TARGET_IOC_SIZESHIFT))
98 /* used to create numbers */
99 #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0)
100 #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size))
101 #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size))
102 #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size))
104 /* the size is automatically computed for these defines */
105 #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK)
106 #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
107 #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
109 struct target_sockaddr {
110 uint16_t sa_family;
111 uint8_t sa_data[14];
114 struct target_in_addr {
115 uint32_t s_addr; /* big endian */
118 struct target_ip_mreq {
119 struct target_in_addr imr_multiaddr;
120 struct target_in_addr imr_address;
123 struct target_ip_mreqn {
124 struct target_in_addr imr_multiaddr;
125 struct target_in_addr imr_address;
126 abi_long imr_ifindex;
129 struct target_ip_mreq_source {
130 /* big endian */
131 uint32_t imr_multiaddr;
132 uint32_t imr_interface;
133 uint32_t imr_sourceaddr;
136 struct target_timeval {
137 abi_long tv_sec;
138 abi_long tv_usec;
141 struct target_timespec {
142 abi_long tv_sec;
143 abi_long tv_nsec;
146 struct target_itimerval {
147 struct target_timeval it_interval;
148 struct target_timeval it_value;
151 typedef abi_long target_clock_t;
153 #define TARGET_HZ 100
155 struct target_tms {
156 target_clock_t tms_utime;
157 target_clock_t tms_stime;
158 target_clock_t tms_cutime;
159 target_clock_t tms_cstime;
162 struct target_utimbuf {
163 abi_long actime;
164 abi_long modtime;
167 struct target_sel_arg_struct {
168 abi_long n;
169 abi_long inp, outp, exp;
170 abi_long tvp;
173 struct target_iovec {
174 abi_long iov_base; /* Starting address */
175 abi_long iov_len; /* Number of bytes */
178 struct target_msghdr {
179 abi_long msg_name; /* Socket name */
180 int msg_namelen; /* Length of name */
181 abi_long msg_iov; /* Data blocks */
182 abi_long msg_iovlen; /* Number of blocks */
183 abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
184 abi_long msg_controllen; /* Length of cmsg list */
185 unsigned int msg_flags;
188 struct target_cmsghdr {
189 abi_long cmsg_len;
190 int cmsg_level;
191 int cmsg_type;
194 #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1))
195 #define TARGET_CMSG_NXTHDR(mhdr, cmsg) __target_cmsg_nxthdr (mhdr, cmsg)
196 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \
197 & (size_t) ~(sizeof (abi_long) - 1))
198 #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \
199 + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)))
200 #define TARGET_CMSG_LEN(len) (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len))
202 static __inline__ struct target_cmsghdr *
203 __target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct target_cmsghdr *__cmsg)
205 struct target_cmsghdr *__ptr;
207 __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg
208 + TARGET_CMSG_ALIGN (tswapl(__cmsg->cmsg_len)));
209 if ((unsigned long)((char *)(__ptr+1) - (char *)(size_t)tswapl(__mhdr->msg_control))
210 > tswapl(__mhdr->msg_controllen))
211 /* No more entries. */
212 return (struct target_cmsghdr *)0;
213 return __cmsg;
217 struct target_rusage {
218 struct target_timeval ru_utime; /* user time used */
219 struct target_timeval ru_stime; /* system time used */
220 abi_long ru_maxrss; /* maximum resident set size */
221 abi_long ru_ixrss; /* integral shared memory size */
222 abi_long ru_idrss; /* integral unshared data size */
223 abi_long ru_isrss; /* integral unshared stack size */
224 abi_long ru_minflt; /* page reclaims */
225 abi_long ru_majflt; /* page faults */
226 abi_long ru_nswap; /* swaps */
227 abi_long ru_inblock; /* block input operations */
228 abi_long ru_oublock; /* block output operations */
229 abi_long ru_msgsnd; /* messages sent */
230 abi_long ru_msgrcv; /* messages received */
231 abi_long ru_nsignals; /* signals received */
232 abi_long ru_nvcsw; /* voluntary context switches */
233 abi_long ru_nivcsw; /* involuntary " */
236 typedef struct {
237 int val[2];
238 } kernel_fsid_t;
240 struct kernel_statfs {
241 int f_type;
242 int f_bsize;
243 int f_blocks;
244 int f_bfree;
245 int f_bavail;
246 int f_files;
247 int f_ffree;
248 kernel_fsid_t f_fsid;
249 int f_namelen;
250 int f_spare[6];
253 struct target_dirent {
254 abi_long d_ino;
255 abi_long d_off;
256 unsigned short d_reclen;
257 char d_name[256]; /* We must not include limits.h! */
260 struct target_dirent64 {
261 uint64_t d_ino;
262 int64_t d_off;
263 unsigned short d_reclen;
264 unsigned char d_type;
265 char d_name[256];
269 /* mostly generic signal stuff */
270 #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */
271 #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */
272 #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */
274 #ifdef TARGET_MIPS
275 #define TARGET_NSIG 128
276 #else
277 #define TARGET_NSIG 64
278 #endif
279 #define TARGET_NSIG_BPW TARGET_ABI_BITS
280 #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW)
282 typedef struct {
283 abi_ulong sig[TARGET_NSIG_WORDS];
284 } target_sigset_t;
286 #ifdef BSWAP_NEEDED
287 static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
289 int i;
290 for(i = 0;i < TARGET_NSIG_WORDS; i++)
291 d->sig[i] = tswapl(s->sig[i]);
293 #else
294 static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
296 *d = *s;
298 #endif
300 static inline void target_siginitset(target_sigset_t *d, abi_ulong set)
302 int i;
303 d->sig[0] = set;
304 for(i = 1;i < TARGET_NSIG_WORDS; i++)
305 d->sig[i] = 0;
308 void host_to_target_sigset(target_sigset_t *d, const sigset_t *s);
309 void target_to_host_sigset(sigset_t *d, const target_sigset_t *s);
310 void host_to_target_old_sigset(abi_ulong *old_sigset,
311 const sigset_t *sigset);
312 void target_to_host_old_sigset(sigset_t *sigset,
313 const abi_ulong *old_sigset);
314 struct target_sigaction;
315 int do_sigaction(int sig, const struct target_sigaction *act,
316 struct target_sigaction *oact);
318 #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined (TARGET_SH4) || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) || defined(TARGET_MICROBLAZE)
320 #if defined(TARGET_SPARC)
321 #define TARGET_SA_NOCLDSTOP 8u
322 #define TARGET_SA_NOCLDWAIT 0x100u
323 #define TARGET_SA_SIGINFO 0x200u
324 #define TARGET_SA_ONSTACK 1u
325 #define TARGET_SA_RESTART 2u
326 #define TARGET_SA_NODEFER 0x20u
327 #define TARGET_SA_RESETHAND 4u
328 #elif defined(TARGET_MIPS)
329 #define TARGET_SA_NOCLDSTOP 0x00000001
330 #define TARGET_SA_NOCLDWAIT 0x00010000
331 #define TARGET_SA_SIGINFO 0x00000008
332 #define TARGET_SA_ONSTACK 0x08000000
333 #define TARGET_SA_NODEFER 0x40000000
334 #define TARGET_SA_RESTART 0x10000000
335 #define TARGET_SA_RESETHAND 0x80000000
336 #if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64)
337 #define TARGET_SA_RESTORER 0x04000000 /* Only for O32 */
338 #endif
339 #else
340 #define TARGET_SA_NOCLDSTOP 0x00000001
341 #define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */
342 #define TARGET_SA_SIGINFO 0x00000004
343 #define TARGET_SA_ONSTACK 0x08000000
344 #define TARGET_SA_RESTART 0x10000000
345 #define TARGET_SA_NODEFER 0x40000000
346 #define TARGET_SA_RESETHAND 0x80000000
347 #define TARGET_SA_RESTORER 0x04000000
348 #endif
350 #if defined(TARGET_SPARC)
352 #define TARGET_SIGHUP 1
353 #define TARGET_SIGINT 2
354 #define TARGET_SIGQUIT 3
355 #define TARGET_SIGILL 4
356 #define TARGET_SIGTRAP 5
357 #define TARGET_SIGABRT 6
358 #define TARGET_SIGIOT 6
359 #define TARGET_SIGSTKFLT 7 /* actually EMT */
360 #define TARGET_SIGFPE 8
361 #define TARGET_SIGKILL 9
362 #define TARGET_SIGBUS 10
363 #define TARGET_SIGSEGV 11
364 #define TARGET_SIGSYS 12
365 #define TARGET_SIGPIPE 13
366 #define TARGET_SIGALRM 14
367 #define TARGET_SIGTERM 15
368 #define TARGET_SIGURG 16
369 #define TARGET_SIGSTOP 17
370 #define TARGET_SIGTSTP 18
371 #define TARGET_SIGCONT 19
372 #define TARGET_SIGCHLD 20
373 #define TARGET_SIGTTIN 21
374 #define TARGET_SIGTTOU 22
375 #define TARGET_SIGIO 23
376 #define TARGET_SIGXCPU 24
377 #define TARGET_SIGXFSZ 25
378 #define TARGET_SIGVTALRM 26
379 #define TARGET_SIGPROF 27
380 #define TARGET_SIGWINCH 28
381 #define TARGET_SIGPWR 29
382 #define TARGET_SIGUSR1 30
383 #define TARGET_SIGUSR2 31
384 #define TARGET_SIGRTMIN 32
386 #define TARGET_SIG_BLOCK 0x01 /* for blocking signals */
387 #define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */
388 #define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */
390 #elif defined(TARGET_MIPS)
392 #define TARGET_SIGHUP 1 /* Hangup (POSIX). */
393 #define TARGET_SIGINT 2 /* Interrupt (ANSI). */
394 #define TARGET_SIGQUIT 3 /* Quit (POSIX). */
395 #define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */
396 #define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */
397 #define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */
398 #define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */
399 #define TARGET_SIGEMT 7
400 #define TARGET_SIGSTKFLT 7 /* XXX: incorrect */
401 #define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */
402 #define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */
403 #define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */
404 #define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */
405 #define TARGET_SIGSYS 12
406 #define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */
407 #define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */
408 #define TARGET_SIGTERM 15 /* Termination (ANSI). */
409 #define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */
410 #define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */
411 #define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */
412 #define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */
413 #define TARGET_SIGPWR 19 /* Power failure restart (System V). */
414 #define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */
415 #define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */
416 #define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */
417 #define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */
418 #define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */
419 #define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */
420 #define TARGET_SIGCONT 25 /* Continue (POSIX). */
421 #define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */
422 #define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */
423 #define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */
424 #define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */
425 #define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */
426 #define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */
427 #define TARGET_SIGRTMIN 32
429 #define TARGET_SIG_BLOCK 1 /* for blocking signals */
430 #define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */
431 #define TARGET_SIG_SETMASK 3 /* for setting the signal mask */
433 #else
435 #define TARGET_SIGHUP 1
436 #define TARGET_SIGINT 2
437 #define TARGET_SIGQUIT 3
438 #define TARGET_SIGILL 4
439 #define TARGET_SIGTRAP 5
440 #define TARGET_SIGABRT 6
441 #define TARGET_SIGIOT 6
442 #define TARGET_SIGBUS 7
443 #define TARGET_SIGFPE 8
444 #define TARGET_SIGKILL 9
445 #define TARGET_SIGUSR1 10
446 #define TARGET_SIGSEGV 11
447 #define TARGET_SIGUSR2 12
448 #define TARGET_SIGPIPE 13
449 #define TARGET_SIGALRM 14
450 #define TARGET_SIGTERM 15
451 #define TARGET_SIGSTKFLT 16
452 #define TARGET_SIGCHLD 17
453 #define TARGET_SIGCONT 18
454 #define TARGET_SIGSTOP 19
455 #define TARGET_SIGTSTP 20
456 #define TARGET_SIGTTIN 21
457 #define TARGET_SIGTTOU 22
458 #define TARGET_SIGURG 23
459 #define TARGET_SIGXCPU 24
460 #define TARGET_SIGXFSZ 25
461 #define TARGET_SIGVTALRM 26
462 #define TARGET_SIGPROF 27
463 #define TARGET_SIGWINCH 28
464 #define TARGET_SIGIO 29
465 #define TARGET_SIGPWR 30
466 #define TARGET_SIGSYS 31
467 #define TARGET_SIGRTMIN 32
469 #define TARGET_SIG_BLOCK 0 /* for blocking signals */
470 #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */
471 #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */
473 #endif
475 #if defined(TARGET_MIPS)
477 struct target_sigaction {
478 uint32_t sa_flags;
479 #if defined(TARGET_ABI_MIPSN32)
480 uint32_t _sa_handler;
481 #else
482 abi_ulong _sa_handler;
483 #endif
484 target_sigset_t sa_mask;
487 #else
488 struct target_old_sigaction {
489 abi_ulong _sa_handler;
490 abi_ulong sa_mask;
491 abi_ulong sa_flags;
492 abi_ulong sa_restorer;
495 struct target_sigaction {
496 abi_ulong _sa_handler;
497 abi_ulong sa_flags;
498 abi_ulong sa_restorer;
499 target_sigset_t sa_mask;
501 #endif
503 typedef union target_sigval {
504 int sival_int;
505 abi_ulong sival_ptr;
506 } target_sigval_t;
507 #if 0
508 #if defined (TARGET_SPARC)
509 typedef struct {
510 struct {
511 abi_ulong psr;
512 abi_ulong pc;
513 abi_ulong npc;
514 abi_ulong y;
515 abi_ulong u_regs[16]; /* globals and ins */
516 } si_regs;
517 int si_mask;
518 } __siginfo_t;
520 typedef struct {
521 unsigned long si_float_regs [32];
522 unsigned long si_fsr;
523 unsigned long si_fpqdepth;
524 struct {
525 unsigned long *insn_addr;
526 unsigned long insn;
527 } si_fpqueue [16];
528 } __siginfo_fpu_t;
529 #endif
530 #endif
532 #define TARGET_SI_MAX_SIZE 128
533 #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE/sizeof(int)) - 3)
535 typedef struct target_siginfo {
536 #ifdef TARGET_MIPS
537 int si_signo;
538 int si_code;
539 int si_errno;
540 #else
541 int si_signo;
542 int si_errno;
543 int si_code;
544 #endif
546 union {
547 int _pad[TARGET_SI_PAD_SIZE];
549 /* kill() */
550 struct {
551 pid_t _pid; /* sender's pid */
552 uid_t _uid; /* sender's uid */
553 } _kill;
555 /* POSIX.1b timers */
556 struct {
557 unsigned int _timer1;
558 unsigned int _timer2;
559 } _timer;
561 /* POSIX.1b signals */
562 struct {
563 pid_t _pid; /* sender's pid */
564 uid_t _uid; /* sender's uid */
565 target_sigval_t _sigval;
566 } _rt;
568 /* SIGCHLD */
569 struct {
570 pid_t _pid; /* which child */
571 uid_t _uid; /* sender's uid */
572 int _status; /* exit code */
573 target_clock_t _utime;
574 target_clock_t _stime;
575 } _sigchld;
577 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
578 struct {
579 abi_ulong _addr; /* faulting insn/memory ref. */
580 } _sigfault;
582 /* SIGPOLL */
583 struct {
584 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
585 int _fd;
586 } _sigpoll;
587 } _sifields;
588 } target_siginfo_t;
591 * si_code values
592 * Digital reserves positive values for kernel-generated signals.
594 #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */
595 #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */
596 #define TARGET_SI_QUEUE -1 /* sent by sigqueue */
597 #define TARGET_SI_TIMER -2 /* sent by timer expiration */
598 #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */
599 #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */
600 #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */
603 * SIGILL si_codes
605 #define TARGET_ILL_ILLOPC (1) /* illegal opcode */
606 #define TARGET_ILL_ILLOPN (2) /* illegal operand */
607 #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */
608 #define TARGET_ILL_ILLTRP (4) /* illegal trap */
609 #define TARGET_ILL_PRVOPC (5) /* privileged opcode */
610 #define TARGET_ILL_PRVREG (6) /* privileged register */
611 #define TARGET_ILL_COPROC (7) /* coprocessor error */
612 #define TARGET_ILL_BADSTK (8) /* internal stack error */
615 * SIGFPE si_codes
617 #define TARGET_FPE_INTDIV (1) /* integer divide by zero */
618 #define TARGET_FPE_INTOVF (2) /* integer overflow */
619 #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */
620 #define TARGET_FPE_FLTOVF (4) /* floating point overflow */
621 #define TARGET_FPE_FLTUND (5) /* floating point underflow */
622 #define TARGET_FPE_FLTRES (6) /* floating point inexact result */
623 #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */
624 #define TARGET_FPE_FLTSUB (8) /* subscript out of range */
625 #define TARGET_NSIGFPE 8
628 * SIGSEGV si_codes
630 #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */
631 #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */
634 * SIGBUS si_codes
636 #define TARGET_BUS_ADRALN (1) /* invalid address alignment */
637 #define TARGET_BUS_ADRERR (2) /* non-existant physical address */
638 #define TARGET_BUS_OBJERR (3) /* object specific hardware error */
641 * SIGTRAP si_codes
643 #define TARGET_TRAP_BRKPT (1) /* process breakpoint */
644 #define TARGET_TRAP_TRACE (2) /* process trace trap */
646 #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */
648 struct target_rlimit {
649 abi_ulong rlim_cur;
650 abi_ulong rlim_max;
653 struct target_pollfd {
654 int fd; /* file descriptor */
655 short events; /* requested events */
656 short revents; /* returned events */
659 /* virtual terminal ioctls */
660 #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */
661 #define TARGET_KDMKTONE 0x4B30 /* generate tone */
662 #define TARGET_KDGKBTYPE 0x4b33
663 #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */
664 #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */
666 #define TARGET_SIOCATMARK 0x8905
668 /* Networking ioctls */
669 #define TARGET_SIOCADDRT 0x890B /* add routing table entry */
670 #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */
671 #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */
672 #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */
673 #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */
674 #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */
675 #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */
676 #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */
677 #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */
678 #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */
679 #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */
680 #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */
681 #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */
682 #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */
683 #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */
684 #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */
685 #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */
686 #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */
687 #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */
688 #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */
689 #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */
690 #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */
691 #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */
692 #define TARGET_SIOCSIFENCAP 0x8926
693 #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */
694 #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */
695 #define TARGET_SIOCSIFSLAVE 0x8930
696 #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */
697 #define TARGET_SIOCDELMULTI 0x8932
699 /* Bridging control calls */
700 #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */
701 #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */
703 #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */
704 #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */
706 /* ARP cache control calls. */
707 #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */
708 #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */
709 #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */
710 #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */
711 #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */
712 #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */
714 /* RARP cache control calls. */
715 #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */
716 #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */
717 #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */
719 /* Driver configuration calls */
720 #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */
721 #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */
723 /* DLCI configuration calls */
724 #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */
725 #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */
728 /* From <linux/fs.h> */
730 #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */
731 #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */
732 #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */
733 #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */
734 #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */
735 #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */
736 #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */
737 #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
738 #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
739 #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
740 #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
741 #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */
742 /* A jump here: 108-111 have been used for various private purposes. */
743 #define TARGET_BLKBSZGET TARGET_IOR(0x12,112,sizeof(int))
744 #define TARGET_BLKBSZSET TARGET_IOW(0x12,113,sizeof(int))
745 #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,sizeof(uint64_t)) /* return device size in bytes (u64 *arg) */
746 #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */
747 #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */
749 /* cdrom commands */
750 #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */
751 #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */
752 #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */
753 #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index
754 (struct cdrom_ti) */
755 #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header
756 (struct cdrom_tochdr) */
757 #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry
758 (struct cdrom_tocentry) */
759 #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */
760 #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */
761 #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */
762 #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume
763 (struct cdrom_volctrl) */
764 #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data
765 (struct cdrom_subchnl) */
766 #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes)
767 (struct cdrom_read) */
768 #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes)
769 (struct cdrom_read) */
770 #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */
771 #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */
772 #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session
773 address of multi session disks
774 (struct cdrom_multisession) */
775 #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code"
776 if available (struct cdrom_mcn) */
777 #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is depricated,
778 but here anyway for compatability */
779 #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */
780 #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting
781 (struct cdrom_volctrl) */
782 #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes)
783 (struct cdrom_read) */
785 * These ioctls are used only used in aztcd.c and optcd.c
787 #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */
788 #define TARGET_CDROMSEEK 0x5316 /* seek msf address */
791 * This ioctl is only used by the scsi-cd driver.
792 It is for playing audio in logical block addressing mode.
794 #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */
797 * These ioctls are only used in optcd.c
799 #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */
802 * These ioctls are (now) only in ide-cd.c for controlling
803 * drive spindown time. They should be implemented in the
804 * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
805 * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
806 * -Erik
808 #define TARGET_CDROMGETSPINDOWN 0x531d
809 #define TARGET_CDROMSETSPINDOWN 0x531e
812 * These ioctls are implemented through the uniform CD-ROM driver
813 * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
814 * drivers are eventually ported to the uniform CD-ROM driver interface.
816 #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
817 #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */
818 #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */
819 #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */
820 #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */
821 #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */
822 #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
823 #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */
824 #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */
825 #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */
826 #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */
827 #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */
829 /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386.
830 * Future CDROM ioctls should be kept below 0x537F
833 /* This ioctl is only used by sbpcd at the moment */
834 #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */
835 /* conflict with SCSI_IOCTL_GET_IDLUN */
837 /* DVD-ROM Specific ioctls */
838 #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */
839 #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */
840 #define TARGET_DVD_AUTH 0x5392 /* Authentication */
842 #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */
843 #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */
844 #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */
846 /* HD commands */
848 /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
849 #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */
850 #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */
851 #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */
852 #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */
853 #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */
854 #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */
855 #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */
856 #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
857 #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */
859 /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
860 #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */
861 #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */
862 #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */
863 #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */
864 #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */
865 #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */
866 #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
868 /* loop ioctls */
869 #define TARGET_LOOP_SET_FD 0x4C00
870 #define TARGET_LOOP_CLR_FD 0x4C01
871 #define TARGET_LOOP_SET_STATUS 0x4C02
872 #define TARGET_LOOP_GET_STATUS 0x4C03
873 #define TARGET_LOOP_SET_STATUS64 0x4C04
874 #define TARGET_LOOP_GET_STATUS64 0x4C05
875 #define TARGET_LOOP_CHANGE_FD 0x4C06
877 /* from asm/termbits.h */
879 #define TARGET_NCC 8
880 struct target_termio {
881 unsigned short c_iflag; /* input mode flags */
882 unsigned short c_oflag; /* output mode flags */
883 unsigned short c_cflag; /* control mode flags */
884 unsigned short c_lflag; /* local mode flags */
885 unsigned char c_line; /* line discipline */
886 unsigned char c_cc[TARGET_NCC]; /* control characters */
889 struct target_winsize {
890 unsigned short ws_row;
891 unsigned short ws_col;
892 unsigned short ws_xpixel;
893 unsigned short ws_ypixel;
896 #include "termbits.h"
898 /* Common */
899 #define TARGET_MAP_SHARED 0x01 /* Share changes */
900 #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */
901 #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */
903 /* Target specific */
904 #if defined(TARGET_MIPS)
905 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
906 #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */
907 #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */
908 #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */
909 #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */
910 #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */
911 #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */
912 #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
913 #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */
914 #elif defined(TARGET_PPC)
915 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
916 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */
917 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */
918 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */
919 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */
920 #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */
921 #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */
922 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
923 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */
924 #elif defined(TARGET_ALPHA)
925 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */
926 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */
927 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */
928 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */
929 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */
930 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */
931 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */
932 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */
933 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */
934 #else
935 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
936 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */
937 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */
938 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */
939 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */
940 #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */
941 #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */
942 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
943 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */
944 #endif
946 #if (defined(TARGET_I386) && defined(TARGET_ABI32)) || defined(TARGET_ARM) || defined(TARGET_CRIS)
947 struct target_stat {
948 unsigned short st_dev;
949 unsigned short __pad1;
950 abi_ulong st_ino;
951 unsigned short st_mode;
952 unsigned short st_nlink;
953 unsigned short st_uid;
954 unsigned short st_gid;
955 unsigned short st_rdev;
956 unsigned short __pad2;
957 abi_ulong st_size;
958 abi_ulong st_blksize;
959 abi_ulong st_blocks;
960 abi_ulong target_st_atime;
961 abi_ulong __unused1;
962 abi_ulong target_st_mtime;
963 abi_ulong __unused2;
964 abi_ulong target_st_ctime;
965 abi_ulong __unused3;
966 abi_ulong __unused4;
967 abi_ulong __unused5;
970 /* This matches struct stat64 in glibc2.1, hence the absolutely
971 * insane amounts of padding around dev_t's.
973 struct target_stat64 {
974 unsigned short st_dev;
975 unsigned char __pad0[10];
977 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
978 abi_ulong __st_ino;
980 unsigned int st_mode;
981 unsigned int st_nlink;
983 abi_ulong st_uid;
984 abi_ulong st_gid;
986 unsigned short st_rdev;
987 unsigned char __pad3[10];
989 long long st_size;
990 abi_ulong st_blksize;
992 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */
993 abi_ulong __pad4; /* future possible st_blocks high bits */
995 abi_ulong target_st_atime;
996 abi_ulong __pad5;
998 abi_ulong target_st_mtime;
999 abi_ulong __pad6;
1001 abi_ulong target_st_ctime;
1002 abi_ulong __pad7; /* will be high 32 bits of ctime someday */
1004 unsigned long long st_ino;
1005 } __attribute__((packed));
1007 #ifdef TARGET_ARM
1008 struct target_eabi_stat64 {
1009 unsigned long long st_dev;
1010 unsigned int __pad1;
1011 abi_ulong __st_ino;
1012 unsigned int st_mode;
1013 unsigned int st_nlink;
1015 abi_ulong st_uid;
1016 abi_ulong st_gid;
1018 unsigned long long st_rdev;
1019 unsigned int __pad2[2];
1021 long long st_size;
1022 abi_ulong st_blksize;
1023 unsigned int __pad3;
1024 unsigned long long st_blocks;
1026 abi_ulong target_st_atime;
1027 abi_ulong target_st_atime_nsec;
1029 abi_ulong target_st_mtime;
1030 abi_ulong target_st_mtime_nsec;
1032 abi_ulong target_st_ctime;
1033 abi_ulong target_st_ctime_nsec;
1035 unsigned long long st_ino;
1036 } __attribute__ ((packed));
1037 #endif
1039 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
1040 struct target_stat {
1041 unsigned int st_dev;
1042 abi_ulong st_ino;
1043 unsigned int st_mode;
1044 unsigned int st_nlink;
1045 unsigned int st_uid;
1046 unsigned int st_gid;
1047 unsigned int st_rdev;
1048 abi_long st_size;
1049 abi_long target_st_atime;
1050 abi_long target_st_mtime;
1051 abi_long target_st_ctime;
1052 abi_long st_blksize;
1053 abi_long st_blocks;
1054 abi_ulong __unused4[2];
1057 struct target_stat64 {
1058 unsigned char __pad0[6];
1059 unsigned short st_dev;
1061 uint64_t st_ino;
1062 uint64_t st_nlink;
1064 unsigned int st_mode;
1066 unsigned int st_uid;
1067 unsigned int st_gid;
1069 unsigned char __pad2[6];
1070 unsigned short st_rdev;
1072 int64_t st_size;
1073 int64_t st_blksize;
1075 unsigned char __pad4[4];
1076 unsigned int st_blocks;
1078 abi_ulong target_st_atime;
1079 abi_ulong __unused1;
1081 abi_ulong target_st_mtime;
1082 abi_ulong __unused2;
1084 abi_ulong target_st_ctime;
1085 abi_ulong __unused3;
1087 abi_ulong __unused4[3];
1090 #elif defined(TARGET_SPARC)
1092 struct target_stat {
1093 unsigned short st_dev;
1094 abi_ulong st_ino;
1095 unsigned short st_mode;
1096 short st_nlink;
1097 unsigned short st_uid;
1098 unsigned short st_gid;
1099 unsigned short st_rdev;
1100 abi_long st_size;
1101 abi_long target_st_atime;
1102 abi_ulong __unused1;
1103 abi_long target_st_mtime;
1104 abi_ulong __unused2;
1105 abi_long target_st_ctime;
1106 abi_ulong __unused3;
1107 abi_long st_blksize;
1108 abi_long st_blocks;
1109 abi_ulong __unused4[2];
1112 struct target_stat64 {
1113 unsigned char __pad0[6];
1114 unsigned short st_dev;
1116 uint64_t st_ino;
1118 unsigned int st_mode;
1119 unsigned int st_nlink;
1121 unsigned int st_uid;
1122 unsigned int st_gid;
1124 unsigned char __pad2[6];
1125 unsigned short st_rdev;
1127 unsigned char __pad3[8];
1129 int64_t st_size;
1130 unsigned int st_blksize;
1132 unsigned char __pad4[8];
1133 unsigned int st_blocks;
1135 unsigned int target_st_atime;
1136 unsigned int __unused1;
1138 unsigned int target_st_mtime;
1139 unsigned int __unused2;
1141 unsigned int target_st_ctime;
1142 unsigned int __unused3;
1144 unsigned int __unused4;
1145 unsigned int __unused5;
1148 #elif defined(TARGET_PPC)
1150 struct target_stat {
1151 abi_ulong st_dev;
1152 abi_ulong st_ino;
1153 #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
1154 abi_ulong st_nlink;
1155 unsigned int st_mode;
1156 #else
1157 unsigned int st_mode;
1158 unsigned short st_nlink;
1159 #endif
1160 unsigned int st_uid;
1161 unsigned int st_gid;
1162 abi_ulong st_rdev;
1163 abi_ulong st_size;
1164 abi_ulong st_blksize;
1165 abi_ulong st_blocks;
1166 abi_ulong target_st_atime;
1167 abi_ulong target_st_atime_nsec;
1168 abi_ulong target_st_mtime;
1169 abi_ulong target_st_mtime_nsec;
1170 abi_ulong target_st_ctime;
1171 abi_ulong target_st_ctime_nsec;
1172 abi_ulong __unused4;
1173 abi_ulong __unused5;
1174 #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
1175 abi_ulong __unused6;
1176 #endif
1179 struct __attribute__((__packed__)) target_stat64 {
1180 unsigned long long st_dev;
1181 unsigned long long st_ino;
1182 unsigned int st_mode;
1183 unsigned int st_nlink;
1184 unsigned int st_uid;
1185 unsigned int st_gid;
1186 unsigned long long st_rdev;
1187 unsigned long long __pad0;
1188 long long st_size;
1189 int st_blksize;
1190 long long st_blocks; /* Number 512-byte blocks allocated. */
1191 unsigned int __pad1;
1192 int target_st_atime;
1193 unsigned int target_st_atime_nsec;
1194 int target_st_mtime;
1195 unsigned int target_st_mtime_nsec;
1196 int target_st_ctime;
1197 unsigned int target_st_ctime_nsec;
1198 unsigned int __unused4;
1199 unsigned int __unused5;
1202 #elif defined(TARGET_MICROBLAZE)
1204 struct target_stat {
1205 abi_ulong st_dev;
1206 abi_ulong st_ino;
1207 unsigned int st_mode;
1208 unsigned short st_nlink;
1209 unsigned int st_uid;
1210 unsigned int st_gid;
1211 abi_ulong st_rdev;
1212 abi_ulong st_size;
1213 abi_ulong st_blksize;
1214 abi_ulong st_blocks;
1215 abi_ulong target_st_atime;
1216 abi_ulong target_st_atime_nsec;
1217 abi_ulong target_st_mtime;
1218 abi_ulong target_st_mtime_nsec;
1219 abi_ulong target_st_ctime;
1220 abi_ulong target_st_ctime_nsec;
1221 abi_ulong __unused4;
1222 abi_ulong __unused5;
1225 /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */
1226 struct __attribute__((__packed__)) target_stat64 {
1227 uint64_t st_dev;
1228 uint64_t st_ino;
1229 uint32_t st_mode;
1230 uint32_t st_nlink;
1231 uint32_t st_uid;
1232 uint32_t st_gid;
1233 uint64_t st_rdev;
1234 uint32_t __pad2;
1236 int64_t st_size;
1237 int32_t st_blksize;
1238 int64_t st_blocks; /* Number 512-byte blocks allocated. */
1240 int target_st_atime;
1241 unsigned int target_st_atime_nsec;
1242 int target_st_mtime;
1243 unsigned int target_st_mtime_nsec;
1244 int target_st_ctime;
1245 unsigned int target_st_ctime_nsec;
1246 uint32_t __unused4;
1247 uint32_t __unused5;
1250 #elif defined(TARGET_M68K)
1252 struct target_stat {
1253 unsigned short st_dev;
1254 unsigned short __pad1;
1255 abi_ulong st_ino;
1256 unsigned short st_mode;
1257 unsigned short st_nlink;
1258 unsigned short st_uid;
1259 unsigned short st_gid;
1260 unsigned short st_rdev;
1261 unsigned short __pad2;
1262 abi_ulong st_size;
1263 abi_ulong st_blksize;
1264 abi_ulong st_blocks;
1265 abi_ulong target_st_atime;
1266 abi_ulong __unused1;
1267 abi_ulong target_st_mtime;
1268 abi_ulong __unused2;
1269 abi_ulong target_st_ctime;
1270 abi_ulong __unused3;
1271 abi_ulong __unused4;
1272 abi_ulong __unused5;
1275 /* This matches struct stat64 in glibc2.1, hence the absolutely
1276 * insane amounts of padding around dev_t's.
1278 struct target_stat64 {
1279 unsigned long long st_dev;
1280 unsigned char __pad1[2];
1282 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
1283 abi_ulong __st_ino;
1285 unsigned int st_mode;
1286 unsigned int st_nlink;
1288 abi_ulong st_uid;
1289 abi_ulong st_gid;
1291 unsigned long long st_rdev;
1292 unsigned char __pad3[2];
1294 long long st_size;
1295 abi_ulong st_blksize;
1297 abi_ulong __pad4; /* future possible st_blocks high bits */
1298 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */
1300 abi_ulong target_st_atime;
1301 abi_ulong target_st_atime_nsec;
1303 abi_ulong target_st_mtime;
1304 abi_ulong target_st_mtime_nsec;
1306 abi_ulong target_st_ctime;
1307 abi_ulong target_st_ctime_nsec;
1309 unsigned long long st_ino;
1310 } __attribute__((packed));
1312 #elif defined(TARGET_ABI_MIPSN64)
1314 /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
1315 struct target_stat {
1316 unsigned int st_dev;
1317 unsigned int st_pad0[3]; /* Reserved for st_dev expansion */
1319 abi_ulong st_ino;
1321 unsigned int st_mode;
1322 unsigned int st_nlink;
1324 int st_uid;
1325 int st_gid;
1327 unsigned int st_rdev;
1328 unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */
1330 abi_ulong st_size;
1333 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1334 * but we don't have it under Linux.
1336 unsigned int target_st_atime;
1337 unsigned int target_st_atime_nsec;
1339 unsigned int target_st_mtime;
1340 unsigned int target_st_mtime_nsec;
1342 unsigned int target_st_ctime;
1343 unsigned int target_st_ctime_nsec;
1345 unsigned int st_blksize;
1346 unsigned int st_pad2;
1348 abi_ulong st_blocks;
1351 #elif defined(TARGET_ABI_MIPSN32)
1353 struct target_stat {
1354 unsigned st_dev;
1355 int st_pad1[3]; /* Reserved for network id */
1356 unsigned int st_ino;
1357 unsigned int st_mode;
1358 unsigned int st_nlink;
1359 int st_uid;
1360 int st_gid;
1361 unsigned st_rdev;
1362 unsigned int st_pad2[2];
1363 unsigned int st_size;
1364 unsigned int st_pad3;
1366 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1367 * but we don't have it under Linux.
1369 unsigned int target_st_atime;
1370 unsigned int target_st_atime_nsec;
1371 unsigned int target_st_mtime;
1372 unsigned int target_st_mtime_nsec;
1373 unsigned int target_st_ctime;
1374 unsigned int target_st_ctime_nsec;
1375 unsigned int st_blksize;
1376 unsigned int st_blocks;
1377 unsigned int st_pad4[14];
1381 * This matches struct stat64 in glibc2.1, hence the absolutely insane
1382 * amounts of padding around dev_t's. The memory layout is the same as of
1383 * struct stat of the 64-bit kernel.
1386 struct target_stat64 {
1387 unsigned int st_dev;
1388 unsigned int st_pad0[3]; /* Reserved for st_dev expansion */
1390 target_ulong st_ino;
1392 unsigned int st_mode;
1393 unsigned int st_nlink;
1395 int st_uid;
1396 int st_gid;
1398 unsigned int st_rdev;
1399 unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */
1401 int st_size;
1404 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1405 * but we don't have it under Linux.
1407 int target_st_atime;
1408 unsigned int target_st_atime_nsec; /* Reserved for st_atime expansion */
1410 int target_st_mtime;
1411 unsigned int target_st_mtime_nsec; /* Reserved for st_mtime expansion */
1413 int target_st_ctime;
1414 unsigned int target_st_ctime_nsec; /* Reserved for st_ctime expansion */
1416 unsigned int st_blksize;
1417 unsigned int st_pad2;
1419 int st_blocks;
1422 #elif defined(TARGET_ABI_MIPSO32)
1424 struct target_stat {
1425 unsigned st_dev;
1426 abi_long st_pad1[3]; /* Reserved for network id */
1427 abi_ulong st_ino;
1428 unsigned int st_mode;
1429 unsigned int st_nlink;
1430 int st_uid;
1431 int st_gid;
1432 unsigned st_rdev;
1433 abi_long st_pad2[2];
1434 abi_long st_size;
1435 abi_long st_pad3;
1437 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1438 * but we don't have it under Linux.
1440 abi_long target_st_atime;
1441 abi_long target_st_atime_nsec;
1442 abi_long target_st_mtime;
1443 abi_long target_st_mtime_nsec;
1444 abi_long target_st_ctime;
1445 abi_long target_st_ctime_nsec;
1446 abi_long st_blksize;
1447 abi_long st_blocks;
1448 abi_long st_pad4[14];
1452 * This matches struct stat64 in glibc2.1, hence the absolutely insane
1453 * amounts of padding around dev_t's. The memory layout is the same as of
1454 * struct stat of the 64-bit kernel.
1457 struct target_stat64 {
1458 abi_ulong st_dev;
1459 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */
1461 uint64_t st_ino;
1463 unsigned int st_mode;
1464 unsigned int st_nlink;
1466 int st_uid;
1467 int st_gid;
1469 abi_ulong st_rdev;
1470 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */
1472 int64_t st_size;
1475 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1476 * but we don't have it under Linux.
1478 abi_long target_st_atime;
1479 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */
1481 abi_long target_st_mtime;
1482 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */
1484 abi_long target_st_ctime;
1485 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */
1487 abi_ulong st_blksize;
1488 abi_ulong st_pad2;
1490 int64_t st_blocks;
1493 #elif defined(TARGET_ALPHA)
1495 struct target_stat {
1496 unsigned int st_dev;
1497 unsigned int st_ino;
1498 unsigned int st_mode;
1499 unsigned int st_nlink;
1500 unsigned int st_uid;
1501 unsigned int st_gid;
1502 unsigned int st_rdev;
1503 abi_long st_size;
1504 abi_ulong target_st_atime;
1505 abi_ulong target_st_mtime;
1506 abi_ulong target_st_ctime;
1507 unsigned int st_blksize;
1508 unsigned int st_blocks;
1509 unsigned int st_flags;
1510 unsigned int st_gen;
1513 struct target_stat64 {
1514 abi_ulong st_dev;
1515 abi_ulong st_ino;
1516 abi_ulong st_rdev;
1517 abi_long st_size;
1518 abi_ulong st_blocks;
1520 unsigned int st_mode;
1521 unsigned int st_uid;
1522 unsigned int st_gid;
1523 unsigned int st_blksize;
1524 unsigned int st_nlink;
1525 unsigned int __pad0;
1527 abi_ulong target_st_atime;
1528 abi_ulong target_st_atime_nsec;
1529 abi_ulong target_st_mtime;
1530 abi_ulong target_st_mtime_nsec;
1531 abi_ulong target_st_ctime;
1532 abi_ulong target_st_ctime_nsec;
1533 abi_long __unused[3];
1536 #elif defined(TARGET_SH4)
1538 struct target_stat {
1539 abi_ulong st_dev;
1540 abi_ulong st_ino;
1541 unsigned short st_mode;
1542 unsigned short st_nlink;
1543 unsigned short st_uid;
1544 unsigned short st_gid;
1545 abi_ulong st_rdev;
1546 abi_ulong st_size;
1547 abi_ulong st_blksize;
1548 abi_ulong st_blocks;
1549 abi_ulong target_st_atime;
1550 abi_ulong target_st_atime_nsec;
1551 abi_ulong target_st_mtime;
1552 abi_ulong target_st_mtime_nsec;
1553 abi_ulong target_st_ctime;
1554 abi_ulong target_st_ctime_nsec;
1555 abi_ulong __unused4;
1556 abi_ulong __unused5;
1559 /* This matches struct stat64 in glibc2.1, hence the absolutely
1560 * insane amounts of padding around dev_t's.
1562 struct __attribute__((__packed__)) target_stat64 {
1563 unsigned long long st_dev;
1564 unsigned char __pad0[4];
1566 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
1567 abi_ulong __st_ino;
1569 unsigned int st_mode;
1570 unsigned int st_nlink;
1572 abi_ulong st_uid;
1573 abi_ulong st_gid;
1575 unsigned long long st_rdev;
1576 unsigned char __pad3[4];
1578 long long st_size;
1579 abi_ulong st_blksize;
1581 unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
1583 abi_ulong target_st_atime;
1584 abi_ulong target_st_atime_nsec;
1586 abi_ulong target_st_mtime;
1587 abi_ulong target_st_mtime_nsec;
1589 abi_ulong target_st_ctime;
1590 abi_ulong target_st_ctime_nsec;
1592 unsigned long long st_ino;
1595 #elif defined(TARGET_I386) && !defined(TARGET_ABI32)
1596 struct target_stat {
1597 abi_ulong st_dev;
1598 abi_ulong st_ino;
1599 abi_ulong st_nlink;
1601 unsigned int st_mode;
1602 unsigned int st_uid;
1603 unsigned int st_gid;
1604 unsigned int __pad0;
1605 abi_ulong st_rdev;
1606 abi_long st_size;
1607 abi_long st_blksize;
1608 abi_long st_blocks; /* Number 512-byte blocks allocated. */
1610 abi_ulong target_st_atime;
1611 abi_ulong target_st_atime_nsec;
1612 abi_ulong target_st_mtime;
1613 abi_ulong target_st_mtime_nsec;
1614 abi_ulong target_st_ctime;
1615 abi_ulong target_st_ctime_nsec;
1617 abi_long __unused[3];
1619 #else
1620 #error unsupported CPU
1621 #endif
1623 typedef struct {
1624 int val[2];
1625 } target_fsid_t;
1627 #ifdef TARGET_MIPS
1628 #ifdef TARGET_ABI_MIPSN32
1629 struct target_statfs {
1630 int32_t f_type;
1631 int32_t f_bsize;
1632 int32_t f_frsize; /* Fragment size - unsupported */
1633 int32_t f_blocks;
1634 int32_t f_bfree;
1635 int32_t f_files;
1636 int32_t f_ffree;
1637 int32_t f_bavail;
1639 /* Linux specials */
1640 target_fsid_t f_fsid;
1641 int32_t f_namelen;
1642 int32_t f_spare[6];
1644 #else
1645 struct target_statfs {
1646 abi_long f_type;
1647 abi_long f_bsize;
1648 abi_long f_frsize; /* Fragment size - unsupported */
1649 abi_long f_blocks;
1650 abi_long f_bfree;
1651 abi_long f_files;
1652 abi_long f_ffree;
1653 abi_long f_bavail;
1655 /* Linux specials */
1656 target_fsid_t f_fsid;
1657 abi_long f_namelen;
1658 abi_long f_spare[6];
1660 #endif
1662 struct target_statfs64 {
1663 uint32_t f_type;
1664 uint32_t f_bsize;
1665 uint32_t f_frsize; /* Fragment size - unsupported */
1666 uint32_t __pad;
1667 uint64_t f_blocks;
1668 uint64_t f_bfree;
1669 uint64_t f_files;
1670 uint64_t f_ffree;
1671 uint64_t f_bavail;
1672 target_fsid_t f_fsid;
1673 uint32_t f_namelen;
1674 uint32_t f_spare[6];
1676 #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \
1677 defined(TARGET_SPARC64)) && !defined(TARGET_ABI32)
1678 struct target_statfs {
1679 abi_long f_type;
1680 abi_long f_bsize;
1681 abi_long f_blocks;
1682 abi_long f_bfree;
1683 abi_long f_bavail;
1684 abi_long f_files;
1685 abi_long f_ffree;
1686 target_fsid_t f_fsid;
1687 abi_long f_namelen;
1688 abi_long f_frsize;
1689 abi_long f_spare[5];
1692 struct target_statfs64 {
1693 abi_long f_type;
1694 abi_long f_bsize;
1695 abi_long f_blocks;
1696 abi_long f_bfree;
1697 abi_long f_bavail;
1698 abi_long f_files;
1699 abi_long f_ffree;
1700 target_fsid_t f_fsid;
1701 abi_long f_namelen;
1702 abi_long f_frsize;
1703 abi_long f_spare[5];
1705 #else
1706 struct target_statfs {
1707 uint32_t f_type;
1708 uint32_t f_bsize;
1709 uint32_t f_blocks;
1710 uint32_t f_bfree;
1711 uint32_t f_bavail;
1712 uint32_t f_files;
1713 uint32_t f_ffree;
1714 target_fsid_t f_fsid;
1715 uint32_t f_namelen;
1716 uint32_t f_frsize;
1717 uint32_t f_spare[5];
1720 struct target_statfs64 {
1721 uint32_t f_type;
1722 uint32_t f_bsize;
1723 uint64_t f_blocks;
1724 uint64_t f_bfree;
1725 uint64_t f_bavail;
1726 uint64_t f_files;
1727 uint64_t f_ffree;
1728 target_fsid_t f_fsid;
1729 uint32_t f_namelen;
1730 uint32_t f_frsize;
1731 uint32_t f_spare[5];
1733 #endif
1736 #define TARGET_F_DUPFD 0 /* dup */
1737 #define TARGET_F_GETFD 1 /* get close_on_exec */
1738 #define TARGET_F_SETFD 2 /* set/clear close_on_exec */
1739 #define TARGET_F_GETFL 3 /* get file->f_flags */
1740 #define TARGET_F_SETFL 4 /* set file->f_flags */
1742 #if defined(TARGET_ALPHA)
1743 #define TARGET_F_GETLK 7
1744 #define TARGET_F_SETLK 8
1745 #define TARGET_F_SETLKW 9
1746 #define TARGET_F_SETOWN 5 /* for sockets. */
1747 #define TARGET_F_GETOWN 6 /* for sockets. */
1748 #elif defined(TARGET_MIPS)
1749 #define TARGET_F_GETLK 14
1750 #define TARGET_F_SETLK 6
1751 #define TARGET_F_SETLKW 7
1752 #define TARGET_F_SETOWN 24 /* for sockets. */
1753 #define TARGET_F_GETOWN 25 /* for sockets. */
1754 #else
1755 #define TARGET_F_GETLK 5
1756 #define TARGET_F_SETLK 6
1757 #define TARGET_F_SETLKW 7
1758 #define TARGET_F_SETOWN 8 /* for sockets. */
1759 #define TARGET_F_GETOWN 9 /* for sockets. */
1760 #endif
1762 #define TARGET_F_SETSIG 10 /* for sockets. */
1763 #define TARGET_F_GETSIG 11 /* for sockets. */
1765 #if defined(TARGET_MIPS)
1766 #define TARGET_F_GETLK64 33 /* using 'struct flock64' */
1767 #define TARGET_F_SETLK64 34
1768 #define TARGET_F_SETLKW64 35
1769 #else
1770 #define TARGET_F_GETLK64 12 /* using 'struct flock64' */
1771 #define TARGET_F_SETLK64 13
1772 #define TARGET_F_SETLKW64 14
1773 #endif
1774 #if defined (TARGET_ARM)
1775 #define TARGET_O_ACCMODE 0003
1776 #define TARGET_O_RDONLY 00
1777 #define TARGET_O_WRONLY 01
1778 #define TARGET_O_RDWR 02
1779 #define TARGET_O_CREAT 0100 /* not fcntl */
1780 #define TARGET_O_EXCL 0200 /* not fcntl */
1781 #define TARGET_O_NOCTTY 0400 /* not fcntl */
1782 #define TARGET_O_TRUNC 01000 /* not fcntl */
1783 #define TARGET_O_APPEND 02000
1784 #define TARGET_O_NONBLOCK 04000
1785 #define TARGET_O_NDELAY TARGET_O_NONBLOCK
1786 #define TARGET_O_SYNC 010000
1787 #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
1788 #define TARGET_O_DIRECTORY 040000 /* must be a directory */
1789 #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
1790 #define TARGET_O_DIRECT 0200000 /* direct disk access hint */
1791 #define TARGET_O_LARGEFILE 0400000
1792 #elif defined (TARGET_PPC)
1793 #define TARGET_O_ACCMODE 0003
1794 #define TARGET_O_RDONLY 00
1795 #define TARGET_O_WRONLY 01
1796 #define TARGET_O_RDWR 02
1797 #define TARGET_O_CREAT 0100 /* not fcntl */
1798 #define TARGET_O_EXCL 0200 /* not fcntl */
1799 #define TARGET_O_NOCTTY 0400 /* not fcntl */
1800 #define TARGET_O_TRUNC 01000 /* not fcntl */
1801 #define TARGET_O_APPEND 02000
1802 #define TARGET_O_NONBLOCK 04000
1803 #define TARGET_O_NDELAY TARGET_O_NONBLOCK
1804 #define TARGET_O_SYNC 010000
1805 #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
1806 #define TARGET_O_DIRECTORY 040000 /* must be a directory */
1807 #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
1808 #define TARGET_O_LARGEFILE 0200000
1809 #define TARGET_O_DIRECT 0400000 /* direct disk access hint */
1810 #elif defined (TARGET_MICROBLAZE)
1811 #define TARGET_O_ACCMODE 0003
1812 #define TARGET_O_RDONLY 00
1813 #define TARGET_O_WRONLY 01
1814 #define TARGET_O_RDWR 02
1815 #define TARGET_O_CREAT 0100 /* not fcntl */
1816 #define TARGET_O_EXCL 0200 /* not fcntl */
1817 #define TARGET_O_NOCTTY 0400 /* not fcntl */
1818 #define TARGET_O_TRUNC 01000 /* not fcntl */
1819 #define TARGET_O_APPEND 02000
1820 #define TARGET_O_NONBLOCK 04000
1821 #define TARGET_O_NDELAY TARGET_O_NONBLOCK
1822 #define TARGET_O_SYNC 010000
1823 #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
1824 #define TARGET_O_DIRECTORY 040000 /* must be a directory */
1825 #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
1826 #define TARGET_O_LARGEFILE 0200000
1827 #define TARGET_O_DIRECT 0400000 /* direct disk access hint */
1828 #elif defined (TARGET_SPARC)
1829 #define TARGET_O_RDONLY 0x0000
1830 #define TARGET_O_WRONLY 0x0001
1831 #define TARGET_O_RDWR 0x0002
1832 #define TARGET_O_ACCMODE 0x0003
1833 #define TARGET_O_APPEND 0x0008
1834 #define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */
1835 #define TARGET_O_CREAT 0x0200 /* not fcntl */
1836 #define TARGET_O_TRUNC 0x0400 /* not fcntl */
1837 #define TARGET_O_EXCL 0x0800 /* not fcntl */
1838 #define TARGET_O_SYNC 0x2000
1839 #define TARGET_O_NONBLOCK 0x4000
1840 #define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK)
1841 #define TARGET_O_NOCTTY 0x8000 /* not fcntl */
1842 #define TARGET_O_DIRECTORY 0x10000 /* must be a directory */
1843 #define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */
1844 #define TARGET_O_LARGEFILE 0x40000
1845 #define TARGET_O_DIRECT 0x100000 /* direct disk access hint */
1846 #elif defined(TARGET_MIPS)
1847 #define TARGET_O_ACCMODE 0x0003
1848 #define TARGET_O_RDONLY 0x0000
1849 #define TARGET_O_WRONLY 0x0001
1850 #define TARGET_O_RDWR 0x0002
1851 #define TARGET_O_APPEND 0x0008
1852 #define TARGET_O_SYNC 0x0010
1853 #define TARGET_O_NONBLOCK 0x0080
1854 #define TARGET_O_CREAT 0x0100 /* not fcntl */
1855 #define TARGET_O_TRUNC 0x0200 /* not fcntl */
1856 #define TARGET_O_EXCL 0x0400 /* not fcntl */
1857 #define TARGET_O_NOCTTY 0x0800 /* not fcntl */
1858 #define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */
1859 #define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */
1860 #define TARGET_O_DIRECT 0x8000 /* direct disk access hint */
1861 #define TARGET_O_DIRECTORY 0x10000 /* must be a directory */
1862 #define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */
1863 #define TARGET_O_NOATIME 0x40000
1864 #define TARGET_O_NDELAY TARGET_O_NONBLOCK
1865 #elif defined(TARGET_ALPHA)
1866 #define TARGET_O_ACCMODE 0x0003
1867 #define TARGET_O_RDONLY 0x0000
1868 #define TARGET_O_WRONLY 0x0001
1869 #define TARGET_O_RDWR 0x0002
1870 #define TARGET_O_APPEND 0x0008
1871 #define TARGET_O_SYNC 0x4000
1872 #define TARGET_O_NONBLOCK 0x0004
1873 #define TARGET_O_CREAT 0x0200 /* not fcntl */
1874 #define TARGET_O_TRUNC 0x0400 /* not fcntl */
1875 #define TARGET_O_EXCL 0x0800 /* not fcntl */
1876 #define TARGET_O_NOCTTY 0x1000 /* not fcntl */
1877 #define TARGET_FASYNC 0x2000 /* fcntl, for BSD compatibility */
1878 #define TARGET_O_LARGEFILE 0x0000 /* not necessary, always 64-bit */
1879 #define TARGET_O_DIRECT 0x80000 /* direct disk access hint */
1880 #define TARGET_O_DIRECTORY 0x8000 /* must be a directory */
1881 #define TARGET_O_NOFOLLOW 0x10000 /* don't follow links */
1882 #define TARGET_O_NOATIME 0x100000
1883 #define TARGET_O_NDELAY TARGET_O_NONBLOCK
1884 #else
1885 #define TARGET_O_ACCMODE 0003
1886 #define TARGET_O_RDONLY 00
1887 #define TARGET_O_WRONLY 01
1888 #define TARGET_O_RDWR 02
1889 #define TARGET_O_CREAT 0100 /* not fcntl */
1890 #define TARGET_O_EXCL 0200 /* not fcntl */
1891 #define TARGET_O_NOCTTY 0400 /* not fcntl */
1892 #define TARGET_O_TRUNC 01000 /* not fcntl */
1893 #define TARGET_O_APPEND 02000
1894 #define TARGET_O_NONBLOCK 04000
1895 #define TARGET_O_NDELAY TARGET_O_NONBLOCK
1896 #define TARGET_O_SYNC 010000
1897 #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
1898 #define TARGET_O_DIRECT 040000 /* direct disk access hint */
1899 #define TARGET_O_LARGEFILE 0100000
1900 #define TARGET_O_DIRECTORY 0200000 /* must be a directory */
1901 #define TARGET_O_NOFOLLOW 0400000 /* don't follow links */
1902 #endif
1904 struct target_flock {
1905 short l_type;
1906 short l_whence;
1907 abi_ulong l_start;
1908 abi_ulong l_len;
1909 int l_pid;
1912 struct target_flock64 {
1913 short l_type;
1914 short l_whence;
1915 #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) || defined(TARGET_SPARC) || defined(TARGET_HPPA) || defined (TARGET_MICROBLAZE)
1916 int __pad;
1917 #endif
1918 unsigned long long l_start;
1919 unsigned long long l_len;
1920 int l_pid;
1921 }__attribute__((packed));
1923 #ifdef TARGET_ARM
1924 struct target_eabi_flock64 {
1925 short l_type;
1926 short l_whence;
1927 int __pad;
1928 unsigned long long l_start;
1929 unsigned long long l_len;
1930 int l_pid;
1931 }__attribute__((packed));
1932 #endif
1934 /* soundcard defines */
1935 /* XXX: convert them all to arch indepedent entries */
1936 #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int);
1937 #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301
1938 #define TARGET_SNDCTL_COPR_RCODE 0xc0144303
1939 #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309
1940 #define TARGET_SNDCTL_COPR_RDATA 0xc0144302
1941 #define TARGET_SNDCTL_COPR_RESET 0x00004300
1942 #define TARGET_SNDCTL_COPR_RUN 0xc0144306
1943 #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308
1944 #define TARGET_SNDCTL_COPR_WCODE 0x40144305
1945 #define TARGET_SNDCTL_COPR_WDATA 0x40144304
1946 #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0)
1947 #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1)
1948 #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int)
1949 #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int)
1950 #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int)
1951 #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int)
1952 #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int)
1953 #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int)
1954 #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8)
1955 #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int)
1956 #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int)
1957 #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int)
1958 #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12)
1959 #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13)
1960 #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int)
1961 #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int)
1962 #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17)
1963 #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18)
1964 #define TARGET_SNDCTL_DSP_MAPINBUF 0x80085013
1965 #define TARGET_SNDCTL_DSP_MAPOUTBUF 0x80085014
1966 #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e
1967 #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005
1968 #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016
1969 #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015
1970 #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010
1971 #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f
1972 #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107
1973 #define TARGET_SNDCTL_MIDI_INFO 0xc074510c
1974 #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02
1975 #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01
1976 #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00
1977 #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110
1978 #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001
1979 #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103
1980 #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105
1981 #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104
1982 #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b
1983 #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a
1984 #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112
1985 #define TARGET_SNDCTL_SEQ_PANIC 0x00005111
1986 #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106
1987 #define TARGET_SNDCTL_SEQ_RESET 0x00005100
1988 #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109
1989 #define TARGET_SNDCTL_SEQ_SYNC 0x00005101
1990 #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108
1991 #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d
1992 #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d
1993 #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102
1994 #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e
1995 #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404
1996 #define TARGET_SNDCTL_TMR_METRONOME 0x40045407
1997 #define TARGET_SNDCTL_TMR_SELECT 0x40045408
1998 #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406
1999 #define TARGET_SNDCTL_TMR_START 0x00005402
2000 #define TARGET_SNDCTL_TMR_STOP 0x00005403
2001 #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405
2002 #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401
2003 #define TARGET_SOUND_PCM_READ_RATE 0x80045002
2004 #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006
2005 #define TARGET_SOUND_PCM_READ_BITS 0x80045005
2006 #define TARGET_SOUND_PCM_READ_FILTER 0x80045007
2007 #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info)
2008 #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66
2009 #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int)
2010 #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int)
2011 #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int)
2012 #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int)
2013 #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int)
2015 #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int)
2017 #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME)
2018 #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS)
2019 #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE)
2020 #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH)
2021 #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM)
2022 #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER)
2023 #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE)
2024 #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC)
2025 #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD)
2026 #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX)
2027 #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM)
2028 #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV)
2029 #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN)
2030 #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN)
2031 #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1)
2032 #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2)
2033 #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3)
2035 /* Obsolete macros */
2036 #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE)
2037 #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE)
2038 #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD)
2040 #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC)
2041 #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK)
2042 #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK)
2043 #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS)
2044 #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS)
2046 #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int)
2048 #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME)
2049 #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS)
2050 #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE)
2051 #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH)
2052 #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM)
2053 #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER)
2054 #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE)
2055 #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC)
2056 #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD)
2057 #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX)
2058 #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM)
2059 #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV)
2060 #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN)
2061 #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN)
2062 #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1)
2063 #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2)
2064 #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3)
2066 /* Obsolete macros */
2067 #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE)
2068 #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE)
2069 #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD)
2071 #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)
2073 /* vfat ioctls */
2074 #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1)
2075 #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2)
2077 #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct mtop)
2078 #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct mtget)
2079 #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct mtpos)
2081 struct target_sysinfo {
2082 abi_long uptime; /* Seconds since boot */
2083 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */
2084 abi_ulong totalram; /* Total usable main memory size */
2085 abi_ulong freeram; /* Available memory size */
2086 abi_ulong sharedram; /* Amount of shared memory */
2087 abi_ulong bufferram; /* Memory used by buffers */
2088 abi_ulong totalswap; /* Total swap space size */
2089 abi_ulong freeswap; /* swap space still available */
2090 unsigned short procs; /* Number of current processes */
2091 unsigned short pad; /* explicit padding for m68k */
2092 abi_ulong totalhigh; /* Total high memory size */
2093 abi_ulong freehigh; /* Available high memory size */
2094 unsigned int mem_unit; /* Memory unit size in bytes */
2095 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */
2098 struct linux_dirent {
2099 long d_ino;
2100 unsigned long d_off;
2101 unsigned short d_reclen;
2102 char d_name[256]; /* We must not include limits.h! */
2105 struct linux_dirent64 {
2106 uint64_t d_ino;
2107 int64_t d_off;
2108 unsigned short d_reclen;
2109 unsigned char d_type;
2110 char d_name[256];
2113 struct target_mq_attr {
2114 abi_long mq_flags;
2115 abi_long mq_maxmsg;
2116 abi_long mq_msgsize;
2117 abi_long mq_curmsgs;
2120 #include "socket.h"
2122 #include "errno_defs.h"
2124 #define FUTEX_WAIT 0
2125 #define FUTEX_WAKE 1
2126 #define FUTEX_FD 2
2127 #define FUTEX_REQUEUE 3
2128 #define FUTEX_CMP_REQUEUE 4
2129 #define FUTEX_WAKE_OP 5
2130 #define FUTEX_LOCK_PI 6
2131 #define FUTEX_UNLOCK_PI 7
2132 #define FUTEX_TRYLOCK_PI 8
2133 #define FUTEX_WAIT_BITSET 9
2134 #define FUTEX_WAKE_BITSET 10
2136 #define FUTEX_PRIVATE_FLAG 128
2137 #define FUTEX_CLOCK_REALTIME 256
2138 #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)