1 | #ifndef _FCNTL_H
|
---|
2 | #define _FCNTL_H
|
---|
3 |
|
---|
4 | #ifdef __cplusplus
|
---|
5 | extern "C" {
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | #include <features.h>
|
---|
9 |
|
---|
10 | #define __NEED_off_t
|
---|
11 | #define __NEED_pid_t
|
---|
12 | #define __NEED_mode_t
|
---|
13 |
|
---|
14 | #ifdef _GNU_SOURCE
|
---|
15 | #define __NEED_size_t
|
---|
16 | #define __NEED_ssize_t
|
---|
17 | #define __NEED_struct_iovec
|
---|
18 | #endif
|
---|
19 |
|
---|
20 | #include <bits/alltypes.h>
|
---|
21 |
|
---|
22 | #include <bits/fcntl.h>
|
---|
23 |
|
---|
24 | struct flock {
|
---|
25 | short l_type;
|
---|
26 | short l_whence;
|
---|
27 | off_t l_start;
|
---|
28 | off_t l_len;
|
---|
29 | pid_t l_pid;
|
---|
30 | };
|
---|
31 |
|
---|
32 | int creat(const char *, mode_t);
|
---|
33 | int fcntl(int, int, ...);
|
---|
34 | int open(const char *, int, ...);
|
---|
35 | int openat(int, const char *, int, ...);
|
---|
36 | int posix_fadvise(int, off_t, off_t, int);
|
---|
37 | int posix_fallocate(int, off_t, off_t);
|
---|
38 |
|
---|
39 | #define O_SEARCH O_PATH
|
---|
40 | #define O_EXEC O_PATH
|
---|
41 |
|
---|
42 | #define O_ACCMODE (03|O_SEARCH)
|
---|
43 | #define O_RDONLY 00
|
---|
44 | #define O_WRONLY 01
|
---|
45 | #define O_RDWR 02
|
---|
46 |
|
---|
47 | #define F_OFD_GETLK 36
|
---|
48 | #define F_OFD_SETLK 37
|
---|
49 | #define F_OFD_SETLKW 38
|
---|
50 |
|
---|
51 | #define F_DUPFD_CLOEXEC 1030
|
---|
52 |
|
---|
53 | #define F_RDLCK 0
|
---|
54 | #define F_WRLCK 1
|
---|
55 | #define F_UNLCK 2
|
---|
56 |
|
---|
57 | #define FD_CLOEXEC 1
|
---|
58 |
|
---|
59 | #define AT_FDCWD (-100)
|
---|
60 | #define AT_SYMLINK_NOFOLLOW 0x100
|
---|
61 | #define AT_REMOVEDIR 0x200
|
---|
62 | #define AT_SYMLINK_FOLLOW 0x400
|
---|
63 | #define AT_EACCESS 0x200
|
---|
64 |
|
---|
65 | #define POSIX_FADV_NORMAL 0
|
---|
66 | #define POSIX_FADV_RANDOM 1
|
---|
67 | #define POSIX_FADV_SEQUENTIAL 2
|
---|
68 | #define POSIX_FADV_WILLNEED 3
|
---|
69 | #define POSIX_FADV_DONTNEED 4
|
---|
70 | #define POSIX_FADV_NOREUSE 5
|
---|
71 |
|
---|
72 | #undef SEEK_SET
|
---|
73 | #undef SEEK_CUR
|
---|
74 | #undef SEEK_END
|
---|
75 | #define SEEK_SET 0
|
---|
76 | #define SEEK_CUR 1
|
---|
77 | #define SEEK_END 2
|
---|
78 |
|
---|
79 | #ifndef S_IRUSR
|
---|
80 | #define S_ISUID 04000
|
---|
81 | #define S_ISGID 02000
|
---|
82 | #define S_ISVTX 01000
|
---|
83 | #define S_IRUSR 0400
|
---|
84 | #define S_IWUSR 0200
|
---|
85 | #define S_IXUSR 0100
|
---|
86 | #define S_IRWXU 0700
|
---|
87 | #define S_IRGRP 0040
|
---|
88 | #define S_IWGRP 0020
|
---|
89 | #define S_IXGRP 0010
|
---|
90 | #define S_IRWXG 0070
|
---|
91 | #define S_IROTH 0004
|
---|
92 | #define S_IWOTH 0002
|
---|
93 | #define S_IXOTH 0001
|
---|
94 | #define S_IRWXO 0007
|
---|
95 | #endif
|
---|
96 |
|
---|
97 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
---|
98 | #define AT_NO_AUTOMOUNT 0x800
|
---|
99 | #define AT_EMPTY_PATH 0x1000
|
---|
100 |
|
---|
101 | #define FAPPEND O_APPEND
|
---|
102 | #define FFSYNC O_SYNC
|
---|
103 | #define FASYNC O_ASYNC
|
---|
104 | #define FNONBLOCK O_NONBLOCK
|
---|
105 | #define FNDELAY O_NDELAY
|
---|
106 |
|
---|
107 | #define F_OK 0
|
---|
108 | #define R_OK 4
|
---|
109 | #define W_OK 2
|
---|
110 | #define X_OK 1
|
---|
111 | #define F_ULOCK 0
|
---|
112 | #define F_LOCK 1
|
---|
113 | #define F_TLOCK 2
|
---|
114 | #define F_TEST 3
|
---|
115 |
|
---|
116 | #define F_SETLEASE 1024
|
---|
117 | #define F_GETLEASE 1025
|
---|
118 | #define F_NOTIFY 1026
|
---|
119 | #define F_CANCELLK 1029
|
---|
120 | #define F_SETPIPE_SZ 1031
|
---|
121 | #define F_GETPIPE_SZ 1032
|
---|
122 | #define F_ADD_SEALS 1033
|
---|
123 | #define F_GET_SEALS 1034
|
---|
124 |
|
---|
125 | #define F_SEAL_SEAL 0x0001
|
---|
126 | #define F_SEAL_SHRINK 0x0002
|
---|
127 | #define F_SEAL_GROW 0x0004
|
---|
128 | #define F_SEAL_WRITE 0x0008
|
---|
129 |
|
---|
130 | #define DN_ACCESS 0x00000001
|
---|
131 | #define DN_MODIFY 0x00000002
|
---|
132 | #define DN_CREATE 0x00000004
|
---|
133 | #define DN_DELETE 0x00000008
|
---|
134 | #define DN_RENAME 0x00000010
|
---|
135 | #define DN_ATTRIB 0x00000020
|
---|
136 | #define DN_MULTISHOT 0x80000000
|
---|
137 |
|
---|
138 | int lockf(int, int, off_t);
|
---|
139 | #endif
|
---|
140 |
|
---|
141 | #if defined(_GNU_SOURCE)
|
---|
142 | #define F_OWNER_TID 0
|
---|
143 | #define F_OWNER_PID 1
|
---|
144 | #define F_OWNER_PGRP 2
|
---|
145 | #define F_OWNER_GID 2
|
---|
146 | struct f_owner_ex {
|
---|
147 | int type;
|
---|
148 | pid_t pid;
|
---|
149 | };
|
---|
150 | #define FALLOC_FL_KEEP_SIZE 1
|
---|
151 | #define FALLOC_FL_PUNCH_HOLE 2
|
---|
152 | #define SYNC_FILE_RANGE_WAIT_BEFORE 1
|
---|
153 | #define SYNC_FILE_RANGE_WRITE 2
|
---|
154 | #define SYNC_FILE_RANGE_WAIT_AFTER 4
|
---|
155 | #define SPLICE_F_MOVE 1
|
---|
156 | #define SPLICE_F_NONBLOCK 2
|
---|
157 | #define SPLICE_F_MORE 4
|
---|
158 | #define SPLICE_F_GIFT 8
|
---|
159 | int fallocate(int, int, off_t, off_t);
|
---|
160 | #define fallocate64 fallocate
|
---|
161 | ssize_t readahead(int, off_t, size_t);
|
---|
162 | int sync_file_range(int, off_t, off_t, unsigned);
|
---|
163 | ssize_t vmsplice(int, const struct iovec *, size_t, unsigned);
|
---|
164 | ssize_t splice(int, off_t *, int, off_t *, size_t, unsigned);
|
---|
165 | ssize_t tee(int, int, size_t, unsigned);
|
---|
166 | #define loff_t off_t
|
---|
167 | #endif
|
---|
168 |
|
---|
169 | #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
|
---|
170 | #define F_GETLK64 F_GETLK
|
---|
171 | #define F_SETLK64 F_SETLK
|
---|
172 | #define F_SETLKW64 F_SETLKW
|
---|
173 | #define flock64 flock
|
---|
174 | #define open64 open
|
---|
175 | #define openat64 openat
|
---|
176 | #define creat64 creat
|
---|
177 | #define lockf64 lockf
|
---|
178 | #define posix_fadvise64 posix_fadvise
|
---|
179 | #define posix_fallocate64 posix_fallocate
|
---|
180 | #define off64_t off_t
|
---|
181 | #endif
|
---|
182 |
|
---|
183 | #ifdef __cplusplus
|
---|
184 | }
|
---|
185 | #endif
|
---|
186 |
|
---|
187 | #endif
|
---|