|
Zbigniew Jędrzejewski-Szmek |
530689 |
From 75720bff62a84896e9a0654afc7cf9408cf89a38 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
From: Filipe Brandenburger <filbranden@google.com>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
Date: Sun, 15 Jul 2018 22:43:35 -0700
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
Subject: [PATCH] build-sys: Detect whether struct statx is defined in
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
sys/stat.h
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
MIME-Version: 1.0
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
Content-Type: text/plain; charset=UTF-8
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
Content-Transfer-Encoding: 8bit
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
Starting with glibc 2.27.9000-36.fc29, include file sys/stat.h will have a
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
definition for struct statx, in which case include file linux/stat.h should be
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
avoided, in order to prevent a duplicate definition.
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
In file included from ../src/basic/missing.h:18,
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
from ../src/basic/util.h:28,
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
from ../src/basic/hashmap.h:10,
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
from ../src/shared/bus-util.h:12,
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
from ../src/libsystemd/sd-bus/bus-creds.c:11:
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
/usr/include/linux/stat.h:99:8: error: redefinition of ‘struct statx’
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
struct statx {
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
^~~~~
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
In file included from /usr/include/sys/stat.h:446,
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
from ../src/basic/util.h:19,
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
from ../src/basic/hashmap.h:10,
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
from ../src/shared/bus-util.h:12,
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
from ../src/libsystemd/sd-bus/bus-creds.c:11:
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
/usr/include/bits/statx.h:36:8: note: originally defined here
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
struct statx
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
^~~~~
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
Extend our meson.build to look for struct statx when only sys/stat.h is
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
included and, in that case, do not include linux/stat.h anymore.
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
Tested that systemd builds correctly when using a glibc version that includes a
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
definition for struct statx.
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
glibc Fedora RPM update:
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
https://src.fedoraproject.org/rpms/glibc/c/28cb5d31fc1e5887912283c889689c47076278ae
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
glibc upstream commit:
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fd70af45528d59a00eb3190ef6706cb299488fcd
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
meson.build | 5 +++++
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
src/basic/missing.h | 5 ++++-
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
src/basic/xattr-util.c | 1 -
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
3 files changed, 9 insertions(+), 2 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
diff --git a/meson.build b/meson.build
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
index dd904c7148..68423bdfa5 100644
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
--- a/meson.build
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
+++ b/meson.build
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
@@ -425,6 +425,7 @@ decl_headers = '''
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
#include <sys/stat.h>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
'''
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
# FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
+# FIXME: these should use -D_GNU_SOURCE, since that is defined at build time
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
foreach decl : ['char16_t',
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
'char32_t',
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
@@ -439,6 +440,10 @@ foreach decl : ['char16_t',
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
endforeach
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
+conf.set10('HAVE_STRUCT_STATX_IN_SYS_STAT_H', cc.sizeof('struct statx', prefix : '''
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
+#include <sys/stat.h>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
+''', args : '-D_GNU_SOURCE') > 0)
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
['IFLA_VRF_TABLE', 'linux/if_link.h'],
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
diff --git a/src/basic/missing.h b/src/basic/missing.h
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
index 71a07d0574..14ad3d4914 100644
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
--- a/src/basic/missing.h
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
+++ b/src/basic/missing.h
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
@@ -15,7 +15,6 @@
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
#include <linux/neighbour.h>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
#include <linux/oom.h>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
#include <linux/rtnetlink.h>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
-#include <linux/stat.h>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
#include <net/ethernet.h>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
#include <stdlib.h>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
#include <sys/resource.h>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
@@ -25,6 +24,10 @@
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
#include <uchar.h>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
#include <unistd.h>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
+#if !HAVE_STRUCT_STATX_IN_SYS_STAT_H
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
+#include <linux/stat.h>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
+#endif
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
#if HAVE_AUDIT
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
#include <libaudit.h>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
#endif
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
diff --git a/src/basic/xattr-util.c b/src/basic/xattr-util.c
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
index c5c55ea846..0ee0979837 100644
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
--- a/src/basic/xattr-util.c
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
+++ b/src/basic/xattr-util.c
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
@@ -2,7 +2,6 @@
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
#include <errno.h>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
#include <fcntl.h>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
-#include <linux/stat.h>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
#include <stdint.h>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
#include <stdlib.h>
|
|
Zbigniew Jędrzejewski-Szmek |
530689 |
#include <string.h>
|