summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2023-08-02 21:55:08 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-08-04 11:44:28 +0100
commit266af294a26e1ad8b8983baca51ff330db254af1 (patch)
tree74f2d0309d069201634a55bad48bfa4933184123 /meta
parent5fab97cc550682fb3dd9c3878e241806497f48a0 (diff)
downloadpoky-266af294a26e1ad8b8983baca51ff330db254af1.tar.gz
systemd: Make 254 work on musl
(From OE-Core rev: 2a7dc1deaa7514c8257d828ee84da70185fc3eda) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-core/systemd/systemd/0028-sd-event-Make-malloc_trim-conditional-on-glibc.patch39
-rw-r--r--meta/recipes-core/systemd/systemd/0029-shared-Do-not-use-malloc_info-on-musl.patch50
-rw-r--r--meta/recipes-core/systemd/systemd_254.bb2
3 files changed, 91 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0028-sd-event-Make-malloc_trim-conditional-on-glibc.patch b/meta/recipes-core/systemd/systemd/0028-sd-event-Make-malloc_trim-conditional-on-glibc.patch
new file mode 100644
index 0000000000..c9ec00012e
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0028-sd-event-Make-malloc_trim-conditional-on-glibc.patch
@@ -0,0 +1,39 @@
1From 148645ba8b62f04c7c5ff5907378663f97880f22 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 2 Aug 2023 12:06:27 -0700
4Subject: [PATCH 1/4] sd-event: Make malloc_trim() conditional on glibc
5
6musl does not have this API
7
8Upstream-Status: Inappropriate [musl-specific]
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 src/libsystemd/sd-event/sd-event.c | 4 +++-
12 1 file changed, 3 insertions(+), 1 deletion(-)
13
14diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
15index aba458185b..48c94a7672 100644
16--- a/src/libsystemd/sd-event/sd-event.c
17+++ b/src/libsystemd/sd-event/sd-event.c
18@@ -1874,7 +1874,7 @@ _public_ int sd_event_add_exit(
19 }
20
21 _public_ int sd_event_trim_memory(void) {
22- int r;
23+ int r = 0;
24
25 /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
26 * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
27@@ -1888,7 +1888,9 @@ _public_ int sd_event_trim_memory(void) {
28
29 usec_t before_timestamp = now(CLOCK_MONOTONIC);
30 hashmap_trim_pools();
31+#ifdef __GLIBC__
32 r = malloc_trim(0);
33+#endif
34 usec_t after_timestamp = now(CLOCK_MONOTONIC);
35
36 if (r > 0)
37--
382.41.0
39
diff --git a/meta/recipes-core/systemd/systemd/0029-shared-Do-not-use-malloc_info-on-musl.patch b/meta/recipes-core/systemd/systemd/0029-shared-Do-not-use-malloc_info-on-musl.patch
new file mode 100644
index 0000000000..8e386551a1
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0029-shared-Do-not-use-malloc_info-on-musl.patch
@@ -0,0 +1,50 @@
1From 9430646e72ea5d260ade300038a6d976fecf7da5 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 2 Aug 2023 12:20:40 -0700
4Subject: [PATCH 4/4] shared: Do not use malloc_info on musl
5
6Upstream-Status: Inappropriate [musl-specific]
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 src/shared/bus-util.c | 5 +++--
10 src/shared/common-signal.c | 4 ++--
11 2 files changed, 5 insertions(+), 4 deletions(-)
12
13--- a/src/shared/bus-util.c
14+++ b/src/shared/bus-util.c
15@@ -617,15 +617,16 @@ static int method_dump_memory_state_by_f
16 _cleanup_close_ int fd = -EBADF;
17 size_t dump_size;
18 FILE *f;
19- int r;
20+ int r = 0;
21
22 assert(message);
23
24 f = memstream_init(&m);
25 if (!f)
26 return -ENOMEM;
27-
28+#ifdef __GLIBC__
29 r = RET_NERRNO(malloc_info(/* options= */ 0, f));
30+#endif
31 if (r < 0)
32 return r;
33
34--- a/src/shared/common-signal.c
35+++ b/src/shared/common-signal.c
36@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *
37 log_oom();
38 break;
39 }
40-
41+#ifdef __GLIBC__
42 if (malloc_info(0, f) < 0) {
43 log_error_errno(errno, "Failed to invoke malloc_info(): %m");
44 break;
45 }
46-
47+#endif
48 (void) memstream_dump(LOG_INFO, &m);
49 break;
50 }
diff --git a/meta/recipes-core/systemd/systemd_254.bb b/meta/recipes-core/systemd/systemd_254.bb
index 7ba4233f6a..ea1a4f02f0 100644
--- a/meta/recipes-core/systemd/systemd_254.bb
+++ b/meta/recipes-core/systemd/systemd_254.bb
@@ -53,6 +53,8 @@ SRC_URI_MUSL = "\
53 file://0025-include-sys-file.h-for-LOCK_EX.patch \ 53 file://0025-include-sys-file.h-for-LOCK_EX.patch \
54 file://0026-test-test-sizeof-Include-sys-timex.h-for-struct-time.patch \ 54 file://0026-test-test-sizeof-Include-sys-timex.h-for-struct-time.patch \
55 file://0027-include-missing-sys-file.h-for-LOCK_EX.patch \ 55 file://0027-include-missing-sys-file.h-for-LOCK_EX.patch \
56 file://0028-sd-event-Make-malloc_trim-conditional-on-glibc.patch \
57 file://0029-shared-Do-not-use-malloc_info-on-musl.patch \
56 " 58 "
57 59
58PAM_PLUGINS = " \ 60PAM_PLUGINS = " \