summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2018-08-06 15:56:59 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-08-08 10:51:59 +0100
commitf13c32446f12b1beaa414dc7cf0475d03adc118d (patch)
treef13a5f4fdd21eb593b794910ba0bd8384c913966
parent4ffc885788fb1401639a57b66eb5ecf91908e1d8 (diff)
downloadpoky-f13c32446f12b1beaa414dc7cf0475d03adc118d.tar.gz
systemd: Detect if statx struct is defined in sys/stat.h
Fixed build with glibc 2.28+ (From OE-Core rev: 776d14db9589eb2e2bca35da862ad0e260e3584c) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/systemd/systemd/0022-build-sys-Detect-whether-struct-statx-is-defined-in-.patch109
-rw-r--r--meta/recipes-core/systemd/systemd_239.bb1
2 files changed, 110 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0022-build-sys-Detect-whether-struct-statx-is-defined-in-.patch b/meta/recipes-core/systemd/systemd/0022-build-sys-Detect-whether-struct-statx-is-defined-in-.patch
new file mode 100644
index 0000000000..962463f0b8
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0022-build-sys-Detect-whether-struct-statx-is-defined-in-.patch
@@ -0,0 +1,109 @@
1From 75720bff62a84896e9a0654afc7cf9408cf89a38 Mon Sep 17 00:00:00 2001
2From: Filipe Brandenburger <filbranden@google.com>
3Date: Sun, 15 Jul 2018 22:43:35 -0700
4Subject: [PATCH] build-sys: Detect whether struct statx is defined in
5 sys/stat.h
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10Starting with glibc 2.27.9000-36.fc29, include file sys/stat.h will have a
11definition for struct statx, in which case include file linux/stat.h should be
12avoided, in order to prevent a duplicate definition.
13
14 In file included from ../src/basic/missing.h:18,
15 from ../src/basic/util.h:28,
16 from ../src/basic/hashmap.h:10,
17 from ../src/shared/bus-util.h:12,
18 from ../src/libsystemd/sd-bus/bus-creds.c:11:
19 /usr/include/linux/stat.h:99:8: error: redefinition of ‘struct statx’
20 struct statx {
21 ^~~~~
22 In file included from /usr/include/sys/stat.h:446,
23 from ../src/basic/util.h:19,
24 from ../src/basic/hashmap.h:10,
25 from ../src/shared/bus-util.h:12,
26 from ../src/libsystemd/sd-bus/bus-creds.c:11:
27 /usr/include/bits/statx.h:36:8: note: originally defined here
28 struct statx
29 ^~~~~
30
31Extend our meson.build to look for struct statx when only sys/stat.h is
32included and, in that case, do not include linux/stat.h anymore.
33
34Tested that systemd builds correctly when using a glibc version that includes a
35definition for struct statx.
36
37glibc Fedora RPM update:
38https://src.fedoraproject.org/rpms/glibc/c/28cb5d31fc1e5887912283c889689c47076278ae
39
40glibc upstream commit:
41https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fd70af45528d59a00eb3190ef6706cb299488fcd
42---
43
44Upstream-Status: Pending
45Signed-off-by: Khem Raj <raj.khem@gmail.com>
46
47 meson.build | 5 +++++
48 src/basic/missing.h | 5 ++++-
49 src/basic/xattr-util.c | 1 -
50 3 files changed, 9 insertions(+), 2 deletions(-)
51
52Index: git/meson.build
53===================================================================
54--- git.orig/meson.build
55+++ git/meson.build
56@@ -432,6 +432,7 @@ decl_headers = '''
57 #include <sys/stat.h>
58 '''
59 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
60+# FIXME: these should use -D_GNU_SOURCE, since that is defined at build time
61
62 foreach decl : ['char16_t',
63 'char32_t',
64@@ -446,6 +447,10 @@ foreach decl : ['char16_t',
65 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
66 endforeach
67
68+conf.set10('HAVE_STRUCT_STATX_IN_SYS_STAT_H', cc.sizeof('struct statx', prefix : '''
69+#include <sys/stat.h>
70+''', args : '-D_GNU_SOURCE') > 0)
71+
72 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
73 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
74 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
75Index: git/src/basic/missing.h
76===================================================================
77--- git.orig/src/basic/missing.h
78+++ git/src/basic/missing.h
79@@ -15,7 +15,6 @@
80 #include <linux/neighbour.h>
81 #include <linux/oom.h>
82 #include <linux/rtnetlink.h>
83-#include <linux/stat.h>
84 #include <net/ethernet.h>
85 #include <stdlib.h>
86 #include <sys/resource.h>
87@@ -25,6 +24,10 @@
88 #include <uchar.h>
89 #include <unistd.h>
90
91+#if !HAVE_STRUCT_STATX_IN_SYS_STAT_H
92+#include <linux/stat.h>
93+#endif
94+
95 #if HAVE_AUDIT
96 #include <libaudit.h>
97 #endif
98Index: git/src/basic/xattr-util.c
99===================================================================
100--- git.orig/src/basic/xattr-util.c
101+++ git/src/basic/xattr-util.c
102@@ -2,7 +2,6 @@
103
104 #include <errno.h>
105 #include <fcntl.h>
106-#include <linux/stat.h>
107 #include <stdint.h>
108 #include <stdlib.h>
109 #include <string.h>
diff --git a/meta/recipes-core/systemd/systemd_239.bb b/meta/recipes-core/systemd/systemd_239.bb
index 001a363444..67f6117a2a 100644
--- a/meta/recipes-core/systemd/systemd_239.bb
+++ b/meta/recipes-core/systemd/systemd_239.bb
@@ -28,6 +28,7 @@ SRC_URI += "file://touchscreen.rules \
28 file://0009-nss-mymachines-Build-conditionally-when-ENABLE_MYHOS.patch \ 28 file://0009-nss-mymachines-Build-conditionally-when-ENABLE_MYHOS.patch \
29 file://0001-login-use-parse_uid-when-unmounting-user-runtime-dir.patch \ 29 file://0001-login-use-parse_uid-when-unmounting-user-runtime-dir.patch \
30 file://0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch \ 30 file://0001-sd-bus-make-BUS_DEFAULT_TIMEOUT-configurable.patch \
31 file://0022-build-sys-Detect-whether-struct-statx-is-defined-in-.patch \
31 " 32 "
32SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch" 33SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
33 34