summaryrefslogtreecommitdiffstats
path: root/package/systemd/0005-missing.h-add-missing-definitions-for-__O_TMPFILE.patch
diff options
context:
space:
mode:
authorYann E. MORIN <yann.morin.1998@free.fr>2016-08-30 11:29:37 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-09-18 16:03:43 +0200
commit01e807f0d8dd411643e4f0939a5b8623bfbe9518 (patch)
tree0cbba6035a3003a259510996fa60c2cc66479182 /package/systemd/0005-missing.h-add-missing-definitions-for-__O_TMPFILE.patch
parentc6f63fca0e62860b1240e039a79ce02fd0f0f9db (diff)
downloadbuildroot-01e807f0d8dd411643e4f0939a5b8623bfbe9518.tar.gz
buildroot-01e807f0d8dd411643e4f0939a5b8623bfbe9518.zip
package/systemd: fix build with old toolchains
Toolchains using glibc-2.18 or older do not define O_TMPFILE, which causes build failures on some archs. systemd has a definition for O_TMPFILE if it is missing, but only defines it for i386 or x86_64. Furthermore, the header defining it is not included everywhere O_TMPFILE is used. Fix that with three patches backported from upstream: - include the needed header where it is needed (he!), - define O_TMPFILE for all archs, according to linux-4.8rc3, - no longer guard against undefined O_TMPFILE in fileio. Upstream merge commit: https://github.com/systemd/systemd/commit/4a13100c6a5a0a4b793e90bd43d21c3696c42d46 Fixes: http://autobuild.buildroot.net/results/b0067e72ffcbbe1db9ef49ab297cece951345aeb/ Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/systemd/0005-missing.h-add-missing-definitions-for-__O_TMPFILE.patch')
-rw-r--r--package/systemd/0005-missing.h-add-missing-definitions-for-__O_TMPFILE.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/package/systemd/0005-missing.h-add-missing-definitions-for-__O_TMPFILE.patch b/package/systemd/0005-missing.h-add-missing-definitions-for-__O_TMPFILE.patch
new file mode 100644
index 0000000000..1c5ca05c97
--- /dev/null
+++ b/package/systemd/0005-missing.h-add-missing-definitions-for-__O_TMPFILE.patch
@@ -0,0 +1,63 @@
+From daad709a7c13c0fac73e407528f96cc876c09629 Mon Sep 17 00:00:00 2001
+From: "Yann E. MORIN" <yann.morin.1998@free.fr>
+Date: Sun, 28 Aug 2016 17:26:42 +0200
+Subject: [PATCH] missing.h: add missing definitions for __O_TMPFILE
+
+Currently, a missing __O_TMPFILE was only defined for i386 and x86_64,
+leaving any other architectures with an "old" toolchain fail miserably
+at build time:
+ src/import/export-raw.c: In function 'reflink_snapshot':
+ src/import/export-raw.c:271:26: error: 'O_TMPFILE' undeclared (first use in this function)
+ new_fd = open(d, O_TMPFILE|O_CLOEXEC|O_NOCTTY|O_RDWR, 0600);
+ ^
+
+__O_TMPFILE (and O_TMPFILE) are available since glibc 2.19. However, a
+lot of existing toolchains are still using glibc-2.18, and some even
+before that, and it is not really possible to update those toolchains.
+
+Instead of defining it only for i386 and x86_64, define __O_TMPFILE
+with the specific values for those archs where it is different from the
+generic value. Use the values as found in the Linux kernel (v4.8-rc3,
+current as of time of commit).
+
+Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
+---
+Backported from upstream:
+ https://github.com/systemd/systemd/commit/daad709a7c13c0fac73e407528f96cc876c09629
+---
+ src/basic/missing.h | 17 +++++++++++++----
+ 1 file changed, 13 insertions(+), 4 deletions(-)
+
+diff --git a/src/basic/missing.h b/src/basic/missing.h
+index f8e0966..13ff51c 100644
+--- a/src/basic/missing.h
++++ b/src/basic/missing.h
+@@ -537,12 +537,21 @@ struct btrfs_ioctl_quota_ctl_args {
+ # define DRM_IOCTL_DROP_MASTER _IO('d', 0x1f)
+ #endif
+
+-#if defined(__i386__) || defined(__x86_64__)
+-
+-/* The precise definition of __O_TMPFILE is arch specific, so let's
+- * just define this on x86 where we know the value. */
++/* The precise definition of __O_TMPFILE is arch specific; use the
++ * values defined by the kernel (note: some are hexa, some are octal,
++ * duplicated as-is from the kernel definitions):
++ * - alpha, parisc, sparc: each has a specific value;
++ * - others: they use the "generic" value.
++ */
+
+ #ifndef __O_TMPFILE
++#if defined(__alpha__)
++#define __O_TMPFILE 0100000000
++#elif defined(__parisc__) || defined(__hppa__)
++#define __O_TMPFILE 0400000000
++#elif defined(__sparc__) || defined(__sparc64__)
++#define __O_TMPFILE 0x2000000
++#else
+ #define __O_TMPFILE 020000000
+ #endif
+
+--
+2.7.4
+
OpenPOWER on IntegriCloud