summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sig.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2000-09-17 14:28:33 +0000
committerbde <bde@FreeBSD.org>2000-09-17 14:28:33 +0000
commit80d33b22bf795a46870a6b7d65b4015725f6e860 (patch)
tree80111b2915a1cb10e090a6fe62fbf1e313386383 /sys/kern/kern_sig.c
parent0a7adf329639dd531f4d9522e52363438e126fdd (diff)
downloadFreeBSD-src-80d33b22bf795a46870a6b7d65b4015725f6e860.zip
FreeBSD-src-80d33b22bf795a46870a6b7d65b4015725f6e860.tar.gz
Uninlined CURSIG() and unpolluted <sys/signalvar.h>. CURSIG() had become
very bloated, first with 128-bit sigset_t's, then with locking in the SMP case, then with locking in all cases. The space bloat was probably also time bloat, partly because the fast path through CURSIG() was pessimized by the sigset_t changes. This change speeds up lmbench's pipe-based latency benchmark by 4% on a Celeron. <sys/signalvar.h> had become very polluted to support the bloat.
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r--sys/kern/kern_sig.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 3f7e5d5..1e8561f 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -67,6 +67,7 @@
#include <machine/ipl.h>
#include <machine/cpu.h>
+#include <machine/mutex.h>
#include <machine/smp.h>
#define ONSIG 32 /* NSIG for osig* syscalls. XXX. */
@@ -166,6 +167,31 @@ static int sigproptbl[NSIG] = {
SA_KILL, /* SIGUSR2 */
};
+/*
+ * Determine signal that should be delivered to process p, the current
+ * process, 0 if none. If there is a pending stop signal with default
+ * action, the process stops in issignal().
+ *
+ * MP SAFE
+ */
+int
+CURSIG(struct proc *p)
+{
+ sigset_t tmpset;
+ int r;
+
+ tmpset = p->p_siglist;
+ SIGSETNAND(tmpset, p->p_sigmask);
+ if (SIGISEMPTY(p->p_siglist) ||
+ (!(p->p_flag & P_TRACED) && SIGISEMPTY(tmpset))) {
+ return(0);
+ }
+ mtx_enter(&Giant, MTX_DEF);
+ r = issignal(p);
+ mtx_exit(&Giant, MTX_DEF);
+ return(r);
+}
+
static __inline int
sigprop(int sig)
{
OpenPOWER on IntegriCloud