1 /* O_*, F_*, FD_* bit values for Linux.
2 Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
21 #define _FCNTLBITS_H 1
23 #include <sys/types.h>
26 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
27 located on an ext2 file system */
28 #define O_ACCMODE 0003
32 #define O_CREAT 01000 /* not fcntl */
33 #define O_TRUNC 02000 /* not fcntl */
34 #define O_EXCL 04000 /* not fcntl */
35 #define O_NOCTTY 010000 /* not fcntl */
37 #define O_NONBLOCK 00004
38 #define O_APPEND 00010
39 #define O_NDELAY O_NONBLOCK
41 #define FASYNC 020000 /* fcntl, for BSD compatibility */
43 #define F_DUPFD 0 /* dup */
44 #define F_GETFD 1 /* get f_flags */
45 #define F_SETFD 2 /* set f_flags */
46 #define F_GETFL 3 /* more flags (cloexec) */
52 #define F_SETOWN 5 /* for sockets. */
53 #define F_GETOWN 6 /* for sockets. */
55 /* for F_[GET|SET]FL */
56 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
58 /* for posix fcntl() and lockf() */
63 /* for old implementation of bsd flock () */
64 #define F_EXLCK 16 /* or 3 */
65 #define F_SHLCK 32 /* or 4 */
67 /* operations for bsd flock(), also used by the kernel implementation */
68 #define LOCK_SH 1 /* shared lock */
69 #define LOCK_EX 2 /* exclusive lock */
70 #define LOCK_NB 4 /* or'd with one of the above to prevent
72 #define LOCK_UN 8 /* remove lock */
84 /* Define some more compatibility macros to be backward compatible with
85 BSD systems which did not managed to hide these kernel macros. */
87 #define FAPPEND O_APPEND
88 #define FFSYNC O_FSYNC
89 #define FNONBLOCK O_NONBLOCK
90 #define FNDELAY O_NDELAY
93 #endif /* fcntlbits.h */