Patch for rc.d/devd on FreeBSD 9-current
M. Warner Losh
imp at bsdimp.com
Sun Jun 27 21:54:02 UTC 2010
In message: <AANLkTilnYGNz7V6z6AkeKsqUvOMN8yLvO57GM1gOIsTD at mail.gmail.com>
Garrett Cooper <yanefbsd at gmail.com> writes:
: On Sat, Jun 26, 2010 at 1:45 PM, Garrett Cooper <yanefbsd at gmail.com> wrote:
: > On Sat, Jun 26, 2010 at 1:29 PM, Hans Petter Selasky <hselasky at c2i.net> wrote:
: >> Hi,
: >>
: >> Sometimes utilities that are started by devd require libraries outside
: >> /usr/lib. One example is the webcamd utility which is started by devd upon USB
: >> device insertion. What do you think about the following patch:
: >>
: >> --- devd (revision 209463)
: >> +++ devd (local)
: >> @@ -4,7 +4,7 @@
: >> #
: >>
: >> # PROVIDE: devd
: >> -# REQUIRE: netif
: >> +# REQUIRE: netif ldconfig
: >> # BEFORE: NETWORKING mountcritremote
: >> # KEYWORD: nojail shutdown
: >
: > Funny since I was just monkeying around with this. This doesn't appear
: > to be the only issue with devd:
: >
: > # devd
: > devd: devd already running, pid: 430
: > # pgrep 430; echo $?
: > 1
: > #
: >
: > Looks like /etc/rc.d/devd restart is broken :(...
:
: This seems to fix that.
: Thanks,
: -Garrett
:
: Index: devd.cc
: ===================================================================
: --- devd.cc (revision 209530)
: +++ devd.cc (working copy)
: @@ -739,6 +739,7 @@
: static void
: event_loop(void)
: {
: + bool warn_user_about_cleanup;
: int rv;
: int fd;
: char buffer[DEVCTL_MAXBUF];
: @@ -804,6 +805,17 @@
: new_client(server_fd);
: }
: close(fd);
: + close(server_fd);
: +
: + if (unlink(PIPE) == 0) {
: + cfg.remove_pidfile();
: + warn_user_about_cleanup = false;
: + } else
: + warn_user_about_cleanup = true;
: +
: + if (warn_user_about_cleanup == true)
: + warn("cleanup failed");
: +
Why not fix pidfile_open to not return a file handle when the PID
doesn't match? Seems like a bug to me in that routine as well.
Warner
More information about the freebsd-current
mailing list