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