1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * Copyright (c) 2014 Cyril Hrubis <chrubis@suse.cz> 4 */ 5 6 #ifndef __LAPI_FCNTL_H__ 7 #define __LAPI_FCNTL_H__ 8 9 #include <fcntl.h> 10 #include <sys/socket.h> 11 12 #ifndef O_DIRECT 13 # define O_DIRECT 040000 14 #endif 15 16 #ifndef O_CLOEXEC 17 # define O_CLOEXEC 02000000 18 #endif 19 20 #ifndef SOCK_CLOEXEC 21 # define SOCK_CLOEXEC O_CLOEXEC 22 #endif 23 24 #ifndef SOCK_NONBLOCK 25 # define SOCK_NONBLOCK O_NONBLOCK 26 #endif 27 28 #ifndef O_TMPFILE 29 # define O_TMPFILE (020000000 | O_DIRECTORY) 30 #endif 31 32 #ifndef F_DUPFD_CLOEXEC 33 # define F_DUPFD_CLOEXEC 1030 34 #endif 35 36 #ifndef F_SETPIPE_SZ 37 # define F_SETPIPE_SZ 1031 38 #endif 39 40 #ifndef F_GETPIPE_SZ 41 # define F_GETPIPE_SZ 1032 42 #endif 43 44 /* 45 * Set/Get seals 46 */ 47 #ifndef F_ADD_SEALS 48 # define F_ADD_SEALS (1033) 49 #endif 50 51 #ifndef F_GET_SEALS 52 # define F_GET_SEALS (1034) 53 #endif 54 55 #ifndef F_SEAL_SEAL 56 # define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */ 57 #endif 58 59 #ifndef F_SEAL_SHRINK 60 # define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */ 61 #endif 62 #ifndef F_SEAL_GROW 63 # define F_SEAL_GROW 0x0004 /* prevent file from growing */ 64 #endif 65 #ifndef F_SEAL_WRITE 66 # define F_SEAL_WRITE 0x0008 /* prevent writes */ 67 #endif 68 69 #ifndef F_OWNER_PGRP 70 # define F_OWNER_PGRP 2 71 #endif 72 73 #ifndef F_OFD_GETLK 74 # define F_OFD_GETLK 36 75 #endif 76 77 #ifndef F_OFD_SETLK 78 # define F_OFD_SETLK 37 79 #endif 80 81 #ifndef F_OFD_SETLKW 82 # define F_OFD_SETLKW 38 83 #endif 84 85 #ifndef AT_FDCWD 86 # define AT_FDCWD -100 87 #endif 88 89 #ifndef AT_SYMLINK_FOLLOW 90 # define AT_SYMLINK_FOLLOW 0x400 91 #endif 92 93 #ifndef AT_SYMLINK_NOFOLLOW 94 # define AT_SYMLINK_NOFOLLOW 0x100 95 #endif 96 97 #ifndef AT_EMPTY_PATH 98 # define AT_EMPTY_PATH 0x1000 99 #endif 100 101 #ifndef AT_REMOVEDIR 102 # define AT_REMOVEDIR 0x200 103 #endif 104 105 #ifndef O_NOATIME 106 # define O_NOATIME 01000000 107 #endif 108 109 #ifndef O_PATH 110 # ifdef __sparc__ 111 # define O_PATH 0x1000000 112 # else 113 # define O_PATH 010000000 114 # endif 115 #endif 116 117 #ifndef FALLOC_FL_KEEP_SIZE 118 # define FALLOC_FL_KEEP_SIZE 1 119 #endif 120 121 #ifndef RENAME_NOREPLACE 122 # define RENAME_NOREPLACE (1 << 0) 123 #endif 124 125 #ifndef RENAME_EXCHANGE 126 # define RENAME_EXCHANGE (1 << 1) 127 #endif 128 129 #ifndef RENAME_WHITEOUT 130 # define RENAME_WHITEOUT (1 << 2) 131 #endif 132 133 /* splice, vmsplice, tee */ 134 135 #ifndef SPLICE_F_NONBLOCK 136 # define SPLICE_F_NONBLOCK 2 137 #endif 138 139 #endif /* __LAPI_FCNTL_H__ */ 140