summaryrefslogtreecommitdiffstats
path: root/sys/netncp
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2003-03-24 21:15:35 +0000
committerjhb <jhb@FreeBSD.org>2003-03-24 21:15:35 +0000
commit98a481610a9dcb442e9c2e851c6ef2a330027e45 (patch)
tree41fad1aa97bccfd68308cf8a8ff0de8b8f243493 /sys/netncp
parent01298a9735ccfad61628107327cfb25e49f8248b (diff)
downloadFreeBSD-src-98a481610a9dcb442e9c2e851c6ef2a330027e45.zip
FreeBSD-src-98a481610a9dcb442e9c2e851c6ef2a330027e45.tar.gz
Replace the at_fork, at_exec, and at_exit functions with the slightly more
flexible process_fork, process_exec, and process_exit eventhandlers. This reduces code duplication and also means that I don't have to go duplicate the eventhandler locking three more times for each of at_fork, at_exec, and at_exit. Reviewed by: phk, jake, almost complete silence on arch@
Diffstat (limited to 'sys/netncp')
-rw-r--r--sys/netncp/ncp_subr.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/netncp/ncp_subr.c b/sys/netncp/ncp_subr.c
index e24098a..ea201c4 100644
--- a/sys/netncp/ncp_subr.c
+++ b/sys/netncp/ncp_subr.c
@@ -34,6 +34,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/errno.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
@@ -52,8 +53,9 @@
int ncp_debuglevel = 0;
struct callout_handle ncp_timer_handle;
+static eventhandler_tag ncp_exit_tag;
-static void ncp_at_exit(struct proc *p);
+static void ncp_at_exit(void *arg, struct proc *p);
static void ncp_timer(void *arg);
/*
@@ -76,7 +78,7 @@ ncp_str_dup(char *s) {
void
-ncp_at_exit(struct proc *p)
+ncp_at_exit(void *arg, struct proc *p)
{
struct ncp_conn *ncp, *nncp;
struct thread *td;
@@ -102,10 +104,8 @@ int
ncp_init(void)
{
ncp_conn_init();
- if (at_exit(ncp_at_exit)) {
- NCPFATAL("can't register at_exit handler\n");
- return ENOMEM;
- }
+ ncp_exit_tag = EVENTHANDLER_REGISTER(process_exit, ncp_at_exit, NULL,
+ EVENTHANDLER_PRI_ANY);
ncp_timer_handle = timeout(ncp_timer, NULL, NCP_TIMER_TICK);
return 0;
}
@@ -119,7 +119,7 @@ ncp_done(void)
if (error)
return error;
untimeout(ncp_timer, NULL, ncp_timer_handle);
- rm_at_exit(ncp_at_exit);
+ EVENTHANDLER_DEREGISTER(process_exit, ncp_exit_tag);
return 0;
}
OpenPOWER on IntegriCloud