xref: /openbmc/qemu/linux-user/generic/fcntl.h (revision ffe98631)
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 #define TARGET_F_OFD_GETLK     36
103 #define TARGET_F_OFD_SETLK     37
104 #define TARGET_F_OFD_SETLKW    38
105 
106 #ifndef TARGET_F_SETOWN_EX
107 #define TARGET_F_SETOWN_EX     15
108 #define TARGET_F_GETOWN_EX     16
109 #endif
110 
111 struct target_f_owner_ex {
112         int type;       /* Owner type of ID.  */
113         int pid;        /* ID of owner.  */
114 };
115 
116 #ifndef TARGET_F_RDLCK
117 #define TARGET_F_RDLCK         0
118 #define TARGET_F_WRLCK         1
119 #define TARGET_F_UNLCK         2
120 #endif
121 
122 #ifndef TARGET_HAVE_ARCH_STRUCT_FLOCK
123 #ifndef TARGET_ARCH_FLOCK_PAD
124 #define TARGET_ARCH_FLOCK_PAD
125 #endif
126 
127 struct target_flock {
128     short l_type;
129     short l_whence;
130     abi_long l_start;
131     abi_long l_len;
132     int l_pid;
133     TARGET_ARCH_FLOCK_PAD
134 };
135 #endif
136 
137 #ifndef TARGET_HAVE_ARCH_STRUCT_FLOCK64
138 #ifndef TARGET_ARCH_FLOCK64_PAD
139 #define TARGET_ARCH_FLOCK64_PAD
140 #endif
141 
142 struct target_flock64 {
143     abi_short l_type;
144     abi_short l_whence;
145     abi_llong l_start;
146     abi_llong l_len;
147     abi_int   l_pid;
148     TARGET_ARCH_FLOCK64_PAD
149 };
150 #endif
151 
152 #endif
153