diff --git a/h_malloc.c b/h_malloc.c index d855e0e..998de6f 100644 --- a/h_malloc.c +++ b/h_malloc.c @@ -1156,7 +1156,7 @@ COLD static void init_slow_path(void) { mutex_unlock(&lock); // may allocate, so wait until the allocator is initialized to avoid deadlocking - if (atfork(full_lock, full_unlock, post_fork_child)) { + if (pthread_atfork(full_lock, full_unlock, post_fork_child)) { fatal_error("pthread_atfork failed"); } } diff --git a/util.h b/util.h index 5f2274a..3e07d8c 100644 --- a/util.h +++ b/util.h @@ -38,19 +38,6 @@ typedef uint32_t u32; typedef uint64_t u64; typedef unsigned __int128 u128; -// use __register_atfork directly to avoid linking with libpthread for glibc < 2.28 -#ifdef __GLIBC__ -#if !__GLIBC_PREREQ(2, 28) -extern void *__dso_handle; -extern int __register_atfork(void (*)(void), void (*)(void), void (*)(void), void *); -#define atfork(prepare, parent, child) __register_atfork(prepare, parent, child, __dso_handle) -#endif -#endif - -#ifndef atfork -#define atfork pthread_atfork -#endif - #if CONFIG_SEAL_METADATA #ifdef __GLIBC__