This is the mail archive of the libc-alpha@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]

Re: [PATCH 09/15] Hurd signals: implement global signal dispositions


On Sun, Jul 3, 2011 at 2:16 AM, Samuel Thibault <samuel.thibault@gnu.org> wrote:
>> --- a/sysdeps/mach/hurd/spawni.c
>> +++ b/sysdeps/mach/hurd/spawni.c
(...)
>> + ?ints[INIT_SIGPENDING] = _hurd_sigstate_pending (ss); /* XXX really? */
>
> Mmm. According to POSIX, fork() is supposed to clear pending signals,
> but GNU/Hurd currently does not clear them. According to POSIX,
> exec() is supposed to not clear pending signals. So at least, spawn()
> inheriting pending signals is coherent in GNU/Hurd. Making fork() and
> spwan() clear pending signals would be a separate fix.

Attached.
-- 
Jérémie Koenig <jk@jk.fr.eu.org>
http://jk.fr.eu.org/
commit da8bf5ea07658a4a6cda679c2b89b48a3f990b37
Author: Jeremie Koenig <jk@jk.fr.eu.org>
Date:   Tue Jul 5 00:57:25 2011 +0000

    Hurd signals: clear the pending mask in fork and spawn
    
    	* sysdeps/mach/hurd/fork.c (__fork): Clear pending masks in the child
    	process.
    	* sysdeps/mach/hurd/spawni.c (__spawni): Don't propagate the pending
    	mask to the new process.

diff --git a/sysdeps/mach/hurd/fork.c b/sysdeps/mach/hurd/fork.c
index a4f3055..c74998d 100644
--- a/sysdeps/mach/hurd/fork.c
+++ b/sysdeps/mach/hurd/fork.c
@@ -648,8 +648,10 @@ __fork (void)
       err = __USEPORT (PROC, __proc_getpids (port, &_hurd_pid, &_hurd_ppid,
 					     &_hurd_orphaned));
 
-      /* Forking clears the trace flag.  */
+      /* Forking clears the trace flag and pending masks.  */
       __sigemptyset (&_hurdsig_traced);
+      __sigemptyset (&_hurd_global_sigstate->pending);
+      __sigemptyset (&ss->pending);
 
       /* Run things that want to run in the child task to set up.  */
       RUN_HOOK (_hurd_fork_child_hook, ());
diff --git a/sysdeps/mach/hurd/spawni.c b/sysdeps/mach/hurd/spawni.c
index 373da8d..2442e6f 100644
--- a/sysdeps/mach/hurd/spawni.c
+++ b/sysdeps/mach/hurd/spawni.c
@@ -241,7 +241,7 @@ __spawni (pid_t *pid, const char *file,
 
   _hurd_sigstate_lock (ss);
   ints[INIT_SIGMASK] = ss->blocked;
-  ints[INIT_SIGPENDING] = _hurd_sigstate_pending (ss); /* XXX really? */
+  ints[INIT_SIGPENDING] = 0;
   ints[INIT_SIGIGN] = 0;
   /* Unless we were asked to reset all handlers to SIG_DFL,
      pass down the set of signals that were set to SIG_IGN.  */

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