diff options
-rw-r--r-- | sys/alpha/osf1/osf1_signal.c | 3 | ||||
-rw-r--r-- | sys/coda/coda_psdev.c | 18 | ||||
-rw-r--r-- | sys/compat/linprocfs/linprocfs.c | 2 | ||||
-rw-r--r-- | sys/compat/linux/linux_misc.c | 3 | ||||
-rw-r--r-- | sys/compat/linux/linux_signal.c | 3 | ||||
-rw-r--r-- | sys/compat/svr4/svr4_filio.c | 3 | ||||
-rw-r--r-- | sys/compat/svr4/svr4_signal.c | 2 | ||||
-rw-r--r-- | sys/conf/files | 1 | ||||
-rw-r--r-- | sys/fs/coda/coda_psdev.c | 18 | ||||
-rw-r--r-- | sys/fs/procfs/procfs_ctl.c | 3 | ||||
-rw-r--r-- | sys/i386/ibcs2/ibcs2_signal.c | 3 | ||||
-rw-r--r-- | sys/kern/init_main.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_exit.c | 9 | ||||
-rw-r--r-- | sys/kern/kern_fork.c | 1 | ||||
-rw-r--r-- | sys/kern/kern_kthread.c | 17 | ||||
-rw-r--r-- | sys/kern/kern_proc.c | 5 | ||||
-rw-r--r-- | sys/kern/kern_sig.c | 64 | ||||
-rw-r--r-- | sys/kern/subr_sigq.c | 301 | ||||
-rw-r--r-- | sys/kern/subr_trap.c | 4 | ||||
-rw-r--r-- | sys/kern/tty.c | 14 | ||||
-rw-r--r-- | sys/netncp/ncp_ncp.c | 5 | ||||
-rw-r--r-- | sys/netsmb/smb_subr.c | 5 | ||||
-rw-r--r-- | sys/nfsclient/nfs_socket.c | 9 | ||||
-rw-r--r-- | sys/sys/ksiginfo.h | 78 | ||||
-rw-r--r-- | sys/sys/proc.h | 2 |
25 files changed, 73 insertions, 502 deletions
diff --git a/sys/alpha/osf1/osf1_signal.c b/sys/alpha/osf1/osf1_signal.c index 4e42796..7ea80fd 100644 --- a/sys/alpha/osf1/osf1_signal.c +++ b/sys/alpha/osf1/osf1_signal.c @@ -46,7 +46,6 @@ #include <sys/buf.h> #include <sys/bus.h> #include <sys/mbuf.h> -#include <sys/ksiginfo.h> #include <sys/vmmeter.h> #include <sys/msgbuf.h> #include <sys/exec.h> @@ -524,7 +523,7 @@ osf1_sigpending(td, uap) p = td->td_proc; PROC_LOCK(p); - ksiginfo_to_sigset_t(p, &bss); + bss = p->p_siglist; SIGSETAND(bss, p->p_sigmask); PROC_UNLOCK(p); bsd_to_osf1_sigset(&bss, &oss); diff --git a/sys/coda/coda_psdev.c b/sys/coda/coda_psdev.c index 19d4703..392012b 100644 --- a/sys/coda/coda_psdev.c +++ b/sys/coda/coda_psdev.c @@ -63,7 +63,6 @@ extern int coda_nc_initialized; /* Set if cache has been initialized */ #include <sys/lock.h> #include <sys/malloc.h> #include <sys/file.h> /* must come after sys/malloc.h */ -#include <sys/ksiginfo.h> #include <sys/mount.h> #include <sys/mutex.h> #include <sys/poll.h> @@ -492,7 +491,6 @@ coda_call(mntinfo, inSize, outSize, buffer) #ifdef CTL_C struct thread *td = curthread; struct proc *p = td->td_proc; - sigset_t pending_set; sigset_t psig_omask; sigset_t tempset; int i; @@ -563,20 +561,18 @@ coda_call(mntinfo, inSize, outSize, buffer) #endif } else { - ksiginfo_to_sigset_t(p, &pending_set); SIGEMPTYSET(tempset); SIGADDSET(tempset, SIGIO); - if (SIGSETEQ(pending_set, tempset)) { + if (SIGSETEQ(p->p_siglist, tempset)) { SIGADDSET(p->p_sigmask, SIGIO); #ifdef CODA_VERBOSE printf("coda_call: tsleep returns %d SIGIO, cnt %d\n", error, i); #endif } else { - ksiginfo_to_sigset_t(p, &pending_set); SIGDELSET(tempset, SIGIO); SIGADDSET(tempset, SIGALRM); - if (SIGSETEQ(pending_set, tempset)) { + if (SIGSETEQ(p->p_siglist, tempset)) { SIGADDSET(p->p_sigmask, SIGALRM); #ifdef CODA_VERBOSE printf("coda_call: tsleep returns %d SIGALRM, cnt %d\n", @@ -588,17 +584,17 @@ coda_call(mntinfo, inSize, outSize, buffer) error, i); #if notyet - tempset = pending_set; + tempset = p->p_siglist; SIGSETNAND(tempset, p->p_sigmask); printf("coda_call: siglist = %p, sigmask = %p, mask %p\n", - pending_set, p->p_sigmask, + p->p_siglist, p->p_sigmask, tempset); break; - SIGSETOR(p->p_sigmask, pending_set); - tempset = pending_set; + SIGSETOR(p->p_sigmask, p->p_siglist); + tempset = p->p_siglist; SIGSETNAND(tempset, p->p_sigmask); printf("coda_call: new mask, siglist = %p, sigmask = %p, mask %p\n", - pending_set, p->p_sigmask, + p->p_siglist, p->p_sigmask, tempset); #endif } diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index af542b4..d0db293 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -651,7 +651,7 @@ linprocfs_doprocstatus(PFS_FILL_ARGS) * running on anything but i386, so ignore that for now. */ PROC_LOCK(p); - sbuf_printf(sb, "SigPnd:\t%08x\n", 0); /* XXX */ + sbuf_printf(sb, "SigPnd:\t%08x\n", p->p_siglist.__bits[0]); /* * I can't seem to find out where the signal mask is in * relation to struct proc, so SigBlk is left unimplemented. diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index d344548..16c8677 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -36,7 +36,6 @@ #include <sys/imgact_aout.h> #include <sys/jail.h> #include <sys/kernel.h> -#include <sys/ksiginfo.h> #include <sys/lock.h> #include <sys/mac.h> #include <sys/malloc.h> @@ -833,7 +832,7 @@ linux_wait4(struct thread *td, struct linux_wait4_args *args) if ((error = wait4(td, &tmp)) != 0) return error; - signal_delete(td->td_proc, NULL, SIGCHLD); + SIGDELSET(td->td_proc->p_siglist, SIGCHLD); if (args->status) { if ((error = copyin((caddr_t)args->status, &tmpstat, diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c index d264db5..532fb81 100644 --- a/sys/compat/linux/linux_signal.c +++ b/sys/compat/linux/linux_signal.c @@ -34,7 +34,6 @@ #include <sys/mutex.h> #include <sys/proc.h> #include <sys/signalvar.h> -#include <sys/ksiginfo.h> #include <sys/syscallsubr.h> #include <sys/sysproto.h> @@ -391,7 +390,7 @@ linux_sigpending(struct thread *td, struct linux_sigpending_args *args) #endif PROC_LOCK(p); - ksiginfo_to_sigset_t(p, &bset); + bset = p->p_siglist; SIGSETAND(bset, p->p_sigmask); bsd_to_linux_sigset(&bset, &lset); PROC_UNLOCK(p); diff --git a/sys/compat/svr4/svr4_filio.c b/sys/compat/svr4/svr4_filio.c index 8dc1b4d..c2bad1d 100644 --- a/sys/compat/svr4/svr4_filio.c +++ b/sys/compat/svr4/svr4_filio.c @@ -39,7 +39,6 @@ #include <sys/poll.h> #include <sys/malloc.h> #include <sys/mutex.h> -#include <sys/ksiginfo.h> #include <sys/sysproto.h> @@ -136,9 +135,7 @@ svr4_sys_read(td, uap) DPRINTF(("sigmask = 0x%x\n", td->td_proc->p_sigmask)); DPRINTF(("sigignore = 0x%x\n", td->td_proc->p_sigignore)); DPRINTF(("sigcaught = 0x%x\n", td->td_proc->p_sigcatch)); -#if 0 /* XXX - use ksiginfo_to_sigset_t ? */ DPRINTF(("siglist = 0x%x\n", td->td_proc->p_siglist)); -#endif } #if defined(GROTTY_READ_HACK) diff --git a/sys/compat/svr4/svr4_signal.c b/sys/compat/svr4/svr4_signal.c index 1c78b53..fea5317 100644 --- a/sys/compat/svr4/svr4_signal.c +++ b/sys/compat/svr4/svr4_signal.c @@ -565,7 +565,7 @@ svr4_sys_sigpending(td, uap) if (SCARG(uap, mask) == NULL) return 0; PROC_LOCK(td->td_proc); - ksiginfo_to_sigset_t(td->td_proc, &bss); + bss = td->td_proc->p_siglist; SIGSETAND(bss, td->td_proc->p_sigmask); PROC_UNLOCK(td->td_proc); bsd_to_svr4_sigset(&bss, &sss); diff --git a/sys/conf/files b/sys/conf/files index eccc374..73e62c0 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -963,7 +963,6 @@ kern/subr_prof.c standard kern/subr_rman.c standard kern/subr_sbuf.c standard kern/subr_scanf.c standard -kern/subr_sigq.c standard kern/subr_smp.c optional smp kern/subr_taskqueue.c standard kern/subr_trap.c standard diff --git a/sys/fs/coda/coda_psdev.c b/sys/fs/coda/coda_psdev.c index 19d4703..392012b 100644 --- a/sys/fs/coda/coda_psdev.c +++ b/sys/fs/coda/coda_psdev.c @@ -63,7 +63,6 @@ extern int coda_nc_initialized; /* Set if cache has been initialized */ #include <sys/lock.h> #include <sys/malloc.h> #include <sys/file.h> /* must come after sys/malloc.h */ -#include <sys/ksiginfo.h> #include <sys/mount.h> #include <sys/mutex.h> #include <sys/poll.h> @@ -492,7 +491,6 @@ coda_call(mntinfo, inSize, outSize, buffer) #ifdef CTL_C struct thread *td = curthread; struct proc *p = td->td_proc; - sigset_t pending_set; sigset_t psig_omask; sigset_t tempset; int i; @@ -563,20 +561,18 @@ coda_call(mntinfo, inSize, outSize, buffer) #endif } else { - ksiginfo_to_sigset_t(p, &pending_set); SIGEMPTYSET(tempset); SIGADDSET(tempset, SIGIO); - if (SIGSETEQ(pending_set, tempset)) { + if (SIGSETEQ(p->p_siglist, tempset)) { SIGADDSET(p->p_sigmask, SIGIO); #ifdef CODA_VERBOSE printf("coda_call: tsleep returns %d SIGIO, cnt %d\n", error, i); #endif } else { - ksiginfo_to_sigset_t(p, &pending_set); SIGDELSET(tempset, SIGIO); SIGADDSET(tempset, SIGALRM); - if (SIGSETEQ(pending_set, tempset)) { + if (SIGSETEQ(p->p_siglist, tempset)) { SIGADDSET(p->p_sigmask, SIGALRM); #ifdef CODA_VERBOSE printf("coda_call: tsleep returns %d SIGALRM, cnt %d\n", @@ -588,17 +584,17 @@ coda_call(mntinfo, inSize, outSize, buffer) error, i); #if notyet - tempset = pending_set; + tempset = p->p_siglist; SIGSETNAND(tempset, p->p_sigmask); printf("coda_call: siglist = %p, sigmask = %p, mask %p\n", - pending_set, p->p_sigmask, + p->p_siglist, p->p_sigmask, tempset); break; - SIGSETOR(p->p_sigmask, pending_set); - tempset = pending_set; + SIGSETOR(p->p_sigmask, p->p_siglist); + tempset = p->p_siglist; SIGSETNAND(tempset, p->p_sigmask); printf("coda_call: new mask, siglist = %p, sigmask = %p, mask %p\n", - pending_set, p->p_sigmask, + p->p_siglist, p->p_sigmask, tempset); #endif } diff --git a/sys/fs/procfs/procfs_ctl.c b/sys/fs/procfs/procfs_ctl.c index 89f8de1..c9572b6 100644 --- a/sys/fs/procfs/procfs_ctl.c +++ b/sys/fs/procfs/procfs_ctl.c @@ -51,7 +51,6 @@ #include <sys/signalvar.h> #include <sys/sx.h> #include <sys/uio.h> -#include <sys/ksiginfo.h> #include <fs/pseudofs/pseudofs.h> #include <fs/procfs/procfs.h> @@ -222,7 +221,7 @@ out: p->p_flag &= ~P_TRACED; /* remove pending SIGTRAP, else the process will die */ - signal_delete(p, NULL, SIGTRAP); + SIGDELSET(p->p_siglist, SIGTRAP); PROC_UNLOCK(p); /* give process back to original parent */ diff --git a/sys/i386/ibcs2/ibcs2_signal.c b/sys/i386/ibcs2/ibcs2_signal.c index 7ea43e5..0084cbe 100644 --- a/sys/i386/ibcs2/ibcs2_signal.c +++ b/sys/i386/ibcs2/ibcs2_signal.c @@ -30,7 +30,6 @@ #include <sys/param.h> #include <sys/systm.h> -#include <sys/ksiginfo.h> #include <sys/lock.h> #include <sys/mutex.h> #include <sys/signalvar.h> @@ -457,7 +456,7 @@ ibcs2_sigpending(td, uap) ibcs2_sigset_t iss; PROC_LOCK(p); - ksiginfo_to_sigset_t(p, &bss); + bss = p->p_siglist; SIGSETAND(bss, p->p_sigmask); PROC_UNLOCK(p); bsd_to_ibcs2_sigset(&bss, &iss); diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index d58e7df..49bb739 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -348,8 +348,6 @@ proc0_init(void *dummy __unused) LIST_INIT(&pgrp0.pg_members); LIST_INSERT_HEAD(&pgrp0.pg_members, p, p_pglist); - TAILQ_INIT(&p->p_sigq); - pgrp0.pg_session = &session0; mtx_init(&session0.s_mtx, "session", NULL, MTX_DEF); session0.s_count = 1; diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 572aab3..1725d54 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -67,7 +67,6 @@ #ifdef KTRACE #include <sys/ktrace.h> #endif -#include <sys/ksiginfo.h> #include <vm/vm.h> #include <vm/vm_extern.h> @@ -245,7 +244,7 @@ exit1(td, rv) */ PROC_LOCK(p); p->p_flag &= ~(P_TRACED | P_PPWAIT); - signal_delete(p, NULL, 0); + SIGEMPTYSET(p->p_siglist); PROC_UNLOCK(p); if (timevalisset(&p->p_realtimer.it_value)) callout_stop(&p->p_itcallout); @@ -474,12 +473,6 @@ exit1(td, rv) */ if (p->p_flag & P_KTHREAD) wakeup(p); - - /* - * And now, kill off its signals... - */ - signal_delete(p, NULL, 0); - PROC_UNLOCK(p); /* diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index c8182f9..da7ca7d 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -605,7 +605,6 @@ again: LIST_INSERT_AFTER(p1, p2, p_pglist); PGRP_UNLOCK(p1->p_pgrp); LIST_INIT(&p2->p_children); - TAILQ_INIT(&p2->p_sigq); callout_init(&p2->p_itcallout, 0); diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c index 95e9a68..08ef71f 100644 --- a/sys/kern/kern_kthread.c +++ b/sys/kern/kern_kthread.c @@ -37,7 +37,6 @@ #include <sys/sx.h> #include <sys/unistd.h> #include <sys/wait.h> -#include <sys/ksiginfo.h> #include <machine/stdarg.h> @@ -145,16 +144,16 @@ kthread_suspend(struct proc *p, int timo) { /* * Make sure this is indeed a system process and we can safely - * use the signal queue. + * use the p_siglist field. */ PROC_LOCK(p); if ((p->p_flag & P_KTHREAD) == 0) { PROC_UNLOCK(p); return (EINVAL); } - signal_add(p, NULL, SIGSTOP); + SIGADDSET(p->p_siglist, SIGSTOP); wakeup(p); - return msleep(&p->p_sigq, &p->p_mtx, PPAUSE | PDROP, "suspkt", timo); + return msleep(&p->p_siglist, &p->p_mtx, PPAUSE | PDROP, "suspkt", timo); } int @@ -169,9 +168,9 @@ kthread_resume(struct proc *p) PROC_UNLOCK(p); return (EINVAL); } - signal_delete(p, NULL, SIGSTOP); + SIGDELSET(p->p_siglist, SIGSTOP); PROC_UNLOCK(p); - wakeup(&p->p_sigq); + wakeup(&p->p_siglist); return (0); } @@ -179,9 +178,9 @@ void kthread_suspend_check(struct proc *p) { PROC_LOCK(p); - while (signal_queued(p, SIGSTOP)) { - wakeup(&p->p_sigq); - msleep(&p->p_sigq, &p->p_mtx, PPAUSE, "ktsusp", 0); + while (SIGISMEMBER(p->p_siglist, SIGSTOP)) { + wakeup(&p->p_siglist); + msleep(&p->p_siglist, &p->p_mtx, PPAUSE, "ktsusp", 0); } PROC_UNLOCK(p); } diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index e7fce8a..633c66e 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -58,7 +58,6 @@ #include <sys/uio.h> #include <sys/ktrace.h> #endif -#include <sys/ksiginfo.h> #include <vm/vm.h> #include <vm/vm_extern.h> @@ -409,7 +408,7 @@ kse_create(struct thread *td, struct kse_create_args *uap) RANGEOF(struct kse, ke_startcopy, ke_endcopy)); #endif PROC_LOCK(p); - if (signal_pending(p)) + if (SIGPENDING(p)) newke->ke_flags |= KEF_ASTPENDING; PROC_UNLOCK(p); mtx_lock_spin(&sched_lock); @@ -1015,7 +1014,7 @@ fill_kinfo_proc(p, kp) strncpy(kp->ki_comm, p->p_comm, sizeof(kp->ki_comm) - 1); strncpy(kp->ki_ocomm, p->p_comm, sizeof(kp->ki_ocomm) - 1); } - ksiginfo_to_sigset_t(p, &kp->ki_siglist); + kp->ki_siglist = p->p_siglist; kp->ki_sigmask = p->p_sigmask; kp->ki_xstat = p->p_xstat; kp->ki_acflag = p->p_acflag; diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index ada2016..f6fa38b 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,6 +1,4 @@ /* - * Copyright (c) 2002 New Gold Technoloy. All rights reserved. - * Copyright (c) 2002 Juli Mallett. All rights reserved. * Copyright (c) 1982, 1986, 1989, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. @@ -72,7 +70,6 @@ #include <sys/sysctl.h> #include <sys/malloc.h> #include <sys/unistd.h> -#include <sys/ksiginfo.h> #include <machine/cpu.h> @@ -119,9 +116,6 @@ static int do_coredump = 1; SYSCTL_INT(_kern, OID_AUTO, coredump, CTLFLAG_RW, &do_coredump, 0, "Enable/Disable coredumps"); -static int stopmask = - sigmask(SIGSTOP) | sigmask(SIGTSTP) | sigmask(SIGTTIN) | sigmask(SIGTTOU); - /* * Signal properties and actions. * The array below categorizes the signals and their default actions @@ -184,12 +178,12 @@ cursig(struct thread *td) PROC_LOCK_ASSERT(p, MA_OWNED); mtx_assert(&sched_lock, MA_NOTOWNED); - return (signal_pending(p) ? issignal(td) : 0); + return (SIGPENDING(p) ? issignal(td) : 0); } /* * Arrange for ast() to handle unmasked pending signals on return to user - * mode. This must be called whenever a signal is added to p_sigq or + * mode. This must be called whenever a signal is added to p_siglist or * unmasked in p_sigmask. */ void @@ -200,7 +194,7 @@ signotify(struct proc *p) PROC_LOCK_ASSERT(p, MA_OWNED); mtx_lock_spin(&sched_lock); - if (signal_pending(p)) { + if (SIGPENDING(p)) { p->p_sflag |= PS_NEEDSIGCHK; /* XXXKSE for now punish all KSEs */ FOREACH_KSEGRP_IN_PROC(p, kg) { @@ -347,7 +341,7 @@ kern_sigaction(td, sig, act, oact, old) (sigprop(sig) & SA_IGNORE && ps->ps_sigact[_SIG_IDX(sig)] == SIG_DFL)) { /* never to be seen again */ - signal_delete(p, NULL, sig); + SIGDELSET(p->p_siglist, sig); if (sig != SIGCONT) /* easier in psignal */ SIGADDSET(p->p_sigignore, sig); @@ -500,7 +494,7 @@ execsigs(p) if (sigprop(sig) & SA_IGNORE) { if (sig != SIGCONT) SIGADDSET(p->p_sigignore, sig); - signal_delete(p, NULL, sig); + SIGDELSET(p->p_siglist, sig); } ps->ps_sigact[_SIG_IDX(sig)] = SIG_DFL; } @@ -647,7 +641,7 @@ sigpending(td, uap) mtx_lock(&Giant); PROC_LOCK(p); - ksiginfo_to_sigset_t(p, &siglist); + siglist = p->p_siglist; PROC_UNLOCK(p); mtx_unlock(&Giant); error = copyout(&siglist, uap->set, sizeof(sigset_t)); @@ -670,12 +664,10 @@ osigpending(td, uap) struct osigpending_args *uap; { struct proc *p = td->td_proc; - sigset_t siglist; mtx_lock(&Giant); PROC_LOCK(p); - ksiginfo_to_sigset_t(p, &siglist); - SIG2OSIG(siglist, td->td_retval[0]); + SIG2OSIG(p->p_siglist, td->td_retval[0]); PROC_UNLOCK(p); mtx_unlock(&Giant); return (0); @@ -1316,7 +1308,7 @@ psignal(p, sig) } if (prop & SA_CONT) - signal_delete_mask(p, stopmask); + SIG_STOPSIGMASK(p->p_siglist); if (prop & SA_STOP) { /* @@ -1329,10 +1321,10 @@ psignal(p, sig) (p->p_pgrp->pg_jobc == 0) && (action == SIG_DFL)) return; - signal_delete_mask(p, sigmask(SIGCONT)); + SIG_CONTSIGMASK(p->p_siglist); p->p_flag &= ~P_CONTINUED; } - signal_add(p, NULL, sig); + SIGADDSET(p->p_siglist, sig); signotify(p); /* uses schedlock */ /* @@ -1370,10 +1362,10 @@ psignal(p, sig) if (prop & SA_CONT) { /* * If SIGCONT is default (or ignored), we continue the - * process but don't leave the signal in p_sigq as it - * has no further action. If SIGCONT is held, we + * process but don't leave the signal in p_siglist as + * it has no further action. If SIGCONT is held, we * continue the process and leave the signal in - * p_sigq. If the process catches SIGCONT, let it + * p_siglist. If the process catches SIGCONT, let it * handle the signal itself. If it isn't waiting on * an event, it goes back to run state. * Otherwise, process goes back to sleep state. @@ -1381,7 +1373,7 @@ psignal(p, sig) p->p_flag &= ~P_STOPPED_SIG; p->p_flag |= P_CONTINUED; if (action == SIG_DFL) { - signal_delete(p, NULL, sig); + SIGDELSET(p->p_siglist, sig); } else if (action == SIG_CATCH) { /* * The process wants to catch it so it needs @@ -1411,7 +1403,7 @@ psignal(p, sig) * Just make sure the signal STOP bit set. */ p->p_flag |= P_STOPPED_SIG; - signal_delete(p, NULL, sig); + SIGDELSET(p->p_siglist, sig); goto out; } @@ -1445,7 +1437,7 @@ psignal(p, sig) /* * Already active, don't need to start again. */ - signal_delete(p, NULL, sig); + SIGDELSET(p->p_siglist, sig); goto out; } if ((p->p_flag & P_TRACED) || (action != SIG_DFL) || @@ -1469,7 +1461,7 @@ psignal(p, sig) mtx_unlock_spin(&sched_lock); stop(p); p->p_xstat = sig; - signal_delete(p, NULL, sig); + SIGDELSET(p->p_siglist, sig); PROC_LOCK(p->p_pptr); if ((p->p_pptr->p_procsig->ps_flag & PS_NOCLDSTOP) == 0) { @@ -1486,7 +1478,7 @@ psignal(p, sig) /* NOTREACHED */ } else { /* Not in "NORMAL" state. discard the signal. */ - signal_delete(p, NULL, sig); + SIGDELSET(p->p_siglist, sig); goto out; } @@ -1561,7 +1553,7 @@ tdsignal(struct thread *td, int sig, sig_t action) * be awakened. */ if ((prop & SA_CONT) && action == SIG_DFL) { - signal_delete(p, NULL, sig); + SIGDELSET(p->p_siglist, sig); return; } @@ -1617,13 +1609,13 @@ issignal(td) for (;;) { int traced = (p->p_flag & P_TRACED) || (p->p_stops & S_SIG); - ksiginfo_to_sigset_t(p, &mask); + mask = p->p_siglist; SIGSETNAND(mask, p->p_sigmask); if (p->p_flag & P_PPWAIT) SIG_STOPSIGMASK(mask); if (SIGISEMPTY(mask)) /* no signal to send */ return (0); - sig = signal_queued_mask(p, mask); + sig = sig_ffs(&mask); prop = sigprop(sig); _STOPEVENT(p, S_SIG, sig); @@ -1633,7 +1625,7 @@ issignal(td) * only if P_TRACED was on when they were posted. */ if (SIGISMEMBER(p->p_sigignore, sig) && (traced == 0)) { - signal_delete(p, NULL, sig); + SIGDELSET(p->p_siglist, sig); continue; } if (p->p_flag & P_TRACED && (p->p_flag & P_PPWAIT) == 0) { @@ -1668,16 +1660,16 @@ issignal(td) * then it will leave it in p->p_xstat; * otherwise we just look for signals again. */ - signal_delete(p, NULL, sig); /* clear old signal */ + SIGDELSET(p->p_siglist, sig); /* clear old signal */ sig = p->p_xstat; if (sig == 0) continue; /* - * Put the new signal into p_sigq. If the signal - * is being masked, look for other signals. + * Put the new signal into p_siglist. If the + * signal is being masked, look for other signals. */ - psignal(p, sig); + SIGADDSET(p->p_siglist, sig); if (SIGISMEMBER(p->p_sigmask, sig)) continue; signotify(p); @@ -1767,7 +1759,7 @@ issignal(td) */ return (sig); } - signal_delete(p, NULL, sig); /* take the signal! */ + SIGDELSET(p->p_siglist, sig); /* take the signal! */ } /* NOTREACHED */ } @@ -1808,7 +1800,7 @@ postsig(sig) PROC_LOCK_ASSERT(p, MA_OWNED); ps = p->p_sigacts; - signal_delete(p, NULL, sig); + SIGDELSET(p->p_siglist, sig); action = ps->ps_sigact[_SIG_IDX(sig)]; #ifdef KTRACE if (KTRPOINT(td, KTR_PSIG)) diff --git a/sys/kern/subr_sigq.c b/sys/kern/subr_sigq.c deleted file mode 100644 index 8f960b7..0000000 --- a/sys/kern/subr_sigq.c +++ /dev/null @@ -1,301 +0,0 @@ -/*- - * Copyright (c) 2002 New Gold Technology. All rights reserved. - * Copyright (c) 2002 Juli Mallett. All rights reserved. - * - * This software was written by Juli Mallett <jmallett@FreeBSD.org> for the - * FreeBSD project. Redistribution and use in source and binary forms, with - * or without modification, are permitted provided that the following - * conditions are met: - * - * 1. Redistribution of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/signalvar.h> -#include <sys/proc.h> -#include <sys/errno.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/mutex.h> -#include <sys/signal.h> -#include <sys/ksiginfo.h> - -MALLOC_DEFINE(M_KSIGINFO, "ksiginfos", "Kernel signal info structures"); - -int -ksiginfo_alloc(struct ksiginfo **ksip, int signo) -{ - int error; - struct ksiginfo *ksi; - - error = 0; - - ksi = malloc(sizeof *ksi, M_KSIGINFO, M_ZERO | M_NOWAIT); - if (ksi == NULL) { - panic("Unable to allocate kernel signal info structure."); - error = ENOMEM; - goto out; - } - ksi->ksi_signo = signo; - if (curproc != NULL) { - ksi->ksi_pid = curproc->p_pid; - ksi->ksi_ruid = curproc->p_ucred->cr_uid; - } -out: - *ksip = ksi; - return (error); -} - -int -ksiginfo_dequeue(struct ksiginfo **ksip, struct proc *p, int signo) -{ - int error; - struct ksiginfo *ksi; - - error = 0; - ksi = NULL; - - PROC_LOCK_ASSERT(p, MA_OWNED); - if (TAILQ_EMPTY(&p->p_sigq)) { - error = EDOOFUS; - goto out; - } - if (!signo) { - ksi = TAILQ_FIRST(&p->p_sigq); - goto out; - } - TAILQ_FOREACH(ksi, &p->p_sigq, ksi_queue) { - if (ksi->ksi_signo == signo) - goto out; - } - error = ESRCH; - ksi = NULL; -out: - if (ksi != NULL) - TAILQ_REMOVE(&p->p_sigq, ksi, ksi_queue); - *ksip = ksi; - return (error); -} - -int -ksiginfo_destroy(struct ksiginfo **ksip) -{ - int error; - struct ksiginfo *ksi; - - error = 0; - - ksi = *ksip; - if (ksi == NULL) { - error = EDOOFUS; - goto out; - } - free(ksi, M_KSIGINFO); - ksi = NULL; -out: - *ksip = ksi; - return (error); -} - -int -ksiginfo_to_sigset_t(struct proc *p, sigset_t *setp) -{ - int error; - sigset_t set; - struct ksiginfo *ksi; - - error = 0; - SIGEMPTYSET(set); - - PROC_LOCK_ASSERT(p, MA_OWNED); - /* - * We could set EDOOFUS here, however if there are no queued - * signals, then an empty signal set _is_ valid. - */ - if (TAILQ_EMPTY(&p->p_sigq)) - goto out; - TAILQ_FOREACH(ksi, &p->p_sigq, ksi_queue) - SIGADDSET(set, ksi->ksi_signo); -out: - *setp = set; - return (error); -} - -int -signal_add(struct proc *p, struct ksiginfo *ksi, int signo) -{ - int error; - - error = 0; - - PROC_LOCK_ASSERT(p, MA_OWNED); - if (ksi == NULL) { - PROC_UNLOCK(p); - error = ksiginfo_alloc(&ksi, signo); - PROC_LOCK(p); - if (error) - goto out; - } - TAILQ_INSERT_HEAD(&p->p_sigq, ksi, ksi_queue); -out: - return (error); -} - -int -signal_delete(struct proc *p, struct ksiginfo *ksi, int signo) -{ - int error; - - error = 0; - - PROC_LOCK_ASSERT(p, MA_OWNED); - if (ksi == NULL) { - while (signal_queued(p, signo)) { - error = ksiginfo_dequeue(&ksi, p, signo); - if (error) - goto out; - error = ksiginfo_destroy(&ksi); - if (error) - goto out; - } - } -out: - if (ksi != NULL) { - TAILQ_REMOVE(&p->p_sigq, ksi, ksi_queue); - ksiginfo_destroy(&ksi); - } - return (error); -} - -int -signal_delete_mask(struct proc *p, int mask) -{ - int error; - struct ksiginfo *ksi, *prev; - - error = 0; - ksi = prev = NULL; - - PROC_LOCK_ASSERT(p, MA_OWNED); - if (TAILQ_EMPTY(&p->p_sigq)) - goto out; - TAILQ_FOREACH(ksi, &p->p_sigq, ksi_queue) { - if (prev != NULL) { - TAILQ_REMOVE(&p->p_sigq, prev, ksi_queue); - error = ksiginfo_destroy(&prev); - if (error) - goto out; - } - if (sigmask(ksi->ksi_signo) & mask) - prev = ksi; - } - if (prev != NULL) { - TAILQ_REMOVE(&p->p_sigq, prev, ksi_queue); - error = ksiginfo_destroy(&prev); - /* - * XXX - Could just fall off the bottom... - */ - if (error) - goto out; - } -out: - return (error); -} - -int -signal_pending(struct proc *p) -{ - int error, pending; - sigset_t set; - - error = 0; - pending = 0; - - PROC_LOCK_ASSERT(p, MA_OWNED); - if (TAILQ_EMPTY(&p->p_sigq)) - goto out; - if (p->p_flag & P_TRACED) { - pending = 1; - goto out; - } - error = ksiginfo_to_sigset_t(p, &set); - if (error) - goto out; - pending = !sigsetmasked(&set, &p->p_sigmask); - if (pending) - goto out; -out: - return (pending); -} - -int -signal_queued(struct proc *p, int signo) -{ - int error, pending; - struct ksiginfo *ksi; - - error = 0; - pending = 0; - ksi = NULL; - - PROC_LOCK_ASSERT(p, MA_OWNED); - if (TAILQ_EMPTY(&p->p_sigq)) - goto out; - /* - * Since we know the queue is not empty, we can just do - * pending = TAILQ_FIRST(&p->p_sigq)->ksi_signo, if the - * signo is 0, however since we have to use at least one - * more TailQ manipulation macro either way, might as well - * just do it like this, as I think it optimises better, - * even if the failure case is more expensive. - */ - TAILQ_FOREACH(ksi, &p->p_sigq, ksi_queue) { - pending = !signo || ksi->ksi_signo == signo; - if (pending) - goto out; - } -out: - return (pending); -} - -int -signal_queued_mask(struct proc *p, sigset_t mask) -{ - int pending; - struct ksiginfo *ksi; - - pending = 0; - ksi = NULL; - - PROC_LOCK_ASSERT(p, MA_OWNED); - if (TAILQ_EMPTY(&p->p_sigq)) - goto out; - TAILQ_FOREACH(ksi, &p->p_sigq, ksi_queue) { - if (SIGISMEMBER(mask, ksi->ksi_signo)) { - pending = ksi->ksi_signo; - goto out; - } - } -out: - return (pending); -} diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 4fc6f81..2ec3fb1 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -54,8 +54,6 @@ #include <sys/signalvar.h> #include <sys/systm.h> #include <sys/vmmeter.h> -#include <sys/malloc.h> -#include <sys/ksiginfo.h> #include <machine/cpu.h> #include <machine/pcb.h> @@ -82,7 +80,7 @@ userret(td, frame, oticks) mtx_lock(&Giant); PROC_LOCK(p); mtx_lock_spin(&sched_lock); - if (signal_pending(p) && ((p->p_sflag & PS_NEEDSIGCHK) == 0 || + if (SIGPENDING(p) && ((p->p_sflag & PS_NEEDSIGCHK) == 0 || (td->td_kse->ke_flags & KEF_ASTPENDING) == 0)) printf("failed to set signal flags properly for ast()\n"); mtx_unlock_spin(&sched_lock); diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 590e8de..c075a47 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -102,7 +102,6 @@ #include <sys/malloc.h> #include <sys/filedesc.h> #include <sys/sysctl.h> -#include <sys/ksiginfo.h> #include <vm/vm.h> #include <vm/pmap.h> @@ -1842,24 +1841,21 @@ int ttycheckoutq(struct tty *tp, int wait) { int hiwat, s; - sigset_t oldmask, newmask; + sigset_t oldmask; hiwat = tp->t_ohiwat; SIGEMPTYSET(oldmask); s = spltty(); if (wait) - ksiginfo_to_sigset_t(curproc, &oldmask); + oldmask = curproc->p_siglist; if (tp->t_outq.c_cc > hiwat + OBUFSIZ + 100) while (tp->t_outq.c_cc > hiwat) { ttstart(tp); if (tp->t_outq.c_cc <= hiwat) break; - if (!wait) { - ksiginfo_to_sigset_t(curproc, &newmask); - if (SIGSETEQ(newmask, oldmask)) { - splx(s); - return (0); - } + if (!(wait && SIGSETEQ(curproc->p_siglist, oldmask))) { + splx(s); + return (0); } SET(tp->t_state, TS_SO_OLOWAT); tsleep(TSA_OLOWAT(tp), PZERO - 1, "ttoutq", hz); diff --git a/sys/netncp/ncp_ncp.c b/sys/netncp/ncp_ncp.c index a93bd61..8d86c02 100644 --- a/sys/netncp/ncp_ncp.c +++ b/sys/netncp/ncp_ncp.c @@ -42,7 +42,6 @@ #include <sys/sysctl.h> #include <sys/mbuf.h> #include <sys/uio.h> -#include <sys/ksiginfo.h> #include <netipx/ipx.h> #include <netipx/ipx_var.h> @@ -81,10 +80,10 @@ ncp_chkintr(struct ncp_conn *conn, struct proc *p) if (p == NULL) return 0; - ksiginfo_to_sigset_t(p, &tmpset); + tmpset = p->p_siglist; SIGSETNAND(tmpset, p->p_sigmask); SIGSETNAND(tmpset, p->p_sigignore); - if (signal_queued(p, 0) && NCP_SIGMASK(tmpset)) + if (SIGNOTEMPTY(p->p_siglist) && NCP_SIGMASK(tmpset)) return EINTR; return 0; } diff --git a/sys/netsmb/smb_subr.c b/sys/netsmb/smb_subr.c index 2b428a3..4a37d6e 100644 --- a/sys/netsmb/smb_subr.c +++ b/sys/netsmb/smb_subr.c @@ -42,7 +42,6 @@ #include <sys/socket.h> #include <sys/signalvar.h> #include <sys/mbuf.h> -#include <sys/ksiginfo.h> #include <sys/iconv.h> @@ -76,10 +75,10 @@ smb_proc_intr(struct proc *p) if (p == NULL) return 0; - ksiginfo_to_sigset_t(p, &tmpset); + tmpset = p->p_siglist; SIGSETNAND(tmpset, p->p_sigmask); SIGSETNAND(tmpset, p->p_sigignore); - if (signal_queued(p, 0) && SMB_SIGMASK(tmpset)) + if (SIGNOTEMPTY(p->p_siglist) && SMB_SIGMASK(tmpset)) return EINTR; return 0; } diff --git a/sys/nfsclient/nfs_socket.c b/sys/nfsclient/nfs_socket.c index 08e53e9..15cf946 100644 --- a/sys/nfsclient/nfs_socket.c +++ b/sys/nfsclient/nfs_socket.c @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include <sys/sysctl.h> #include <sys/syslog.h> #include <sys/vnode.h> -#include <sys/ksiginfo.h> #include <netinet/in.h> #include <netinet/tcp.h> @@ -1240,15 +1239,11 @@ nfs_sigintr(struct nfsmount *nmp, struct nfsreq *rep, struct thread *td) return (0); p = td->td_proc; - PROC_LOCK(p); - ksiginfo_to_sigset_t(p, &tmpset); + tmpset = p->p_siglist; SIGSETNAND(tmpset, p->p_sigmask); SIGSETNAND(tmpset, p->p_sigignore); - if (signal_queued(p, 0) && NFSINT_SIGMASK(tmpset)) { - PROC_UNLOCK(p); + if (SIGNOTEMPTY(p->p_siglist) && NFSINT_SIGMASK(tmpset)) return (EINTR); - } - PROC_UNLOCK(p); return (0); } diff --git a/sys/sys/ksiginfo.h b/sys/sys/ksiginfo.h deleted file mode 100644 index 26b88d5..0000000 --- a/sys/sys/ksiginfo.h +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * Copyright (c) 2002 New Gold Technology. All rights reserved. - * Copyright (c) 2002 Juli Mallett. All rights reserved. - * - * This software was written by Juli Mallett <jmallett@FreeBSD.org> for the - * FreeBSD project. Redistribution and use in source and binary forms, with - * or without modification, are permitted provided that the following - * conditions are met: - * - * 1. Redistribution of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _SYS_KSIGINFO_H_ -#define _SYS_KSIGINFO_H_ - -#ifndef _KERNEL -#error "no user-serviceable parts inside" -#endif - -#include <sys/malloc.h> - -/* - * Structures and prototypes for working with the in-kernel representation - * of pending signals, and all the information we have about them. - */ - -MALLOC_DECLARE(M_KSIGINFO); - -/* - * This is pushed to userland in the form of a siginfo_t, which is POSIX - * defined. This is for in-kernel representations only, and has no ABI - * consumers. - */ -struct ksiginfo { - TAILQ_ENTRY(ksiginfo) ksi_queue; /* Entry in the signal queue. */ - void *ksi_addr; /* [Fault] address. */ - int ksi_code; /* [Trap] code. */ - int ksi_errno; /* Error number. */ - int ksi_signo; /* Signal number. */ - int ksi_status; /* Exit status (SIGCHLD). */ - uid_t ksi_ruid; /* Real UID of sender. */ - pid_t ksi_pid; /* PID of sender. */ -}; - -struct proc; - -__BEGIN_DECLS; -int ksiginfo_alloc(struct ksiginfo **, int); -int ksiginfo_dequeue(struct ksiginfo **, struct proc *, int); -int ksiginfo_destroy(struct ksiginfo **); -int ksiginfo_to_sigset_t(struct proc *, sigset_t *); -int signal_add(struct proc *, struct ksiginfo *, int); -int signal_delete(struct proc *, struct ksiginfo *, int); -int signal_delete_mask(struct proc *, int); -int signal_pending(struct proc *); -int signal_queued(struct proc *, int); -int signal_queued_mask(struct proc *, sigset_t); -__END_DECLS; - -#endif /* !_SYS_KSIGINFO_H_ */ diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 707baa4..74ca25d 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -497,7 +497,6 @@ struct proc { TAILQ_HEAD(, ksegrp) p_ksegrps; /* (kg_ksegrp) All KSEGs. */ TAILQ_HEAD(, thread) p_threads; /* (td_plist) Threads. (shortcut) */ TAILQ_HEAD(, thread) p_suspended; /* (td_runq) suspended threads */ - TAILQ_HEAD(, ksiginfo) p_sigq; /* (c) Queued signals. */ struct ucred *p_ucred; /* (c) Process owner's identity. */ struct filedesc *p_fd; /* (b) Ptr to open files structure. */ /* Accumulated stats for all KSEs? */ @@ -538,6 +537,7 @@ struct proc { struct bintime p_runtime; /* (j) Real time. */ int p_traceflag; /* (o) Kernel trace points. */ struct vnode *p_tracep; /* (c + o) Trace to vnode. */ + sigset_t p_siglist; /* (c) Sigs arrived, not delivered. */ struct vnode *p_textvp; /* (b) Vnode of executable. */ char p_lock; /* (c) Proclock (prevent swap) count. */ struct klist p_klist; /* (c) Knotes attached to this proc. */ |