summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_acct.c
diff options
context:
space:
mode:
authorgibbs <gibbs@FreeBSD.org>1997-09-21 22:00:25 +0000
committergibbs <gibbs@FreeBSD.org>1997-09-21 22:00:25 +0000
commit52ace446d29ab170f74f1db02832f24b01e04f20 (patch)
treed6afe48cd9d67da6e613d4b0c40b0446ded305f5 /sys/kern/kern_acct.c
parent3579df4d35e102051246eb21aa0d7712fbfb6544 (diff)
downloadFreeBSD-src-52ace446d29ab170f74f1db02832f24b01e04f20.zip
FreeBSD-src-52ace446d29ab170f74f1db02832f24b01e04f20.tar.gz
init_main.c subr_autoconf.c:
Add support for "interrupt driven configuration hooks". A component of the kernel can register a hook, most likely during auto-configuration, and receive a callback once interrupt services are available. This callback will occur before the root and dump devices are configured, so the configuration task can affect the selection of those two devices or complete any tasks that need to be performed prior to launching init. System boot is posponed so long as a hook is registered. The hook owner is responsible for removing the hook once their task is complete or the system boot can continue. kern_acct.c kern_clock.c kern_exit.c kern_synch.c kern_time.c: Change the interface and implementation for the kernel callout service. The new implemntaion is based on the work of Adam M. Costello and George Varghese, published in a technical report entitled "Redesigning the BSD Callout and Timer Facilities". The interface used in FreeBSD is a little different than the one outlined in the paper. The new function prototypes are: struct callout_handle timeout(void (*func)(void *), void *arg, int ticks); void untimeout(void (*func)(void *), void *arg, struct callout_handle handle); If a client wishes to remove a timeout, it must store the callout_handle returned by timeout and pass it to untimeout. The new implementation gives 0(1) insert and removal of callouts making this interface scale well even for applications that keep 100s of callouts outstanding. See the updated timeout.9 man page for more details.
Diffstat (limited to 'sys/kern/kern_acct.c')
-rw-r--r--sys/kern/kern_acct.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c
index 65aa4fc..9393a72 100644
--- a/sys/kern/kern_acct.c
+++ b/sys/kern/kern_acct.c
@@ -37,7 +37,7 @@
* SUCH DAMAGE.
*
* @(#)kern_acct.c 8.1 (Berkeley) 6/14/93
- * $Id: kern_acct.c,v 1.15 1997/03/24 11:24:34 bde Exp $
+ * $Id: kern_acct.c,v 1.16 1997/09/02 20:05:36 bde Exp $
*/
#include <sys/param.h>
@@ -76,6 +76,13 @@ static comp_t encode_comp_t __P((u_long, u_long));
static void acctwatch __P((void *));
/*
+ * Accounting callout handle used for periodic scheduling of
+ * acctwatch.
+ */
+static struct callout_handle acctwatch_handle
+ = CALLOUT_HANDLE_INITIALIZER(&acctwatch_handle);
+
+/*
* Accounting vnode pointer, and saved vnode pointer.
*/
static struct vnode *acctp;
@@ -139,7 +146,7 @@ acct(a1, uap, a3)
* close the file, and (if no new file was specified, leave).
*/
if (acctp != NULLVP || savacctp != NULLVP) {
- untimeout(acctwatch, NULL);
+ untimeout(acctwatch, NULL, acctwatch_handle);
error = vn_close((acctp != NULLVP ? acctp : savacctp), FWRITE,
p->p_ucred, p);
acctp = savacctp = NULLVP;
@@ -310,5 +317,5 @@ acctwatch(a)
log(LOG_NOTICE, "Accounting suspended\n");
}
}
- timeout(acctwatch, NULL, acctchkfreq * hz);
+ acctwatch_handle = timeout(acctwatch, NULL, acctchkfreq * hz);
}
OpenPOWER on IntegriCloud