summaryrefslogtreecommitdiff
path: root/sysdeps/nptl/fork.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/nptl/fork.h')
-rw-r--r--sysdeps/nptl/fork.h33
1 files changed, 19 insertions, 14 deletions
diff --git a/sysdeps/nptl/fork.h b/sysdeps/nptl/fork.h
index 76762d4b1e..6eab61c121 100644
--- a/sysdeps/nptl/fork.h
+++ b/sysdeps/nptl/fork.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2016 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -24,29 +24,37 @@ extern unsigned long int __fork_generation attribute_hidden;
/* Pointer to the fork generation counter in the thread library. */
extern unsigned long int *__fork_generation_pointer attribute_hidden;
-/* Lock to protect allocation and deallocation of fork handlers. */
-extern int __fork_lock attribute_hidden;
-
/* Elements of the fork handler lists. */
struct fork_handler
{
- struct fork_handler *next;
void (*prepare_handler) (void);
void (*parent_handler) (void);
void (*child_handler) (void);
void *dso_handle;
- unsigned int refcntr;
- int need_signal;
};
-/* The single linked list of all currently registered for handlers. */
-extern struct fork_handler *__fork_handlers attribute_hidden;
-
-
/* Function to call to unregister fork handlers. */
extern void __unregister_atfork (void *dso_handle) attribute_hidden;
#define UNREGISTER_ATFORK(dso_handle) __unregister_atfork (dso_handle)
+enum __run_fork_handler_type
+{
+ atfork_run_prepare,
+ atfork_run_child,
+ atfork_run_parent
+};
+
+/* Run the atfork handlers and lock/unlock the internal lock depending
+ of the WHO argument:
+
+ - atfork_run_prepare: run all the PREPARE_HANDLER in reverse order of
+ insertion and locks the internal lock.
+ - atfork_run_child: run all the CHILD_HANDLER and unlocks the internal
+ lock.
+ - atfork_run_parent: run all the PARENT_HANDLER and unlocks the internal
+ lock. */
+extern void __run_fork_handlers (enum __run_fork_handler_type who)
+ attribute_hidden;
/* C library side function to register new fork handlers. */
extern int __register_atfork (void (*__prepare) (void),
@@ -54,6 +62,3 @@ extern int __register_atfork (void (*__prepare) (void),
void (*__child) (void),
void *dso_handle);
libc_hidden_proto (__register_atfork)
-
-/* Add a new element to the fork list. */
-extern void __linkin_atfork (struct fork_handler *newp) attribute_hidden;