If a signal did not fire, restore the original signal mask for pselect/pollts

using a signal mask. Tested by tron.
This commit is contained in:
christos 2011-05-28 15:33:40 +00:00
parent 3b708a2134
commit 0b60c7be7c
3 changed files with 22 additions and 5 deletions

View File

@ -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 @@ state_check:
}
selclear();
if (__predict_false(mask))
sigsuspendteardown(l);
/* select and poll are not restarted after signals... */
if (error == ERESTART)
return EINTR;

View File

@ -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 @@ sigsuspendsetup(struct lwp *l, const sigset_t *ss)
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)
{

View File

@ -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 sigaction1(struct lwp *, int, const struct sigaction *,
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 *);