1 [Fedora 0001-build-sys-Detect-whether-struct-statx-is-defined-in-.patch]
2 From 75720bff62a84896e9a0654afc7cf9408cf89a38 Mon Sep 17 00:00:00 2001
3 From: Filipe Brandenburger <filbranden@google.com>
4 Date: Sun, 15 Jul 2018 22:43:35 -0700
5 Subject: [PATCH] build-sys: Detect whether struct statx is defined in
8 Content-Type: text/plain; charset=UTF-8
9 Content-Transfer-Encoding: 8bit
11 Starting with glibc 2.27.9000-36.fc29, include file sys/stat.h will have a
12 definition for struct statx, in which case include file linux/stat.h should be
13 avoided, in order to prevent a duplicate definition.
15 In file included from ../src/basic/missing.h:18,
16 from ../src/basic/util.h:28,
17 from ../src/basic/hashmap.h:10,
18 from ../src/shared/bus-util.h:12,
19 from ../src/libsystemd/sd-bus/bus-creds.c:11:
20 /usr/include/linux/stat.h:99:8: error: redefinition of ‘struct statx’
23 In file included from /usr/include/sys/stat.h:446,
24 from ../src/basic/util.h:19,
25 from ../src/basic/hashmap.h:10,
26 from ../src/shared/bus-util.h:12,
27 from ../src/libsystemd/sd-bus/bus-creds.c:11:
28 /usr/include/bits/statx.h:36:8: note: originally defined here
32 Extend our meson.build to look for struct statx when only sys/stat.h is
33 included and, in that case, do not include linux/stat.h anymore.
35 Tested that systemd builds correctly when using a glibc version that includes a
36 definition for struct statx.
38 glibc Fedora RPM update:
39 https://src.fedoraproject.org/rpms/glibc/c/28cb5d31fc1e5887912283c889689c47076278ae
41 glibc upstream commit:
42 https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fd70af45528d59a00eb3190ef6706cb299488fcd
45 src/basic/missing.h | 5 ++++-
46 src/basic/xattr-util.c | 1 -
47 3 files changed, 9 insertions(+), 2 deletions(-)
49 diff --git a/meson.build b/meson.build
50 index dd904c7148..68423bdfa5 100644
53 @@ -425,6 +425,7 @@ decl_headers = '''
56 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
57 +# FIXME: these should use -D_GNU_SOURCE, since that is defined at build time
59 foreach decl : ['char16_t',
61 @@ -439,6 +440,10 @@ foreach decl : ['char16_t',
62 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
65 +conf.set10('HAVE_STRUCT_STATX_IN_SYS_STAT_H', cc.sizeof('struct statx', prefix : '''
66 +#include <sys/stat.h>
67 +''', args : '-D_GNU_SOURCE') > 0)
69 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
70 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
71 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
72 diff --git a/src/basic/missing.h b/src/basic/missing.h
73 index 71a07d0574..14ad3d4914 100644
74 --- a/src/basic/missing.h
75 +++ b/src/basic/missing.h
77 #include <linux/neighbour.h>
78 #include <linux/oom.h>
79 #include <linux/rtnetlink.h>
80 -#include <linux/stat.h>
81 #include <net/ethernet.h>
83 #include <sys/resource.h>
88 +#if !HAVE_STRUCT_STATX_IN_SYS_STAT_H
89 +#include <linux/stat.h>
95 diff --git a/src/basic/xattr-util.c b/src/basic/xattr-util.c
96 index c5c55ea846..0ee0979837 100644
97 --- a/src/basic/xattr-util.c
98 +++ b/src/basic/xattr-util.c
103 -#include <linux/stat.h>