mips64: time64 for n32 ABI breaks a lot of tests, disable it for now
[uclibc-ng.git] / libc / sysdeps / linux / sparc64 / bits / fcntl.h
blob00e91a671b051da3c5c67e7f149b6973c7b38264
1 /* O_*, F_*, FD_* bit values for Linux/SPARC64.
2 Copyright (C) 1995-2017 Free Software Foundation, Inc.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
18 #ifndef _FCNTL_H
19 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
20 #endif
22 #include <sys/types.h>
23 #ifdef __USE_GNU
24 # include <bits/uio.h>
25 #endif
27 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
28 located on an ext2 file system */
29 #define O_RDONLY 0x0000
30 #define O_WRONLY 0x0001
31 #define O_RDWR 0x0002
32 #define O_ACCMODE 0x0003
33 #define O_APPEND 0x0008
34 #define O_ASYNC 0x0040
35 #define O_CREAT 0x0200 /* not fcntl */
36 #define O_TRUNC 0x0400 /* not fcntl */
37 #define O_EXCL 0x0800 /* not fcntl */
38 #define O_SYNC 0x2000
39 #define O_NONBLOCK 0x4000
40 #define O_NDELAY (0x0004 | O_NONBLOCK)
41 #define O_NOCTTY 0x8000 /* not fcntl */
43 #ifdef __USE_GNU
44 # define O_DIRECTORY 0x10000 /* must be a directory */
45 # define O_NOFOLLOW 0x20000 /* don't follow links */
46 # define O_DIRECT 0x100000 /* direct disk access hint */
47 # define O_NOATIME 0x200000 /* Do not set atime. */
48 # define O_CLOEXEC 0x400000 /* Set close_on_exit. */
49 # define O_PATH 0x1000000 /* Resolve pathname but do not open file. */
50 # define O_TMPFILE 0x2010000 /* Atomically create nameless file. */
51 #endif
53 #ifdef __USE_LARGEFILE64
54 # define O_LARGEFILE 0
55 #endif
57 /* For now Linux has no synchronisity options for data and read
58 operations. We define the symbols here but let them do the same as
59 O_SYNC since this is a superset. */
60 #if defined __USE_POSIX199309 || defined __USE_UNIX98
61 # define O_DSYNC O_SYNC /* Synchronize data. */
62 # define O_RSYNC O_SYNC /* Synchronize read operations. */
63 #endif
65 /* For now Linux has synchronisity options for data and read operations.
66 We define the symbols here but let them do the same as O_SYNC since
67 this is a superset. */
68 #if defined __USE_POSIX199309 || defined __USE_UNIX98
69 # define O_DSYNC O_SYNC /* Synchronize data. */
70 # define O_RSYNC O_SYNC /* Synchronize read operations. */
71 #endif
73 /* Values for the second argument to `fcntl'. */
74 #define F_DUPFD 0 /* Duplicate file descriptor. */
75 #define F_GETFD 1 /* Get file descriptor flags. */
76 #define F_SETFD 2 /* Set file descriptor flags. */
77 #define F_GETFL 3 /* Get file status flags. */
78 #define F_SETFL 4 /* Set file status flags. */
79 #if defined __USE_BSD || defined __USE_UNIX98
80 # define F_GETOWN 5 /* Get owner of socket (receiver of SIGIO). */
81 # define F_SETOWN 6 /* Set owner of socket (receiver of SIGIO). */
82 #endif
83 #ifndef __USE_FILE_OFFSET64
84 # define F_GETLK 7 /* Get record locking info. */
85 # define F_SETLK 8 /* Set record locking info (non-blocking). */
86 # define F_SETLKW 9 /* Set record locking info (blocking). */
87 #else
88 # define F_GETLK F_GETLK64 /* Get record locking info. */
89 # define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
90 # define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
91 #endif
93 #ifdef __USE_GNU
94 # define F_SETSIG 10 /* Set number of signal to be sent. */
95 # define F_GETSIG 11 /* Get number of signal to be sent. */
96 #endif
98 #ifdef __USE_GNU
99 # define F_SETLEASE 1024 /* Set a lease. */
100 # define F_GETLEASE 1025 /* Enquire what lease is active. */
101 # define F_NOTIFY 1026 /* Request notfications on a directory. */
102 # define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
103 # define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
104 #endif
105 #if defined __USE_XOPEN2K8 || defined __USE_GNU
106 # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
107 close-on-exit set on new fd. */
108 #endif
110 #define F_GETLK64 7 /* Get record locking info. */
111 #define F_SETLK64 8 /* Set record locking info (non-blocking). */
112 #define F_SETLKW64 9 /* Set record locking info (blocking). */
114 /* for F_[GET|SET]FD */
115 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
117 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
118 #define F_RDLCK 1 /* Read lock. */
119 #define F_WRLCK 2 /* Write lock. */
120 #define F_UNLCK 3 /* Remove lock. */
122 /* for old implementation of bsd flock () */
123 #define F_EXLCK 4 /* or 3 */
124 #define F_SHLCK 8 /* or 4 */
126 #ifdef __USE_BSD
127 /* Operations for bsd flock(), also used by the kernel implementation */
128 # define LOCK_SH 1 /* shared lock */
129 # define LOCK_EX 2 /* exclusive lock */
130 # define LOCK_NB 4 /* or'd with one of the above to prevent
131 blocking */
132 # define LOCK_UN 8 /* remove lock */
133 #endif
135 #ifdef __USE_GNU
136 # define LOCK_MAND 32 /* This is a mandatory flock: */
137 # define LOCK_READ 64 /* ... which allows concurrent read operations. */
138 # define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
139 # define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
140 #endif
142 #ifdef __USE_GNU
143 /* Types of directory notifications that may be requested with F_NOTIFY. */
144 # define DN_ACCESS 0x00000001 /* File accessed. */
145 # define DN_MODIFY 0x00000002 /* File modified. */
146 # define DN_CREATE 0x00000004 /* File created. */
147 # define DN_DELETE 0x00000008 /* File removed. */
148 # define DN_RENAME 0x00000010 /* File renamed. */
149 # define DN_ATTRIB 0x00000020 /* File changed attibutes. */
150 # define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
151 #endif
153 struct flock
155 short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
156 short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
157 #ifndef __USE_FILE_OFFSET64
158 __off_t l_start; /* Offset where the lock begins. */
159 __off_t l_len; /* Size of the locked area; zero means until EOF. */
160 #else
161 __off64_t l_start; /* Offset where the lock begins. */
162 __off64_t l_len; /* Size of the locked area; zero means until EOF. */
163 #endif
164 __pid_t l_pid; /* Process holding the lock. */
165 short int __uclibc_unused;
168 #ifdef __USE_LARGEFILE64
169 struct flock64
171 short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
172 short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
173 __off64_t l_start; /* Offset where the lock begins. */
174 __off64_t l_len; /* Size of the locked area; zero means until EOF. */
175 __pid_t l_pid; /* Process holding the lock. */
176 short int __uclibc_unused;
178 #endif
180 /* Define some more compatibility macros to be backward compatible with
181 BSD systems which did not managed to hide these kernel macros. */
182 #ifdef __USE_BSD
183 # define FAPPEND O_APPEND
184 # define FFSYNC O_FSYNC
185 # define FASYNC O_ASYNC
186 # define FNONBLOCK O_NONBLOCK
187 # define FNDELAY O_NDELAY
188 #endif /* Use BSD. */
190 /* Advise to `posix_fadvise'. */
191 #ifdef __USE_XOPEN2K
192 # define POSIX_FADV_NORMAL 0 /* No further special treatment. */
193 # define POSIX_FADV_RANDOM 1 /* Expect random page references. */
194 # define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
195 # define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
196 # define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
197 # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
198 #endif
201 #if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__
202 /* Flags for SYNC_FILE_RANGE. */
203 # define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
204 in the range before performing the
205 write. */
206 # define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
207 dirty pages in the range which are
208 not presently under writeback. */
209 # define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
210 the range after performing the
211 write. */
213 /* Flags for SPLICE and VMSPLICE. */
214 # define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
215 # define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
216 (but we may still block on the fd
217 we splice from/to). */
218 # define SPLICE_F_MORE 4 /* Expect more data. */
219 # define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
220 #endif
222 __BEGIN_DECLS
224 #if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__
226 /* Provide kernel hint to read ahead. */
227 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
228 __THROW;
231 /* Selective file content synch'ing. */
232 extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
233 unsigned int __flags);
235 /* Splice address range into a pipe. */
236 extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
237 size_t __count, unsigned int __flags);
239 /* Splice two files together. */
240 extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
241 __off64_t *__offout, size_t __len,
242 unsigned int __flags);
244 /* In-kernel implementation of tee for pipe buffers. */
245 extern ssize_t tee (int __fdin, int __fdout, size_t __len,
246 unsigned int __flags);
248 #endif
249 __END_DECLS
251 /* Include generic Linux declarations. */
252 #include <bits/fcntl-linux.h>