diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-07-05 19:39:07 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-07-05 19:39:07 +0000 |
commit | be14ed898157e77414dcf3b16f7cff1a3eb33c59 (patch) | |
tree | e3bb2ad41d7b048de4fa4eeff6b927c249378c10 /sys/dev | |
parent | b02f94fb7f4d068ae4fd7bbc6a9efe3cd5ba6a31 (diff) |
do not queue events when no daemon running. flush all events on last close.
ok tedu
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/hotplug.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/hotplug.c b/sys/dev/hotplug.c index 425cc4462af..6f47fa5ee65 100644 --- a/sys/dev/hotplug.c +++ b/sys/dev/hotplug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hotplug.c,v 1.1 2004/05/30 08:11:26 grange Exp $ */ +/* $OpenBSD: hotplug.c,v 1.2 2004/07/05 19:39:06 deraadt Exp $ */ /* * Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org> * @@ -86,6 +86,9 @@ hotplug_device_detach(enum devclass class, char *name) int hotplug_put_event(struct hotplug_event *he) { + if (opened == 0) + return (0); + if (evqueue_count == HOTPLUG_MAXEVENTS) { printf("hotplug: event lost, queue full\n"); return (1); @@ -131,6 +134,10 @@ hotplugopen(dev_t dev, int flag, int mode, struct proc *p) int hotplugclose(dev_t dev, int flag, int mode, struct proc *p) { + struct hotplug_event he; + + while (hotplug_get_event(&he) == 1) + ; opened = 0; return (0); |