add new function sigismasked(), which checks whether passed signal

is ignored or masked by the process, and use it appropriately
instead of directly checking p->p_sigmask and p->p_sigignore
This commit is contained in:
jdolecek 2000-11-05 15:37:09 +00:00
parent 70b3814a53
commit e8e4da6b87
4 changed files with 19 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_sig.c,v 1.107 2000/09/23 00:48:29 enami Exp $ */
/* $NetBSD: kern_sig.c,v 1.108 2000/11/05 15:37:09 jdolecek Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
@ -1586,3 +1586,15 @@ copy: *d = *s;
*d = '\0';
return (0);
}
/*
* Returns true if signal is ignored or masked for passed process.
*/
int
sigismasked(p, sig)
struct proc *p;
int sig;
{
return sigismember(&p->p_sigignore, SIGTTOU)
|| sigismember(&p->p_sigmask, SIGTTOU);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tty.c,v 1.121 2000/11/01 23:51:38 eeh Exp $ */
/* $NetBSD: tty.c,v 1.122 2000/11/05 15:37:09 jdolecek Exp $ */
/*-
* Copyright (c) 1982, 1986, 1990, 1991, 1993
@ -770,8 +770,7 @@ ttioctl(tp, cmd, data, flag, p)
#endif
while (isbackground(curproc, tp) &&
p->p_pgrp->pg_jobc && (p->p_flag & P_PPWAIT) == 0 &&
!sigismember(&p->p_sigignore, SIGTTOU) &&
!sigismember(&p->p_sigmask, SIGTTOU)) {
!sigismasked(p, SIGTTOU)) {
pgsignal(p->p_pgrp, SIGTTOU, 1);
error = ttysleep(tp, &lbolt, TTOPRI | PCATCH, ttybg, 0);
if (error)

View File

@ -1,4 +1,4 @@
/* $NetBSD: tty_pty.c,v 1.50 2000/11/01 23:51:39 eeh Exp $ */
/* $NetBSD: tty_pty.c,v 1.51 2000/11/05 15:37:09 jdolecek Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -336,8 +336,7 @@ ptsread(dev, uio, flag)
again:
if (pti->pt_flags & PF_REMOTE) {
while (isbackground(p, tp)) {
if (sigismember(&p->p_sigignore, SIGTTIN) ||
sigismember(&p->p_sigmask, SIGTTIN) ||
if (sigismasked(p, SIGTTIN) ||
p->p_pgrp->pg_jobc == 0 ||
p->p_flag & P_PPWAIT)
return (EIO);

View File

@ -1,4 +1,4 @@
/* $NetBSD: signalvar.h,v 1.24 2000/08/20 21:50:12 thorpej Exp $ */
/* $NetBSD: signalvar.h,v 1.25 2000/11/05 15:37:10 jdolecek Exp $ */
/*
* Copyright (c) 1991, 1993
@ -164,6 +164,7 @@ void sigpending1 __P((struct proc *p, sigset_t *ss));
int sigsuspend1 __P((struct proc *p, const sigset_t *ss));
int sigaltstack1 __P((struct proc *p, \
const struct sigaltstack *nss, struct sigaltstack *oss));
int sigismasked __P((struct proc *, int));
void signal_init __P((void));