1 /* O_*, F_*, FD_* bit values for Linux.
2 Copyright (C) 1995-2024 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, see
17 <https://www.gnu.org/licenses/>. */
20 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
25 #define O_APPEND 0x0008
27 #define O_NONBLOCK 0x0080
28 #define O_CREAT 0x0100 /* not fcntl */
29 #define O_TRUNC 0x0200 /* not fcntl */
30 #define O_EXCL 0x0400 /* not fcntl */
31 #define O_NOCTTY 0x0800 /* not fcntl */
32 #define O_ASYNC 0x1000
34 #define __O_DIRECT 0x8000 /* Direct disk access hint. */
35 #define __O_DSYNC 0x0010 /* Synchronize data. */
37 #if _MIPS_SIM == _ABI64
38 /* Not necessary, files are always with 64bit off_t. */
39 # define __O_LARGEFILE 0
41 # define __O_LARGEFILE 0x2000 /* Allow large file opens. */
44 #ifndef __USE_FILE_OFFSET64
45 # define F_GETLK 14 /* Get record locking info. */
46 # define F_SETLK 6 /* Set record locking info (non-blocking). */
47 # define F_SETLKW 7 /* Set record locking info (blocking). */
49 # define F_GETLK F_GETLK64 /* Get record locking info. */
50 # define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
51 # define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
54 #if _MIPS_SIM != _ABI64
55 # define F_GETLK64 33 /* Get record locking info. */
56 # define F_SETLK64 34 /* Set record locking info (non-blocking). */
57 # define F_SETLKW64 35 /* Set record locking info (blocking). */
59 # define F_GETLK64 14 /* Get record locking info. */
60 # define F_SETLK64 6 /* Set record locking info (non-blocking).*/
61 # define F_SETLKW64 7 /* Set record locking info (blocking). */
64 #define __F_SETOWN 24 /* Get owner (process receiving SIGIO). */
65 #define __F_GETOWN 23 /* Set owner (process receiving SIGIO). */
69 short int l_type
; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
70 short int l_whence
; /* Where `l_start' is relative to (like `lseek'). */
71 #ifndef __USE_FILE_OFFSET64
72 __off_t l_start
; /* Offset where the lock begins. */
73 __off_t l_len
; /* Size of the locked area; zero means until EOF. */
74 #if _MIPS_SIM != _ABI64
75 /* The 64-bit flock structure, used by the n64 ABI, and for 64-bit
76 fcntls in o32 and n32, never has this field. */
80 __off64_t l_start
; /* Offset where the lock begins. */
81 __off64_t l_len
; /* Size of the locked area; zero means until EOF. */
83 __pid_t l_pid
; /* Process holding the lock. */
84 #if ! defined __USE_FILE_OFFSET64 && _MIPS_SIM != _ABI64
85 /* The 64-bit flock structure, used by the n64 ABI, and for 64-bit
86 flock in o32 and n32, never has this field. */
87 long int __glibc_reserved0
[4];
90 typedef struct flock flock_t
;
92 #ifdef __USE_LARGEFILE64
95 short int l_type
; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
96 short int l_whence
; /* Where `l_start' is relative to (like `lseek'). */
97 __off64_t l_start
; /* Offset where the lock begins. */
98 __off64_t l_len
; /* Size of the locked area; zero means until EOF. */
99 __pid_t l_pid
; /* Process holding the lock. */
103 /* Include generic Linux declarations. */
104 #include <bits/fcntl-linux.h>