Re: hotplugd restart problem
Martin Natanowrites: > On Mon, Jul 25, 2016 at 02:17:11PM +0300, Alexey Vatchenko wrote: >> 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. > >> 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 - 1.13 >> +++ usr.sbin/hotplugd/hotplugd.c 25 Jul 2016 11:05:12 - >> @@ -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(, sizeof(sact)); >> sigemptyset(_mask); > -- jca | PGP: 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
Re: hotplugd restart problem
On Mon, Jul 25, 2016 at 02:17:11PM +0300, Alexey Vatchenko wrote: > 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()? > 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 - 1.13 > +++ usr.sbin/hotplugd/hotplugd.c 25 Jul 2016 11:05:12 - > @@ -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(, sizeof(sact)); > sigemptyset(_mask);
hotplugd restart problem
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. 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.c19 Nov 2015 06:05:40 - 1.13 +++ usr.sbin/hotplugd/hotplugd.c25 Jul 2016 11:05:12 - @@ -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(, sizeof(sact)); sigemptyset(_mask);