cmake: bump version to 3.6.3
[buildroot-gz.git] / package / systemd / 0005-missing.h-add-missing-definitions-for-__O_TMPFILE.patch
blob1c5ca05c973bcb7ecbae71d90caba46f625cb673
1 From daad709a7c13c0fac73e407528f96cc876c09629 Mon Sep 17 00:00:00 2001
2 From: "Yann E. MORIN" <yann.morin.1998@free.fr>
3 Date: Sun, 28 Aug 2016 17:26:42 +0200
4 Subject: [PATCH] missing.h: add missing definitions for __O_TMPFILE
6 Currently, a missing __O_TMPFILE was only defined for i386 and x86_64,
7 leaving any other architectures with an "old" toolchain fail miserably
8 at build time:
9 src/import/export-raw.c: In function 'reflink_snapshot':
10 src/import/export-raw.c:271:26: error: 'O_TMPFILE' undeclared (first use in this function)
11 new_fd = open(d, O_TMPFILE|O_CLOEXEC|O_NOCTTY|O_RDWR, 0600);
14 __O_TMPFILE (and O_TMPFILE) are available since glibc 2.19. However, a
15 lot of existing toolchains are still using glibc-2.18, and some even
16 before that, and it is not really possible to update those toolchains.
18 Instead of defining it only for i386 and x86_64, define __O_TMPFILE
19 with the specific values for those archs where it is different from the
20 generic value. Use the values as found in the Linux kernel (v4.8-rc3,
21 current as of time of commit).
23 Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
24 ---
25 Backported from upstream:
26 https://github.com/systemd/systemd/commit/daad709a7c13c0fac73e407528f96cc876c09629
27 ---
28 src/basic/missing.h | 17 +++++++++++++----
29 1 file changed, 13 insertions(+), 4 deletions(-)
31 diff --git a/src/basic/missing.h b/src/basic/missing.h
32 index f8e0966..13ff51c 100644
33 --- a/src/basic/missing.h
34 +++ b/src/basic/missing.h
35 @@ -537,12 +537,21 @@ struct btrfs_ioctl_quota_ctl_args {
36 # define DRM_IOCTL_DROP_MASTER _IO('d', 0x1f)
37 #endif
39 -#if defined(__i386__) || defined(__x86_64__)
41 -/* The precise definition of __O_TMPFILE is arch specific, so let's
42 - * just define this on x86 where we know the value. */
43 +/* The precise definition of __O_TMPFILE is arch specific; use the
44 + * values defined by the kernel (note: some are hexa, some are octal,
45 + * duplicated as-is from the kernel definitions):
46 + * - alpha, parisc, sparc: each has a specific value;
47 + * - others: they use the "generic" value.
48 + */
50 #ifndef __O_TMPFILE
51 +#if defined(__alpha__)
52 +#define __O_TMPFILE 0100000000
53 +#elif defined(__parisc__) || defined(__hppa__)
54 +#define __O_TMPFILE 0400000000
55 +#elif defined(__sparc__) || defined(__sparc64__)
56 +#define __O_TMPFILE 0x2000000
57 +#else
58 #define __O_TMPFILE 020000000
59 #endif
61 --
62 2.7.4