summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_watchdog.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2012-10-17 22:31:59 +0000
committerderaadt <deraadt@openbsd.org>2012-10-17 22:31:59 +0000
commit2bc62deca48d4e48b34ffa22cb9403b25aaa9c56 (patch)
treee9d3498ac5f31b94cd2cc5b05bb47b1c1d28ceab /sys/kern/kern_watchdog.c
parentNarrow the spltty/splx pair in com_activate to only enclose the minimum (diff)
downloadwireguard-openbsd-2bc62deca48d4e48b34ffa22cb9403b25aaa9c56.tar.xz
wireguard-openbsd-2bc62deca48d4e48b34ffa22cb9403b25aaa9c56.zip
Swap arguments to wdog_register() since it is nicer, and prepare
wdog_shutdown() for external usage.
Diffstat (limited to 'sys/kern/kern_watchdog.c')
-rw-r--r--sys/kern/kern_watchdog.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/kern/kern_watchdog.c b/sys/kern/kern_watchdog.c
index af2fc703afb..3670e0932ef 100644
--- a/sys/kern/kern_watchdog.c
+++ b/sys/kern/kern_watchdog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_watchdog.c,v 1.8 2010/04/20 22:05:43 tedu Exp $ */
+/* $OpenBSD: kern_watchdog.c,v 1.9 2012/10/17 22:32:01 deraadt Exp $ */
/*
* Copyright (c) 2003 Markus Friedl. All rights reserved.
@@ -31,7 +31,6 @@
#include <sys/time.h>
void wdog_tickle(void *arg);
-void wdog_shutdown(void *arg);
int (*wdog_ctl_cb)(void *, int) = NULL;
void *wdog_ctl_cb_arg = NULL;
int wdog_period = 0;
@@ -40,7 +39,7 @@ void *wdog_cookie;
struct timeout wdog_timeout;
void
-wdog_register(void *cb_arg, int (*cb)(void *, int))
+wdog_register(int (*cb)(void *, int), void *cb_arg)
{
if (wdog_ctl_cb != NULL)
return;
@@ -48,7 +47,7 @@ wdog_register(void *cb_arg, int (*cb)(void *, int))
wdog_ctl_cb = cb;
wdog_ctl_cb_arg = cb_arg;
timeout_set(&wdog_timeout, wdog_tickle, NULL);
- wdog_cookie = shutdownhook_establish(wdog_shutdown, NULL);
+ wdog_cookie = shutdownhook_establish((void (*)(void *))wdog_shutdown, NULL);
}
void
@@ -61,7 +60,7 @@ wdog_tickle(void *arg)
}
void
-wdog_shutdown(void *arg)
+wdog_shutdown(int (*cb)(void *, int), void *cb_arg)
{
if (wdog_ctl_cb == NULL)
return;
@@ -97,7 +96,7 @@ sysctl_wdog(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
if (error)
return (error);
if (wdog_auto && wdog_cookie == NULL)
- wdog_cookie = shutdownhook_establish(wdog_shutdown,
+ wdog_cookie = shutdownhook_establish((void (*)(void *))wdog_shutdown,
NULL);
else if (!wdog_auto && wdog_cookie) {
shutdownhook_disestablish(wdog_cookie);