summary refs log tree commit diff stats
path: root/linux-user/syscall_defs.h
diff options
context:
space:
mode:
Diffstat (limited to 'linux-user/syscall_defs.h')
-rw-r--r--linux-user/syscall_defs.h536
1 files changed, 2 insertions, 534 deletions
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index e4cd87cc00..40bb60ef4c 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -418,280 +418,13 @@ struct target_sigaction;
 int do_sigaction(int sig, const struct target_sigaction *act,
                  struct target_sigaction *oact);
 
-#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) \
-    || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \
-    || defined(TARGET_TILEGX) || defined(TARGET_HPPA) || defined(TARGET_NIOS2) \
-    || defined(TARGET_RISCV) || defined(TARGET_XTENSA)
-
-#if defined(TARGET_SPARC)
-#define TARGET_SA_NOCLDSTOP    8u
-#define TARGET_SA_NOCLDWAIT    0x100u
-#define TARGET_SA_SIGINFO      0x200u
-#define TARGET_SA_ONSTACK      1u
-#define TARGET_SA_RESTART      2u
-#define TARGET_SA_NODEFER      0x20u
-#define TARGET_SA_RESETHAND    4u
-#define TARGET_ARCH_HAS_SA_RESTORER 1
-#define TARGET_ARCH_HAS_KA_RESTORER 1
-#elif defined(TARGET_MIPS)
-#define TARGET_SA_NOCLDSTOP	0x00000001
-#define TARGET_SA_NOCLDWAIT	0x00010000
-#define TARGET_SA_SIGINFO	0x00000008
-#define TARGET_SA_ONSTACK	0x08000000
-#define TARGET_SA_NODEFER	0x40000000
-#define TARGET_SA_RESTART	0x10000000
-#define TARGET_SA_RESETHAND	0x80000000
-#if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64)
-#define TARGET_SA_RESTORER	0x04000000	/* Only for O32 */
-#endif
-#elif defined(TARGET_OPENRISC)
-#define TARGET_SA_NOCLDSTOP    0x00000001
-#define TARGET_SA_NOCLDWAIT    0x00000002
-#define TARGET_SA_SIGINFO      0x00000004
-#define TARGET_SA_ONSTACK      0x08000000
-#define TARGET_SA_RESTART      0x10000000
-#define TARGET_SA_NODEFER      0x40000000
-#define TARGET_SA_RESETHAND    0x80000000
-#elif defined(TARGET_ALPHA)
-#define TARGET_SA_ONSTACK	0x00000001
-#define TARGET_SA_RESTART	0x00000002
-#define TARGET_SA_NOCLDSTOP	0x00000004
-#define TARGET_SA_NODEFER	0x00000008
-#define TARGET_SA_RESETHAND	0x00000010
-#define TARGET_SA_NOCLDWAIT	0x00000020 /* not supported yet */
-#define TARGET_SA_SIGINFO	0x00000040
-#elif defined(TARGET_HPPA)
-#define TARGET_SA_ONSTACK       0x00000001
-#define TARGET_SA_RESETHAND     0x00000004
-#define TARGET_SA_NOCLDSTOP     0x00000008
-#define TARGET_SA_SIGINFO       0x00000010
-#define TARGET_SA_NODEFER       0x00000020
-#define TARGET_SA_RESTART       0x00000040
-#define TARGET_SA_NOCLDWAIT     0x00000080
-#else
-#define TARGET_SA_NOCLDSTOP	0x00000001
-#define TARGET_SA_NOCLDWAIT	0x00000002 /* not supported yet */
-#define TARGET_SA_SIGINFO	0x00000004
-#define TARGET_SA_ONSTACK	0x08000000
-#define TARGET_SA_RESTART	0x10000000
-#define TARGET_SA_NODEFER	0x40000000
-#define TARGET_SA_RESETHAND	0x80000000
-#define TARGET_SA_RESTORER	0x04000000
-#endif
+#include "target_signal.h"
 
 #ifdef TARGET_SA_RESTORER
 #define TARGET_ARCH_HAS_SA_RESTORER 1
 #endif
 
 #if defined(TARGET_ALPHA)
-
-#define TARGET_SIGHUP            1
-#define TARGET_SIGINT            2
-#define TARGET_SIGQUIT           3
-#define TARGET_SIGILL            4
-#define TARGET_SIGTRAP           5
-#define TARGET_SIGABRT           6
-#define TARGET_SIGSTKFLT         7 /* actually SIGEMT */
-#define TARGET_SIGFPE            8
-#define TARGET_SIGKILL           9
-#define TARGET_SIGBUS           10
-#define TARGET_SIGSEGV          11
-#define TARGET_SIGSYS           12
-#define TARGET_SIGPIPE          13
-#define TARGET_SIGALRM          14
-#define TARGET_SIGTERM          15
-#define TARGET_SIGURG           16
-#define TARGET_SIGSTOP          17
-#define TARGET_SIGTSTP          18
-#define TARGET_SIGCONT          19
-#define TARGET_SIGCHLD          20
-#define TARGET_SIGTTIN          21
-#define TARGET_SIGTTOU          22
-#define TARGET_SIGIO            23
-#define TARGET_SIGXCPU          24
-#define TARGET_SIGXFSZ          25
-#define TARGET_SIGVTALRM        26
-#define TARGET_SIGPROF          27
-#define TARGET_SIGWINCH         28
-#define TARGET_SIGPWR           29 /* actually SIGINFO */
-#define TARGET_SIGUSR1          30
-#define TARGET_SIGUSR2          31
-#define TARGET_SIGRTMIN         32
-
-#define TARGET_SIG_BLOCK         1
-#define TARGET_SIG_UNBLOCK       2
-#define TARGET_SIG_SETMASK       3
-
-#elif defined(TARGET_SPARC)
-
-#define TARGET_SIGHUP		 1
-#define TARGET_SIGINT		 2
-#define TARGET_SIGQUIT		 3
-#define TARGET_SIGILL		 4
-#define TARGET_SIGTRAP		 5
-#define TARGET_SIGABRT		 6
-#define TARGET_SIGIOT		 6
-#define TARGET_SIGSTKFLT	 7 /* actually EMT */
-#define TARGET_SIGFPE		 8
-#define TARGET_SIGKILL		 9
-#define TARGET_SIGBUS		10
-#define TARGET_SIGSEGV		11
-#define TARGET_SIGSYS		12
-#define TARGET_SIGPIPE		13
-#define TARGET_SIGALRM		14
-#define TARGET_SIGTERM		15
-#define TARGET_SIGURG		16
-#define TARGET_SIGSTOP		17
-#define TARGET_SIGTSTP		18
-#define TARGET_SIGCONT		19
-#define TARGET_SIGCHLD		20
-#define TARGET_SIGTTIN		21
-#define TARGET_SIGTTOU		22
-#define TARGET_SIGIO		23
-#define TARGET_SIGXCPU		24
-#define TARGET_SIGXFSZ		25
-#define TARGET_SIGVTALRM	26
-#define TARGET_SIGPROF		27
-#define TARGET_SIGWINCH	        28
-#define TARGET_SIGPWR		29
-#define TARGET_SIGUSR1		30
-#define TARGET_SIGUSR2		31
-#define TARGET_SIGRTMIN         32
-
-#define TARGET_SIG_BLOCK          0x01 /* for blocking signals */
-#define TARGET_SIG_UNBLOCK        0x02 /* for unblocking signals */
-#define TARGET_SIG_SETMASK        0x04 /* for setting the signal mask */
-
-#elif defined(TARGET_MIPS)
-
-#define TARGET_SIGHUP		 1	/* Hangup (POSIX).  */
-#define TARGET_SIGINT		 2	/* Interrupt (ANSI).  */
-#define TARGET_SIGQUIT		 3	/* Quit (POSIX).  */
-#define TARGET_SIGILL		 4	/* Illegal instruction (ANSI).  */
-#define TARGET_SIGTRAP		 5	/* Trace trap (POSIX).  */
-#define TARGET_SIGIOT		 6	/* IOT trap (4.2 BSD).  */
-#define TARGET_SIGABRT		 TARGET_SIGIOT	/* Abort (ANSI).  */
-#define TARGET_SIGEMT		 7
-#define TARGET_SIGSTKFLT	 7 /* XXX: incorrect */
-#define TARGET_SIGFPE		 8	/* Floating-point exception (ANSI).  */
-#define TARGET_SIGKILL		 9	/* Kill, unblockable (POSIX).  */
-#define TARGET_SIGBUS		10	/* BUS error (4.2 BSD).  */
-#define TARGET_SIGSEGV		11	/* Segmentation violation (ANSI).  */
-#define TARGET_SIGSYS		12
-#define TARGET_SIGPIPE		13	/* Broken pipe (POSIX).  */
-#define TARGET_SIGALRM		14	/* Alarm clock (POSIX).  */
-#define TARGET_SIGTERM		15	/* Termination (ANSI).  */
-#define TARGET_SIGUSR1		16	/* User-defined signal 1 (POSIX).  */
-#define TARGET_SIGUSR2		17	/* User-defined signal 2 (POSIX).  */
-#define TARGET_SIGCHLD		18	/* Child status has changed (POSIX).  */
-#define TARGET_SIGCLD		TARGET_SIGCHLD	/* Same as TARGET_SIGCHLD (System V).  */
-#define TARGET_SIGPWR		19	/* Power failure restart (System V).  */
-#define TARGET_SIGWINCH	20	/* Window size change (4.3 BSD, Sun).  */
-#define TARGET_SIGURG		21	/* Urgent condition on socket (4.2 BSD).  */
-#define TARGET_SIGIO		22	/* I/O now possible (4.2 BSD).  */
-#define TARGET_SIGPOLL		TARGET_SIGIO	/* Pollable event occurred (System V).  */
-#define TARGET_SIGSTOP		23	/* Stop, unblockable (POSIX).  */
-#define TARGET_SIGTSTP		24	/* Keyboard stop (POSIX).  */
-#define TARGET_SIGCONT		25	/* Continue (POSIX).  */
-#define TARGET_SIGTTIN		26	/* Background read from tty (POSIX).  */
-#define TARGET_SIGTTOU		27	/* Background write to tty (POSIX).  */
-#define TARGET_SIGVTALRM	28	/* Virtual alarm clock (4.2 BSD).  */
-#define TARGET_SIGPROF		29	/* Profiling alarm clock (4.2 BSD).  */
-#define TARGET_SIGXCPU		30	/* CPU limit exceeded (4.2 BSD).  */
-#define TARGET_SIGXFSZ		31	/* File size limit exceeded (4.2 BSD).  */
-#define TARGET_SIGRTMIN         32
-
-#define TARGET_SIG_BLOCK	1	/* for blocking signals */
-#define TARGET_SIG_UNBLOCK	2	/* for unblocking signals */
-#define TARGET_SIG_SETMASK	3	/* for setting the signal mask */
-
-#elif defined(TARGET_HPPA)
-
-#define TARGET_SIGHUP           1
-#define TARGET_SIGINT           2
-#define TARGET_SIGQUIT          3
-#define TARGET_SIGILL           4
-#define TARGET_SIGTRAP          5
-#define TARGET_SIGABRT          6
-#define TARGET_SIGIOT           6
-#define TARGET_SIGSTKFLT        7
-#define TARGET_SIGFPE           8
-#define TARGET_SIGKILL          9
-#define TARGET_SIGBUS          10
-#define TARGET_SIGSEGV         11
-#define TARGET_SIGXCPU         12
-#define TARGET_SIGPIPE         13
-#define TARGET_SIGALRM         14
-#define TARGET_SIGTERM         15
-#define TARGET_SIGUSR1         16
-#define TARGET_SIGUSR2         17
-#define TARGET_SIGCHLD         18
-#define TARGET_SIGPWR          19
-#define TARGET_SIGVTALRM       20
-#define TARGET_SIGPROF         21
-#define TARGET_SIGIO           22
-#define TARGET_SIGPOLL         TARGET_SIGIO
-#define TARGET_SIGWINCH        23
-#define TARGET_SIGSTOP         24
-#define TARGET_SIGTSTP         25
-#define TARGET_SIGCONT         26
-#define TARGET_SIGTTIN         27
-#define TARGET_SIGTTOU         28
-#define TARGET_SIGURG          29
-#define TARGET_SIGXFSZ         30
-#define TARGET_SIGSYS          31
-
-#define TARGET_SIG_BLOCK       0
-#define TARGET_SIG_UNBLOCK     1
-#define TARGET_SIG_SETMASK     2
-
-#else
-
-/* OpenRISC Using the general signals */
-#define TARGET_SIGHUP		 1
-#define TARGET_SIGINT		 2
-#define TARGET_SIGQUIT		 3
-#define TARGET_SIGILL		 4
-#define TARGET_SIGTRAP		 5
-#define TARGET_SIGABRT		 6
-#define TARGET_SIGIOT		 6
-#define TARGET_SIGBUS		 7
-#define TARGET_SIGFPE		 8
-#define TARGET_SIGKILL		 9
-#define TARGET_SIGUSR1		10
-#define TARGET_SIGSEGV		11
-#define TARGET_SIGUSR2		12
-#define TARGET_SIGPIPE		13
-#define TARGET_SIGALRM		14
-#define TARGET_SIGTERM		15
-#define TARGET_SIGSTKFLT	16
-#define TARGET_SIGCHLD		17
-#define TARGET_SIGCONT		18
-#define TARGET_SIGSTOP		19
-#define TARGET_SIGTSTP		20
-#define TARGET_SIGTTIN		21
-#define TARGET_SIGTTOU		22
-#define TARGET_SIGURG		23
-#define TARGET_SIGXCPU		24
-#define TARGET_SIGXFSZ		25
-#define TARGET_SIGVTALRM	26
-#define TARGET_SIGPROF		27
-#define TARGET_SIGWINCH	        28
-#define TARGET_SIGIO		29
-#define TARGET_SIGPWR		30
-#define TARGET_SIGSYS		31
-#define TARGET_SIGRTMIN         32
-
-#define TARGET_SIG_BLOCK          0    /* for blocking signals */
-#define TARGET_SIG_UNBLOCK        1    /* for unblocking signals */
-#define TARGET_SIG_SETMASK        2    /* for setting the signal mask */
-
-#endif
-
-#if defined(TARGET_ALPHA)
 struct target_old_sigaction {
     abi_ulong _sa_handler;
     abi_ulong sa_mask;
@@ -925,8 +658,6 @@ typedef struct target_siginfo {
 #define TARGET_TRAP_BRANCH      (3)     /* process taken branch trap */
 #define TARGET_TRAP_HWBKPT      (4)     /* hardware breakpoint/watchpoint */
 
-#endif /* defined(TARGET_I386) || defined(TARGET_ARM) */
-
 struct target_rlimit {
         abi_ulong   rlim_cur;
         abi_ulong   rlim_max;
@@ -2407,93 +2138,6 @@ struct target_statfs64 {
 };
 #endif
 
-
-#define TARGET_F_DUPFD         0       /* dup */
-#define TARGET_F_GETFD         1       /* get close_on_exec */
-#define TARGET_F_SETFD         2       /* set/clear close_on_exec */
-#define TARGET_F_GETFL         3       /* get file->f_flags */
-#define TARGET_F_SETFL         4       /* set file->f_flags */
-
-#if defined(TARGET_ALPHA)
-#define TARGET_F_GETLK         7
-#define TARGET_F_SETLK         8
-#define TARGET_F_SETLKW        9
-#define TARGET_F_SETOWN        5       /*  for sockets. */
-#define TARGET_F_GETOWN        6       /*  for sockets. */
-
-#define TARGET_F_RDLCK         1
-#define TARGET_F_WRLCK         2
-#define TARGET_F_UNLCK         8
-#define TARGET_F_EXLCK         16
-#define TARGET_F_SHLCK         32
-#elif defined(TARGET_MIPS)
-#define TARGET_F_GETLK         14
-#define TARGET_F_SETLK         6
-#define TARGET_F_SETLKW        7
-#define TARGET_F_SETOWN        24       /*  for sockets. */
-#define TARGET_F_GETOWN        23       /*  for sockets. */
-#elif defined(TARGET_HPPA)
-#define TARGET_F_RDLCK         1
-#define TARGET_F_WRLCK         2
-#define TARGET_F_UNLCK         3
-#define TARGET_F_GETLK         5
-#define TARGET_F_SETLK         6
-#define TARGET_F_SETLKW        7
-#define TARGET_F_GETOWN        11       /*  for sockets. */
-#define TARGET_F_SETOWN        12       /*  for sockets. */
-#elif defined(TARGET_SPARC)
-#define TARGET_F_RDLCK         1
-#define TARGET_F_WRLCK         2
-#define TARGET_F_UNLCK         3
-#define TARGET_F_GETOWN        5       /*  for sockets. */
-#define TARGET_F_SETOWN        6       /*  for sockets. */
-#define TARGET_F_GETLK         7
-#define TARGET_F_SETLK         8
-#define TARGET_F_SETLKW        9
-#else
-#define TARGET_F_GETLK         5
-#define TARGET_F_SETLK         6
-#define TARGET_F_SETLKW        7
-#define TARGET_F_SETOWN        8       /*  for sockets. */
-#define TARGET_F_GETOWN        9       /*  for sockets. */
-#endif
-#define TARGET_F_SETOWN_EX     15
-#define TARGET_F_GETOWN_EX     16
-
-#ifndef TARGET_F_RDLCK
-#define TARGET_F_RDLCK         0
-#define TARGET_F_WRLCK         1
-#define TARGET_F_UNLCK         2
-#endif
-
-#ifndef TARGET_F_EXLCK
-#define TARGET_F_EXLCK         4
-#define TARGET_F_SHLCK         8
-#endif
-
-
-#if defined(TARGET_HPPA)
-#define TARGET_F_SETSIG        13      /*  for sockets. */
-#define TARGET_F_GETSIG        14      /*  for sockets. */
-#else
-#define TARGET_F_SETSIG        10      /*  for sockets. */
-#define TARGET_F_GETSIG        11      /*  for sockets. */
-#endif
-
-#if defined(TARGET_MIPS)
-#define TARGET_F_GETLK64       33      /*  using 'struct flock64' */
-#define TARGET_F_SETLK64       34
-#define TARGET_F_SETLKW64      35
-#elif defined(TARGET_HPPA)
-#define TARGET_F_GETLK64       8       /*  using 'struct flock64' */
-#define TARGET_F_SETLK64       9
-#define TARGET_F_SETLKW64      10
-#else
-#define TARGET_F_GETLK64       12      /*  using 'struct flock64' */
-#define TARGET_F_SETLK64       13
-#define TARGET_F_SETLKW64      14
-#endif
-
 #define TARGET_F_LINUX_SPECIFIC_BASE 1024
 #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0)
 #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1)
@@ -2502,183 +2146,7 @@ struct target_statfs64 {
 #define TARGET_F_GETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 8)
 #define TARGET_F_NOTIFY  (TARGET_F_LINUX_SPECIFIC_BASE+2)
 
-#if defined(TARGET_ALPHA)
-#define TARGET_O_NONBLOCK           04
-#define TARGET_O_APPEND            010
-#define TARGET_O_CREAT           01000 /* not fcntl */
-#define TARGET_O_TRUNC           02000 /* not fcntl */
-#define TARGET_O_EXCL            04000 /* not fcntl */
-#define TARGET_O_NOCTTY         010000 /* not fcntl */
-#define TARGET_O_DSYNC          040000
-#define TARGET_O_LARGEFILE           0 /* not necessary, always 64-bit */
-#define TARGET_O_DIRECTORY     0100000 /* must be a directory */
-#define TARGET_O_NOFOLLOW      0200000 /* don't follow links */
-#define TARGET_O_DIRECT       02000000 /* direct disk access hint */
-#define TARGET_O_NOATIME      04000000
-#define TARGET_O_CLOEXEC     010000000
-#define TARGET___O_SYNC      020000000
-#define TARGET_O_PATH        040000000
-#elif defined(TARGET_HPPA)
-#define TARGET_O_NONBLOCK    000200004 /* HPUX has separate NDELAY & NONBLOCK */
-#define TARGET_O_APPEND      000000010
-#define TARGET_O_CREAT       000000400 /* not fcntl */
-#define TARGET_O_EXCL        000002000 /* not fcntl */
-#define TARGET_O_NOCTTY      000400000 /* not fcntl */
-#define TARGET_O_DSYNC       001000000
-#define TARGET_O_LARGEFILE   000004000
-#define TARGET_O_DIRECTORY   000010000 /* must be a directory */
-#define TARGET_O_NOFOLLOW    000000200 /* don't follow links */
-#define TARGET_O_NOATIME     004000000
-#define TARGET_O_CLOEXEC     010000000
-#define TARGET___O_SYNC      000100000
-#define TARGET_O_PATH        020000000
-#elif defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_AARCH64)
-#define TARGET_O_DIRECTORY      040000 /* must be a directory */
-#define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
-#define TARGET_O_DIRECT        0200000 /* direct disk access hint */
-#define TARGET_O_LARGEFILE     0400000
-#elif defined(TARGET_MIPS)
-#define TARGET_O_APPEND         0x0008
-#define TARGET_O_DSYNC          0x0010
-#define TARGET_O_NONBLOCK       0x0080
-#define TARGET_O_CREAT          0x0100  /* not fcntl */
-#define TARGET_O_TRUNC          0x0200  /* not fcntl */
-#define TARGET_O_EXCL           0x0400  /* not fcntl */
-#define TARGET_O_NOCTTY         0x0800  /* not fcntl */
-#define TARGET_FASYNC           0x1000  /* fcntl, for BSD compatibility */
-#define TARGET_O_LARGEFILE      0x2000  /* allow large file opens */
-#define TARGET___O_SYNC         0x4000
-#define TARGET_O_DIRECT         0x8000  /* direct disk access hint */
-#elif defined (TARGET_PPC)
-#define TARGET_O_DIRECTORY      040000 /* must be a directory */
-#define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
-#define TARGET_O_LARGEFILE     0200000
-#define TARGET_O_DIRECT        0400000 /* direct disk access hint */
-#elif defined (TARGET_SPARC)
-#define TARGET_O_APPEND         0x0008
-#define TARGET_FASYNC           0x0040  /* fcntl, for BSD compatibility */
-#define TARGET_O_CREAT          0x0200  /* not fcntl */
-#define TARGET_O_TRUNC          0x0400  /* not fcntl */
-#define TARGET_O_EXCL           0x0800  /* not fcntl */
-#define TARGET_O_DSYNC          0x2000
-#define TARGET_O_NONBLOCK       0x4000
-# ifdef TARGET_SPARC64
-#  define TARGET_O_NDELAY       0x0004
-# else
-#  define TARGET_O_NDELAY       (0x0004 | TARGET_O_NONBLOCK)
-# endif
-#define TARGET_O_NOCTTY         0x8000  /* not fcntl */
-#define TARGET_O_LARGEFILE     0x40000
-#define TARGET_O_DIRECT       0x100000  /* direct disk access hint */
-#define TARGET_O_NOATIME      0x200000
-#define TARGET_O_CLOEXEC      0x400000
-#define TARGET___O_SYNC       0x800000
-#define TARGET_O_PATH        0x1000000
-#define TARGET___O_TMPFILE   0x2000000
-#endif
-
-/* <asm-generic/fcntl.h> values follow.  */
-#define TARGET_O_ACCMODE          0003
-#define TARGET_O_RDONLY             00
-#define TARGET_O_WRONLY             01
-#define TARGET_O_RDWR               02
-#ifndef TARGET_O_CREAT
-#define TARGET_O_CREAT            0100 /* not fcntl */
-#endif
-#ifndef TARGET_O_EXCL
-#define TARGET_O_EXCL             0200 /* not fcntl */
-#endif
-#ifndef TARGET_O_NOCTTY
-#define TARGET_O_NOCTTY           0400 /* not fcntl */
-#endif
-#ifndef TARGET_O_TRUNC
-#define TARGET_O_TRUNC           01000 /* not fcntl */
-#endif
-#ifndef TARGET_O_APPEND
-#define TARGET_O_APPEND          02000
-#endif
-#ifndef TARGET_O_NONBLOCK
-#define TARGET_O_NONBLOCK        04000
-#endif
-#ifndef TARGET_O_DSYNC
-#define TARGET_O_DSYNC          010000
-#endif
-#ifndef TARGET_FASYNC
-#define TARGET_FASYNC           020000 /* fcntl, for BSD compatibility */
-#endif
-#ifndef TARGET_O_DIRECT
-#define TARGET_O_DIRECT         040000 /* direct disk access hint */
-#endif
-#ifndef TARGET_O_LARGEFILE
-#define TARGET_O_LARGEFILE     0100000
-#endif
-#ifndef TARGET_O_DIRECTORY
-#define TARGET_O_DIRECTORY     0200000 /* must be a directory */
-#endif
-#ifndef TARGET_O_NOFOLLOW
-#define TARGET_O_NOFOLLOW      0400000 /* don't follow links */
-#endif
-#ifndef TARGET_O_NOATIME
-#define TARGET_O_NOATIME      01000000
-#endif
-#ifndef TARGET_O_CLOEXEC
-#define TARGET_O_CLOEXEC      02000000
-#endif
-#ifndef TARGET___O_SYNC
-#define TARGET___O_SYNC       04000000
-#endif
-#ifndef TARGET_O_PATH
-#define TARGET_O_PATH        010000000
-#endif
-#ifndef TARGET___O_TMPFILE
-#define TARGET___O_TMPFILE   020000000
-#endif
-#ifndef TARGET_O_TMPFILE
-#define TARGET_O_TMPFILE     (TARGET___O_TMPFILE | TARGET_O_DIRECTORY)
-#endif
-#ifndef TARGET_O_NDELAY
-#define TARGET_O_NDELAY  TARGET_O_NONBLOCK
-#endif
-#ifndef TARGET_O_SYNC
-#define TARGET_O_SYNC    (TARGET___O_SYNC | TARGET_O_DSYNC)
-#endif
-
-#if defined(TARGET_SPARC)
-#define TARGET_ARCH_FLOCK_PAD abi_short __unused;
-#define TARGET_ARCH_FLOCK64_PAD abi_short __unused;
-#elif defined(TARGET_MIPS)
-#define TARGET_ARCH_FLOCK_PAD abi_long pad[4];
-#define TARGET_ARCH_FLOCK64_PAD
-#else
-#define TARGET_ARCH_FLOCK_PAD
-#define TARGET_ARCH_FLOCK64_PAD
-#endif
-
-struct target_flock {
-    short l_type;
-    short l_whence;
-    abi_long l_start;
-    abi_long l_len;
-#if defined(TARGET_MIPS)
-    abi_long l_sysid;
-#endif
-    int l_pid;
-    TARGET_ARCH_FLOCK_PAD
-};
-
-struct target_flock64 {
-    abi_short l_type;
-    abi_short l_whence;
-    abi_llong l_start;
-    abi_llong l_len;
-    abi_int   l_pid;
-    TARGET_ARCH_FLOCK64_PAD
-};
-
-struct target_f_owner_ex {
-        int type;	/* Owner type of ID.  */
-        int pid;	/* ID of owner.  */
-};
+#include "target_fcntl.h"
 
 /* soundcard defines */
 /* XXX: convert them all to arch independent entries */