(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / sysdeps / unix / sysv / linux / sparc / bits / fcntl.h
blob5dc8bf32f033fefb7f04c96946a2d31e3e64c13d
1 /* O_*, F_*, FD_* bit values for Linux/SPARC.
2 Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004
3 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
21 #ifndef _FCNTL_H
22 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
23 #endif
25 #include <sys/types.h>
26 #include <bits/wordsize.h>
28 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
29 located on an ext2 file system */
30 #define O_RDONLY 0x0000
31 #define O_WRONLY 0x0001
32 #define O_RDWR 0x0002
33 #define O_ACCMODE 0x0003
34 #define O_APPEND 0x0008
35 #define O_ASYNC 0x0040
36 #define O_CREAT 0x0200 /* not fcntl */
37 #define O_TRUNC 0x0400 /* not fcntl */
38 #define O_EXCL 0x0800 /* not fcntl */
39 #define O_SYNC 0x2000
40 #define O_NONBLOCK 0x4000
41 #define O_NDELAY (0x0004 | O_NONBLOCK)
42 #define O_NOCTTY 0x8000 /* not fcntl */
44 #ifdef __USE_GNU
45 # define O_DIRECTORY 0x10000 /* must be a directory */
46 # define O_NOFOLLOW 0x20000 /* don't follow links */
47 # define O_DIRECT 0x100000 /* direct disk access hint */
48 # define O_NOATIME 0x200000 /* Do not set atime. */
49 #endif
51 #ifdef __USE_LARGEFILE64
52 # if __WORDSIZE == 64
53 # define O_LARGEFILE 0
54 # else
55 # define O_LARGEFILE 0x40000
56 # endif
57 #endif
59 /* For now Linux has no synchronisity options for data and read
60 operations. We define the symbols here but let them do the same as
61 O_SYNC since this is a superset. */
62 #if defined __USE_POSIX199309 || defined __USE_UNIX98
63 # define O_DSYNC O_SYNC /* Synchronize data. */
64 # define O_RSYNC O_SYNC /* Synchronize read operations. */
65 #endif
67 /* For now Linux has synchronisity options for data and read operations.
68 We define the symbols here but let them do the same as O_SYNC since
69 this is a superset. */
70 #if defined __USE_POSIX199309 || defined __USE_UNIX98
71 # define O_DSYNC O_SYNC /* Synchronize data. */
72 # define O_RSYNC O_SYNC /* Synchronize read operations. */
73 #endif
75 /* Values for the second argument to `fcntl'. */
76 #define F_DUPFD 0 /* Duplicate file descriptor. */
77 #define F_GETFD 1 /* Get file descriptor flags. */
78 #define F_SETFD 2 /* Set file descriptor flags. */
79 #define F_GETFL 3 /* Get file status flags. */
80 #define F_SETFL 4 /* Set file status flags. */
81 #if defined __USE_BSD || defined __USE_UNIX98
82 # define F_GETOWN 5 /* Get owner of socket (receiver of SIGIO). */
83 # define F_SETOWN 6 /* Set owner of socket (receiver of SIGIO). */
84 #endif
85 #ifndef __USE_FILE_OFFSET64
86 # define F_GETLK 7 /* Get record locking info. */
87 # define F_SETLK 8 /* Set record locking info (non-blocking). */
88 # define F_SETLKW 9 /* Set record locking info (blocking). */
89 #else
90 # define F_GETLK F_GETLK64 /* Get record locking info. */
91 # define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
92 # define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
93 #endif
95 #ifdef __USE_GNU
96 # define F_SETSIG 10 /* Set number of signal to be sent. */
97 # define F_GETSIG 11 /* Get number of signal to be sent. */
98 #endif
100 #ifdef __USE_GNU
101 # define F_SETLEASE 1024 /* Set a lease. */
102 # define F_GETLEASE 1025 /* Enquire what lease is active. */
103 # define F_NOTIFY 1026 /* Request notfications on a directory. */
104 #endif
106 #if __WORDSIZE == 64
107 # define F_GETLK64 7 /* Get record locking info. */
108 # define F_SETLK64 8 /* Set record locking info (non-blocking). */
109 # define F_SETLKW64 9 /* Set record locking info (blocking). */
110 #else
111 # define F_GETLK64 12 /* Get record locking info. */
112 # define F_SETLK64 13 /* Set record locking info (non-blocking). */
113 # define F_SETLKW64 14 /* Set record locking info (blocking). */
114 #endif
116 /* for F_[GET|SET]FL */
117 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
119 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
120 #define F_RDLCK 1 /* Read lock. */
121 #define F_WRLCK 2 /* Write lock. */
122 #define F_UNLCK 3 /* Remove lock. */
124 /* for old implementation of bsd flock () */
125 #define F_EXLCK 4 /* or 3 */
126 #define F_SHLCK 8 /* or 4 */
128 #ifdef __USE_BSD
129 /* Operations for bsd flock(), also used by the kernel implementation */
130 # define LOCK_SH 1 /* shared lock */
131 # define LOCK_EX 2 /* exclusive lock */
132 # define LOCK_NB 4 /* or'd with one of the above to prevent
133 blocking */
134 # define LOCK_UN 8 /* remove lock */
135 #endif
137 #ifdef __USE_GNU
138 # define LOCK_MAND 32 /* This is a mandatory flock: */
139 # define LOCK_READ 64 /* ... which allows concurrent read operations. */
140 # define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
141 # define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
142 #endif
144 #ifdef __USE_GNU
145 /* Types of directory notifications that may be requested with F_NOTIFY. */
146 # define DN_ACCESS 0x00000001 /* File accessed. */
147 # define DN_MODIFY 0x00000002 /* File modified. */
148 # define DN_CREATE 0x00000004 /* File created. */
149 # define DN_DELETE 0x00000008 /* File removed. */
150 # define DN_RENAME 0x00000010 /* File renamed. */
151 # define DN_ATTRIB 0x00000020 /* File changed attibutes. */
152 # define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
153 #endif
155 struct flock
157 short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
158 short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
159 #ifndef __USE_FILE_OFFSET64
160 __off_t l_start; /* Offset where the lock begins. */
161 __off_t l_len; /* Size of the locked area; zero means until EOF. */
162 #else
163 __off64_t l_start; /* Offset where the lock begins. */
164 __off64_t l_len; /* Size of the locked area; zero means until EOF. */
165 #endif
166 __pid_t l_pid; /* Process holding the lock. */
167 short int __unused;
170 #ifdef __USE_LARGEFILE64
171 struct flock64
173 short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
174 short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
175 __off64_t l_start; /* Offset where the lock begins. */
176 __off64_t l_len; /* Size of the locked area; zero means until EOF. */
177 __pid_t l_pid; /* Process holding the lock. */
178 short int __unused;
180 #endif
182 /* Define some more compatibility macros to be backward compatible with
183 BSD systems which did not managed to hide these kernel macros. */
184 #ifdef __USE_BSD
185 # define FAPPEND O_APPEND
186 # define FFSYNC O_FSYNC
187 # define FASYNC O_ASYNC
188 # define FNONBLOCK O_NONBLOCK
189 # define FNDELAY O_NDELAY
190 #endif /* Use BSD. */
192 /* Advise to `posix_fadvise'. */
193 #ifdef __USE_XOPEN2K
194 # define POSIX_FADV_NORMAL 0 /* No further special treatment. */
195 # define POSIX_FADV_RANDOM 1 /* Expect random page references. */
196 # define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
197 # define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
198 # define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
199 # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
200 #endif
202 __BEGIN_DECLS
204 /* Provide kernel hint to read ahead. */
205 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
206 __THROW;
208 __END_DECLS