Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | From b0933e76c6f0594c10cf8a9a70b34e15b68066d1 Mon Sep 17 00:00:00 2001 |
| 2 | From: Rudi Heitbaum <rudi@heitbaum.com> |
| 3 | Date: Sat, 23 Jul 2022 10:38:49 +0000 |
| 4 | Subject: [PATCH] glibc: Remove #include <linux/fs.h> to resolve fsconfig_command/mount_attr conflict with glibc 2.36 |
| 5 | |
| 6 | Upstream-Status: Backport [https://github.com/systemd/systemd/pull/23992/commits/21c03ad5e9d8d0350e30dae92a5e15da318a1539] |
| 7 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 8 | --- |
| 9 | meson.build | 13 ++++++++++++- |
| 10 | src/basic/fd-util.c | 2 ++ |
| 11 | src/core/namespace.c | 2 ++ |
| 12 | src/shared/mount-util.c | 2 ++ |
| 13 | 4 files changed, 18 insertions(+), 1 deletion(-) |
| 14 | |
| 15 | --- a/meson.build |
| 16 | +++ b/meson.build |
| 17 | @@ -474,7 +474,6 @@ decl_headers = ''' |
| 18 | #include <uchar.h> |
| 19 | #include <sys/mount.h> |
| 20 | #include <sys/stat.h> |
| 21 | -#include <linux/fs.h> |
| 22 | ''' |
| 23 | |
| 24 | foreach decl : ['char16_t', |
| 25 | @@ -486,6 +485,17 @@ foreach decl : ['char16_t', |
| 26 | # We get -1 if the size cannot be determined |
| 27 | have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0 |
| 28 | |
| 29 | + if decl == 'struct mount_attr' |
| 30 | + if have |
| 31 | + want_linux_fs_h = false |
| 32 | + else |
| 33 | + have = cc.sizeof(decl, |
| 34 | + prefix : decl_headers + '#include <linux/fs.h>', |
| 35 | + args : '-D_GNU_SOURCE') > 0 |
| 36 | + want_linux_fs_h = have |
| 37 | + endif |
| 38 | + endif |
| 39 | + |
| 40 | if decl == 'struct statx' |
| 41 | if have |
| 42 | want_linux_stat_h = false |
| 43 | @@ -501,6 +511,7 @@ foreach decl : ['char16_t', |
| 44 | endforeach |
| 45 | |
| 46 | conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h) |
| 47 | +conf.set10('WANT_LINUX_FS_H', want_linux_fs_h) |
| 48 | |
| 49 | foreach ident : ['secure_getenv', '__secure_getenv'] |
| 50 | conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident)) |
| 51 | --- a/src/core/namespace.c |
| 52 | +++ b/src/core/namespace.c |
| 53 | @@ -6,7 +6,9 @@ |
| 54 | #include <stdio.h> |
| 55 | #include <sys/mount.h> |
| 56 | #include <unistd.h> |
| 57 | +#if WANT_LINUX_FS_H |
| 58 | #include <linux/fs.h> |
| 59 | +#endif |
| 60 | |
| 61 | #include "alloc-util.h" |
| 62 | #include "base-filesystem.h" |
| 63 | --- a/src/shared/mount-util.c |
| 64 | +++ b/src/shared/mount-util.c |
| 65 | @@ -7,7 +7,9 @@ |
| 66 | #include <sys/statvfs.h> |
| 67 | #include <unistd.h> |
| 68 | #include <linux/loop.h> |
| 69 | +#if WANT_LINUX_FS_H |
| 70 | #include <linux/fs.h> |
| 71 | +#endif |
| 72 | |
| 73 | #include "alloc-util.h" |
| 74 | #include "chase-symlinks.h" |