version 1.272, 2008/02/20 11:48:46 |
version 1.272.6.1, 2008/04/03 12:43:02 |
Line 906 trapsignal(struct lwp *l, ksiginfo_t *ks |
|
Line 906 trapsignal(struct lwp *l, ksiginfo_t *ks |
|
sigismember(&p->p_sigctx.ps_sigcatch, signo) && |
sigismember(&p->p_sigctx.ps_sigcatch, signo) && |
!sigismember(&l->l_sigmask, signo)) { |
!sigismember(&l->l_sigmask, signo)) { |
mutex_exit(&proclist_mutex); |
mutex_exit(&proclist_mutex); |
p->p_stats->p_ru.ru_nsignals++; |
l->l_ru.ru_nsignals++; |
kpsendsig(l, ksi, &l->l_sigmask); |
kpsendsig(l, ksi, &l->l_sigmask); |
mutex_exit(&p->p_smutex); |
mutex_exit(&p->p_smutex); |
ktrpsig(signo, SIGACTION_PS(ps, signo).sa_handler, |
ktrpsig(signo, SIGACTION_PS(ps, signo).sa_handler, |
Line 975 psignal(struct proc *p, int signo) |
|
Line 975 psignal(struct proc *p, int signo) |
|
void |
void |
kpsignal(struct proc *p, ksiginfo_t *ksi, void *data) |
kpsignal(struct proc *p, ksiginfo_t *ksi, void *data) |
{ |
{ |
|
fdfile_t *ff; |
|
file_t *fp; |
|
|
KASSERT(mutex_owned(&proclist_mutex)); |
KASSERT(mutex_owned(&proclist_mutex)); |
|
|
/* XXXSMP Why is this here? */ |
|
if ((p->p_sflag & PS_WEXIT) == 0 && data) { |
if ((p->p_sflag & PS_WEXIT) == 0 && data) { |
size_t fd; |
size_t fd; |
struct filedesc *fdp = p->p_fd; |
filedesc_t *fdp = p->p_fd; |
|
|
|
/* XXXSMP locking */ |
ksi->ksi_fd = -1; |
ksi->ksi_fd = -1; |
for (fd = 0; fd < fdp->fd_nfiles; fd++) { |
for (fd = 0; fd < fdp->fd_nfiles; fd++) { |
struct file *fp = fdp->fd_ofiles[fd]; |
if ((ff = fdp->fd_ofiles[fd]) == NULL) |
/* XXX: lock? */ |
continue; |
if (fp && fp->f_data == data) { |
if ((fp = ff->ff_file) == NULL) |
|
continue; |
|
if (fp->f_data == data) { |
ksi->ksi_fd = fd; |
ksi->ksi_fd = fd; |
break; |
break; |
} |
} |
Line 1352 kpsignal2(struct proc *p, ksiginfo_t *ks |
|
Line 1356 kpsignal2(struct proc *p, ksiginfo_t *ks |
|
if ((prop & SA_CONT) != 0 && action == SIG_DFL) |
if ((prop & SA_CONT) != 0 && action == SIG_DFL) |
goto out; |
goto out; |
|
|
if ((prop & SA_STOP) != 0 && action == SIG_DFL) { |
sigput(&p->p_sigpend, p, kp); |
/* |
|
* If a child holding parent blocked, stopping could |
|
* cause deadlock: discard the signal. |
|
*/ |
|
if ((p->p_sflag & PS_PPWAIT) == 0) { |
|
p->p_xstat = signo; |
|
proc_stop(p, 1, signo); |
|
} |
|
goto out; |
|
} else { |
|
/* |
|
* Stop signals with the default action are handled |
|
* specially in issignal(), and so are not enqueued. |
|
*/ |
|
sigput(&p->p_sigpend, p, kp); |
|
} |
|
} else { |
} else { |
/* |
/* |
* Process is stopped or stopping. If traced, then no |
* Process is stopped or stopping. If traced, then no |
Line 1819 postsig(int signo) |
|
Line 1807 postsig(int signo) |
|
* Commit to taking the signal before releasing the mutex. |
* Commit to taking the signal before releasing the mutex. |
*/ |
*/ |
action = SIGACTION_PS(ps, signo).sa_handler; |
action = SIGACTION_PS(ps, signo).sa_handler; |
p->p_stats->p_ru.ru_nsignals++; |
l->l_ru.ru_nsignals++; |
sigget(l->l_sigpendset, &ksi, signo, NULL); |
sigget(l->l_sigpendset, &ksi, signo, NULL); |
|
|
if (ktrpoint(KTR_PSIG)) { |
if (ktrpoint(KTR_PSIG)) { |
Line 2167 filt_sigattach(struct knote *kn) |
|
Line 2155 filt_sigattach(struct knote *kn) |
|
{ |
{ |
struct proc *p = curproc; |
struct proc *p = curproc; |
|
|
kn->kn_ptr.p_proc = p; |
kn->kn_obj = p; |
kn->kn_flags |= EV_CLEAR; /* automatically set */ |
kn->kn_flags |= EV_CLEAR; /* automatically set */ |
|
|
mutex_enter(&p->p_smutex); |
mutex_enter(&p->p_smutex); |
Line 2180 filt_sigattach(struct knote *kn) |
|
Line 2168 filt_sigattach(struct knote *kn) |
|
static void |
static void |
filt_sigdetach(struct knote *kn) |
filt_sigdetach(struct knote *kn) |
{ |
{ |
struct proc *p = kn->kn_ptr.p_proc; |
struct proc *p = kn->kn_obj; |
|
|
mutex_enter(&p->p_smutex); |
mutex_enter(&p->p_smutex); |
SLIST_REMOVE(&p->p_klist, kn, knote, kn_selnext); |
SLIST_REMOVE(&p->p_klist, kn, knote, kn_selnext); |