summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_sig.c17
-rw-r--r--sys/sys/signalvar.h2
2 files changed, 8 insertions, 11 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 17a0e61..1d21f06 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
+#include <sys/refcount.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/procdesc.h>
@@ -3432,21 +3433,17 @@ void
sigacts_free(struct sigacts *ps)
{
- mtx_lock(&ps->ps_mtx);
- ps->ps_refcnt--;
- if (ps->ps_refcnt == 0) {
- mtx_destroy(&ps->ps_mtx);
- free(ps, M_SUBPROC);
- } else
- mtx_unlock(&ps->ps_mtx);
+ if (refcount_release(&ps->ps_refcnt) == 0)
+ return;
+ mtx_destroy(&ps->ps_mtx);
+ free(ps, M_SUBPROC);
}
struct sigacts *
sigacts_hold(struct sigacts *ps)
{
- mtx_lock(&ps->ps_mtx);
- ps->ps_refcnt++;
- mtx_unlock(&ps->ps_mtx);
+
+ refcount_acquire(&ps->ps_refcnt);
return (ps);
}
diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h
index c784cfa..f7fcaa9 100644
--- a/sys/sys/signalvar.h
+++ b/sys/sys/signalvar.h
@@ -63,7 +63,7 @@ struct sigacts {
sigset_t ps_osigset; /* Signals using <= 3.x osigset_t. */
sigset_t ps_usertramp; /* SunOS compat; libc sigtramp. XXX */
int ps_flag;
- int ps_refcnt;
+ u_int ps_refcnt;
struct mtx ps_mtx;
};
OpenPOWER on IntegriCloud