summaryrefslogtreecommitdiff
path: root/sys/kern/kern_acct.c
diff options
context:
space:
mode:
authorcheloha <cheloha@cvs.openbsd.org>2019-07-03 22:39:34 +0000
committercheloha <cheloha@cvs.openbsd.org>2019-07-03 22:39:34 +0000
commit40d389b2bd19834e09052025f12e67335b94fc98 (patch)
tree3f5428eadae30d9344b2407c5295b0dced7579f5 /sys/kern/kern_acct.c
parentd5cb3b4efc31fe576d9835223fa53e89d6671346 (diff)
Add tsleep_nsec(9), msleep_nsec(9), and rwsleep_nsec(9).
Equivalent to their unsuffixed counterparts except that (a) they take a timeout in terms of nanoseconds, and (b) INFSLP, aka UINT64_MAX (not zero) indicates that a timeout should not be set. For now, zero nanoseconds is not a strictly valid invocation: we log a warning on DIAGNOSTIC kernels if we see such a call. We still sleep until the next tick in such a case, however. In the future this could become some sort of poll... TBD. To facilitate conversions to these interfaces: add inline conversion functions to sys/time.h for turning your timeout into nanoseconds. Also do a few easy conversions for warmup and to demonstrate how further conversions should be done. Lots of input from mpi@ and ratchov@. Additional input from tedu@, deraadt@, mortimer@, millert@, and claudio@. Partly inspired by FreeBSD r247787. positive feedback from deraadt@, ok mpi@
Diffstat (limited to 'sys/kern/kern_acct.c')
-rw-r--r--sys/kern/kern_acct.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c
index 3bf3ae26c9a..db8494f292d 100644
--- a/sys/kern/kern_acct.c
+++ b/sys/kern/kern_acct.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_acct.c,v 1.38 2019/06/01 14:11:17 mpi Exp $ */
+/* $OpenBSD: kern_acct.c,v 1.39 2019/07/03 22:39:33 cheloha Exp $ */
/* $NetBSD: kern_acct.c,v 1.42 1996/02/04 02:15:12 christos Exp $ */
/*-
@@ -86,7 +86,7 @@ struct vnode *savacctp;
*/
int acctsuspend = 2; /* stop accounting when < 2% free space left */
int acctresume = 4; /* resume when free space risen to > 4% */
-int acctchkfreq = 15; /* frequency (in seconds) to check space */
+int acctrate = 15; /* delay (in seconds) between space checks */
struct proc *acct_proc;
@@ -313,7 +313,7 @@ acct_thread(void *arg)
} else {
break;
}
- tsleep(&acct_proc, PPAUSE, "acct", acctchkfreq *hz);
+ tsleep_nsec(&acct_proc, PPAUSE, "acct", SEC_TO_NSEC(acctrate));
}
acct_proc = NULL;
kthread_exit(0);