Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys If a signal did not fire, restore the original signal ma...



details:   https://anonhg.NetBSD.org/src/rev/738a51676006
branches:  trunk
changeset: 765494:738a51676006
user:      christos <christos%NetBSD.org@localhost>
date:      Sat May 28 15:33:40 2011 +0000

description:
If a signal did not fire, restore the original signal mask for pselect/pollts
using a signal mask. Tested by tron.

diffstat:

 sys/kern/sys_select.c |   7 +++++--
 sys/kern/sys_sig.c    |  17 +++++++++++++++--
 sys/sys/signalvar.h   |   3 ++-
 3 files changed, 22 insertions(+), 5 deletions(-)

diffs (83 lines):

diff -r 0cff0ce27f1d -r 738a51676006 sys/kern/sys_select.c
--- a/sys/kern/sys_select.c     Sat May 28 15:24:49 2011 +0000
+++ b/sys/kern/sys_select.c     Sat May 28 15:33:40 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_select.c,v 1.32 2011/05/18 14:48:04 christos Exp $ */
+/*     $NetBSD: sys_select.c,v 1.33 2011/05/28 15:33:41 christos Exp $ */
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010 The NetBSD Foundation, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_select.c,v 1.32 2011/05/18 14:48:04 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_select.c,v 1.33 2011/05/28 15:33:41 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -304,6 +304,9 @@
        }
        selclear();
 
+       if (__predict_false(mask))
+               sigsuspendteardown(l);
+
        /* select and poll are not restarted after signals... */
        if (error == ERESTART)
                return EINTR;
diff -r 0cff0ce27f1d -r 738a51676006 sys/kern/sys_sig.c
--- a/sys/kern/sys_sig.c        Sat May 28 15:24:49 2011 +0000
+++ b/sys/kern/sys_sig.c        Sat May 28 15:33:40 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_sig.c,v 1.33 2011/05/18 03:51:41 christos Exp $    */
+/*     $NetBSD: sys_sig.c,v 1.34 2011/05/28 15:33:40 christos Exp $    */
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_sig.c,v 1.33 2011/05/18 03:51:41 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_sig.c,v 1.34 2011/05/28 15:33:40 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -631,6 +631,19 @@
        mutex_exit(p->p_lock);
 }
 
+void
+sigsuspendteardown(struct lwp *l)
+{
+       struct proc *p = l->l_proc;
+
+       mutex_enter(p->p_lock);
+       if (l->l_sigrestore) {
+               l->l_sigrestore = 0;
+               l->l_sigmask = l->l_sigoldmask;
+       }
+       mutex_exit(p->p_lock);
+}
+
 int
 sigsuspend1(struct lwp *l, const sigset_t *ss)
 {
diff -r 0cff0ce27f1d -r 738a51676006 sys/sys/signalvar.h
--- a/sys/sys/signalvar.h       Sat May 28 15:24:49 2011 +0000
+++ b/sys/sys/signalvar.h       Sat May 28 15:33:40 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: signalvar.h,v 1.80 2011/05/18 03:51:41 christos Exp $  */
+/*     $NetBSD: signalvar.h,v 1.81 2011/05/28 15:33:41 christos Exp $  */
 
 /*
  * Copyright (c) 1991, 1993
@@ -149,6 +149,7 @@
 int    sigprocmask1(struct lwp *, int, const sigset_t *, sigset_t *);
 void   sigpending1(struct lwp *, sigset_t *);
 void   sigsuspendsetup(struct lwp *, const sigset_t *);
+void   sigsuspendteardown(struct lwp *);
 int    sigsuspend1(struct lwp *, const sigset_t *);
 int    sigaltstack1(struct lwp *, const struct sigaltstack *,
            struct sigaltstack *);



Home | Main Index | Thread Index | Old Index