ted.unan...@gmail.com (Ted Unangst), 2010.12.12 (Sun) 19:10 (CET):
> On Sun, Dec 12, 2010 at 6:36 AM, MERIGHI Marcus <mcmer-open...@tor.at> wrote:
> > The behaviour change in hotplug(4)/hotplugd(8) after your commit makes
> > it more ``hot plug'', actually. What bothers me (but not many others,
> > obviously) is the fact that the behaviour change is undocumented. Four
> > places come to my mind:
> > 1) a comment in hotplug.c with appropriate commit message.

See below. Commit message suggestion: "document behaviour change: no
more queueing before open to avoid problems when both attach and detach
happens before device is opened.".

> > 2) hotplug(4) man page, ``When a device attaches or detaches, the
> >   corresponding event is queued'' should (suggestion) read ``Once the
> >   device is opened by userland, when a device attaches or detaches, the
> >   corresponding event is queued.'' (I am not a native speaker, so
> >   please correct me!)

See below.

> > 3) hotplugd(8) man page, make
> >   ``The hotplugd daemon monitors the hotplug(4) pseudo-device, acting on
> >   signaled events by executing the scripts in the /etc/hotplug
> >   directory.'' read
> >   ``The hotplugd daemon opens the hotplug(4) pseudo-device and thus
> >   enables event signaling. It then monitors the device, acting on
> >   signaled events by executing the scripts in the /etc/hotplug
> >   directory.''

See below

> > 4) http://www.openbsd.org/faq/current.html

that one went to w...@.

> > I'd gladly supply patches for any of these.
> 
> That sounds good.  I was aware of the change, but didn't think anybody
> would notice. :)

Index: share/man/man4/hotplug.4
===================================================================
RCS file: /cvs/src/share/man/man4/hotplug.4,v
retrieving revision 1.3
diff -u -r1.3 hotplug.4
--- share/man/man4/hotplug.4    31 May 2007 19:19:50 -0000      1.3
+++ share/man/man4/hotplug.4    13 Dec 2010 11:29:30 -0000
@@ -31,7 +31,8 @@
 .Nm
 pseudo-device passes device attachment and detachment events to
 userland.
-When a device attaches or detaches, the corresponding event is queued.
+Once the device is opened by userland, when a device attaches or detaches, 
+the corresponding event is queued.
 The events can then be obtained from the queue through the
 .Xr read 2
 call on the

Index: usr.sbin/hotplugd/hotplugd.8
===================================================================
RCS file: /cvs/src/usr.sbin/hotplugd/hotplugd.8,v
retrieving revision 1.10
diff -u -r1.10 hotplugd.8
--- usr.sbin/hotplugd/hotplugd.8        20 Mar 2009 17:53:14 -0000      1.10
+++ usr.sbin/hotplugd/hotplugd.8        13 Dec 2010 11:26:51 -0000
@@ -26,9 +26,11 @@
 .Sh DESCRIPTION
 The
 .Nm
-daemon monitors the
+daemon opens the
 .Xr hotplug 4
-pseudo-device, acting on signaled events by executing the scripts in the
+pseudo-device and thus enables event signaling.
+It then monitors the device, acting on signaled events by executing the 
+scripts in the
 .Pa /etc/hotplug
 directory.
 By default it uses the

Index: sys/dev/hotplug.c
===================================================================
RCS file: /cvs/src/sys/dev/hotplug.c,v
retrieving revision 1.10
diff -u -r1.10 hotplug.c
--- sys/dev/hotplug.c   2 Dec 2010 04:12:35 -0000       1.10
+++ sys/dev/hotplug.c   13 Dec 2010 11:41:59 -0000
@@ -89,6 +89,13 @@
                printf("hotplug: event lost, queue full\n");
                return (1);
        }
+
+       /* 
+        * Do not queue events prior to hotplugopen anymore. This prevents 
+        * problems where the device is both attached and detached before 
+        * the device is opened.
+        */
+
        if (!evqueue)
                return (1);

Reply via email to