| From b7eacdf0388f930fc5271bdecfa46612c71dd65c Mon Sep 17 00:00:00 2001 |
| From: Chen Qi <Qi.Chen@windriver.com> |
| Date: Tue, 27 Feb 2018 13:27:47 +0800 |
| Subject: [PATCH 30/31] fix missing of __register_atfork for non-glibc builds |
| |
| Upstream-Status: Pending |
| |
| Signed-off-by: Chen Qi <Qi.Chen@windriver.com> |
| --- |
| src/basic/process-util.c | 7 +++++++ |
| 1 file changed, 7 insertions(+) |
| |
| diff --git a/src/basic/process-util.c b/src/basic/process-util.c |
| index dc7c9ef9e..85ce8a0cc 100644 |
| --- a/src/basic/process-util.c |
| +++ b/src/basic/process-util.c |
| @@ -39,6 +39,9 @@ |
| #if HAVE_VALGRIND_VALGRIND_H |
| #include <valgrind/valgrind.h> |
| #endif |
| +#ifndef __GLIBC__ |
| +#include <pthread.h> |
| +#endif |
| |
| #include "alloc-util.h" |
| #include "architecture.h" |
| @@ -1112,11 +1115,15 @@ void reset_cached_pid(void) { |
| cached_pid = CACHED_PID_UNSET; |
| } |
| |
| +#ifdef __GLIBC__ |
| /* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc |
| * headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against |
| * libpthread, as it is part of glibc anyway. */ |
| extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void * __dso_handle); |
| extern void* __dso_handle __attribute__ ((__weak__)); |
| +#else |
| +#define __register_atfork(prepare,parent,child,dso) pthread_atfork(prepare,parent,child) |
| +#endif |
| |
| pid_t getpid_cached(void) { |
| pid_t current_value; |
| -- |
| 2.13.0 |
| |