summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch')
-rw-r--r--meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch b/meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch
new file mode 100644
index 0000000000..b83fffe793
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch
@@ -0,0 +1,39 @@
1From 9eb4867b4e2dbdb2484ae854022aff97e2f0feb3 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 20/22] 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 288798a0dc..6419a7f216 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.34.1
39