1 /* O_*, F_*, FD_* bit values for Linux. 2 Copyright (C) 1995-2021 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 #define O_CREAT 00000400 /* not fcntl */ 24 #define O_EXCL 00002000 /* not fcntl */ 25 #define O_NOCTTY 00400000 /* not fcntl */ 26 #define O_APPEND 00000010 27 #define O_NONBLOCK 00200000 28 #define __O_DSYNC 01000000 29 #define __O_SYNC 00100000 30 #define O_SYNC (__O_SYNC|__O_DSYNC) 31 32 #define __O_DIRECTORY 000010000 /* Must be a directory. */ 33 #define __O_NOFOLLOW 000000200 /* Do not follow links. */ 34 #define __O_CLOEXEC 010000000 /* Set close_on_exec. */ 35 #define __O_NOATIME 004000000 /* Do not set atime. */ 36 #define __O_PATH 020000000 37 #define __O_TMPFILE 040010000 /* Atomically create nameless file. */ 38 39 #define __O_LARGEFILE 00004000 40 41 #define F_GETLK64 8 /* Get record locking info. */ 42 #define F_SETLK64 9 /* Set record locking info (non-blocking). */ 43 #define F_SETLKW64 10 /* Set record locking info (blocking). */ 44 45 #define __F_GETOWN 11 /* Get owner of socket (receiver of SIGIO). */ 46 #define __F_SETOWN 12 /* Set owner of socket (receiver of SIGIO). */ 47 48 #define __F_SETSIG 13 /* Set number of signal to be sent. */ 49 #define __F_GETSIG 14 /* Get number of signal to be sent. */ 50 51 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ 52 #define F_RDLCK 1 /* Read lock. */ 53 #define F_WRLCK 2 /* Write lock. */ 54 #define F_UNLCK 3 /* Remove lock. */ 55 56 struct flock 57 { 58 short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ 59 short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ 60 #ifndef __USE_FILE_OFFSET64 61 __off_t l_start; /* Offset where the lock begins. */ 62 __off_t l_len; /* Size of the locked area; zero means until EOF. */ 63 #else 64 __off64_t l_start; /* Offset where the lock begins. */ 65 __off64_t l_len; /* Size of the locked area; zero means until EOF. */ 66 #endif 67 __pid_t l_pid; /* Process holding the lock. */ 68 }; 69 70 #ifdef __USE_LARGEFILE64 71 struct flock64 72 { 73 short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ 74 short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ 75 __off64_t l_start; /* Offset where the lock begins. */ 76 __off64_t l_len; /* Size of the locked area; zero means until EOF. */ 77 __pid_t l_pid; /* Process holding the lock. */ 78 }; 79 #endif 80 81 /* Include generic Linux declarations. */ 82 #include <bits/fcntl-linux.h> 83