aboutsummaryrefslogtreecommitdiff
path: root/nptl/sysdeps/unix/sysv
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps/unix/sysv')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/fork.c4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/register-atfork.c36
-rw-r--r--nptl/sysdeps/unix/sysv/linux/unregister-atfork.c20
3 files changed, 53 insertions, 7 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/fork.c b/nptl/sysdeps/unix/sysv/linux/fork.c
index b643f89dfc..eba28064ea 100644
--- a/nptl/sysdeps/unix/sysv/linux/fork.c
+++ b/nptl/sysdeps/unix/sysv/linux/fork.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -83,7 +83,7 @@ __libc_fork (void)
/* Reset the file list. These are recursive mutexes. */
fresetlockfiles ();
- /* We execute this even if the 'fork' call failed. */
+ /* Reset locks in the I/O code. */
_IO_list_resetlock ();
/* Run the handlers registered for the child. */
diff --git a/nptl/sysdeps/unix/sysv/linux/register-atfork.c b/nptl/sysdeps/unix/sysv/linux/register-atfork.c
index af567a0b18..7047d6a72a 100644
--- a/nptl/sysdeps/unix/sysv/linux/register-atfork.c
+++ b/nptl/sysdeps/unix/sysv/linux/register-atfork.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -86,3 +86,37 @@ __register_atfork (prepare, parent, child, dso_handle)
return 0;
}
libc_hidden_def (__register_atfork)
+
+
+libc_freeres_fn (free_mem)
+{
+ /* Get the lock to not conflict with running forks. */
+ lll_lock (__fork_lock);
+
+ list_t *runp;
+ list_t *prevp;
+
+ list_for_each_prev_safe (runp, prevp, &__fork_prepare_list)
+ {
+ list_del (runp);
+
+ free (list_entry (runp, struct fork_handler, list));
+ }
+
+ list_for_each_prev_safe (runp, prevp, &__fork_parent_list)
+ {
+ list_del (runp);
+
+ free (list_entry (runp, struct fork_handler, list));
+ }
+
+ list_for_each_prev_safe (runp, prevp, &__fork_child_list)
+ {
+ list_del (runp);
+
+ free (list_entry (runp, struct fork_handler, list));
+ }
+
+ /* Release the lock. */
+ lll_unlock (__fork_lock);
+}
diff --git a/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c b/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c
index 470f80d05c..7b3a785923 100644
--- a/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c
+++ b/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -34,15 +34,27 @@ __unregister_atfork (dso_handle)
list_for_each_prev_safe (runp, prevp, &__fork_prepare_list)
if (list_entry (runp, struct fork_handler, list)->dso_handle == dso_handle)
- list_del (runp);
+ {
+ list_del (runp);
+
+ free (list_entry (runp, struct fork_handler, list));
+ }
list_for_each_prev_safe (runp, prevp, &__fork_parent_list)
if (list_entry (runp, struct fork_handler, list)->dso_handle == dso_handle)
- list_del (runp);
+ {
+ list_del (runp);
+
+ free (list_entry (runp, struct fork_handler, list));
+ }
list_for_each_prev_safe (runp, prevp, &__fork_child_list)
if (list_entry (runp, struct fork_handler, list)->dso_handle == dso_handle)
- list_del (runp);
+ {
+ list_del (runp);
+
+ free (list_entry (runp, struct fork_handler, list));
+ }
/* Release the lock. */
lll_unlock (__fork_lock);