summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0012-fix-missing-of-__register_atfork-for-non-glibc-build.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0012-fix-missing-of-__register_atfork-for-non-glibc-build.patch')
-rw-r--r--meta/recipes-core/systemd/systemd/0012-fix-missing-of-__register_atfork-for-non-glibc-build.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0012-fix-missing-of-__register_atfork-for-non-glibc-build.patch b/meta/recipes-core/systemd/systemd/0012-fix-missing-of-__register_atfork-for-non-glibc-build.patch
new file mode 100644
index 0000000000..d41bc4a0da
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0012-fix-missing-of-__register_atfork-for-non-glibc-build.patch
@@ -0,0 +1,45 @@
1From 1fadf805cb391e3bcbd9a0286a9e4b7adb9e7427 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 2 Jul 2018 13:34:09 +0800
4Subject: [PATCH 12/19] fix missing of __register_atfork for non-glibc builds
5
6Upstream-Status: Inappropriate [musl specific]
7
8Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
9---
10 src/basic/process-util.c | 7 +++++++
11 1 file changed, 7 insertions(+)
12
13diff --git a/src/basic/process-util.c b/src/basic/process-util.c
14index 0a4f917cb..3543bc045 100644
15--- a/src/basic/process-util.c
16+++ b/src/basic/process-util.c
17@@ -22,6 +22,9 @@
18 #if HAVE_VALGRIND_VALGRIND_H
19 #include <valgrind/valgrind.h>
20 #endif
21+#ifndef __GLIBC__
22+#include <pthread.h>
23+#endif
24
25 #include "alloc-util.h"
26 #include "architecture.h"
27@@ -1150,11 +1153,15 @@ void reset_cached_pid(void) {
28 cached_pid = CACHED_PID_UNSET;
29 }
30
31+#ifdef __GLIBC__
32 /* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc
33 * headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against
34 * libpthread, as it is part of glibc anyway. */
35 extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void * __dso_handle);
36 extern void* __dso_handle __attribute__ ((__weak__));
37+#else
38+#define __register_atfork(prepare,parent,child,dso) pthread_atfork(prepare,parent,child)
39+#endif
40
41 pid_t getpid_cached(void) {
42 static bool installed = false;
43--
442.11.0
45