Module Name: src Committed By: christos Date: Sat May 28 15:33:41 UTC 2011
Modified Files: src/sys/kern: sys_select.c sys_sig.c src/sys/sys: signalvar.h Log Message: If a signal did not fire, restore the original signal mask for pselect/pollts using a signal mask. Tested by tron. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/kern/sys_select.c cvs rdiff -u -r1.33 -r1.34 src/sys/kern/sys_sig.c cvs rdiff -u -r1.80 -r1.81 src/sys/sys/signalvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/sys_select.c diff -u src/sys/kern/sys_select.c:1.32 src/sys/kern/sys_select.c:1.33 --- src/sys/kern/sys_select.c:1.32 Wed May 18 10:48:04 2011 +++ src/sys/kern/sys_select.c Sat May 28 11:33:41 2011 @@ -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; Index: src/sys/kern/sys_sig.c diff -u src/sys/kern/sys_sig.c:1.33 src/sys/kern/sys_sig.c:1.34 --- src/sys/kern/sys_sig.c:1.33 Tue May 17 23:51:41 2011 +++ src/sys/kern/sys_sig.c Sat May 28 11:33:40 2011 @@ -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) { Index: src/sys/sys/signalvar.h diff -u src/sys/sys/signalvar.h:1.80 src/sys/sys/signalvar.h:1.81 --- src/sys/sys/signalvar.h:1.80 Tue May 17 23:51:41 2011 +++ src/sys/sys/signalvar.h Sat May 28 11:33:41 2011 @@ -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 *);