lxc: Fix compilation with glibc 2.36
[feed/packages.git] / utils / lxc / patches / 003-build-check-for-FS_CONFIG_-header-symbol-in-sys-moun.patch
1 From cbabe8abf11e7e7fb49c123bae31efdd9bc8f1e8 Mon Sep 17 00:00:00 2001
2 From: Christian Brauner <brauner@kernel.org>
3 Date: Tue, 9 Aug 2022 17:19:40 +0200
4 Subject: build: check for FS_CONFIG_* header symbol in sys/mount.h
5
6 Fixes: #4176
7 Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
8 ---
9 meson.build | 59 +++++++++++++++++++++++++++++++++++++++++--
10 src/lxc/mount_utils.h | 16 ++++++++++++
11 2 files changed, 73 insertions(+), 2 deletions(-)
12
13 --- a/meson.build
14 +++ b/meson.build
15 @@ -638,8 +638,7 @@ if cc.sizeof('struct mount_attr', prefix
16 found_types += 'struct mount_attr (sys/mount.h)'
17 else
18 srcconf.set10('HAVE_' + 'struct mount_attr'.underscorify().to_upper(), false)
19 - missing_types += 'struct mount_attr (sys/mount.h)'
20 -endif
21 + missing_types += 'struct mount_attr (sys/mount.h)' endif
22
23 ## Types.
24 decl_headers = '''
25 @@ -655,6 +654,62 @@ else
26 missing_types += 'struct mount_attr (linux/mount.h)'
27 endif
28
29 +if cc.has_header_symbol('sys/mount.h', 'FSCONFIG_SET_FLAG')
30 + srcconf.set10('HAVE_' + 'FSCONFIG_SET_FLAG'.underscorify().to_upper(), true)
31 + found_types += 'FSCONFIG_SET_FLAG'
32 +else
33 + srcconf.set10('HAVE_' + 'FSCONFIG_SET_FLAG'.underscorify().to_upper(), false)
34 + missing_types += 'FSCONFIG_SET_FLAG'
35 +endif
36 +
37 +if cc.has_header_symbol('sys/mount.h', 'FS_CONFIG_SET_STRING')
38 + srcconf.set10('HAVE_' + 'FS_CONFIG_SET_STRING'.underscorify().to_upper(), true)
39 + found_types += 'FS_CONFIG_SET_STRING'
40 +else
41 + srcconf.set10('HAVE_' + 'FS_CONFIG_SET_STRING'.underscorify().to_upper(), false)
42 + missing_types += 'FS_CONFIG_SET_STRING'
43 +endif
44 +
45 +if cc.has_header_symbol('sys/mount.h', 'FS_CONFIG_SET_BINARY')
46 + srcconf.set10('HAVE_' + 'FS_CONFIG_SET_BINARY'.underscorify().to_upper(), true)
47 + found_types += 'FS_CONFIG_SET_BINARY'
48 +else
49 + srcconf.set10('HAVE_' + 'FS_CONFIG_SET_BINARY'.underscorify().to_upper(), false)
50 + missing_types += 'FS_CONFIG_SET_BINARY'
51 +endif
52 +
53 +if cc.has_header_symbol('sys/mount.h', 'FS_CONFIG_SET_PATH_EMPTY')
54 + srcconf.set10('HAVE_' + 'FS_CONFIG_SET_PATH_EMPTY'.underscorify().to_upper(), true)
55 + found_types += 'FS_CONFIG_SET_PATH_EMPTY'
56 +else
57 + srcconf.set10('HAVE_' + 'FS_CONFIG_SET_PATH_EMPTY'.underscorify().to_upper(), false)
58 + missing_types += 'FS_CONFIG_SET_PATH_EMPTY'
59 +endif
60 +
61 +if cc.has_header_symbol('sys/mount.h', 'FS_CONFIG_SET_PATH_FD')
62 + srcconf.set10('HAVE_' + 'FS_CONFIG_SET_PATH_FD'.underscorify().to_upper(), true)
63 + found_types += 'FS_CONFIG_SET_PATH_FD'
64 +else
65 + srcconf.set10('HAVE_' + 'FS_CONFIG_SET_PATH_FD'.underscorify().to_upper(), false)
66 + missing_types += 'FS_CONFIG_SET_PATH_FD'
67 +endif
68 +
69 +if cc.has_header_symbol('sys/mount.h', 'FS_CONFIG_SET_CMD_CREATE')
70 + srcconf.set10('HAVE_' + 'FS_CONFIG_SET_CMD_CREATE'.underscorify().to_upper(), true)
71 + found_types += 'FS_CONFIG_SET_CMD_CREATE'
72 +else
73 + srcconf.set10('HAVE_' + 'FS_CONFIG_SET_CMD_CREATE'.underscorify().to_upper(), false)
74 + missing_types += 'FS_CONFIG_SET_CMD_CREATE'
75 +endif
76 +
77 +if cc.has_header_symbol('sys/mount.h', 'FS_CONFIG_SET_CMD_RECONFIGURE')
78 + srcconf.set10('HAVE_' + 'FS_CONFIG_SET_CMD_RECONFIGURE'.underscorify().to_upper(), true)
79 + found_types += 'FS_CONFIG_SET_CMD_RECONFIGURE'
80 +else
81 + srcconf.set10('HAVE_' + 'FS_CONFIG_SET_CMD_RECONFIGURE'.underscorify().to_upper(), false)
82 + missing_types += 'FS_CONFIG_SET_CMD_RECONFIGURE'
83 +endif
84 +
85 ## Headers.
86 foreach ident: [
87 ['bpf', '''#include <sys/syscall.h>
88 --- a/src/lxc/mount_utils.h
89 +++ b/src/lxc/mount_utils.h
90 @@ -82,37 +82,53 @@ struct lxc_rootfs;
91 #endif
92
93 /* fsconfig() commands */
94 +#if !HAVE_FSCONFIG_SET_FLAG
95 #ifndef FSCONFIG_SET_FLAG
96 #define FSCONFIG_SET_FLAG 0 /* Set parameter, supplying no value */
97 #endif
98 +#endif
99
100 +#if !HAVE_FSCONFIG_SET_STRING
101 #ifndef FSCONFIG_SET_STRING
102 #define FSCONFIG_SET_STRING 1 /* Set parameter, supplying a string value */
103 #endif
104 +#endif
105
106 +#if !HAVE_FSCONFIG_SET_BINARY
107 #ifndef FSCONFIG_SET_BINARY
108 #define FSCONFIG_SET_BINARY 2 /* Set parameter, supplying a binary blob value */
109 #endif
110 +#endif
111
112 +#if !HAVE_FSCONFIG_SET_PATH
113 #ifndef FSCONFIG_SET_PATH
114 #define FSCONFIG_SET_PATH 3 /* Set parameter, supplying an object by path */
115 #endif
116 +#endif
117
118 +#if !HAVE_FSCONFIG_SET_PATH_EMPTY
119 #ifndef FSCONFIG_SET_PATH_EMPTY
120 #define FSCONFIG_SET_PATH_EMPTY 4 /* Set parameter, supplying an object by (empty) path */
121 #endif
122 +#endif
123
124 +#if !HAVE_FSCONFIG_SET_FD
125 #ifndef FSCONFIG_SET_FD
126 #define FSCONFIG_SET_FD 5 /* Set parameter, supplying an object by fd */
127 #endif
128 +#endif
129
130 +#if !HAVE_FSCONFIG_CMD_CREATE
131 #ifndef FSCONFIG_CMD_CREATE
132 #define FSCONFIG_CMD_CREATE 6 /* Invoke superblock creation */
133 #endif
134 +#endif
135
136 +#if !FSCONFIG_CMD_RECONFIGURE
137 #ifndef FSCONFIG_CMD_RECONFIGURE
138 #define FSCONFIG_CMD_RECONFIGURE 7 /* Invoke superblock reconfiguration */
139 #endif
140 +#endif
141
142 /* fsmount() flags */
143 #ifndef FSMOUNT_CLOEXEC