Test for stack alignment.
[jlayton/glibc.git] / sysdeps / unix / sysv / linux / hppa / bits / fcntl.h
1 /* O_*, F_*, FD_* bit values for Linux/HPPA.
2    Copyright (C) 1995,1996,1997,1998,1999,2000,2002,2004
3         Free Software Foundation, Inc.
4    This file is part of the GNU C Library.
5
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.
10
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.
15
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.  */
20
21 #ifndef _FCNTL_H
22 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
23 #endif
24
25 #include <sys/types.h>
26
27
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        00000000
31 #define O_WRONLY        00000001
32 #define O_RDWR          00000002
33 #define O_ACCMODE       00000003
34 #define O_APPEND        00000010
35 #define O_BLKSEEK       00000100 /* HPUX only */
36 #define O_CREAT         00000400 /* not fcntl */
37 #define O_TRUNC         00001000 /* not fcntl */
38 #define O_EXCL          00002000 /* not fcntl */
39 #define O_ASYNC         00020000
40 #define O_SYNC          00100000
41 #define O_NONBLOCK      00200004 /* HPUX has separate NDELAY & NONBLOCK */
42 #define O_NDELAY        O_NONBLOCK
43 #define O_NOCTTY        00400000 /* not fcntl */
44
45
46 #ifdef __USE_GNU
47 # define O_DIRECT       00040000 /* direct disk access hint - currently ignored */
48 # define O_DIRECTORY    00010000 /* must be a directory */
49 # define O_NOFOLLOW     00000200 /* don't follow links */
50 # define O_NOATIME      04000000 /* Do not set atime.  */
51 #endif
52
53 #ifdef __USE_LARGEFILE64
54 # define O_LARGEFILE    00004000
55 #endif
56
57 #if defined __USE_POSIX199309 || defined __USE_UNIX98
58 # define O_DSYNC                01000000 /* HPUX only */
59 # define O_RSYNC                02000000 /* HPUX only */
60 #endif
61
62 /* Values for the second argument to `fcntl'.  */
63 #define F_DUPFD         0       /* Duplicate file descriptor.  */
64 #define F_GETFD         1       /* Get file descriptor flags.  */
65 #define F_SETFD         2       /* Set file descriptor flags.  */
66 #define F_GETFL         3       /* Get file status flags.  */
67 #define F_SETFL         4       /* Set file status flags.  */
68 #ifndef __USE_FILE_OFFSET64
69 # define F_GETLK        5       /* Get record locking info.  */
70 # define F_SETLK        6       /* Set record locking info (non-blocking).  */
71 # define F_SETLKW       7       /* Set record locking info (blocking).  */
72 #else
73 # define F_GETLK        F_GETLK64 /* Get record locking info.  */
74 # define F_SETLK        F_SETLK64 /* Set record locking info (non-blocking). */
75 # define F_SETLKW       F_SETLKW64 /* Set record locking info (blocking).  */
76 #endif
77
78 #define F_GETLK64       8       /* Get record locking info.  */
79 #define F_SETLK64       9       /* Set record locking info (non-blocking).  */
80 #define F_SETLKW64      10      /* Set record locking info (blocking).  */
81
82 #if defined __USE_BSD || defined __USE_UNIX98
83 # define F_GETOWN       11      /* Get owner of socket (receiver of SIGIO).  */
84 # define F_SETOWN       12      /* Set owner of socket (receiver of SIGIO).  */
85 #endif
86
87 #ifdef __USE_GNU
88 # define F_SETSIG       13      /* Set number of signal to be sent.  */
89 # define F_GETSIG       14      /* Get number of signal to be sent.  */
90 #endif
91
92 #ifdef __USE_GNU
93 # define F_SETLEASE     1024    /* Set a lease.  */
94 # define F_GETLEASE     1025    /* Enquire what lease is active.  */
95 # define F_NOTIFY       1026    /* Request notfications on a directory.  */
96 #endif
97
98 /* for F_[GET|SET]FL */
99 #define FD_CLOEXEC      1       /* actually anything with low bit set goes */
100
101 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
102 #define F_RDLCK         1       /* Read lock.  */
103 #define F_WRLCK         2       /* Write lock.  */
104 #define F_UNLCK         3       /* Remove lock.  */
105
106 /* for old implementation of bsd flock () */
107 #define F_EXLCK         4       /* or 3 */
108 #define F_SHLCK         8       /* or 4 */
109
110 #ifdef __USE_BSD
111 /* operations for bsd flock(), also used by the kernel implementation */
112 # define LOCK_SH        1       /* shared lock */
113 # define LOCK_EX        2       /* exclusive lock */
114 # define LOCK_NB        4       /* or'd with one of the above to prevent
115                                    blocking */
116 # define LOCK_UN        8       /* remove lock */
117 #endif
118
119 #ifdef __USE_GNU
120 /* Types of directory notifications that may be requested with F_NOTIFY.  */
121 # define DN_ACCESS      0x00000001      /* File accessed.  */
122 # define DN_MODIFY      0x00000002      /* File modified.  */
123 # define DN_CREATE      0x00000004      /* File created.  */
124 # define DN_DELETE      0x00000008      /* File removed.  */
125 # define DN_RENAME      0x00000010      /* File renamed.  */
126 # define DN_ATTRIB      0x00000020      /* File changed attibutes.  */
127 # define DN_MULTISHOT   0x80000000      /* Don't remove notifier.  */
128 #endif
129
130 struct flock
131   {
132     short int l_type;   /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
133     short int l_whence; /* Where `l_start' is relative to (like `lseek').  */
134 #ifndef __USE_FILE_OFFSET64
135     __off_t l_start;    /* Offset where the lock begins.  */
136     __off_t l_len;      /* Size of the locked area; zero means until EOF.  */
137 #else
138     __off64_t l_start;  /* Offset where the lock begins.  */
139     __off64_t l_len;    /* Size of the locked area; zero means until EOF.  */
140 #endif
141     __pid_t l_pid;      /* Process holding the lock.  */
142   };
143
144 #ifdef __USE_LARGEFILE64
145 struct flock64
146   {
147     short int l_type;   /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
148     short int l_whence; /* Where `l_start' is relative to (like `lseek').  */
149     __off64_t l_start;  /* Offset where the lock begins.  */
150     __off64_t l_len;    /* Size of the locked area; zero means until EOF.  */
151     __pid_t l_pid;      /* Process holding the lock.  */
152   };
153 #endif
154
155 /* Define some more compatibility macros to be backward compatible with
156    BSD systems which did not managed to hide these kernel macros.  */
157 #ifdef  __USE_BSD
158 # define FAPPEND        O_APPEND
159 # define FFSYNC         O_FSYNC
160 # define FASYNC         O_ASYNC
161 # define FNONBLOCK      O_NONBLOCK
162 # define FNDELAY        O_NDELAY
163 #endif /* Use BSD.  */
164
165 /* Advise to `posix_fadvise'.  */
166 #ifdef __USE_XOPEN2K
167 # define POSIX_FADV_NORMAL      0 /* No further special treatment.  */
168 # define POSIX_FADV_RANDOM      1 /* Expect random page references.  */
169 # define POSIX_FADV_SEQUENTIAL  2 /* Expect sequential page references.  */
170 # define POSIX_FADV_WILLNEED    3 /* Will need these pages.  */
171 # define POSIX_FADV_DONTNEED    4 /* Don't need these pages.  */
172 # define POSIX_FADV_NOREUSE     5 /* Data will be accessed once.  */
173 #endif
174
175 __BEGIN_DECLS
176
177 /* Provide kernel hint to read ahead.  */
178 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
179     __THROW;
180
181 __END_DECLS