-/* $OpenBSD: kern_acct.c,v 1.7 1998/07/28 00:13:00 millert Exp $ */
+/* $OpenBSD: kern_acct.c,v 1.8 2000/03/23 11:26:28 art Exp $ */
/* $NetBSD: kern_acct.c,v 1.42 1996/02/04 02:15:12 christos Exp $ */
/*-
#include <sys/resourcevar.h>
#include <sys/ioctl.h>
#include <sys/tty.h>
+#include <sys/timeout.h>
#include <sys/syscallargs.h>
} */ *uap = v;
struct nameidata nd;
int error;
+ static struct timeout acct_timeout;
/* Make sure that the caller is root. */
if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
* close the file, and (if no new file was specified, leave).
*/
if (acctp != NULLVP || savacctp != NULLVP) {
- untimeout(acctwatch, NULL);
+ timeout_del(&acct_timeout);
error = vn_close((acctp != NULLVP ? acctp : savacctp), FWRITE,
p->p_ucred, p);
acctp = savacctp = NULLVP;
* free space watcher.
*/
acctp = nd.ni_vp;
- acctwatch(NULL);
+ if (!timeout_initialized(&acct_timeout))
+ timeout_set(&acct_timeout, acctwatch, &acct_timeout);
+ acctwatch(&acct_timeout);
return (error);
}
*/
/* ARGSUSED */
void
-acctwatch(a)
- void *a;
+acctwatch(arg)
+ void *arg;
{
+ struct timeout *to = (struct timeout *)arg;
struct statfs sb;
if (savacctp != NULLVP) {
}
} else
return;
- timeout(acctwatch, NULL, acctchkfreq * hz);
+ timeout_add(to, acctchkfreq * hz);
}