diff options
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0021-shared-Do-not-use-malloc_info-on-musl.patch')
-rw-r--r-- | meta/recipes-core/systemd/systemd/0021-shared-Do-not-use-malloc_info-on-musl.patch | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0021-shared-Do-not-use-malloc_info-on-musl.patch b/meta/recipes-core/systemd/systemd/0021-shared-Do-not-use-malloc_info-on-musl.patch new file mode 100644 index 0000000000..7eff069bb7 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0021-shared-Do-not-use-malloc_info-on-musl.patch | |||
@@ -0,0 +1,57 @@ | |||
1 | From 502597b9ddd6b145541b23fadca0b1d3ca9f6367 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Wed, 2 Aug 2023 12:20:40 -0700 | ||
4 | Subject: [PATCH 21/22] shared: Do not use malloc_info on musl | ||
5 | |||
6 | Upstream-Status: Inappropriate [musl-specific] | ||
7 | Signed-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 | diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c | ||
14 | index 74f148c8b4..2d862a123d 100644 | ||
15 | --- a/src/shared/bus-util.c | ||
16 | +++ b/src/shared/bus-util.c | ||
17 | @@ -611,15 +611,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat | ||
18 | _cleanup_close_ int fd = -EBADF; | ||
19 | size_t dump_size; | ||
20 | FILE *f; | ||
21 | - int r; | ||
22 | + int r = 0; | ||
23 | |||
24 | assert(message); | ||
25 | |||
26 | f = memstream_init(&m); | ||
27 | if (!f) | ||
28 | return -ENOMEM; | ||
29 | - | ||
30 | +#ifdef __GLIBC__ | ||
31 | r = RET_NERRNO(malloc_info(/* options= */ 0, f)); | ||
32 | +#endif | ||
33 | if (r < 0) | ||
34 | return r; | ||
35 | |||
36 | diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c | ||
37 | index 8e70e365dd..9e782caec9 100644 | ||
38 | --- a/src/shared/common-signal.c | ||
39 | +++ b/src/shared/common-signal.c | ||
40 | @@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo | ||
41 | log_oom(); | ||
42 | break; | ||
43 | } | ||
44 | - | ||
45 | +#ifdef __GLIBC__ | ||
46 | if (malloc_info(0, f) < 0) { | ||
47 | log_error_errno(errno, "Failed to invoke malloc_info(): %m"); | ||
48 | break; | ||
49 | } | ||
50 | - | ||
51 | +#endif | ||
52 | (void) memstream_dump(LOG_INFO, &m); | ||
53 | break; | ||
54 | } | ||
55 | -- | ||
56 | 2.34.1 | ||
57 | |||