Update abandoned code for sysdeps/generic demise.
[glibc-ports.git] / sysdeps / unix / sysv / irix4 / bits / fcntl.h
blob5eb7c76eb7256eea2ce2eba5d0f21bd069a7bb75
1 /* O_*, F_*, FD_* bit values for SGI Irix 4.
2 Copyright (C) 1994, 1997, 2004 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 Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the 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 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #ifndef _FCNTL_H
21 #error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
22 #endif
25 /* File access modes for `open' and `fcntl'. */
26 #define O_RDONLY 0 /* Open read-only. */
27 #define O_WRONLY 1 /* Open write-only. */
28 #define O_RDWR 2 /* Open read/write. */
31 /* Bits OR'd into the second argument to open. */
32 #define O_CREAT 00400 /* Create file if it doesn't exist. */
33 #define O_EXCL 02000 /* Fail if file already exists. */
34 #define O_TRUNC 01000 /* Truncate file to zero length. */
35 #ifdef __USE_MISC
36 #define O_SYNC 00020 /* Synchronous writes. */
37 #define O_FSYNC O_SYNC
38 #define O_ASYNC 00100 /* Send SIGIO to owner when data is ready. */
39 #endif
41 /* File status flags for `open' and `fcntl'. */
42 #define O_APPEND 000010 /* Writes append to the file. */
43 #ifdef __USE_BSD
44 #define O_NDELAY 000004 /* Non-blocking I/O. */
45 #endif
46 #define O_NONBLOCK 000200 /* POSIX.1 non-blocking I/O. */
48 /* Mask for file access modes. This is system-dependent in case
49 some system ever wants to define some other flavor of access. */
50 #define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
52 /* Values for the second argument to `fcntl'. */
53 #define F_DUPFD 0 /* Duplicate file descriptor. */
54 #define F_GETFD 1 /* Get file descriptor flags. */
55 #define F_SETFD 2 /* Set file descriptor flags. */
56 #define F_GETFL 3 /* Get file status flags. */
57 #define F_SETFL 4 /* Set file status flags. */
58 #define F_GETLK 5 /* Get record locking info. */
59 #define F_SETLK 6 /* Set record locking info. */
60 #define F_SETLKW 7 /* Set record locking info, wait. */
61 #ifdef __USE_MISC
62 #define F_CHKFL 8 /* Check legality of file flag changes. */
63 #define F_ALLOCSP 10
64 #define F_FREESP 11
65 #define F_SETBSDLK 12 /* Set Berkeley record lock. */
66 #define F_SETBSDLKW 13 /* Set Berkeley record lock and wait. */
67 #define F_RGETLK 20 /* Get info on a remote lock. */
68 #define F_RSETLK 21 /* Set or unlock a remote lock. */
69 #define F_RSETLKW 22 /* Set or unlock a remote lock and wait. */
70 #endif
71 #if defined __USE_BSD || defined __USE_UNIX98
72 #define F_GETOWN 10 /* Get owner; only works on sockets. */
73 #define F_SETOWN 11 /* Set owner; only works on sockets. */
74 #endif
77 /* File descriptor flags used with F_GETFD and F_SETFD. */
78 #define FD_CLOEXEC 1 /* Close on exec. */
81 #include <bits/types.h>
83 /* The structure describing an advisory lock. This is the type of the third
84 argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */
85 struct flock
87 short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
88 short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
89 __off_t l_start; /* Offset where the lock begins. */
90 __off_t l_len; /* Size of the locked area; zero means until EOF. */
91 short int l_sysid; /* System ID where locking process resides. */
92 short int l_pid; /* Process holding the lock. */
95 /* Values for the `l_type' field of a `struct flock'. */
96 #define F_RDLCK 1 /* Read lock. */
97 #define F_WRLCK 2 /* Write lock. */
98 #define F_UNLCK 3 /* Remove lock. */
101 /* Define some more compatibility macros to be backward compatible with
102 BSD systems which did not managed to hide these kernel macros. */
103 #ifdef __USE_BSD
104 #define FAPPEND O_APPEND
105 #define FFSYNC O_FSYNC
106 #define FASYNC O_ASYNC
107 #define FNONBLOCK O_NONBLOCK
108 #define FNDELAY O_NDELAY
109 #endif /* Use BSD. */