diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2006-04-18 21:48:35 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2006-04-18 21:48:35 +0000 |
commit | aefad587fb3de10c7982bc9b97d75354bb61077f (patch) | |
tree | 6cc8576741d9225cfac9ea78a99fe04dd46f0f09 /sys/kern | |
parent | 3046f083c2f71d3901121a765de0054de2ae1dfe (diff) |
if you go timeout_set, timeout_add, and then timeout_set again you can
screw up the queues that tie all the timeouts together. this makes us
panic if we detect that happening. its a lot easier to debug that the
weird side effects of broken timeout queues.
ok mickey@ kettenis@ deraadt@ pedro@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_timeout.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index 01ad715a983..476eb6371ee 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_timeout.c,v 1.22 2004/12/28 22:48:30 deraadt Exp $ */ +/* $OpenBSD: kern_timeout.c,v 1.23 2006/04/18 21:48:34 dlg Exp $ */ /* * Copyright (c) 2001 Thomas Nordin <nordin@openbsd.org> * Copyright (c) 2000-2001 Artur Grabowski <art@openbsd.org> @@ -141,6 +141,11 @@ timeout_startup(void) void timeout_set(struct timeout *new, void (*fn)(void *), void *arg) { +#ifdef DIAGNOSTIC + if (new->to_flags & TIMEOUT_ONQUEUE) + panic("timeout_set: already queued"); +#endif + new->to_func = fn; new->to_arg = arg; new->to_flags = TIMEOUT_INITIALIZED; |