This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.18-255-g7b7bab1


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  7b7bab1391a3b16fff7e325e2c8a36b68eacba90 (commit)
      from  d39baad11e5092b56621902f8406c64c092a90dc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7b7bab1391a3b16fff7e325e2c8a36b68eacba90

commit 7b7bab1391a3b16fff7e325e2c8a36b68eacba90
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Tue Sep 24 23:08:15 2013 +0200

    Add fork hooks for pthread_atfork
    
    pthread_atfork needs application callbacks to be called outside any locking.

diff --git a/ChangeLog b/ChangeLog
index 2ff5516..1c3f685 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-10-04  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* sysdeps/mach/hurd/fork.c (_hurd_atfork_prepare_hook,
+	_hurd_atfork_child_hook, _hurd_atfork_parent_hook): New hooks.
+	(__fork): Call _hurd_atfork_prepare_hook hooks before all locking, call
+	_hurd_atfork_parent_hook or _hurd_atfork_child_hook after all unlocking.
+
 2013-10-04  Ryan S. Arnold  <ryan.arnold@linaro.org>
 
 	* misc/swapon.c (swapon): Update definition, adding FLAGS parameter to
diff --git a/sysdeps/mach/hurd/fork.c b/sysdeps/mach/hurd/fork.c
index ab11bab..321421f 100644
--- a/sysdeps/mach/hurd/fork.c
+++ b/sysdeps/mach/hurd/fork.c
@@ -34,6 +34,11 @@
 symbol_set_declare (_hurd_fork_locks)
 
 
+/* Application callbacks registered through pthread_atfork.  */
+DEFINE_HOOK (_hurd_atfork_prepare_hook, (void));
+DEFINE_HOOK (_hurd_atfork_child_hook, (void));
+DEFINE_HOOK (_hurd_atfork_parent_hook, (void));
+
 /* Things that want to be called before we fork, to prepare the parent for
    task_create, when the new child task will inherit our address space.  */
 DEFINE_HOOK (_hurd_fork_prepare_hook, (void));
@@ -62,6 +67,8 @@ __fork (void)
   error_t err;
   struct hurd_sigstate *volatile ss;
 
+  RUN_HOOK (_hurd_atfork_prepare_hook, ());
+
   ss = _hurd_self_sigstate ();
   __spin_lock (&ss->critical_section_lock);
 
@@ -695,6 +702,14 @@ __fork (void)
 
   _hurd_critical_section_unlock (ss);
 
+  if (!err)
+    {
+      if (pid != 0)
+	RUN_HOOK (_hurd_atfork_parent_hook, ());
+      else
+	RUN_HOOK (_hurd_atfork_child_hook, ());
+    }
+
   return err ? __hurd_fail (err) : pid;
 }
 libc_hidden_def (__fork)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                |    7 +++++++
 sysdeps/mach/hurd/fork.c |   15 +++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]