| 1 | /* O_*, F_*, FD_* bit values for Linux. |
| 2 | Copyright (C) 1995-2026 Free Software Foundation, Inc. |
| 3 | This file is part of the GNU C Library. |
| 4 | |
| 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. |
| 9 | |
| 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. |
| 14 | |
| 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/>. */ |
| 18 | |
| 19 | #ifndef	_FCNTL_H |
| 20 | # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." |
| 21 | #endif |
| 22 | |
| 23 | #include <sgidefs.h> |
| 24 | |
| 25 | #define O_APPEND	 0x0008 |
| 26 | #define O_SYNC		 0x4010 |
| 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 |
| 33 | |
| 34 | #define __O_DIRECT	 0x8000	/* Direct disk access hint. */ |
| 35 | #define __O_DSYNC	 0x0010	/* Synchronize data. */ |
| 36 | |
| 37 | #if _MIPS_SIM == _ABI64 |
| 38 | /* Not necessary, files are always with 64bit off_t. */ |
| 39 | # define __O_LARGEFILE 0 |
| 40 | #else |
| 41 | # define __O_LARGEFILE	0x2000	/* Allow large file opens. */ |
| 42 | #endif |
| 43 | |
| 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).	*/ |
| 48 | #else |
| 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). */ |
| 52 | #endif |
| 53 | |
| 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).	*/ |
| 58 | #else |
| 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). */ |
| 62 | #endif |
| 63 | |
| 64 | #define __F_SETOWN	24	/* Get owner (process receiving SIGIO). */ |
| 65 | #define __F_GETOWN	23	/* Set owner (process receiving SIGIO). */ |
| 66 | |
| 67 | struct flock |
| 68 | { |
| 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. */ |
| 77 | long int l_sysid; |
| 78 | #endif |
| 79 | #else |
| 80 | __off64_t l_start;	/* Offset where the lock begins. */ |
| 81 | __off64_t l_len;	/* Size of the locked area; zero means until EOF. */ |
| 82 | #endif |
| 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]; |
| 88 | #endif |
| 89 | }; |
| 90 | typedef struct flock flock_t; |
| 91 | |
| 92 | #ifdef __USE_LARGEFILE64 |
| 93 | struct flock64 |
| 94 | { |
| 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. */ |
| 100 | }; |
| 101 | #endif |
| 102 | |
| 103 | /* Include generic Linux declarations. */ |
| 104 | #include <bits/fcntl-linux.h> |