]>
Commit | Line | Data |
---|---|---|
c1458549 AM |
1 | commit 0e50bfaefde2a01792f4e4bcad7e0d822c74835b |
2 | Author: Yu Watanabe <watanabe.yu+github@gmail.com> | |
3 | Date: Mon Dec 25 19:42:42 2017 +0900 | |
4 | ||
5 | meson: define _GNU_SOURCE to detect copy_file_range() (#7734) | |
6 | ||
7 | Follow-up for bad7a0c81f501fbbcc79af9eaa4b8254441c4a1f of git | |
8 | repository for glibc. | |
9 | ||
10 | Recently glibc added `copy_file_range()`, but to use it, | |
11 | `_GNU_SOURCE` needs to be defined. This adds the flag in | |
12 | meson.build to detect the function by meson correctly. | |
13 | ||
14 | diff --git a/meson.build b/meson.build | |
15 | index be8e61045..f3a65b389 100644 | |
16 | --- a/meson.build | |
17 | +++ b/meson.build | |
18 | @@ -468,7 +468,8 @@ foreach ident : [ | |
19 | ['kcmp', '''#include <linux/kcmp.h>'''], | |
20 | ['keyctl', '''#include <sys/types.h> | |
21 | #include <keyutils.h>'''], | |
22 | - ['copy_file_range', '''#include <sys/syscall.h> | |
23 | + ['copy_file_range', '''#define _GNU_SOURCE | |
24 | + #include <sys/syscall.h> | |
25 | #include <unistd.h>'''], | |
26 | ['bpf', '''#include <sys/syscall.h> | |
27 | #include <unistd.h>'''], | |
28 | commit 85db59b794d1ca7f16ea816c916bb4472958cc1b | |
29 | Author: Lennart Poettering <lennart@poettering.net> | |
30 | Date: Mon Dec 25 12:01:14 2017 +0100 | |
31 | ||
32 | meson: use "args" for setting _GNU_SOURCE when checking for functions | |
33 | ||
34 | This reworks how we set _GNU_SOURCE when checking for the availability | |
35 | of functions: | |
36 | ||
37 | 1. We set it for most of the functions we look for. After all we set it | |
38 | for our entire built anyway, and it's usually how Linux-specific | |
39 | definitions in glibc are protected these days. Given that we usually | |
40 | have checks for such modern stuff only anyway, let's just blanket enable | |
41 | it. | |
42 | ||
43 | 2. Use "args" instead of "prefix" to set the macro. This is what is | |
44 | suggested in the meson docs, hence let's do it. | |
45 | ||
46 | diff --git a/meson.build b/meson.build | |
47 | index f3a65b389..eda9e382b 100644 | |
48 | --- a/meson.build | |
49 | +++ b/meson.build | |
50 | @@ -431,29 +431,26 @@ foreach ident : [ | |
51 | ['memfd_create', '''#include <sys/memfd.h>'''], | |
52 | ['gettid', '''#include <sys/types.h>'''], | |
53 | ['pivot_root', '''#include <stdlib.h>'''], # no known header declares pivot_root | |
54 | - ['name_to_handle_at', '''#define _GNU_SOURCE | |
55 | - #include <sys/types.h> | |
56 | + ['name_to_handle_at', '''#include <sys/types.h> | |
57 | #include <sys/stat.h> | |
58 | #include <fcntl.h>'''], | |
59 | - ['setns', '''#define _GNU_SOURCE | |
60 | - #include <sched.h>'''], | |
61 | + ['setns', '''#include <sched.h>'''], | |
62 | ['renameat2', '''#include <stdio.h>'''], | |
63 | ['kcmp', '''#include <linux/kcmp.h>'''], | |
64 | ['keyctl', '''#include <sys/types.h> | |
65 | #include <keyutils.h>'''], | |
66 | - ['copy_file_range', '''#define _GNU_SOURCE | |
67 | - #include <sys/syscall.h> | |
68 | + ['copy_file_range', '''#include <sys/syscall.h> | |
69 | #include <unistd.h>'''], | |
70 | ['bpf', '''#include <sys/syscall.h> | |
71 | #include <unistd.h>'''], | |
72 | ['explicit_bzero' , '''#include <string.h>'''], | |
73 | ] | |
74 | ||
75 | - have = cc.has_function(ident[0], prefix : ident[1]) | |
76 | + have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE') | |
77 | conf.set10('HAVE_' + ident[0].to_upper(), have) | |
78 | endforeach | |
79 | ||
80 | -if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''') | |
81 | +if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE') | |
82 | conf.set10('USE_SYS_RANDOM_H', true) | |
83 | conf.set10('HAVE_GETRANDOM', true) | |
84 | else | |
85 | ||
86 | missing_syscall: when adding syscall replacements, use different names ( | |
87 | ||
88 | #8229) | |
89 | ||
90 | In meson.build we check that functions are available using: | |
91 | meson.get_compiler('c').has_function('foo') | |
92 | which checks the following: | |
93 | - if __stub_foo or __stub___foo are defined, return false | |
94 | - if foo is declared (a pointer to the function can be taken), return true | |
95 | - otherwise check for __builtin_memfd_create | |
96 | ||
97 | _stub is documented by glibc as | |
98 | It defines a symbol '__stub_FUNCTION' for each function | |
99 | in the C library which is a stub, meaning it will fail | |
100 | every time called, usually setting errno to ENOSYS. | |
101 | ||
102 | So if __stub is defined, we know we don't want to use the glibc version, but | |
103 | this doesn't tell us if the name itself is defined or not. If it _is_ defined, | |
104 | and we define our replacement as an inline static function, we get an error: | |
105 | ||
106 | In file included from ../src/basic/missing.h:1358:0, | |
107 | from ../src/basic/util.h:47, | |
108 | from ../src/basic/calendarspec.h:29, | |
109 | from ../src/basic/calendarspec.c:34: | |
110 | ../src/basic/missing_syscall.h:65:19: error: static declaration of 'memfd_create' follows non-static declaration | |
111 | static inline int memfd_create(const char *name, unsigned int flags) { | |
112 | ^~~~~~~~~~~~ | |
113 | .../usr/include/bits/mman-shared.h:46:5: note: previous declaration of 'memfd_create' was here | |
114 | int memfd_create (const char *__name, unsigned int __flags) __THROW; | |
115 | ^~~~~~~~~~~~ | |
116 | ||
117 | To avoid this problem, call our inline functions different than glibc, | |
118 | and use a #define to map the official name to our replacement. | |
119 | ||
120 | Fixes #8099. | |
121 | ||
122 | v2: | |
123 | - use "missing_" as the prefix instead of "_" | |
124 | ||
125 | v3: | |
126 | - rebase and update for statx() | |
127 | ||
128 | Unfortunately "statx" is also present in "struct statx", so the define | |
129 | causes issues. Work around this by using a typedef. | |
130 | ||
131 | I checked that systemd compiles with current glibc | |
132 | (glibc-devel-2.26-24.fc27.x86_64) if HAVE_MEMFD_CREATE, HAVE_GETTID, | |
133 | HAVE_PIVOT_ROOT, HAVE_SETNS, HAVE_RENAMEAT2, HAVE_KCMP, HAVE_KEYCTL, | |
134 | HAVE_COPY_FILE_RANGE, HAVE_BPF, HAVE_STATX are forced to 0. | |
135 | ||
136 | Setting HAVE_NAME_TO_HANDLE_AT to 0 causes an issue, but it's not because of | |
137 | the define, but because of struct file_handle. | |
138 | ||
139 | ||
140 | backport https://github.com/systemd/systemd/commit/5187dd2c403caf92d09f3491e41f1ceb3f10491f | |
141 | ||
142 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | |
143 | Upstream-Status: Backport [https://github.com/systemd/systemd/issues/8099] | |
144 | Index: git/src/basic/missing_syscall.h | |
145 | =================================================================== | |
146 | --- git.orig/src/basic/missing_syscall.h | |
147 | +++ git/src/basic/missing_syscall.h | |
148 | @@ -26,9 +26,11 @@ | |
149 | #include <sys/types.h> | |
150 | ||
151 | #if !HAVE_PIVOT_ROOT | |
152 | -static inline int pivot_root(const char *new_root, const char *put_old) { | |
153 | +static inline int missing_pivot_root(const char *new_root, const char *put_old) { | |
154 | return syscall(SYS_pivot_root, new_root, put_old); | |
155 | } | |
156 | + | |
157 | +# define pivot_root missing_pivot_root | |
158 | #endif | |
159 | ||
160 | #if !HAVE_CANONICALIZE_FILE_NAME | |
161 | @@ -68,7 +70,7 @@ static inline char *canonicalize_file_na | |
162 | # endif | |
163 | # endif | |
164 | ||
165 | -static inline int memfd_create(const char *name, unsigned int flags) { | |
166 | +static inline int missing_memfd_create(const char *name, unsigned int flags) { | |
167 | # ifdef __NR_memfd_create | |
168 | return syscall(__NR_memfd_create, name, flags); | |
169 | # else | |
170 | @@ -76,6 +78,8 @@ static inline int memfd_create(const cha | |
171 | return -1; | |
172 | # endif | |
173 | } | |
174 | + | |
175 | +# define memfd_create missing_memfd_create | |
176 | #endif | |
177 | ||
178 | /* ======================================================================= */ | |
179 | @@ -115,7 +119,7 @@ static inline int memfd_create(const cha | |
180 | # endif | |
181 | # endif | |
182 | ||
183 | -static inline int getrandom(void *buffer, size_t count, unsigned flags) { | |
184 | +static inline int missing_getrandom(void *buffer, size_t count, unsigned flags) { | |
185 | # ifdef __NR_getrandom | |
186 | return syscall(__NR_getrandom, buffer, count, flags); | |
187 | # else | |
188 | @@ -123,14 +127,18 @@ static inline int getrandom(void *buffer | |
189 | return -1; | |
190 | # endif | |
191 | } | |
192 | + | |
193 | +# define getrandom missing_getrandom | |
194 | #endif | |
195 | ||
196 | /* ======================================================================= */ | |
197 | ||
198 | #if !HAVE_GETTID | |
199 | -static inline pid_t gettid(void) { | |
200 | +static inline pid_t missing_gettid(void) { | |
201 | return (pid_t) syscall(SYS_gettid); | |
202 | } | |
203 | + | |
204 | +# define gettid missing_gettid | |
205 | #endif | |
206 | ||
207 | /* ======================================================================= */ | |
208 | @@ -158,7 +166,7 @@ struct file_handle { | |
209 | unsigned char f_handle[0]; | |
210 | }; | |
211 | ||
212 | -static inline int name_to_handle_at(int fd, const char *name, struct file_handle *handle, int *mnt_id, int flags) { | |
213 | +static inline int missing_name_to_handle_at(int fd, const char *name, struct file_handle *handle, int *mnt_id, int flags) { | |
214 | # ifdef __NR_name_to_handle_at | |
215 | return syscall(__NR_name_to_handle_at, fd, name, handle, mnt_id, flags); | |
216 | # else | |
217 | @@ -166,6 +174,8 @@ static inline int name_to_handle_at(int | |
218 | return -1; | |
219 | # endif | |
220 | } | |
221 | + | |
222 | +# define name_to_handle_at missing_name_to_handle_at | |
223 | #endif | |
224 | ||
225 | /* ======================================================================= */ | |
226 | @@ -183,7 +193,7 @@ static inline int name_to_handle_at(int | |
227 | # endif | |
228 | # endif | |
229 | ||
230 | -static inline int setns(int fd, int nstype) { | |
231 | +static inline int missing_setns(int fd, int nstype) { | |
232 | # ifdef __NR_setns | |
233 | return syscall(__NR_setns, fd, nstype); | |
234 | # else | |
235 | @@ -191,6 +201,8 @@ static inline int setns(int fd, int nsty | |
236 | return -1; | |
237 | # endif | |
238 | } | |
239 | + | |
240 | +# define setns missing_setns | |
241 | #endif | |
242 | ||
243 | /* ======================================================================= */ | |
244 | @@ -236,7 +248,7 @@ static inline pid_t raw_getpid(void) { | |
245 | # endif | |
246 | # endif | |
247 | ||
248 | -static inline int renameat2(int oldfd, const char *oldname, int newfd, const char *newname, unsigned flags) { | |
249 | +static inline int missing_renameat2(int oldfd, const char *oldname, int newfd, const char *newname, unsigned flags) { | |
250 | # ifdef __NR_renameat2 | |
251 | return syscall(__NR_renameat2, oldfd, oldname, newfd, newname, flags); | |
252 | # else | |
253 | @@ -244,12 +256,14 @@ static inline int renameat2(int oldfd, c | |
254 | return -1; | |
255 | # endif | |
256 | } | |
257 | + | |
258 | +# define renameat2 missing_renameat2 | |
259 | #endif | |
260 | ||
261 | /* ======================================================================= */ | |
262 | ||
263 | #if !HAVE_KCMP | |
264 | -static inline int kcmp(pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2) { | |
265 | +static inline int missing_kcmp(pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2) { | |
266 | # ifdef __NR_kcmp | |
267 | return syscall(__NR_kcmp, pid1, pid2, type, idx1, idx2); | |
268 | # else | |
269 | @@ -257,36 +271,44 @@ static inline int kcmp(pid_t pid1, pid_t | |
270 | return -1; | |
271 | # endif | |
272 | } | |
273 | + | |
274 | +# define kcmp missing_kcmp | |
275 | #endif | |
276 | ||
277 | /* ======================================================================= */ | |
278 | ||
279 | #if !HAVE_KEYCTL | |
280 | -static inline long keyctl(int cmd, unsigned long arg2, unsigned long arg3, unsigned long arg4,unsigned long arg5) { | |
281 | +static inline long missing_keyctl(int cmd, unsigned long arg2, unsigned long arg3, unsigned long arg4,unsigned long arg5) { | |
282 | # ifdef __NR_keyctl | |
283 | return syscall(__NR_keyctl, cmd, arg2, arg3, arg4, arg5); | |
284 | # else | |
285 | errno = ENOSYS; | |
286 | return -1; | |
287 | # endif | |
288 | + | |
289 | +# define keyctl missing_keyctl | |
290 | } | |
291 | ||
292 | -static inline key_serial_t add_key(const char *type, const char *description, const void *payload, size_t plen, key_serial_t ringid) { | |
293 | +static inline key_serial_t missing_add_key(const char *type, const char *description, const void *payload, size_t plen, key_serial_t ringid) { | |
294 | # ifdef __NR_add_key | |
295 | return syscall(__NR_add_key, type, description, payload, plen, ringid); | |
296 | # else | |
297 | errno = ENOSYS; | |
298 | return -1; | |
299 | # endif | |
300 | + | |
301 | +# define add_key missing_add_key | |
302 | } | |
303 | ||
304 | -static inline key_serial_t request_key(const char *type, const char *description, const char * callout_info, key_serial_t destringid) { | |
305 | +static inline key_serial_t missing_request_key(const char *type, const char *description, const char * callout_info, key_serial_t destringid) { | |
306 | # ifdef __NR_request_key | |
307 | return syscall(__NR_request_key, type, description, callout_info, destringid); | |
308 | # else | |
309 | errno = ENOSYS; | |
310 | return -1; | |
311 | # endif | |
312 | + | |
313 | +# define request_key missing_request_key | |
314 | } | |
315 | #endif | |
316 | ||
317 | @@ -313,10 +335,10 @@ static inline key_serial_t request_key(c | |
318 | # endif | |
319 | # endif | |
320 | ||
321 | -static inline ssize_t copy_file_range(int fd_in, loff_t *off_in, | |
322 | - int fd_out, loff_t *off_out, | |
323 | - size_t len, | |
324 | - unsigned int flags) { | |
325 | +static inline ssize_t missing_copy_file_range(int fd_in, loff_t *off_in, | |
326 | + int fd_out, loff_t *off_out, | |
327 | + size_t len, | |
328 | + unsigned int flags) { | |
329 | # ifdef __NR_copy_file_range | |
330 | return syscall(__NR_copy_file_range, fd_in, off_in, fd_out, off_out, len, flags); | |
331 | # else | |
332 | @@ -324,6 +346,8 @@ static inline ssize_t copy_file_range(in | |
333 | return -1; | |
334 | # endif | |
335 | } | |
336 | + | |
337 | +# define copy_file_range missing_copy_file_range | |
338 | #endif | |
339 | ||
340 | /* ======================================================================= */ | |
341 | @@ -351,7 +375,7 @@ static inline ssize_t copy_file_range(in | |
342 | ||
343 | union bpf_attr; | |
344 | ||
345 | -static inline int bpf(int cmd, union bpf_attr *attr, size_t size) { | |
346 | +static inline int missing_bpf(int cmd, union bpf_attr *attr, size_t size) { | |
347 | #ifdef __NR_bpf | |
348 | return (int) syscall(__NR_bpf, cmd, attr, size); | |
349 | #else | |
350 | @@ -360,6 +384,7 @@ static inline int bpf(int cmd, union bpf | |
351 | #endif | |
352 | } | |
353 | ||
354 | +# define bpf missing_bpf | |
355 | #endif | |
356 | ||
357 | /* ======================================================================= */ | |
358 | commit 848e863acc51ecfb0f3955c498874588201d9130 | |
359 | Author: Franck Bui <fbui@suse.com> | |
360 | Date: Thu Mar 15 06:23:46 2018 +0100 | |
361 | ||
362 | basic/macros: rename noreturn into _noreturn_ (#8456) | |
363 | ||
364 | "noreturn" is reserved and can be used in other header files we include: | |
365 | ||
366 | [ 16s] In file included from /usr/include/gcrypt.h:30:0, | |
367 | [ 16s] from ../src/journal/journal-file.h:26, | |
368 | [ 16s] from ../src/journal/journal-vacuum.c:31: | |
369 | [ 16s] /usr/include/gpg-error.h:1544:46: error: expected â,â or â;â before â)â token | |
370 | [ 16s] void gpgrt_log_bug (const char *fmt, ...) GPGRT_ATTR_NR_PRINTF(1,2); | |
371 | ||
372 | Here we include grcrypt.h (which in turns include gpg-error.h) *after* we | |
373 | "noreturn" was defined in macro.h. | |
374 | ||
375 | diff --git a/src/basic/log.c b/src/basic/log.c | |
376 | index 7a7f2cbec..16a2431c5 100644 | |
377 | --- a/src/basic/log.c | |
378 | +++ b/src/basic/log.c | |
379 | @@ -814,7 +814,7 @@ static void log_assert( | |
380 | log_dispatch_internal(level, 0, file, line, func, NULL, NULL, NULL, NULL, buffer); | |
381 | } | |
382 | ||
383 | -noreturn void log_assert_failed_realm( | |
384 | +_noreturn_ void log_assert_failed_realm( | |
385 | LogRealm realm, | |
386 | const char *text, | |
387 | const char *file, | |
388 | @@ -826,7 +826,7 @@ noreturn void log_assert_failed_realm( | |
389 | abort(); | |
390 | } | |
391 | ||
392 | -noreturn void log_assert_failed_unreachable_realm( | |
393 | +_noreturn_ void log_assert_failed_unreachable_realm( | |
394 | LogRealm realm, | |
395 | const char *text, | |
396 | const char *file, | |
397 | diff --git a/src/basic/log.h b/src/basic/log.h | |
398 | index efcf0f1bf..314be128a 100644 | |
399 | --- a/src/basic/log.h | |
400 | +++ b/src/basic/log.h | |
401 | @@ -186,7 +186,7 @@ int log_dump_internal( | |
402 | char *buffer); | |
403 | ||
404 | /* Logging for various assertions */ | |
405 | -noreturn void log_assert_failed_realm( | |
406 | +_noreturn_ void log_assert_failed_realm( | |
407 | LogRealm realm, | |
408 | const char *text, | |
409 | const char *file, | |
410 | @@ -195,7 +195,7 @@ noreturn void log_assert_failed_realm( | |
411 | #define log_assert_failed(text, ...) \ | |
412 | log_assert_failed_realm(LOG_REALM, (text), __VA_ARGS__) | |
413 | ||
414 | -noreturn void log_assert_failed_unreachable_realm( | |
415 | +_noreturn_ void log_assert_failed_unreachable_realm( | |
416 | LogRealm realm, | |
417 | const char *text, | |
418 | const char *file, | |
419 | diff --git a/src/basic/macro.h b/src/basic/macro.h | |
420 | index 95be63a20..8911edfc4 100644 | |
421 | --- a/src/basic/macro.h | |
422 | +++ b/src/basic/macro.h | |
423 | @@ -53,6 +53,15 @@ | |
424 | #else | |
425 | #define _fallthrough_ | |
426 | #endif | |
427 | +/* Define C11 noreturn without <stdnoreturn.h> and even on older gcc | |
428 | + * compiler versions */ | |
429 | +#ifndef _noreturn_ | |
430 | +#if __STDC_VERSION__ >= 201112L | |
431 | +#define _noreturn_ _Noreturn | |
432 | +#else | |
433 | +#define _noreturn_ __attribute__((noreturn)) | |
434 | +#endif | |
435 | +#endif | |
436 | ||
437 | /* Temporarily disable some warnings */ | |
438 | #define DISABLE_WARNING_DECLARATION_AFTER_STATEMENT \ | |
439 | @@ -414,16 +423,6 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) { | |
440 | #endif | |
441 | #endif | |
442 | ||
443 | -/* Define C11 noreturn without <stdnoreturn.h> and even on older gcc | |
444 | - * compiler versions */ | |
445 | -#ifndef noreturn | |
446 | -#if __STDC_VERSION__ >= 201112L | |
447 | -#define noreturn _Noreturn | |
448 | -#else | |
449 | -#define noreturn __attribute__((noreturn)) | |
450 | -#endif | |
451 | -#endif | |
452 | - | |
453 | #define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \ | |
454 | static inline void func##p(type *p) { \ | |
455 | if (*p) \ | |
456 | diff --git a/src/basic/process-util.c b/src/basic/process-util.c | |
457 | index aa9846db5..e6120af5b 100644 | |
458 | --- a/src/basic/process-util.c | |
459 | +++ b/src/basic/process-util.c | |
460 | @@ -987,7 +987,7 @@ bool is_main_thread(void) { | |
461 | return cached > 0; | |
462 | } | |
463 | ||
464 | -noreturn void freeze(void) { | |
465 | +_noreturn_ void freeze(void) { | |
466 | ||
467 | log_close(); | |
468 | ||
469 | diff --git a/src/basic/process-util.h b/src/basic/process-util.h | |
470 | index 93029e36e..5170adec7 100644 | |
471 | --- a/src/basic/process-util.h | |
472 | +++ b/src/basic/process-util.h | |
473 | @@ -91,7 +91,7 @@ int pid_from_same_root_fs(pid_t pid); | |
474 | ||
475 | bool is_main_thread(void); | |
476 | ||
477 | -noreturn void freeze(void); | |
478 | +_noreturn_ void freeze(void); | |
479 | ||
480 | bool oom_score_adjust_is_valid(int oa); | |
481 | ||
482 | diff --git a/src/core/main.c b/src/core/main.c | |
483 | index 076846a41..4b2d14923 100644 | |
484 | --- a/src/core/main.c | |
485 | +++ b/src/core/main.c | |
486 | @@ -141,7 +141,7 @@ static uint64_t arg_default_tasks_max = UINT64_MAX; | |
487 | static sd_id128_t arg_machine_id = {}; | |
488 | static EmergencyAction arg_cad_burst_action = EMERGENCY_ACTION_REBOOT_FORCE; | |
489 | ||
490 | -noreturn static void freeze_or_reboot(void) { | |
491 | +_noreturn_ static void freeze_or_reboot(void) { | |
492 | ||
493 | if (arg_crash_reboot) { | |
494 | log_notice("Rebooting in 10s..."); | |
495 | @@ -156,7 +156,7 @@ noreturn static void freeze_or_reboot(void) { | |
496 | freeze(); | |
497 | } | |
498 | ||
499 | -noreturn static void crash(int sig) { | |
500 | +_noreturn_ static void crash(int sig) { | |
501 | struct sigaction sa; | |
502 | pid_t pid; | |
503 | ||
504 | diff --git a/src/journal/test-journal-interleaving.c b/src/journal/test-journal-interleaving.c | |
505 | index 5a88b2774..d87bdbdd3 100644 | |
506 | --- a/src/journal/test-journal-interleaving.c | |
507 | +++ b/src/journal/test-journal-interleaving.c | |
508 | @@ -37,7 +37,7 @@ | |
509 | ||
510 | static bool arg_keep = false; | |
511 | ||
512 | -noreturn static void log_assert_errno(const char *text, int error, const char *file, int line, const char *func) { | |
513 | +_noreturn_ static void log_assert_errno(const char *text, int error, const char *file, int line, const char *func) { | |
514 | log_internal(LOG_CRIT, error, file, line, func, | |
515 | "'%s' failed at %s:%u (%s): %m", text, file, line, func); | |
516 | abort(); | |
517 | diff --git a/src/shared/pager.c b/src/shared/pager.c | |
518 | index 75db3c985..681af9c40 100644 | |
519 | --- a/src/shared/pager.c | |
520 | +++ b/src/shared/pager.c | |
521 | @@ -47,7 +47,7 @@ static int stored_stderr = -1; | |
522 | static bool stdout_redirected = false; | |
523 | static bool stderr_redirected = false; | |
524 | ||
525 | -noreturn static void pager_fallback(void) { | |
526 | +_noreturn_ static void pager_fallback(void) { | |
527 | int r; | |
528 | ||
529 | r = copy_bytes(STDIN_FILENO, STDOUT_FILENO, (uint64_t) -1, 0); | |
530 | diff --git a/src/udev/collect/collect.c b/src/udev/collect/collect.c | |
531 | index 2821640e9..c8fa47b3d 100644 | |
532 | --- a/src/udev/collect/collect.c | |
533 | +++ b/src/udev/collect/collect.c | |
534 | @@ -58,7 +58,7 @@ static inline struct _mate *node_to_mate(struct udev_list_node *node) | |
535 | return container_of(node, struct _mate, node); | |
536 | } | |
537 | ||
538 | -noreturn static void sig_alrm(int signo) | |
539 | +_noreturn_ static void sig_alrm(int signo) | |
540 | { | |
541 | exit(4); | |
542 | } | |
543 | From eb50b6d936c474f5bc2974c059f6432222af4de4 Mon Sep 17 00:00:00 2001 | |
544 | From: Karel Zak <kzak@redhat.com> | |
545 | Date: Thu, 22 Mar 2018 12:50:45 +0100 | |
546 | Subject: [PATCH] Fix linux/fs.h and sys/mount.h collisions | |
547 | ||
548 | * (kernel-headers) linux/fs.h and (glibc) sys/mount.h contains MS_* constants | |
549 | and because it's without #ifdefs you cannot include the both files together | |
550 | in the same code | |
551 | ||
552 | * (systemd) src/basic/missing.h contains another copy of MS_* constants | |
553 | ||
554 | The patch removes local systemd MS_* fallbacks, cleanup fs.h and | |
555 | mount.h include. | |
556 | ||
557 | Signed-off-by: Karel Zak <kzak@redhat.com> | |
558 | --- | |
559 | src/basic/missing.h | 40 ---------------------------------------- | |
560 | src/core/load-fragment.c | 1 - | |
561 | src/shared/bus-unit-util.c | 2 ++ | |
562 | 3 files changed, 2 insertions(+), 41 deletions(-) | |
563 | ||
564 | diff --git a/src/basic/missing.h b/src/basic/missing.h | |
565 | index 567aea8da9c..6802dd27c7b 100644 | |
566 | --- a/src/basic/missing.h | |
567 | +++ b/src/basic/missing.h | |
568 | @@ -524,46 +524,6 @@ struct btrfs_ioctl_quota_ctl_args { | |
569 | #define OCFS2_SUPER_MAGIC 0x7461636f | |
570 | #endif | |
571 | ||
572 | -#ifndef MS_MOVE | |
573 | -#define MS_MOVE 8192 | |
574 | -#endif | |
575 | - | |
576 | -#ifndef MS_REC | |
577 | -#define MS_REC 16384 | |
578 | -#endif | |
579 | - | |
580 | -#ifndef MS_PRIVATE | |
581 | -#define MS_PRIVATE (1<<18) | |
582 | -#endif | |
583 | - | |
584 | -#ifndef MS_REC | |
585 | -#define MS_REC (1<<19) | |
586 | -#endif | |
587 | - | |
588 | -#ifndef MS_SHARED | |
589 | -#define MS_SHARED (1<<20) | |
590 | -#endif | |
591 | - | |
592 | -#ifndef MS_RELATIME | |
593 | -#define MS_RELATIME (1<<21) | |
594 | -#endif | |
595 | - | |
596 | -#ifndef MS_KERNMOUNT | |
597 | -#define MS_KERNMOUNT (1<<22) | |
598 | -#endif | |
599 | - | |
600 | -#ifndef MS_I_VERSION | |
601 | -#define MS_I_VERSION (1<<23) | |
602 | -#endif | |
603 | - | |
604 | -#ifndef MS_STRICTATIME | |
605 | -#define MS_STRICTATIME (1<<24) | |
606 | -#endif | |
607 | - | |
608 | -#ifndef MS_LAZYTIME | |
609 | -#define MS_LAZYTIME (1<<25) | |
610 | -#endif | |
611 | - | |
612 | #ifndef SCM_SECURITY | |
613 | #define SCM_SECURITY 0x03 | |
614 | #endif | |
615 | diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c | |
616 | index 94605ab0d02..49f8a8c6da1 100644 | |
617 | --- a/src/core/load-fragment.c | |
618 | +++ b/src/core/load-fragment.c | |
619 | @@ -21,7 +21,6 @@ | |
620 | ||
621 | #include <errno.h> | |
622 | #include <fcntl.h> | |
623 | -#include <linux/fs.h> | |
624 | #include <linux/oom.h> | |
625 | #if HAVE_SECCOMP | |
626 | #include <seccomp.h> | |
627 | diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c | |
628 | index 23e05daf48c..6e7ea10e714 100644 | |
629 | --- a/src/shared/bus-unit-util.c | |
630 | +++ b/src/shared/bus-unit-util.c | |
631 | @@ -52,6 +52,8 @@ | |
632 | #include "utf8.h" | |
633 | #include "util.h" | |
634 | ||
635 | +#include <sys/mount.h> | |
636 | + | |
637 | int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) { | |
638 | assert(message); | |
639 | assert(u); |