diff options
-rw-r--r-- | Versions | 1 | ||||
-rw-r--r-- | forward.c | 5 | ||||
-rw-r--r-- | sysdeps/generic/pt-atfork.c | 6 |
3 files changed, 10 insertions, 2 deletions
@@ -20,6 +20,7 @@ libc { GLIBC_PRIVATE { __libc_alloca_cutoff; __libc_pthread_init; + # TODO: expose this publicly __register_atfork; } } @@ -148,6 +148,7 @@ struct atfork { void (*prepare) (void); void (*parent) (void); void (*child) (void); + void *dso_handle; struct atfork *prev; struct atfork *next; }; @@ -220,7 +221,8 @@ int __register_atfork ( void (*prepare) (void), void (*parent) (void), - void (*child) (void)) + void (*child) (void), + void *dso_handle) { struct atfork *new = malloc (sizeof (*new)); if (!new) @@ -229,6 +231,7 @@ __register_atfork ( new->prepare = prepare; new->parent = parent; new->child = child; + new->dso_handle = dso_handle; new->prev = NULL; __mutex_lock (&atfork_lock); diff --git a/sysdeps/generic/pt-atfork.c b/sysdeps/generic/pt-atfork.c index ce72e10..304d7ef 100644 --- a/sysdeps/generic/pt-atfork.c +++ b/sysdeps/generic/pt-atfork.c @@ -20,10 +20,14 @@ #include <pthread.h> #include <pt-internal.h> +/* This is defined by newer gcc version unique for each module. */ +extern void *__dso_handle __attribute__ ((__weak__, + __visibility__ ("hidden"))); + int pthread_atfork (void (*prepare) (void), void (*parent) (void), void (*child) (void)) { - return __register_atfork (prepare, parent, child); + return __register_atfork (prepare, parent, child, &__dso_handle == NULL ? NULL : __dso_handle); } |