1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 #include <fcntl.h>
5 
6 #ifndef F_LINUX_SPECIFIC_BASE
7 #define F_LINUX_SPECIFIC_BASE 1024
8 #endif
9 
10 #ifndef F_SETPIPE_SZ
11 #define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
12 #endif
13 
14 #ifndef F_GETPIPE_SZ
15 #define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
16 #endif
17 
18 #ifndef F_ADD_SEALS
19 #define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
20 #define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10)
21 
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 */
26 #endif
27 
28 #ifndef F_OFD_GETLK
29 #define F_OFD_GETLK     36
30 #define F_OFD_SETLK     37
31 #define F_OFD_SETLKW    38
32 #endif
33 
34 #ifndef MAX_HANDLE_SZ
35 #define MAX_HANDLE_SZ 128
36 #endif
37 
38 /* The precise definition of __O_TMPFILE is arch specific; use the
39  * values defined by the kernel (note: some are hexa, some are octal,
40  * duplicated as-is from the kernel definitions):
41  * - alpha, parisc, sparc: each has a specific value;
42  * - others: they use the "generic" value.
43  */
44 
45 #ifndef __O_TMPFILE
46 #if defined(__alpha__)
47 #define __O_TMPFILE     0100000000
48 #elif defined(__parisc__) || defined(__hppa__)
49 #define __O_TMPFILE     0400000000
50 #elif defined(__sparc__) || defined(__sparc64__)
51 #define __O_TMPFILE     0x2000000
52 #else
53 #define __O_TMPFILE     020000000
54 #endif
55 #endif
56 
57 /* a horrid kludge trying to make sure that this will fail on old kernels */
58 #ifndef O_TMPFILE
59 #define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
60 #endif
61