diff options
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.patch | 39 |
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..16df44cd86 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch | |||
@@ -0,0 +1,39 @@ | |||
1 | From 66de8a53849f76f5596327c38ae5f002b9f534cd Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Wed, 2 Aug 2023 12:06:27 -0700 | ||
4 | Subject: [PATCH 20/26] sd-event: Make malloc_trim() conditional on glibc | ||
5 | |||
6 | musl does not have this API | ||
7 | |||
8 | Upstream-Status: Inappropriate [musl-specific] | ||
9 | Signed-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 | |||
14 | diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c | ||
15 | index 7aea7d2581..d3f4001f53 100644 | ||
16 | --- a/src/libsystemd/sd-event/sd-event.c | ||
17 | +++ b/src/libsystemd/sd-event/sd-event.c | ||
18 | @@ -1881,7 +1881,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 | @@ -1895,7 +1895,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 | -- | ||
38 | 2.34.1 | ||
39 | |||