]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/avr32/bits/fcntl.h
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / libc / sysdeps / linux / avr32 / bits / fcntl.h
1 #ifndef _FCNTL_H
2 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
3 #endif
4
5 #include <sys/types.h>
6 #ifdef __USE_GNU
7 # include <bits/uio.h>
8 #endif
9
10 /*
11  * open/fcntl - O_SYNC is only implemented on blocks devices and on files
12  * located on an ext2 file system
13  */
14 #define O_ACCMODE       00000003
15 #define O_RDONLY        00000000
16 #define O_WRONLY        00000001
17 #define O_RDWR          00000002
18 #define O_CREAT         00000100        /* not fcntl */
19 #define O_EXCL          00000200        /* not fcntl */
20 #define O_NOCTTY        00000400        /* not fcntl */
21 #define O_TRUNC         00001000        /* not fcntl */
22 #define O_APPEND        00002000
23 #define O_NONBLOCK      00004000
24 #define O_NDELAY        O_NONBLOCK
25 #define O_SYNC          00010000
26 #define O_ASYNC         00020000
27
28 #ifdef __USE_GNU
29 # define O_DIRECT       00040000        /* must be a directory */
30 # define O_DIRECTORY    00200000        /* direct disk access */
31 # define O_NOFOLLOW     00400000        /* don't follow links */
32 # define O_NOATIME      01000000        /* don't set atime */
33 # define O_CLOEXEC      02000000        /* set close_on_exec */
34 #endif
35
36 #ifdef __USE_LARGEFILE64
37 # define O_LARGEFILE    00100000
38 #endif
39
40 /* For now Linux has synchronisity options for data and read operations.
41    We define the symbols here but let them do the same as O_SYNC since
42    this is a superset.  */
43 #if defined __USE_POSIX199309 || defined __USE_UNIX98
44 # define O_DSYNC        O_SYNC  /* Synchronize data.  */
45 # define O_RSYNC        O_SYNC  /* Synchronize read operations.  */
46 #endif
47
48 #define F_DUPFD         0       /* dup */
49 #define F_GETFD         1       /* get close_on_exec */
50 #define F_SETFD         2       /* set/clear close_on_exec */
51 #define F_GETFL         3       /* get file->f_flags */
52 #define F_SETFL         4       /* set file->f_flags */
53
54 #ifndef __USE_FILE_OFFSET64
55 # define F_GETLK        5
56 # define F_SETLK        6
57 # define F_SETLKW       7
58 #else
59 # define F_GETLK        F_GETLK64
60 # define F_SETLK        F_SETLK64
61 # define F_SETLKW       F_SETLKW64
62 #endif
63 #define F_GETLK64       12      /*  using 'struct flock64' */
64 #define F_SETLK64       13
65 #define F_SETLKW64      14
66
67 #if defined __USE_BSD || defined __USE_XOPEN2K
68 # define F_SETOWN       8       /*  for sockets. */
69 # define F_GETOWN       9       /*  for sockets. */
70 #endif
71
72 #ifdef __USE_GNU
73 # define F_SETSIG       10      /*  for sockets. */
74 # define F_GETSIG       11      /*  for sockets. */
75 #endif
76
77 #ifdef __USE_GNU
78 # define F_SETLEASE     1024    /* Set a lease.  */
79 # define F_GETLEASE     1025    /* Enquire what lease is active.  */
80 # define F_NOTIFY       1026    /* Request notfications on a directory.  */
81 #endif
82
83 /* for F_[GET|SET]FL */
84 #define FD_CLOEXEC      1       /* actually anything with low bit set goes */
85
86 /* for posix fcntl() and lockf() */
87 #define F_RDLCK         0
88 #define F_WRLCK         1
89 #define F_UNLCK         2
90
91 /* for old implementation of bsd flock () */
92 #define F_EXLCK         4       /* or 3 */
93 #define F_SHLCK         8       /* or 4 */
94
95 /* for leases */
96 #define F_INPROGRESS    16
97
98 #ifdef __USE_BSD
99 /* operations for bsd flock(), also used by the kernel implementation */
100 # define LOCK_SH        1       /* shared lock */
101 # define LOCK_EX        2       /* exclusive lock */
102 # define LOCK_NB        4       /* or'd with one of the above to prevent
103                                    blocking */
104 # define LOCK_UN        8       /* remove lock */
105 #endif
106
107 #ifdef __USE_GNU
108 # define LOCK_MAND      32      /* This is a mandatory flock */
109 # define LOCK_READ      64      /* ... Which allows concurrent
110                                        read operations */
111 # define LOCK_WRITE     128     /* ... Which allows concurrent
112                                        write operations */
113 # define LOCK_RW        192     /* ... Which allows concurrent
114                                        read & write ops */
115 #endif
116
117 #ifdef __USE_GNU
118 /* Types of directory notifications that may be requested with F_NOTIFY.  */
119 # define DN_ACCESS      0x00000001      /* File accessed.  */
120 # define DN_MODIFY      0x00000002      /* File modified.  */
121 # define DN_CREATE      0x00000004      /* File created.  */
122 # define DN_DELETE      0x00000008      /* File removed.  */
123 # define DN_RENAME      0x00000010      /* File renamed.  */
124 # define DN_ATTRIB      0x00000020      /* File changed attibutes.  */
125 # define DN_MULTISHOT   0x80000000      /* Don't remove notifier.  */
126 #endif
127
128 struct flock {
129         short           l_type;
130         short           l_whence;
131 #ifndef __USE_FILE_OFFSET64
132         __off_t         l_start;
133         __off_t         l_len;
134 #else
135         __off64_t       l_start;
136         __off64_t       l_len;
137 #endif
138         __pid_t         l_pid;
139 };
140
141 #ifdef __USE_LARGEFILE64
142 struct flock64 {
143         short           l_type;
144         short           l_whence;
145         __off64_t       l_start;
146         __off64_t       l_len;
147         __pid_t         l_pid;
148 };
149 #endif
150
151 /* Define some more compatibility macros to be backward compatible with
152  *    BSD systems which did not managed to hide these kernel macros.  */
153 #ifdef  __USE_BSD
154 # define FAPPEND        O_APPEND
155 # define FFSYNC         O_FSYNC
156 # define FASYNC         O_ASYNC
157 # define FNONBLOCK      O_NONBLOCK
158 # define FNDELAY        O_NDELAY
159 #endif /* Use BSD.  */
160
161 /* Advise to `posix_fadvise'.  */
162 #ifdef __USE_XOPEN2K
163 # define POSIX_FADV_NORMAL      0 /* No further special treatment.  */
164 # define POSIX_FADV_RANDOM      1 /* Expect random page references.  */
165 # define POSIX_FADV_SEQUENTIAL  2 /* Expect sequential page references.  */
166 # define POSIX_FADV_WILLNEED    3 /* Will need these pages.  */
167 # define POSIX_FADV_DONTNEED    4 /* Don't need these pages.  */
168 # define POSIX_FADV_NOREUSE     5 /* Data will be accessed once.  */
169 #endif
170
171
172 #if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__
173 /* Flags for SYNC_FILE_RANGE.  */
174 # define SYNC_FILE_RANGE_WAIT_BEFORE    1 /* Wait upon writeout of all pages
175                                              in the range before performing
176                                              the write */
177 # define SYNC_FILE_RANGE_WRITE          2 /* Initiate writeout of all those
178                                              dirty pages in the range which are
179                                              not presently under writeback */
180 # define SYNC_FILE_RANGE_WAIT_AFTER     4 /* Wait upon writeout of all pages
181                                              in the range after performing the
182                                              write */
183
184 /* Flags for splice() and vmsplice() */
185 # define SPLICE_F_MOVE          1       /* Move pages instead of copying */
186 # define SPLICE_F_NONBLOCK      2       /* Don't block on the pipe splicing
187                                            (but we may still block on the fd
188                                            we splice from/to) */
189 # define SPLICE_F_MORE          4       /* Expect more data */
190 # define SPLICE_F_GIFT          8       /* Pages passed in are a gift */
191
192 __BEGIN_DECLS
193
194 /* Provide kernel hint to read ahead. */
195 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW;
196
197 /* Selective file content synch'ing */
198 extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
199                             unsigned int __flags);
200
201 /* Splice address range into a pipe */
202 extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
203                          size_t __count, unsigned int __flags);
204
205 /* Splice two files together */
206 extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
207                        __off64_t *__offout, size_t __len,
208                        unsigned int __flags);
209
210 /* In-kernel implementation of tee for pipe buffers */
211 extern ssize_t tee (int __fdin, int __fdout, size_t __len,
212                     unsigned int __flags);
213
214 __END_DECLS
215 #endif