Date: Thu, 16 Oct 2014 08:33:04 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273160 - head/usr.sbin/autofs Message-ID: <201410160833.s9G8X48c088361@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Thu Oct 16 08:33:04 2014 New Revision: 273160 URL: https://svnweb.freebsd.org/changeset/base/273160 Log: Fix automountd(8) not to leave zombies. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/autofs/automountd.c Modified: head/usr.sbin/autofs/automountd.c ============================================================================== --- head/usr.sbin/autofs/automountd.c Thu Oct 16 02:24:19 2014 (r273159) +++ head/usr.sbin/autofs/automountd.c Thu Oct 16 08:33:04 2014 (r273160) @@ -364,6 +364,33 @@ handle_request(const struct autofs_daemo quick_exit(0); } +static void +sigchld_handler(int dummy __unused) +{ + + /* + * The only purpose of this handler is to make SIGCHLD + * interrupt the AUTOFSREQUEST ioctl(2), so we can call + * wait_for_children(). + */ +} + +static void +register_sigchld(void) +{ + struct sigaction sa; + int error; + + bzero(&sa, sizeof(sa)); + sa.sa_handler = sigchld_handler; + sigfillset(&sa.sa_mask); + error = sigaction(SIGCHLD, &sa, NULL); + if (error != 0) + log_err(1, "sigaction"); + +} + + static int wait_for_children(bool block) { @@ -496,6 +523,8 @@ main_automountd(int argc, char **argv) pidfile_write(pidfh); + register_sigchld(); + for (;;) { log_debugx("waiting for request from the kernel");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410160833.s9G8X48c088361>