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
7 #include "syscall_nr.h"
9 #define SOCKOP_socket 1
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
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
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
48 #define TARGET_IOC_NRBITS 8
49 #define TARGET_IOC_TYPEBITS 8
51 #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
52 || defined(TARGET_M68K) || defined(TARGET_CRIS)
54 #define TARGET_IOC_SIZEBITS 14
55 #define TARGET_IOC_DIRBITS 2
57 #define TARGET_IOC_NONE 0U
58 #define TARGET_IOC_WRITE 1U
59 #define TARGET_IOC_READ 2U
61 #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \
62 defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \
65 #define TARGET_IOC_SIZEBITS 13
66 #define TARGET_IOC_DIRBITS 3
68 #define TARGET_IOC_NONE 1U
69 #define TARGET_IOC_READ 2U
70 #define TARGET_IOC_WRITE 4U
72 #elif defined(TARGET_HPPA)
74 #define TARGET_IOC_SIZEBITS 14
75 #define TARGET_IOC_DIRBITS 2
77 #define TARGET_IOC_NONE 0U
78 #define TARGET_IOC_WRITE 2U
79 #define TARGET_IOC_READ 1U
82 #error unsupported CPU
85 #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1)
86 #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1)
87 #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1)
88 #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1)
90 #define TARGET_IOC_NRSHIFT 0
91 #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS)
92 #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS)
93 #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS)
95 #define TARGET_IOC(dir,type,nr,size) \
96 (((dir) << TARGET_IOC_DIRSHIFT) | \
97 ((type) << TARGET_IOC_TYPESHIFT) | \
98 ((nr) << TARGET_IOC_NRSHIFT) | \
99 ((size) << TARGET_IOC_SIZESHIFT))
101 /* used to create numbers */
102 #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0)
103 #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size))
104 #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size))
105 #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size))
107 /* the size is automatically computed for these defines */
108 #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK)
109 #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
110 #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
112 struct target_sockaddr
{
117 struct target_timeval
{
122 struct target_timespec
{
127 struct target_itimerval
{
128 struct target_timeval it_interval
;
129 struct target_timeval it_value
;
132 typedef abi_long target_clock_t
;
134 #define TARGET_HZ 100
137 target_clock_t tms_utime
;
138 target_clock_t tms_stime
;
139 target_clock_t tms_cutime
;
140 target_clock_t tms_cstime
;
143 struct target_utimbuf
{
148 struct target_sel_arg_struct
{
150 abi_long inp
, outp
, exp
;
154 struct target_iovec
{
155 abi_long iov_base
; /* Starting address */
156 abi_long iov_len
; /* Number of bytes */
159 struct target_msghdr
{
160 abi_long msg_name
; /* Socket name */
161 int msg_namelen
; /* Length of name */
162 abi_long msg_iov
; /* Data blocks */
163 abi_long msg_iovlen
; /* Number of blocks */
164 abi_long msg_control
; /* Per protocol magic (eg BSD file descriptor passing) */
165 abi_long msg_controllen
; /* Length of cmsg list */
166 unsigned int msg_flags
;
169 struct target_cmsghdr
{
175 #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1))
176 #define TARGET_CMSG_NXTHDR(mhdr, cmsg) __target_cmsg_nxthdr (mhdr, cmsg)
177 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \
178 & (size_t) ~(sizeof (abi_long) - 1))
179 #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \
180 + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)))
181 #define TARGET_CMSG_LEN(len) (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len))
183 static __inline__
struct target_cmsghdr
*
184 __target_cmsg_nxthdr (struct target_msghdr
*__mhdr
, struct target_cmsghdr
*__cmsg
)
186 struct target_cmsghdr
*__ptr
;
188 __ptr
= (struct target_cmsghdr
*)((unsigned char *) __cmsg
189 + TARGET_CMSG_ALIGN (tswapl(__cmsg
->cmsg_len
)));
190 if ((unsigned long)((char *)(__ptr
+1) - (char *)(size_t)tswapl(__mhdr
->msg_control
))
191 > tswapl(__mhdr
->msg_controllen
))
192 /* No more entries. */
193 return (struct target_cmsghdr
*)0;
198 struct target_rusage
{
199 struct target_timeval ru_utime
; /* user time used */
200 struct target_timeval ru_stime
; /* system time used */
201 abi_long ru_maxrss
; /* maximum resident set size */
202 abi_long ru_ixrss
; /* integral shared memory size */
203 abi_long ru_idrss
; /* integral unshared data size */
204 abi_long ru_isrss
; /* integral unshared stack size */
205 abi_long ru_minflt
; /* page reclaims */
206 abi_long ru_majflt
; /* page faults */
207 abi_long ru_nswap
; /* swaps */
208 abi_long ru_inblock
; /* block input operations */
209 abi_long ru_oublock
; /* block output operations */
210 abi_long ru_msgsnd
; /* messages sent */
211 abi_long ru_msgrcv
; /* messages received */
212 abi_long ru_nsignals
; /* signals received */
213 abi_long ru_nvcsw
; /* voluntary context switches */
214 abi_long ru_nivcsw
; /* involuntary " */
221 struct kernel_statfs
{
229 kernel_fsid_t f_fsid
;
234 struct target_dirent
{
237 unsigned short d_reclen
;
238 char d_name
[256]; /* We must not include limits.h! */
241 struct target_dirent64
{
244 unsigned short d_reclen
;
245 unsigned char d_type
;
250 /* mostly generic signal stuff */
251 #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */
252 #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */
253 #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */
256 #define TARGET_NSIG 128
258 #define TARGET_NSIG 64
260 #define TARGET_NSIG_BPW TARGET_ABI_BITS
261 #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW)
264 abi_ulong sig
[TARGET_NSIG_WORDS
];
268 static inline void tswap_sigset(target_sigset_t
*d
, const target_sigset_t
*s
)
271 for(i
= 0;i
< TARGET_NSIG_WORDS
; i
++)
272 d
->sig
[i
] = tswapl(s
->sig
[i
]);
275 static inline void tswap_sigset(target_sigset_t
*d
, const target_sigset_t
*s
)
281 static inline void target_siginitset(target_sigset_t
*d
, abi_ulong set
)
285 for(i
= 1;i
< TARGET_NSIG_WORDS
; i
++)
289 void host_to_target_sigset(target_sigset_t
*d
, const sigset_t
*s
);
290 void target_to_host_sigset(sigset_t
*d
, const target_sigset_t
*s
);
291 void host_to_target_old_sigset(abi_ulong
*old_sigset
,
292 const sigset_t
*sigset
);
293 void target_to_host_old_sigset(sigset_t
*sigset
,
294 const abi_ulong
*old_sigset
);
295 struct target_sigaction
;
296 int do_sigaction(int sig
, const struct target_sigaction
*act
,
297 struct target_sigaction
*oact
);
299 #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_HPPA) || defined(TARGET_MICROBLAZE)
301 #if defined(TARGET_SPARC)
302 #define TARGET_SA_NOCLDSTOP 8u
303 #define TARGET_SA_NOCLDWAIT 0x100u
304 #define TARGET_SA_SIGINFO 0x200u
305 #define TARGET_SA_ONSTACK 1u
306 #define TARGET_SA_RESTART 2u
307 #define TARGET_SA_NODEFER 0x20u
308 #define TARGET_SA_RESETHAND 4u
309 #elif defined(TARGET_MIPS)
310 #define TARGET_SA_NOCLDSTOP 0x00000001
311 #define TARGET_SA_NOCLDWAIT 0x00010000
312 #define TARGET_SA_SIGINFO 0x00000008
313 #define TARGET_SA_ONSTACK 0x08000000
314 #define TARGET_SA_NODEFER 0x40000000
315 #define TARGET_SA_RESTART 0x10000000
316 #define TARGET_SA_RESETHAND 0x80000000
317 #if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64)
318 #define TARGET_SA_RESTORER 0x04000000 /* Only for O32 */
320 #elif defined(TARGET_HPPA)
321 #define TARGET_SA_NOCLDSTOP 0x00000008
322 #define TARGET_SA_NOCLDWAIT 0x00000080
323 #define TARGET_SA_SIGINFO 0x00000010
324 #define TARGET_SA_ONSTACK 0x00000001
325 #define TARGET_SA_RESTART 0x00000040
326 #define TARGET_SA_NODEFER 0x00000020
327 #define TARGET_SA_RESETHAND 0x00000004
328 #define TARGET_SA_RESTORER 0x04000000
330 #define TARGET_SA_NOCLDSTOP 0x00000001
331 #define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */
332 #define TARGET_SA_SIGINFO 0x00000004
333 #define TARGET_SA_ONSTACK 0x08000000
334 #define TARGET_SA_RESTART 0x10000000
335 #define TARGET_SA_NODEFER 0x40000000
336 #define TARGET_SA_RESETHAND 0x80000000
337 #define TARGET_SA_RESTORER 0x04000000
340 #if defined(TARGET_SPARC)
342 #define TARGET_SIGHUP 1
343 #define TARGET_SIGINT 2
344 #define TARGET_SIGQUIT 3
345 #define TARGET_SIGILL 4
346 #define TARGET_SIGTRAP 5
347 #define TARGET_SIGABRT 6
348 #define TARGET_SIGIOT 6
349 #define TARGET_SIGSTKFLT 7 /* actually EMT */
350 #define TARGET_SIGFPE 8
351 #define TARGET_SIGKILL 9
352 #define TARGET_SIGBUS 10
353 #define TARGET_SIGSEGV 11
354 #define TARGET_SIGSYS 12
355 #define TARGET_SIGPIPE 13
356 #define TARGET_SIGALRM 14
357 #define TARGET_SIGTERM 15
358 #define TARGET_SIGURG 16
359 #define TARGET_SIGSTOP 17
360 #define TARGET_SIGTSTP 18
361 #define TARGET_SIGCONT 19
362 #define TARGET_SIGCHLD 20
363 #define TARGET_SIGTTIN 21
364 #define TARGET_SIGTTOU 22
365 #define TARGET_SIGIO 23
366 #define TARGET_SIGXCPU 24
367 #define TARGET_SIGXFSZ 25
368 #define TARGET_SIGVTALRM 26
369 #define TARGET_SIGPROF 27
370 #define TARGET_SIGWINCH 28
371 #define TARGET_SIGPWR 29
372 #define TARGET_SIGUSR1 30
373 #define TARGET_SIGUSR2 31
374 #define TARGET_SIGRTMIN 32
376 #define TARGET_SIG_BLOCK 0x01 /* for blocking signals */
377 #define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */
378 #define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */
380 #elif defined(TARGET_MIPS)
382 #define TARGET_SIGHUP 1 /* Hangup (POSIX). */
383 #define TARGET_SIGINT 2 /* Interrupt (ANSI). */
384 #define TARGET_SIGQUIT 3 /* Quit (POSIX). */
385 #define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */
386 #define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */
387 #define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */
388 #define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */
389 #define TARGET_SIGEMT 7
390 #define TARGET_SIGSTKFLT 7 /* XXX: incorrect */
391 #define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */
392 #define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */
393 #define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */
394 #define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */
395 #define TARGET_SIGSYS 12
396 #define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */
397 #define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */
398 #define TARGET_SIGTERM 15 /* Termination (ANSI). */
399 #define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */
400 #define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */
401 #define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */
402 #define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */
403 #define TARGET_SIGPWR 19 /* Power failure restart (System V). */
404 #define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */
405 #define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */
406 #define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */
407 #define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */
408 #define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */
409 #define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */
410 #define TARGET_SIGCONT 25 /* Continue (POSIX). */
411 #define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */
412 #define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */
413 #define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */
414 #define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */
415 #define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */
416 #define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */
417 #define TARGET_SIGRTMIN 32
419 #define TARGET_SIG_BLOCK 1 /* for blocking signals */
420 #define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */
421 #define TARGET_SIG_SETMASK 3 /* for setting the signal mask */
423 #elif defined(TARGET_HPPA)
425 #define TARGET_SIGHUP 1
426 #define TARGET_SIGINT 2
427 #define TARGET_SIGQUIT 3
428 #define TARGET_SIGILL 4
429 #define TARGET_SIGTRAP 5
430 #define TARGET_SIGABRT 6
431 #define TARGET_SIGIOT 6
432 #define TARGET_SIGEMT 7
433 #define TARGET_SIGFPE 8
434 #define TARGET_SIGKILL 9
435 #define TARGET_SIGBUS 10
436 #define TARGET_SIGSEGV 11
437 #define TARGET_SIGSYS 12 /* Linux doesn't use this */
438 #define TARGET_SIGPIPE 13
439 #define TARGET_SIGALRM 14
440 #define TARGET_SIGTERM 15
441 #define TARGET_SIGUSR1 16
442 #define TARGET_SIGUSR2 17
443 #define TARGET_SIGCHLD 18
444 #define TARGET_SIGPWR 19
445 #define TARGET_SIGVTALRM 20
446 #define TARGET_SIGPROF 21
447 #define TARGET_SIGIO 22
448 #define TARGET_SIGPOLL TARGET_SIGIO
449 #define TARGET_SIGWINCH 23
450 #define TARGET_SIGSTOP 24
451 #define TARGET_SIGTSTP 25
452 #define TARGET_SIGCONT 26
453 #define TARGET_SIGTTIN 27
454 #define TARGET_SIGTTOU 28
455 #define TARGET_SIGURG 29
456 #define TARGET_SIGLOST 30 /* Linux doesn't use this either */
457 #define TARGET_SIGUNUSED 31
458 #define TARGET_SIGRESERVE TARGET_SIGUNUSED
460 #define TARGET_SIGXCPU 33
461 #define TARGET_SIGXFSZ 34
462 #define TARGET_SIGSTKFLT 36
463 #define TARGET_SIGRTMIN 37
465 #define TARGET_SIG_BLOCK 0 /* for blocking signals */
466 #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */
467 #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */
471 #define TARGET_SIGHUP 1
472 #define TARGET_SIGINT 2
473 #define TARGET_SIGQUIT 3
474 #define TARGET_SIGILL 4
475 #define TARGET_SIGTRAP 5
476 #define TARGET_SIGABRT 6
477 #define TARGET_SIGIOT 6
478 #define TARGET_SIGBUS 7
479 #define TARGET_SIGFPE 8
480 #define TARGET_SIGKILL 9
481 #define TARGET_SIGUSR1 10
482 #define TARGET_SIGSEGV 11
483 #define TARGET_SIGUSR2 12
484 #define TARGET_SIGPIPE 13
485 #define TARGET_SIGALRM 14
486 #define TARGET_SIGTERM 15
487 #define TARGET_SIGSTKFLT 16
488 #define TARGET_SIGCHLD 17
489 #define TARGET_SIGCONT 18
490 #define TARGET_SIGSTOP 19
491 #define TARGET_SIGTSTP 20
492 #define TARGET_SIGTTIN 21
493 #define TARGET_SIGTTOU 22
494 #define TARGET_SIGURG 23
495 #define TARGET_SIGXCPU 24
496 #define TARGET_SIGXFSZ 25
497 #define TARGET_SIGVTALRM 26
498 #define TARGET_SIGPROF 27
499 #define TARGET_SIGWINCH 28
500 #define TARGET_SIGIO 29
501 #define TARGET_SIGPWR 30
502 #define TARGET_SIGSYS 31
503 #define TARGET_SIGRTMIN 32
505 #define TARGET_SIG_BLOCK 0 /* for blocking signals */
506 #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */
507 #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */
511 #if defined(TARGET_MIPS)
513 struct target_sigaction
{
515 #if defined(TARGET_ABI_MIPSN32)
516 uint32_t _sa_handler
;
518 abi_ulong _sa_handler
;
520 target_sigset_t sa_mask
;
523 #elif defined(TARGET_HPPA)
525 struct target_sigaction
{
526 abi_ulong _sa_handler
;
528 target_sigset_t sa_mask
;
532 struct target_old_sigaction
{
533 abi_ulong _sa_handler
;
536 abi_ulong sa_restorer
;
539 struct target_sigaction
{
540 abi_ulong _sa_handler
;
542 abi_ulong sa_restorer
;
543 target_sigset_t sa_mask
;
547 typedef union target_sigval
{
552 #if defined (TARGET_SPARC)
559 abi_ulong u_regs
[16]; /* globals and ins */
565 unsigned long si_float_regs
[32];
566 unsigned long si_fsr
;
567 unsigned long si_fpqdepth
;
569 unsigned long *insn_addr
;
576 #define TARGET_SI_MAX_SIZE 128
577 #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE/sizeof(int)) - 3)
579 typedef struct target_siginfo
{
591 int _pad
[TARGET_SI_PAD_SIZE
];
595 pid_t _pid
; /* sender's pid */
596 uid_t _uid
; /* sender's uid */
599 /* POSIX.1b timers */
601 unsigned int _timer1
;
602 unsigned int _timer2
;
605 /* POSIX.1b signals */
607 pid_t _pid
; /* sender's pid */
608 uid_t _uid
; /* sender's uid */
609 target_sigval_t _sigval
;
614 pid_t _pid
; /* which child */
615 uid_t _uid
; /* sender's uid */
616 int _status
; /* exit code */
617 target_clock_t _utime
;
618 target_clock_t _stime
;
621 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
623 abi_ulong _addr
; /* faulting insn/memory ref. */
628 int _band
; /* POLL_IN, POLL_OUT, POLL_MSG */
636 * Digital reserves positive values for kernel-generated signals.
638 #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */
639 #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */
640 #define TARGET_SI_QUEUE -1 /* sent by sigqueue */
641 #define TARGET_SI_TIMER -2 /* sent by timer expiration */
642 #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */
643 #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */
644 #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */
649 #define TARGET_ILL_ILLOPC (1) /* illegal opcode */
650 #define TARGET_ILL_ILLOPN (2) /* illegal operand */
651 #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */
652 #define TARGET_ILL_ILLTRP (4) /* illegal trap */
653 #define TARGET_ILL_PRVOPC (5) /* privileged opcode */
654 #define TARGET_ILL_PRVREG (6) /* privileged register */
655 #define TARGET_ILL_COPROC (7) /* coprocessor error */
656 #define TARGET_ILL_BADSTK (8) /* internal stack error */
661 #define TARGET_FPE_INTDIV (1) /* integer divide by zero */
662 #define TARGET_FPE_INTOVF (2) /* integer overflow */
663 #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */
664 #define TARGET_FPE_FLTOVF (4) /* floating point overflow */
665 #define TARGET_FPE_FLTUND (5) /* floating point underflow */
666 #define TARGET_FPE_FLTRES (6) /* floating point inexact result */
667 #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */
668 #define TARGET_FPE_FLTSUB (8) /* subscript out of range */
669 #define TARGET_NSIGFPE 8
674 #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */
675 #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */
680 #define TARGET_BUS_ADRALN (1) /* invalid address alignment */
681 #define TARGET_BUS_ADRERR (2) /* non-existant physical address */
682 #define TARGET_BUS_OBJERR (3) /* object specific hardware error */
687 #define TARGET_TRAP_BRKPT (1) /* process breakpoint */
688 #define TARGET_TRAP_TRACE (2) /* process trace trap */
690 #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */
692 struct target_rlimit
{
697 struct target_pollfd
{
698 int fd
; /* file descriptor */
699 short events
; /* requested events */
700 short revents
; /* returned events */
703 /* virtual terminal ioctls */
704 #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */
705 #define TARGET_KDMKTONE 0x4B30 /* generate tone */
706 #define TARGET_KDGKBTYPE 0x4b33
707 #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */
708 #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */
710 #define TARGET_SIOCATMARK 0x8905
712 /* Networking ioctls */
713 #define TARGET_SIOCADDRT 0x890B /* add routing table entry */
714 #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */
715 #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */
716 #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */
717 #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */
718 #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */
719 #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */
720 #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */
721 #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */
722 #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */
723 #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */
724 #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */
725 #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */
726 #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */
727 #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */
728 #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */
729 #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */
730 #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */
731 #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */
732 #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */
733 #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */
734 #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */
735 #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */
736 #define TARGET_SIOCSIFENCAP 0x8926
737 #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */
738 #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */
739 #define TARGET_SIOCSIFSLAVE 0x8930
740 #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */
741 #define TARGET_SIOCDELMULTI 0x8932
743 /* Bridging control calls */
744 #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */
745 #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */
747 #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */
748 #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */
750 /* ARP cache control calls. */
751 #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */
752 #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */
753 #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */
754 #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */
755 #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */
756 #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */
758 /* RARP cache control calls. */
759 #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */
760 #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */
761 #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */
763 /* Driver configuration calls */
764 #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */
765 #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */
767 /* DLCI configuration calls */
768 #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */
769 #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */
772 /* From <linux/fs.h> */
774 #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */
775 #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */
776 #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */
777 #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */
778 #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */
779 #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */
780 #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */
781 #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
782 #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
783 #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
784 #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
785 #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */
786 /* A jump here: 108-111 have been used for various private purposes. */
787 #define TARGET_BLKBSZGET TARGET_IOR(0x12,112,sizeof(int))
788 #define TARGET_BLKBSZSET TARGET_IOW(0x12,113,sizeof(int))
789 #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,sizeof(uint64_t)) /* return device size in bytes (u64 *arg) */
790 #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */
791 #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */
794 #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */
795 #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */
796 #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */
797 #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index
799 #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header
800 (struct cdrom_tochdr) */
801 #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry
802 (struct cdrom_tocentry) */
803 #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */
804 #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */
805 #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */
806 #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume
807 (struct cdrom_volctrl) */
808 #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data
809 (struct cdrom_subchnl) */
810 #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes)
811 (struct cdrom_read) */
812 #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes)
813 (struct cdrom_read) */
814 #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */
815 #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */
816 #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session
817 address of multi session disks
818 (struct cdrom_multisession) */
819 #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code"
820 if available (struct cdrom_mcn) */
821 #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is depricated,
822 but here anyway for compatability */
823 #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */
824 #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting
825 (struct cdrom_volctrl) */
826 #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes)
827 (struct cdrom_read) */
829 * These ioctls are used only used in aztcd.c and optcd.c
831 #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */
832 #define TARGET_CDROMSEEK 0x5316 /* seek msf address */
835 * This ioctl is only used by the scsi-cd driver.
836 It is for playing audio in logical block addressing mode.
838 #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */
841 * These ioctls are only used in optcd.c
843 #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */
846 * These ioctls are (now) only in ide-cd.c for controlling
847 * drive spindown time. They should be implemented in the
848 * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
849 * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
852 #define TARGET_CDROMGETSPINDOWN 0x531d
853 #define TARGET_CDROMSETSPINDOWN 0x531e
856 * These ioctls are implemented through the uniform CD-ROM driver
857 * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
858 * drivers are eventually ported to the uniform CD-ROM driver interface.
860 #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
861 #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */
862 #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */
863 #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */
864 #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */
865 #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */
866 #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
867 #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */
868 #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */
869 #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */
870 #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */
871 #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */
873 /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386.
874 * Future CDROM ioctls should be kept below 0x537F
877 /* This ioctl is only used by sbpcd at the moment */
878 #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */
879 /* conflict with SCSI_IOCTL_GET_IDLUN */
881 /* DVD-ROM Specific ioctls */
882 #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */
883 #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */
884 #define TARGET_DVD_AUTH 0x5392 /* Authentication */
886 #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */
887 #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */
888 #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */
892 /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
893 #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */
894 #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */
895 #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */
896 #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */
897 #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */
898 #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */
899 #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */
900 #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
901 #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */
903 /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
904 #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */
905 #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */
906 #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */
907 #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */
908 #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */
909 #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */
910 #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
913 #define TARGET_LOOP_SET_FD 0x4C00
914 #define TARGET_LOOP_CLR_FD 0x4C01
915 #define TARGET_LOOP_SET_STATUS 0x4C02
916 #define TARGET_LOOP_GET_STATUS 0x4C03
917 #define TARGET_LOOP_SET_STATUS64 0x4C04
918 #define TARGET_LOOP_GET_STATUS64 0x4C05
919 #define TARGET_LOOP_CHANGE_FD 0x4C06
921 /* from asm/termbits.h */
924 struct target_termio
{
925 unsigned short c_iflag
; /* input mode flags */
926 unsigned short c_oflag
; /* output mode flags */
927 unsigned short c_cflag
; /* control mode flags */
928 unsigned short c_lflag
; /* local mode flags */
929 unsigned char c_line
; /* line discipline */
930 unsigned char c_cc
[TARGET_NCC
]; /* control characters */
933 struct target_winsize
{
934 unsigned short ws_row
;
935 unsigned short ws_col
;
936 unsigned short ws_xpixel
;
937 unsigned short ws_ypixel
;
940 #include "termbits.h"
943 #define TARGET_MAP_SHARED 0x01 /* Share changes */
944 #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */
946 /* Target specific */
947 #if defined(TARGET_MIPS)
948 #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */
949 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
950 #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */
951 #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */
952 #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */
953 #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */
954 #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */
955 #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */
956 #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
957 #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */
958 #elif defined(TARGET_PPC)
959 #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */
960 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
961 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */
962 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */
963 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */
964 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */
965 #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */
966 #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */
967 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
968 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */
969 #elif defined(TARGET_ALPHA)
970 #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */
971 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */
972 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */
973 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */
974 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */
975 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */
976 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */
977 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */
978 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */
979 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */
980 #elif defined(TARGET_HPPA)
981 #define TARGET_MAP_TYPE 0x03 /* Mask for type of mapping */
982 #define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly */
983 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */
984 #define TARGET_MAP_GROWSDOWN 0x8000 /* stack-like segment */
985 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */
986 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */
987 #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */
988 #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */
989 #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
990 #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */
992 #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */
993 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
994 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */
995 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */
996 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */
997 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */
998 #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */
999 #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */
1000 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
1001 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */
1004 #if (defined(TARGET_I386) && defined(TARGET_ABI32)) || defined(TARGET_ARM) || defined(TARGET_CRIS)
1005 struct target_stat
{
1006 unsigned short st_dev
;
1007 unsigned short __pad1
;
1009 unsigned short st_mode
;
1010 unsigned short st_nlink
;
1011 unsigned short st_uid
;
1012 unsigned short st_gid
;
1013 unsigned short st_rdev
;
1014 unsigned short __pad2
;
1016 abi_ulong st_blksize
;
1017 abi_ulong st_blocks
;
1018 abi_ulong target_st_atime
;
1019 abi_ulong __unused1
;
1020 abi_ulong target_st_mtime
;
1021 abi_ulong __unused2
;
1022 abi_ulong target_st_ctime
;
1023 abi_ulong __unused3
;
1024 abi_ulong __unused4
;
1025 abi_ulong __unused5
;
1028 /* This matches struct stat64 in glibc2.1, hence the absolutely
1029 * insane amounts of padding around dev_t's.
1031 struct target_stat64
{
1032 unsigned short st_dev
;
1033 unsigned char __pad0
[10];
1035 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
1038 unsigned int st_mode
;
1039 unsigned int st_nlink
;
1044 unsigned short st_rdev
;
1045 unsigned char __pad3
[10];
1048 abi_ulong st_blksize
;
1050 abi_ulong st_blocks
; /* Number 512-byte blocks allocated. */
1051 abi_ulong __pad4
; /* future possible st_blocks high bits */
1053 abi_ulong target_st_atime
;
1056 abi_ulong target_st_mtime
;
1059 abi_ulong target_st_ctime
;
1060 abi_ulong __pad7
; /* will be high 32 bits of ctime someday */
1062 unsigned long long st_ino
;
1063 } __attribute__((packed
));
1066 struct target_eabi_stat64
{
1067 unsigned long long st_dev
;
1068 unsigned int __pad1
;
1070 unsigned int st_mode
;
1071 unsigned int st_nlink
;
1076 unsigned long long st_rdev
;
1077 unsigned int __pad2
[2];
1080 abi_ulong st_blksize
;
1081 unsigned int __pad3
;
1082 unsigned long long st_blocks
;
1084 abi_ulong target_st_atime
;
1085 abi_ulong target_st_atime_nsec
;
1087 abi_ulong target_st_mtime
;
1088 abi_ulong target_st_mtime_nsec
;
1090 abi_ulong target_st_ctime
;
1091 abi_ulong target_st_ctime_nsec
;
1093 unsigned long long st_ino
;
1094 } __attribute__ ((packed
));
1097 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
1098 struct target_stat
{
1099 unsigned int st_dev
;
1101 unsigned int st_mode
;
1102 unsigned int st_nlink
;
1103 unsigned int st_uid
;
1104 unsigned int st_gid
;
1105 unsigned int st_rdev
;
1107 abi_long target_st_atime
;
1108 abi_long target_st_mtime
;
1109 abi_long target_st_ctime
;
1110 abi_long st_blksize
;
1112 abi_ulong __unused4
[2];
1115 struct target_stat64
{
1116 unsigned char __pad0
[6];
1117 unsigned short st_dev
;
1122 unsigned int st_mode
;
1124 unsigned int st_uid
;
1125 unsigned int st_gid
;
1127 unsigned char __pad2
[6];
1128 unsigned short st_rdev
;
1133 unsigned char __pad4
[4];
1134 unsigned int st_blocks
;
1136 abi_ulong target_st_atime
;
1137 abi_ulong __unused1
;
1139 abi_ulong target_st_mtime
;
1140 abi_ulong __unused2
;
1142 abi_ulong target_st_ctime
;
1143 abi_ulong __unused3
;
1145 abi_ulong __unused4
[3];
1148 #elif defined(TARGET_SPARC)
1150 struct target_stat
{
1151 unsigned short st_dev
;
1153 unsigned short st_mode
;
1155 unsigned short st_uid
;
1156 unsigned short st_gid
;
1157 unsigned short st_rdev
;
1159 abi_long target_st_atime
;
1160 abi_ulong __unused1
;
1161 abi_long target_st_mtime
;
1162 abi_ulong __unused2
;
1163 abi_long target_st_ctime
;
1164 abi_ulong __unused3
;
1165 abi_long st_blksize
;
1167 abi_ulong __unused4
[2];
1170 struct target_stat64
{
1171 unsigned char __pad0
[6];
1172 unsigned short st_dev
;
1176 unsigned int st_mode
;
1177 unsigned int st_nlink
;
1179 unsigned int st_uid
;
1180 unsigned int st_gid
;
1182 unsigned char __pad2
[6];
1183 unsigned short st_rdev
;
1185 unsigned char __pad3
[8];
1188 unsigned int st_blksize
;
1190 unsigned char __pad4
[8];
1191 unsigned int st_blocks
;
1193 unsigned int target_st_atime
;
1194 unsigned int __unused1
;
1196 unsigned int target_st_mtime
;
1197 unsigned int __unused2
;
1199 unsigned int target_st_ctime
;
1200 unsigned int __unused3
;
1202 unsigned int __unused4
;
1203 unsigned int __unused5
;
1206 #elif defined(TARGET_PPC)
1208 struct target_stat
{
1211 #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
1213 unsigned int st_mode
;
1215 unsigned int st_mode
;
1216 unsigned short st_nlink
;
1218 unsigned int st_uid
;
1219 unsigned int st_gid
;
1222 abi_ulong st_blksize
;
1223 abi_ulong st_blocks
;
1224 abi_ulong target_st_atime
;
1225 abi_ulong target_st_atime_nsec
;
1226 abi_ulong target_st_mtime
;
1227 abi_ulong target_st_mtime_nsec
;
1228 abi_ulong target_st_ctime
;
1229 abi_ulong target_st_ctime_nsec
;
1230 abi_ulong __unused4
;
1231 abi_ulong __unused5
;
1232 #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
1233 abi_ulong __unused6
;
1237 struct __attribute__((__packed__
)) target_stat64
{
1238 unsigned long long st_dev
;
1239 unsigned long long st_ino
;
1240 unsigned int st_mode
;
1241 unsigned int st_nlink
;
1242 unsigned int st_uid
;
1243 unsigned int st_gid
;
1244 unsigned long long st_rdev
;
1245 unsigned long long __pad0
;
1248 long long st_blocks
; /* Number 512-byte blocks allocated. */
1249 unsigned int __pad1
;
1250 int target_st_atime
;
1251 unsigned int target_st_atime_nsec
;
1252 int target_st_mtime
;
1253 unsigned int target_st_mtime_nsec
;
1254 int target_st_ctime
;
1255 unsigned int target_st_ctime_nsec
;
1256 unsigned int __unused4
;
1257 unsigned int __unused5
;
1260 #elif defined(TARGET_MICROBLAZE)
1262 struct target_stat
{
1265 unsigned int st_mode
;
1266 unsigned short st_nlink
;
1267 unsigned int st_uid
;
1268 unsigned int st_gid
;
1271 abi_ulong st_blksize
;
1272 abi_ulong st_blocks
;
1273 abi_ulong target_st_atime
;
1274 abi_ulong target_st_atime_nsec
;
1275 abi_ulong target_st_mtime
;
1276 abi_ulong target_st_mtime_nsec
;
1277 abi_ulong target_st_ctime
;
1278 abi_ulong target_st_ctime_nsec
;
1279 abi_ulong __unused4
;
1280 abi_ulong __unused5
;
1283 /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */
1284 struct __attribute__((__packed__
)) target_stat64
{
1296 int64_t st_blocks
; /* Number 512-byte blocks allocated. */
1298 int target_st_atime
;
1299 unsigned int target_st_atime_nsec
;
1300 int target_st_mtime
;
1301 unsigned int target_st_mtime_nsec
;
1302 int target_st_ctime
;
1303 unsigned int target_st_ctime_nsec
;
1308 #elif defined(TARGET_M68K)
1310 struct target_stat
{
1311 unsigned short st_dev
;
1312 unsigned short __pad1
;
1314 unsigned short st_mode
;
1315 unsigned short st_nlink
;
1316 unsigned short st_uid
;
1317 unsigned short st_gid
;
1318 unsigned short st_rdev
;
1319 unsigned short __pad2
;
1321 abi_ulong st_blksize
;
1322 abi_ulong st_blocks
;
1323 abi_ulong target_st_atime
;
1324 abi_ulong __unused1
;
1325 abi_ulong target_st_mtime
;
1326 abi_ulong __unused2
;
1327 abi_ulong target_st_ctime
;
1328 abi_ulong __unused3
;
1329 abi_ulong __unused4
;
1330 abi_ulong __unused5
;
1333 /* This matches struct stat64 in glibc2.1, hence the absolutely
1334 * insane amounts of padding around dev_t's.
1336 struct target_stat64
{
1337 unsigned long long st_dev
;
1338 unsigned char __pad1
[2];
1340 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
1343 unsigned int st_mode
;
1344 unsigned int st_nlink
;
1349 unsigned long long st_rdev
;
1350 unsigned char __pad3
[2];
1353 abi_ulong st_blksize
;
1355 abi_ulong __pad4
; /* future possible st_blocks high bits */
1356 abi_ulong st_blocks
; /* Number 512-byte blocks allocated. */
1358 abi_ulong target_st_atime
;
1359 abi_ulong target_st_atime_nsec
;
1361 abi_ulong target_st_mtime
;
1362 abi_ulong target_st_mtime_nsec
;
1364 abi_ulong target_st_ctime
;
1365 abi_ulong target_st_ctime_nsec
;
1367 unsigned long long st_ino
;
1368 } __attribute__((packed
));
1370 #elif defined(TARGET_ABI_MIPSN64)
1372 /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
1373 struct target_stat
{
1374 unsigned int st_dev
;
1375 unsigned int st_pad0
[3]; /* Reserved for st_dev expansion */
1379 unsigned int st_mode
;
1380 unsigned int st_nlink
;
1385 unsigned int st_rdev
;
1386 unsigned int st_pad1
[3]; /* Reserved for st_rdev expansion */
1391 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1392 * but we don't have it under Linux.
1394 unsigned int target_st_atime
;
1395 unsigned int target_st_atime_nsec
;
1397 unsigned int target_st_mtime
;
1398 unsigned int target_st_mtime_nsec
;
1400 unsigned int target_st_ctime
;
1401 unsigned int target_st_ctime_nsec
;
1403 unsigned int st_blksize
;
1404 unsigned int st_pad2
;
1406 abi_ulong st_blocks
;
1409 #elif defined(TARGET_ABI_MIPSN32)
1411 struct target_stat
{
1413 int st_pad1
[3]; /* Reserved for network id */
1414 unsigned int st_ino
;
1415 unsigned int st_mode
;
1416 unsigned int st_nlink
;
1420 unsigned int st_pad2
[2];
1421 unsigned int st_size
;
1422 unsigned int st_pad3
;
1424 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1425 * but we don't have it under Linux.
1427 unsigned int target_st_atime
;
1428 unsigned int target_st_atime_nsec
;
1429 unsigned int target_st_mtime
;
1430 unsigned int target_st_mtime_nsec
;
1431 unsigned int target_st_ctime
;
1432 unsigned int target_st_ctime_nsec
;
1433 unsigned int st_blksize
;
1434 unsigned int st_blocks
;
1435 unsigned int st_pad4
[14];
1439 * This matches struct stat64 in glibc2.1, hence the absolutely insane
1440 * amounts of padding around dev_t's. The memory layout is the same as of
1441 * struct stat of the 64-bit kernel.
1444 struct target_stat64
{
1445 unsigned int st_dev
;
1446 unsigned int st_pad0
[3]; /* Reserved for st_dev expansion */
1448 target_ulong st_ino
;
1450 unsigned int st_mode
;
1451 unsigned int st_nlink
;
1456 unsigned int st_rdev
;
1457 unsigned int st_pad1
[3]; /* Reserved for st_rdev expansion */
1462 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1463 * but we don't have it under Linux.
1465 int target_st_atime
;
1466 unsigned int target_st_atime_nsec
; /* Reserved for st_atime expansion */
1468 int target_st_mtime
;
1469 unsigned int target_st_mtime_nsec
; /* Reserved for st_mtime expansion */
1471 int target_st_ctime
;
1472 unsigned int target_st_ctime_nsec
; /* Reserved for st_ctime expansion */
1474 unsigned int st_blksize
;
1475 unsigned int st_pad2
;
1480 #elif defined(TARGET_ABI_MIPSO32)
1482 struct target_stat
{
1484 abi_long st_pad1
[3]; /* Reserved for network id */
1486 unsigned int st_mode
;
1487 unsigned int st_nlink
;
1491 abi_long st_pad2
[2];
1495 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1496 * but we don't have it under Linux.
1498 abi_long target_st_atime
;
1499 abi_long target_st_atime_nsec
;
1500 abi_long target_st_mtime
;
1501 abi_long target_st_mtime_nsec
;
1502 abi_long target_st_ctime
;
1503 abi_long target_st_ctime_nsec
;
1504 abi_long st_blksize
;
1506 abi_long st_pad4
[14];
1510 * This matches struct stat64 in glibc2.1, hence the absolutely insane
1511 * amounts of padding around dev_t's. The memory layout is the same as of
1512 * struct stat of the 64-bit kernel.
1515 struct target_stat64
{
1517 abi_ulong st_pad0
[3]; /* Reserved for st_dev expansion */
1521 unsigned int st_mode
;
1522 unsigned int st_nlink
;
1528 abi_ulong st_pad1
[3]; /* Reserved for st_rdev expansion */
1533 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1534 * but we don't have it under Linux.
1536 abi_long target_st_atime
;
1537 abi_ulong target_st_atime_nsec
; /* Reserved for st_atime expansion */
1539 abi_long target_st_mtime
;
1540 abi_ulong target_st_mtime_nsec
; /* Reserved for st_mtime expansion */
1542 abi_long target_st_ctime
;
1543 abi_ulong target_st_ctime_nsec
; /* Reserved for st_ctime expansion */
1545 abi_ulong st_blksize
;
1551 #elif defined(TARGET_ALPHA)
1553 struct target_stat
{
1554 unsigned int st_dev
;
1555 unsigned int st_ino
;
1556 unsigned int st_mode
;
1557 unsigned int st_nlink
;
1558 unsigned int st_uid
;
1559 unsigned int st_gid
;
1560 unsigned int st_rdev
;
1562 abi_ulong target_st_atime
;
1563 abi_ulong target_st_mtime
;
1564 abi_ulong target_st_ctime
;
1565 unsigned int st_blksize
;
1566 unsigned int st_blocks
;
1567 unsigned int st_flags
;
1568 unsigned int st_gen
;
1571 struct target_stat64
{
1576 abi_ulong st_blocks
;
1578 unsigned int st_mode
;
1579 unsigned int st_uid
;
1580 unsigned int st_gid
;
1581 unsigned int st_blksize
;
1582 unsigned int st_nlink
;
1583 unsigned int __pad0
;
1585 abi_ulong target_st_atime
;
1586 abi_ulong target_st_atime_nsec
;
1587 abi_ulong target_st_mtime
;
1588 abi_ulong target_st_mtime_nsec
;
1589 abi_ulong target_st_ctime
;
1590 abi_ulong target_st_ctime_nsec
;
1591 abi_long __unused
[3];
1594 #elif defined(TARGET_SH4)
1596 struct target_stat
{
1599 unsigned short st_mode
;
1600 unsigned short st_nlink
;
1601 unsigned short st_uid
;
1602 unsigned short st_gid
;
1605 abi_ulong st_blksize
;
1606 abi_ulong st_blocks
;
1607 abi_ulong target_st_atime
;
1608 abi_ulong target_st_atime_nsec
;
1609 abi_ulong target_st_mtime
;
1610 abi_ulong target_st_mtime_nsec
;
1611 abi_ulong target_st_ctime
;
1612 abi_ulong target_st_ctime_nsec
;
1613 abi_ulong __unused4
;
1614 abi_ulong __unused5
;
1617 /* This matches struct stat64 in glibc2.1, hence the absolutely
1618 * insane amounts of padding around dev_t's.
1620 struct __attribute__((__packed__
)) target_stat64
{
1621 unsigned long long st_dev
;
1622 unsigned char __pad0
[4];
1624 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
1627 unsigned int st_mode
;
1628 unsigned int st_nlink
;
1633 unsigned long long st_rdev
;
1634 unsigned char __pad3
[4];
1637 abi_ulong st_blksize
;
1639 unsigned long long st_blocks
; /* Number 512-byte blocks allocated. */
1641 abi_ulong target_st_atime
;
1642 abi_ulong target_st_atime_nsec
;
1644 abi_ulong target_st_mtime
;
1645 abi_ulong target_st_mtime_nsec
;
1647 abi_ulong target_st_ctime
;
1648 abi_ulong target_st_ctime_nsec
;
1650 unsigned long long st_ino
;
1653 #elif defined(TARGET_HPPA)
1655 struct target_stat
{
1656 unsigned int st_dev
; /* dev_t is 32 bits on parisc */
1657 target_ulong st_ino
; /* 32 bits */
1658 unsigned short st_mode
; /* 16 bits */
1659 unsigned short st_nlink
; /* 16 bits */
1660 unsigned short st_reserved1
; /* old st_uid */
1661 unsigned short st_reserved2
; /* old st_gid */
1662 unsigned int st_rdev
;
1663 target_ulong st_size
;
1664 target_ulong target_st_atime
;
1665 unsigned int target_st_atime_nsec
;
1666 target_ulong target_st_mtime
;
1667 unsigned int target_st_mtime_nsec
;
1668 target_ulong target_st_ctime
;
1669 unsigned int target_st_ctime_nsec
;
1672 unsigned int __unused1
; /* ACL stuff */
1673 unsigned int __unused2
; /* network */
1674 target_ulong __unused3
; /* network */
1675 unsigned int __unused4
; /* cnodes */
1676 unsigned short __unused5
; /* netsite */
1678 unsigned int st_realdev
;
1679 unsigned short st_basemode
;
1680 unsigned short st_spareshort
;
1681 target_ulong st_uid
;
1682 target_ulong st_gid
;
1683 unsigned int st_spare4
[3];
1686 struct target_stat64
{
1687 unsigned long long st_dev
;
1688 unsigned int __pad1
;
1690 unsigned int __st_ino
; /* Not actually filled in */
1691 unsigned int st_mode
;
1692 unsigned int st_nlink
;
1693 unsigned int st_uid
;
1694 unsigned int st_gid
;
1695 unsigned long long st_rdev
;
1696 unsigned int __pad2
;
1697 signed long long st_size
;
1698 signed int st_blksize
;
1700 signed long long st_blocks
;
1701 signed int target_st_atime
;
1702 unsigned int target_st_atime_nsec
;
1703 signed int target_st_mtime
;
1704 unsigned int target_st_mtime_nsec
;
1705 signed int target_st_ctime
;
1706 unsigned int target_st_ctime_nsec
;
1707 unsigned long long st_ino
;
1710 #elif defined(TARGET_I386) && !defined(TARGET_ABI32)
1711 struct target_stat
{
1716 unsigned int st_mode
;
1717 unsigned int st_uid
;
1718 unsigned int st_gid
;
1719 unsigned int __pad0
;
1722 abi_long st_blksize
;
1723 abi_long st_blocks
; /* Number 512-byte blocks allocated. */
1725 abi_ulong target_st_atime
;
1726 abi_ulong target_st_atime_nsec
;
1727 abi_ulong target_st_mtime
;
1728 abi_ulong target_st_mtime_nsec
;
1729 abi_ulong target_st_ctime
;
1730 abi_ulong target_st_ctime_nsec
;
1732 abi_long __unused
[3];
1735 #error unsupported CPU
1743 #ifdef TARGET_ABI_MIPSN32
1744 struct target_statfs
{
1747 int32_t f_frsize
; /* Fragment size - unsupported */
1754 /* Linux specials */
1755 target_fsid_t f_fsid
;
1760 struct target_statfs
{
1763 abi_long f_frsize
; /* Fragment size - unsupported */
1770 /* Linux specials */
1771 target_fsid_t f_fsid
;
1773 abi_long f_spare
[6];
1777 struct target_statfs64
{
1780 uint32_t f_frsize
; /* Fragment size - unsupported */
1787 target_fsid_t f_fsid
;
1789 uint32_t f_spare
[6];
1791 #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \
1792 defined(TARGET_SPARC64)) && !defined(TARGET_ABI32)
1793 struct target_statfs
{
1801 target_fsid_t f_fsid
;
1804 abi_long f_spare
[5];
1807 struct target_statfs64
{
1815 target_fsid_t f_fsid
;
1818 abi_long f_spare
[5];
1820 #elif defined(TARGET_HPPA)
1821 typedef abi_long target_statfs_word
;
1823 struct target_statfs
{
1824 target_statfs_word f_type
;
1825 target_statfs_word f_bsize
;
1826 target_statfs_word f_blocks
;
1827 target_statfs_word f_bfree
;
1828 target_statfs_word f_bavail
;
1829 target_statfs_word f_files
;
1830 target_statfs_word f_ffree
;
1831 target_fsid_t f_fsid
;
1832 target_statfs_word f_namelen
;
1833 target_statfs_word f_frsize
;
1834 target_statfs_word f_spare
[5];
1837 struct target_statfs64
{
1838 target_statfs_word f_type
;
1839 target_statfs_word f_bsize
;
1845 target_fsid_t f_fsid
;
1846 target_statfs_word f_namelen
;
1847 target_statfs_word f_frsize
;
1848 target_statfs_word f_spare
[5];
1851 struct target_statfs
{
1859 target_fsid_t f_fsid
;
1862 uint32_t f_spare
[5];
1865 struct target_statfs64
{
1873 target_fsid_t f_fsid
;
1876 uint32_t f_spare
[5];
1881 #define TARGET_F_DUPFD 0 /* dup */
1882 #define TARGET_F_GETFD 1 /* get close_on_exec */
1883 #define TARGET_F_SETFD 2 /* set/clear close_on_exec */
1884 #define TARGET_F_GETFL 3 /* get file->f_flags */
1885 #define TARGET_F_SETFL 4 /* set file->f_flags */
1887 #if defined(TARGET_ALPHA)
1888 #define TARGET_F_GETLK 7
1889 #define TARGET_F_SETLK 8
1890 #define TARGET_F_SETLKW 9
1891 #define TARGET_F_SETOWN 5 /* for sockets. */
1892 #define TARGET_F_GETOWN 6 /* for sockets. */
1894 #define TARGET_F_SETSIG 10 /* for sockets. */
1895 #define TARGET_F_GETSIG 11 /* for sockets. */
1897 #define TARGET_F_GETLK64 12 /* using 'struct flock64' */
1898 #define TARGET_F_SETLK64 13
1899 #define TARGET_F_SETLKW64 14
1902 #elif defined(TARGET_HPPA)
1904 #define TARGET_F_GETLK 5
1905 #define TARGET_F_SETLK 6
1906 #define TARGET_F_SETLKW 7
1907 #define TARGET_F_SETOWN 12 /* for sockets. */
1908 #define TARGET_F_GETOWN 11 /* for sockets. */
1910 #define TARGET_F_SETSIG 13 /* for sockets. */
1911 #define TARGET_F_GETSIG 14 /* for sockets. */
1913 #define TARGET_F_GETLK64 8
1914 #define TARGET_F_SETLK64 9
1915 #define TARGET_F_SETLKW64 10
1919 #define TARGET_F_GETLK 5
1920 #define TARGET_F_SETLK 6
1921 #define TARGET_F_SETLKW 7
1922 #define TARGET_F_SETOWN 8 /* for sockets. */
1923 #define TARGET_F_GETOWN 9 /* for sockets. */
1925 #define TARGET_F_SETSIG 10 /* for sockets. */
1926 #define TARGET_F_GETSIG 11 /* for sockets. */
1928 #define TARGET_F_GETLK64 12 /* using 'struct flock64' */
1929 #define TARGET_F_SETLK64 13
1930 #define TARGET_F_SETLKW64 14
1934 #if defined (TARGET_ARM)
1935 #define TARGET_O_ACCMODE 0003
1936 #define TARGET_O_RDONLY 00
1937 #define TARGET_O_WRONLY 01
1938 #define TARGET_O_RDWR 02
1939 #define TARGET_O_CREAT 0100 /* not fcntl */
1940 #define TARGET_O_EXCL 0200 /* not fcntl */
1941 #define TARGET_O_NOCTTY 0400 /* not fcntl */
1942 #define TARGET_O_TRUNC 01000 /* not fcntl */
1943 #define TARGET_O_APPEND 02000
1944 #define TARGET_O_NONBLOCK 04000
1945 #define TARGET_O_NDELAY TARGET_O_NONBLOCK
1946 #define TARGET_O_SYNC 010000
1947 #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
1948 #define TARGET_O_DIRECTORY 040000 /* must be a directory */
1949 #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
1950 #define TARGET_O_DIRECT 0200000 /* direct disk access hint */
1951 #define TARGET_O_LARGEFILE 0400000
1952 #elif defined (TARGET_PPC)
1953 #define TARGET_O_ACCMODE 0003
1954 #define TARGET_O_RDONLY 00
1955 #define TARGET_O_WRONLY 01
1956 #define TARGET_O_RDWR 02
1957 #define TARGET_O_CREAT 0100 /* not fcntl */
1958 #define TARGET_O_EXCL 0200 /* not fcntl */
1959 #define TARGET_O_NOCTTY 0400 /* not fcntl */
1960 #define TARGET_O_TRUNC 01000 /* not fcntl */
1961 #define TARGET_O_APPEND 02000
1962 #define TARGET_O_NONBLOCK 04000
1963 #define TARGET_O_NDELAY TARGET_O_NONBLOCK
1964 #define TARGET_O_SYNC 010000
1965 #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
1966 #define TARGET_O_DIRECTORY 040000 /* must be a directory */
1967 #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
1968 #define TARGET_O_LARGEFILE 0200000
1969 #define TARGET_O_DIRECT 0400000 /* direct disk access hint */
1970 #elif defined (TARGET_MICROBLAZE)
1971 #define TARGET_O_ACCMODE 0003
1972 #define TARGET_O_RDONLY 00
1973 #define TARGET_O_WRONLY 01
1974 #define TARGET_O_RDWR 02
1975 #define TARGET_O_CREAT 0100 /* not fcntl */
1976 #define TARGET_O_EXCL 0200 /* not fcntl */
1977 #define TARGET_O_NOCTTY 0400 /* not fcntl */
1978 #define TARGET_O_TRUNC 01000 /* not fcntl */
1979 #define TARGET_O_APPEND 02000
1980 #define TARGET_O_NONBLOCK 04000
1981 #define TARGET_O_NDELAY TARGET_O_NONBLOCK
1982 #define TARGET_O_SYNC 010000
1983 #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
1984 #define TARGET_O_DIRECTORY 040000 /* must be a directory */
1985 #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
1986 #define TARGET_O_LARGEFILE 0200000
1987 #define TARGET_O_DIRECT 0400000 /* direct disk access hint */
1988 #elif defined (TARGET_SPARC)
1989 #define TARGET_O_RDONLY 0x0000
1990 #define TARGET_O_WRONLY 0x0001
1991 #define TARGET_O_RDWR 0x0002
1992 #define TARGET_O_ACCMODE 0x0003
1993 #define TARGET_O_APPEND 0x0008
1994 #define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */
1995 #define TARGET_O_CREAT 0x0200 /* not fcntl */
1996 #define TARGET_O_TRUNC 0x0400 /* not fcntl */
1997 #define TARGET_O_EXCL 0x0800 /* not fcntl */
1998 #define TARGET_O_SYNC 0x2000
1999 #define TARGET_O_NONBLOCK 0x4000
2000 #define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK)
2001 #define TARGET_O_NOCTTY 0x8000 /* not fcntl */
2002 #define TARGET_O_DIRECTORY 0x10000 /* must be a directory */
2003 #define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */
2004 #define TARGET_O_LARGEFILE 0x40000
2005 #define TARGET_O_DIRECT 0x100000 /* direct disk access hint */
2006 #elif defined(TARGET_MIPS)
2007 #define TARGET_O_ACCMODE 0x0003
2008 #define TARGET_O_RDONLY 0x0000
2009 #define TARGET_O_WRONLY 0x0001
2010 #define TARGET_O_RDWR 0x0002
2011 #define TARGET_O_APPEND 0x0008
2012 #define TARGET_O_SYNC 0x0010
2013 #define TARGET_O_NONBLOCK 0x0080
2014 #define TARGET_O_CREAT 0x0100 /* not fcntl */
2015 #define TARGET_O_TRUNC 0x0200 /* not fcntl */
2016 #define TARGET_O_EXCL 0x0400 /* not fcntl */
2017 #define TARGET_O_NOCTTY 0x0800 /* not fcntl */
2018 #define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */
2019 #define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */
2020 #define TARGET_O_DIRECT 0x8000 /* direct disk access hint */
2021 #define TARGET_O_DIRECTORY 0x10000 /* must be a directory */
2022 #define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */
2023 #define TARGET_O_NOATIME 0x40000
2024 #define TARGET_O_NDELAY TARGET_O_NONBLOCK
2025 #elif defined(TARGET_ALPHA)
2026 #define TARGET_O_ACCMODE 0x0003
2027 #define TARGET_O_RDONLY 0x0000
2028 #define TARGET_O_WRONLY 0x0001
2029 #define TARGET_O_RDWR 0x0002
2030 #define TARGET_O_APPEND 0x0008
2031 #define TARGET_O_SYNC 0x4000
2032 #define TARGET_O_NONBLOCK 0x0004
2033 #define TARGET_O_CREAT 0x0200 /* not fcntl */
2034 #define TARGET_O_TRUNC 0x0400 /* not fcntl */
2035 #define TARGET_O_EXCL 0x0800 /* not fcntl */
2036 #define TARGET_O_NOCTTY 0x1000 /* not fcntl */
2037 #define TARGET_FASYNC 0x2000 /* fcntl, for BSD compatibility */
2038 #define TARGET_O_LARGEFILE 0x0000 /* not necessary, always 64-bit */
2039 #define TARGET_O_DIRECT 0x80000 /* direct disk access hint */
2040 #define TARGET_O_DIRECTORY 0x8000 /* must be a directory */
2041 #define TARGET_O_NOFOLLOW 0x10000 /* don't follow links */
2042 #define TARGET_O_NOATIME 0x100000
2043 #define TARGET_O_NDELAY TARGET_O_NONBLOCK
2044 #elif defined(TARGET_HPPA)
2045 #define TARGET_O_ACCMODE 0003
2046 #define TARGET_O_RDONLY 00
2047 #define TARGET_O_WRONLY 01
2048 #define TARGET_O_RDWR 02
2049 #define TARGET_O_TRUNC 01000 /* not fcntl */
2050 #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
2051 #define TARGET_O_DIRECT 040000 /* direct disk access hint */
2052 #define TARGET_O_APPEND 000000010
2053 #define TARGET_O_BLKSEEK 000000100 /* HPUX only */
2054 #define TARGET_O_CREAT 000000400 /* not fcntl */
2055 #define TARGET_O_EXCL 000002000 /* not fcntl */
2056 #define TARGET_O_LARGEFILE 000004000
2057 #define TARGET_O_SYNC 000100000
2058 #define TARGET_O_NONBLOCK 000200004 /* HPUX has separate NDELAY & NONBLOCK */
2059 #define TARGET_O_NDELAY TARGET_O_NONBLOCK
2060 #define TARGET_O_NOCTTY 000400000 /* not fcntl */
2061 #define TARGET_O_DSYNC 001000000 /* HPUX only */
2062 #define TARGET_O_RSYNC 002000000 /* HPUX only */
2063 #define TARGET_O_NOATIME 004000000
2064 #define TARGET_O_CLOEXEC 010000000 /* set close_on_exec */
2065 #define TARGET_O_DIRECTORY 000010000 /* must be a directory */
2066 #define TARGET_O_NOFOLLOW 000000200 /* don't follow links */
2067 #define TARGET_O_INVISIBLE 004000000 /* invisible I/O, for DMAPI/XDSM */
2069 #define TARGET_O_ACCMODE 0003
2070 #define TARGET_O_RDONLY 00
2071 #define TARGET_O_WRONLY 01
2072 #define TARGET_O_RDWR 02
2073 #define TARGET_O_CREAT 0100 /* not fcntl */
2074 #define TARGET_O_EXCL 0200 /* not fcntl */
2075 #define TARGET_O_NOCTTY 0400 /* not fcntl */
2076 #define TARGET_O_TRUNC 01000 /* not fcntl */
2077 #define TARGET_O_APPEND 02000
2078 #define TARGET_O_NONBLOCK 04000
2079 #define TARGET_O_NDELAY TARGET_O_NONBLOCK
2080 #define TARGET_O_SYNC 010000
2081 #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
2082 #define TARGET_O_DIRECT 040000 /* direct disk access hint */
2083 #define TARGET_O_LARGEFILE 0100000
2084 #define TARGET_O_DIRECTORY 0200000 /* must be a directory */
2085 #define TARGET_O_NOFOLLOW 0400000 /* don't follow links */
2088 struct target_flock
{
2096 struct target_flock64
{
2099 #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) || defined(TARGET_SPARC) || defined(TARGET_HPPA) || defined (TARGET_MICROBLAZE)
2102 unsigned long long l_start
;
2103 unsigned long long l_len
;
2105 }__attribute__((packed
));
2108 struct target_eabi_flock64
{
2112 unsigned long long l_start
;
2113 unsigned long long l_len
;
2115 }__attribute__((packed
));
2118 /* soundcard defines */
2119 /* XXX: convert them all to arch indepedent entries */
2120 #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int);
2121 #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301
2122 #define TARGET_SNDCTL_COPR_RCODE 0xc0144303
2123 #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309
2124 #define TARGET_SNDCTL_COPR_RDATA 0xc0144302
2125 #define TARGET_SNDCTL_COPR_RESET 0x00004300
2126 #define TARGET_SNDCTL_COPR_RUN 0xc0144306
2127 #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308
2128 #define TARGET_SNDCTL_COPR_WCODE 0x40144305
2129 #define TARGET_SNDCTL_COPR_WDATA 0x40144304
2130 #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0)
2131 #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1)
2132 #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int)
2133 #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int)
2134 #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int)
2135 #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int)
2136 #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int)
2137 #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int)
2138 #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8)
2139 #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int)
2140 #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int)
2141 #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int)
2142 #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12)
2143 #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13)
2144 #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int)
2145 #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int)
2146 #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17)
2147 #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18)
2148 #define TARGET_SNDCTL_DSP_MAPINBUF 0x80085013
2149 #define TARGET_SNDCTL_DSP_MAPOUTBUF 0x80085014
2150 #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e
2151 #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005
2152 #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016
2153 #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015
2154 #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010
2155 #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f
2156 #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107
2157 #define TARGET_SNDCTL_MIDI_INFO 0xc074510c
2158 #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02
2159 #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01
2160 #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00
2161 #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110
2162 #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001
2163 #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103
2164 #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105
2165 #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104
2166 #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b
2167 #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a
2168 #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112
2169 #define TARGET_SNDCTL_SEQ_PANIC 0x00005111
2170 #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106
2171 #define TARGET_SNDCTL_SEQ_RESET 0x00005100
2172 #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109
2173 #define TARGET_SNDCTL_SEQ_SYNC 0x00005101
2174 #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108
2175 #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d
2176 #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d
2177 #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102
2178 #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e
2179 #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404
2180 #define TARGET_SNDCTL_TMR_METRONOME 0x40045407
2181 #define TARGET_SNDCTL_TMR_SELECT 0x40045408
2182 #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406
2183 #define TARGET_SNDCTL_TMR_START 0x00005402
2184 #define TARGET_SNDCTL_TMR_STOP 0x00005403
2185 #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405
2186 #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401
2187 #define TARGET_SOUND_PCM_READ_RATE 0x80045002
2188 #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006
2189 #define TARGET_SOUND_PCM_READ_BITS 0x80045005
2190 #define TARGET_SOUND_PCM_READ_FILTER 0x80045007
2191 #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info)
2192 #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66
2193 #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int)
2194 #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int)
2195 #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int)
2196 #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int)
2197 #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int)
2199 #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int)
2201 #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME)
2202 #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS)
2203 #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE)
2204 #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH)
2205 #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM)
2206 #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER)
2207 #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE)
2208 #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC)
2209 #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD)
2210 #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX)
2211 #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM)
2212 #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV)
2213 #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN)
2214 #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN)
2215 #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1)
2216 #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2)
2217 #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3)
2219 /* Obsolete macros */
2220 #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE)
2221 #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE)
2222 #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD)
2224 #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC)
2225 #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK)
2226 #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK)
2227 #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS)
2228 #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS)
2230 #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int)
2232 #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME)
2233 #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS)
2234 #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE)
2235 #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH)
2236 #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM)
2237 #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER)
2238 #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE)
2239 #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC)
2240 #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD)
2241 #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX)
2242 #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM)
2243 #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV)
2244 #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN)
2245 #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN)
2246 #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1)
2247 #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2)
2248 #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3)
2250 /* Obsolete macros */
2251 #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE)
2252 #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE)
2253 #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD)
2255 #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)
2258 #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1)
2259 #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2)
2261 #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct mtop)
2262 #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct mtget)
2263 #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct mtpos)
2265 struct target_sysinfo
{
2266 abi_long uptime
; /* Seconds since boot */
2267 abi_ulong loads
[3]; /* 1, 5, and 15 minute load averages */
2268 abi_ulong totalram
; /* Total usable main memory size */
2269 abi_ulong freeram
; /* Available memory size */
2270 abi_ulong sharedram
; /* Amount of shared memory */
2271 abi_ulong bufferram
; /* Memory used by buffers */
2272 abi_ulong totalswap
; /* Total swap space size */
2273 abi_ulong freeswap
; /* swap space still available */
2274 unsigned short procs
; /* Number of current processes */
2275 unsigned short pad
; /* explicit padding for m68k */
2276 abi_ulong totalhigh
; /* Total high memory size */
2277 abi_ulong freehigh
; /* Available high memory size */
2278 unsigned int mem_unit
; /* Memory unit size in bytes */
2279 char _f
[20-2*sizeof(abi_long
)-sizeof(int)]; /* Padding: libc5 uses this.. */
2282 struct linux_dirent
{
2284 unsigned long d_off
;
2285 unsigned short d_reclen
;
2286 char d_name
[256]; /* We must not include limits.h! */
2289 struct linux_dirent64
{
2292 unsigned short d_reclen
;
2293 unsigned char d_type
;
2297 struct target_mq_attr
{
2300 abi_long mq_msgsize
;
2301 abi_long mq_curmsgs
;
2306 #include "errno_defs.h"