xref: /openbmc/qemu/linux-user/generic/fcntl.h (revision 59a3a1c0)
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License version 2 as
4  * published by the Free Software Foundation, or (at your option) any
5  * later version. See the COPYING file in the top-level directory.
6  */
7 
8 #ifndef GENERIC_FCNTL_H
9 #define GENERIC_FCNTL_H
10 
11 /* <asm-generic/fcntl.h> values follow.  */
12 #define TARGET_O_ACCMODE          0003
13 #define TARGET_O_RDONLY             00
14 #define TARGET_O_WRONLY             01
15 #define TARGET_O_RDWR               02
16 #ifndef TARGET_O_CREAT
17 #define TARGET_O_CREAT            0100 /* not fcntl */
18 #endif
19 #ifndef TARGET_O_EXCL
20 #define TARGET_O_EXCL             0200 /* not fcntl */
21 #endif
22 #ifndef TARGET_O_NOCTTY
23 #define TARGET_O_NOCTTY           0400 /* not fcntl */
24 #endif
25 #ifndef TARGET_O_TRUNC
26 #define TARGET_O_TRUNC           01000 /* not fcntl */
27 #endif
28 #ifndef TARGET_O_APPEND
29 #define TARGET_O_APPEND          02000
30 #endif
31 #ifndef TARGET_O_NONBLOCK
32 #define TARGET_O_NONBLOCK        04000
33 #endif
34 #ifndef TARGET_O_DSYNC
35 #define TARGET_O_DSYNC          010000
36 #endif
37 #ifndef TARGET_FASYNC
38 #define TARGET_FASYNC           020000 /* fcntl, for BSD compatibility */
39 #endif
40 #ifndef TARGET_O_DIRECT
41 #define TARGET_O_DIRECT         040000 /* direct disk access hint */
42 #endif
43 #ifndef TARGET_O_LARGEFILE
44 #define TARGET_O_LARGEFILE     0100000
45 #endif
46 #ifndef TARGET_O_DIRECTORY
47 #define TARGET_O_DIRECTORY     0200000 /* must be a directory */
48 #endif
49 #ifndef TARGET_O_NOFOLLOW
50 #define TARGET_O_NOFOLLOW      0400000 /* don't follow links */
51 #endif
52 #ifndef TARGET_O_NOATIME
53 #define TARGET_O_NOATIME      01000000
54 #endif
55 #ifndef TARGET_O_CLOEXEC
56 #define TARGET_O_CLOEXEC      02000000
57 #endif
58 #ifndef TARGET___O_SYNC
59 #define TARGET___O_SYNC       04000000
60 #endif
61 #ifndef TARGET_O_PATH
62 #define TARGET_O_PATH        010000000
63 #endif
64 #ifndef TARGET___O_TMPFILE
65 #define TARGET___O_TMPFILE   020000000
66 #endif
67 #ifndef TARGET_O_TMPFILE
68 #define TARGET_O_TMPFILE     (TARGET___O_TMPFILE | TARGET_O_DIRECTORY)
69 #endif
70 #ifndef TARGET_O_NDELAY
71 #define TARGET_O_NDELAY  TARGET_O_NONBLOCK
72 #endif
73 #ifndef TARGET_O_SYNC
74 #define TARGET_O_SYNC    (TARGET___O_SYNC | TARGET_O_DSYNC)
75 #endif
76 
77 #define TARGET_F_DUPFD         0       /* dup */
78 #define TARGET_F_GETFD         1       /* get close_on_exec */
79 #define TARGET_F_SETFD         2       /* set/clear close_on_exec */
80 #define TARGET_F_GETFL         3       /* get file->f_flags */
81 #define TARGET_F_SETFL         4       /* set file->f_flags */
82 #ifndef TARGET_F_GETLK
83 #define TARGET_F_GETLK         5
84 #define TARGET_F_SETLK         6
85 #define TARGET_F_SETLKW        7
86 #endif
87 #ifndef TARGET_F_SETOWN
88 #define TARGET_F_SETOWN        8       /*  for sockets. */
89 #define TARGET_F_GETOWN        9       /*  for sockets. */
90 #endif
91 #ifndef TARGET_F_SETSIG
92 #define TARGET_F_SETSIG        10      /*  for sockets. */
93 #define TARGET_F_GETSIG        11      /*  for sockets. */
94 #endif
95 
96 #ifndef TARGET_F_GETLK64
97 #define TARGET_F_GETLK64       12      /*  using 'struct flock64' */
98 #define TARGET_F_SETLK64       13
99 #define TARGET_F_SETLKW64      14
100 #endif
101 
102 #ifndef TARGET_F_SETOWN_EX
103 #define TARGET_F_SETOWN_EX     15
104 #define TARGET_F_GETOWN_EX     16
105 #endif
106 
107 struct target_f_owner_ex {
108         int type;       /* Owner type of ID.  */
109         int pid;        /* ID of owner.  */
110 };
111 
112 #ifndef TARGET_F_RDLCK
113 #define TARGET_F_RDLCK         0
114 #define TARGET_F_WRLCK         1
115 #define TARGET_F_UNLCK         2
116 #endif
117 
118 #ifndef TARGET_F_EXLCK
119 #define TARGET_F_EXLCK         4
120 #define TARGET_F_SHLCK         8
121 #endif
122 
123 #ifndef TARGET_HAVE_ARCH_STRUCT_FLOCK
124 #ifndef TARGET_ARCH_FLOCK_PAD
125 #define TARGET_ARCH_FLOCK_PAD
126 #endif
127 
128 struct target_flock {
129     short l_type;
130     short l_whence;
131     abi_long l_start;
132     abi_long l_len;
133     int l_pid;
134     TARGET_ARCH_FLOCK_PAD
135 };
136 #endif
137 
138 #ifndef TARGET_HAVE_ARCH_STRUCT_FLOCK64
139 #ifndef TARGET_ARCH_FLOCK64_PAD
140 #define TARGET_ARCH_FLOCK64_PAD
141 #endif
142 
143 struct target_flock64 {
144     abi_short l_type;
145     abi_short l_whence;
146     abi_llong l_start;
147     abi_llong l_len;
148     abi_int   l_pid;
149     TARGET_ARCH_FLOCK64_PAD
150 };
151 #endif
152 
153 #endif
154