summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2017-10-27 13:16:03 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-11-11 12:14:26 +0000
commitf18e7cd807bc663649d755dd6b6abdd591788f62 (patch)
treeba3e97c703e260e544cac37ac04aa7b665d67c57
parenta52d0f30a744b63e1f077e14a9d84aac03a122a8 (diff)
downloadpoky-f18e7cd807bc663649d755dd6b6abdd591788f62.tar.gz
systemd: Fix build with musl/mips64
(From OE-Core rev: b2ca2d74d773d6d63834c1018a9041ae52a6701f) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/systemd/systemd/0001-Use-uintmax_t-for-handling-rlim_t.patch89
-rw-r--r--meta/recipes-core/systemd/systemd_234.bb1
2 files changed, 90 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0001-Use-uintmax_t-for-handling-rlim_t.patch b/meta/recipes-core/systemd/systemd/0001-Use-uintmax_t-for-handling-rlim_t.patch
new file mode 100644
index 0000000000..779dc78fd3
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-Use-uintmax_t-for-handling-rlim_t.patch
@@ -0,0 +1,89 @@
1From b2d4171c6e521cf1e70331fb769234d63a4a6d44 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 27 Oct 2017 13:00:41 -0700
4Subject: [PATCH] Use uintmax_t for handling rlim_t
5
6PRIu{32,64} is not right format to represent rlim_t type
7therefore use %ju and typecast the rlim_t variables to
8uintmax_t.
9
10Fixes portablility errors like
11
12execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
13| fprintf(f, "%s%s: " RLIM_FMT "\n",
14| ^~~~~~~~
15| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
16| ~~~~~~~~~~~~~~~~~~~~~~
17
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/7199]
21
22 src/basic/format-util.h | 8 --------
23 src/basic/rlimit-util.c | 8 ++++----
24 src/core/execute.c | 8 ++++----
25 3 files changed, 8 insertions(+), 16 deletions(-)
26
27diff --git a/src/basic/format-util.h b/src/basic/format-util.h
28index ae42a8f89..144249cd6 100644
29--- a/src/basic/format-util.h
30+++ b/src/basic/format-util.h
31@@ -60,14 +60,6 @@
32 # define PRI_TIMEX "li"
33 #endif
34
35-#if SIZEOF_RLIM_T == 8
36-# define RLIM_FMT "%" PRIu64
37-#elif SIZEOF_RLIM_T == 4
38-# define RLIM_FMT "%" PRIu32
39-#else
40-# error Unknown rlim_t size
41-#endif
42-
43 #if SIZEOF_DEV_T == 8
44 # define DEV_FMT "%" PRIu64
45 #elif SIZEOF_DEV_T == 4
46diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
47index ca834df62..41fcebb74 100644
48--- a/src/basic/rlimit-util.c
49+++ b/src/basic/rlimit-util.c
50@@ -284,13 +284,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
51 if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
52 s = strdup("infinity");
53 else if (rl->rlim_cur >= RLIM_INFINITY)
54- (void) asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
55+ (void) asprintf(&s, "infinity:%ju", (uintmax_t)rl->rlim_max);
56 else if (rl->rlim_max >= RLIM_INFINITY)
57- (void) asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
58+ (void) asprintf(&s, "%ju:infinity", (uintmax_t)rl->rlim_cur);
59 else if (rl->rlim_cur == rl->rlim_max)
60- (void) asprintf(&s, RLIM_FMT, rl->rlim_cur);
61+ (void) asprintf(&s, "%ju", (uintmax_t)rl->rlim_cur);
62 else
63- (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
64+ (void) asprintf(&s, "%ju:%ju", (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
65
66 if (!s)
67 return -ENOMEM;
68diff --git a/src/core/execute.c b/src/core/execute.c
69index d72e5bf08..d38946002 100644
70--- a/src/core/execute.c
71+++ b/src/core/execute.c
72@@ -3443,10 +3443,10 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
73
74 for (i = 0; i < RLIM_NLIMITS; i++)
75 if (c->rlimit[i]) {
76- fprintf(f, "%s%s: " RLIM_FMT "\n",
77- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
78- fprintf(f, "%s%sSoft: " RLIM_FMT "\n",
79- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
80+ fprintf(f, "%s%s: %ju\n",
81+ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
82+ fprintf(f, "%s%sSoft: %ju\n",
83+ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
84 }
85
86 if (c->ioprio_set) {
87--
882.14.3
89
diff --git a/meta/recipes-core/systemd/systemd_234.bb b/meta/recipes-core/systemd/systemd_234.bb
index bcb683f10a..6b8745b93f 100644
--- a/meta/recipes-core/systemd/systemd_234.bb
+++ b/meta/recipes-core/systemd/systemd_234.bb
@@ -40,6 +40,7 @@ SRC_URI = "git://github.com/systemd/systemd.git;protocol=git \
40 file://0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ 40 file://0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \
41 file://0013-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch \ 41 file://0013-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch \
42 file://0001-Define-_PATH_WTMPX-and-_PATH_UTMPX-if-not-defined.patch \ 42 file://0001-Define-_PATH_WTMPX-and-_PATH_UTMPX-if-not-defined.patch \
43 file://0001-Use-uintmax_t-for-handling-rlim_t.patch \
43 " 44 "
44SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch" 45SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
45 46