Discussion:
hotplugd restart problem
(too old to reply)
Alexey Vatchenko
2016-07-25 11:17:11 UTC
Permalink
Hi!
If something is running which is started from attach script, restarting of
hotplugd fails because /dev/hotplug is occupied by child process.

Attached is the patch to fix this problem.
Martin Natano
2016-07-25 11:48:57 UTC
Permalink
Post by Alexey Vatchenko
Hi!
If something is running which is started from attach script, restarting of
hotplugd fails because /dev/hotplug is occupied by child process.
Attached is the patch to fix this problem.
Makes sense, but why not pass O_CLOEXEC to open() instead of using
fcntl()?
Post by Alexey Vatchenko
Index: usr.sbin/hotplugd/hotplugd.c
===================================================================
RCS file: /cvs/src/usr.sbin/hotplugd/hotplugd.c,v
retrieving revision 1.13
diff -u -p -r1.13 hotplugd.c
--- usr.sbin/hotplugd/hotplugd.c 19 Nov 2015 06:05:40 -0000 1.13
+++ usr.sbin/hotplugd/hotplugd.c 25 Jul 2016 11:05:12 -0000
@@ -82,6 +82,7 @@ main(int argc, char *argv[])
if ((devfd = open(device, O_RDONLY)) == -1)
err(1, "%s", device);
+ fcntl(devfd, F_SETFD, FD_CLOEXEC);
bzero(&sact, sizeof(sact));
sigemptyset(&sact.sa_mask);
Jeremie Courreges-Anglas
2016-07-31 16:18:03 UTC
Permalink
Post by Martin Natano
Post by Alexey Vatchenko
Hi!
If something is running which is started from attach script, restarting of
hotplugd fails because /dev/hotplug is occupied by child process.
Attached is the patch to fix this problem.
Makes sense, but why not pass O_CLOEXEC to open() instead of using
fcntl()?
ok for a diff using O_CLOEXEC.
Post by Martin Natano
Post by Alexey Vatchenko
Index: usr.sbin/hotplugd/hotplugd.c
===================================================================
RCS file: /cvs/src/usr.sbin/hotplugd/hotplugd.c,v
retrieving revision 1.13
diff -u -p -r1.13 hotplugd.c
--- usr.sbin/hotplugd/hotplugd.c 19 Nov 2015 06:05:40 -0000 1.13
+++ usr.sbin/hotplugd/hotplugd.c 25 Jul 2016 11:05:12 -0000
@@ -82,6 +82,7 @@ main(int argc, char *argv[])
if ((devfd = open(device, O_RDONLY)) == -1)
err(1, "%s", device);
+ fcntl(devfd, F_SETFD, FD_CLOEXEC);
bzero(&sact, sizeof(sact));
sigemptyset(&sact.sa_mask);
--
jca | PGP: 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
Loading...