Patrick Williams | db4c27e | 2022-08-05 08:10:29 -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 | diff --git a/meson.build b/meson.build |
| 16 | index 9c170acc0a..a2e4d5054e 100644 |
| 17 | --- a/meson.build |
| 18 | +++ b/meson.build |
| 19 | @@ -481,7 +481,6 @@ decl_headers = ''' |
| 20 | #include <uchar.h> |
| 21 | #include <sys/mount.h> |
| 22 | #include <sys/stat.h> |
| 23 | -#include <linux/fs.h> |
| 24 | ''' |
| 25 | |
| 26 | foreach decl : ['char16_t', |
| 27 | @@ -493,6 +492,17 @@ foreach decl : ['char16_t', |
| 28 | # We get -1 if the size cannot be determined |
| 29 | have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0 |
| 30 | |
| 31 | + if decl == 'struct mount_attr' |
| 32 | + if have |
| 33 | + want_linux_fs_h = false |
| 34 | + else |
| 35 | + have = cc.sizeof(decl, |
| 36 | + prefix : decl_headers + '#include <linux/fs.h>', |
| 37 | + args : '-D_GNU_SOURCE') > 0 |
| 38 | + want_linux_fs_h = have |
| 39 | + endif |
| 40 | + endif |
| 41 | + |
| 42 | if decl == 'struct statx' |
| 43 | if have |
| 44 | want_linux_stat_h = false |
| 45 | @@ -508,6 +518,7 @@ foreach decl : ['char16_t', |
| 46 | endforeach |
| 47 | |
| 48 | conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h) |
| 49 | +conf.set10('WANT_LINUX_FS_H', want_linux_fs_h) |
| 50 | |
| 51 | foreach ident : ['secure_getenv', '__secure_getenv'] |
| 52 | conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident)) |
| 53 | diff --git a/src/basic/fd-util.c b/src/basic/fd-util.c |
| 54 | index 6c1de92a26..00591d6c2d 100644 |
| 55 | --- a/src/basic/fd-util.c |
| 56 | +++ b/src/basic/fd-util.c |
| 57 | @@ -3,7 +3,9 @@ |
| 58 | #include <errno.h> |
| 59 | #include <fcntl.h> |
| 60 | #include <linux/btrfs.h> |
| 61 | +#if WANT_LINUX_FS_H |
| 62 | #include <linux/fs.h> |
| 63 | +#endif |
| 64 | #include <linux/magic.h> |
| 65 | #include <sys/ioctl.h> |
| 66 | #include <sys/resource.h> |
| 67 | diff --git a/src/core/namespace.c b/src/core/namespace.c |
| 68 | index 3256871803..2eafe43290 100644 |
| 69 | --- a/src/core/namespace.c |
| 70 | +++ b/src/core/namespace.c |
| 71 | @@ -7,7 +7,9 @@ |
| 72 | #include <sys/file.h> |
| 73 | #include <sys/mount.h> |
| 74 | #include <unistd.h> |
| 75 | +#if WANT_LINUX_FS_H |
| 76 | #include <linux/fs.h> |
| 77 | +#endif |
| 78 | |
| 79 | #include "alloc-util.h" |
| 80 | #include "base-filesystem.h" |
| 81 | diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c |
| 82 | index e76e4a0b38..0c8dec7688 100644 |
| 83 | --- a/src/shared/mount-util.c |
| 84 | +++ b/src/shared/mount-util.c |
| 85 | @@ -7,7 +7,9 @@ |
| 86 | #include <sys/statvfs.h> |
| 87 | #include <unistd.h> |
| 88 | #include <linux/loop.h> |
| 89 | +#if WANT_LINUX_FS_H |
| 90 | #include <linux/fs.h> |
| 91 | +#endif |
| 92 | |
| 93 | #include "alloc-util.h" |
| 94 | #include "chase-symlinks.h" |
| 95 | -- |
| 96 | 2.25.1 |
| 97 | |