]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/missing_fcntl.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
6 #ifndef F_LINUX_SPECIFIC_BASE
7 #define F_LINUX_SPECIFIC_BASE 1024
11 #define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
15 #define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
19 #define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
20 #define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10)
22 #define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */
23 #define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */
24 #define F_SEAL_GROW 0x0004 /* prevent file from growing */
25 #define F_SEAL_WRITE 0x0008 /* prevent writes */
28 #ifndef F_SEAL_FUTURE_WRITE
29 #define F_SEAL_FUTURE_WRITE 0x0010 /* prevent future writes while mapped */
33 #define F_SEAL_EXEC 0x0020 /* prevent chmod modifying exec bits */
37 #define F_OFD_GETLK 36
38 #define F_OFD_SETLK 37
39 #define F_OFD_SETLKW 38
43 #define MAX_HANDLE_SZ 128
46 /* The precise definition of __O_TMPFILE is arch specific; use the
47 * values defined by the kernel (note: some are hexa, some are octal,
48 * duplicated as-is from the kernel definitions):
49 * - alpha, parisc, sparc: each has a specific value;
50 * - others: they use the "generic" value.
54 #if defined(__alpha__)
55 #define __O_TMPFILE 0100000000
56 #elif defined(__parisc__) || defined(__hppa__)
57 #define __O_TMPFILE 0400000000
58 #elif defined(__sparc__) || defined(__sparc64__)
59 #define __O_TMPFILE 0x2000000
61 #define __O_TMPFILE 020000000
65 /* a horrid kludge trying to make sure that this will fail on old kernels */
67 #define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
70 /* So O_LARGEFILE is generally implied by glibc, and defined to zero hence, because we only build in LFS
71 * mode. However, when invoking fcntl(F_GETFL) the flag is ORed into the result anyway — glibc does not mask
72 * it away. Which sucks. Let's define the actual value here, so that we can mask it ourselves.
74 * The precise definition is arch specific, so we use the values defined in the kernel (note that some
75 * are hexa and others are octal; duplicated as-is from the kernel definitions):
76 * - alpha, arm, arm64, m68k, mips, parisc, powerpc, sparc: each has a specific value;
77 * - others: they use the "generic" value (defined in include/uapi/asm-generic/fcntl.h) */
79 #define RAW_O_LARGEFILE O_LARGEFILE
81 #if defined(__alpha__) || defined(__arm__) || defined(__aarch64__) || defined(__m68k__)
82 #define RAW_O_LARGEFILE 0400000
83 #elif defined(__mips__)
84 #define RAW_O_LARGEFILE 0x2000
85 #elif defined(__parisc__) || defined(__hppa__)
86 #define RAW_O_LARGEFILE 000004000
87 #elif defined(__powerpc__)
88 #define RAW_O_LARGEFILE 0200000
89 #elif defined(__sparc__)
90 #define RAW_O_LARGEFILE 0x40000
92 #define RAW_O_LARGEFILE 00100000