Commit an old change that has been sitting around for a long while.
signanosleep() did not deal with signal masks properly. This change was based on a discussion with bde some time ago (at least 6 months or more). signanosleep() should probably go away since it was never really used for more than a few weeks and doesn't appear in released code. It should probably be killed before somebody uses it and it becomes a gratuitous nonstandard feature.
This commit is contained in:
parent
bc53c0a6b2
commit
1973d51bfb
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_time.c 8.1 (Berkeley) 6/10/93
|
||||
* $Id: kern_time.c,v 1.51 1998/04/05 12:10:41 phk Exp $
|
||||
* $Id: kern_time.c,v 1.52 1998/04/06 08:26:04 phk Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -287,11 +287,25 @@ signanosleep(p, uap)
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
/* change mask for sleep */
|
||||
/*
|
||||
* Use the support for sigsuspend() to manage the masks. Arrange to
|
||||
* have postsig() itself restore the mask after the signal has
|
||||
* been delivered. This is because postsig() is called just prior
|
||||
* to returning to usermode. If we had restore the masks early, the
|
||||
* signal would be blocked by the time it should have been processed.
|
||||
*/
|
||||
p->p_sigacts->ps_oldmask = p->p_sigmask;
|
||||
p->p_sigacts->ps_flags |= SAS_OLDMASK;
|
||||
p->p_sigmask = mask &~ sigcantmask;
|
||||
|
||||
error = nanosleep1(p, &rqt, &rmt);
|
||||
|
||||
if (error != EINTR) {
|
||||
/* signal not queued, restore mask ourselves */
|
||||
p->p_sigmask = p->p_sigacts->ps_oldmask;
|
||||
p->p_sigacts->ps_flags &= ~SAS_OLDMASK;
|
||||
}
|
||||
|
||||
if (error && SCARG(uap, rmtp)) {
|
||||
error2 = copyout(&rmt, SCARG(uap, rmtp), sizeof(rmt));
|
||||
if (error2) /* XXX shouldn't happen, did useracc() above */
|
||||
|
Loading…
x
Reference in New Issue
Block a user