svn commit: r261764 - head/usr.sbin/ctld
Edward Tomasz Napierala
trasz at FreeBSD.org
Tue Feb 11 11:33:44 UTC 2014
Author: trasz
Date: Tue Feb 11 11:33:44 2014
New Revision: 261764
URL: http://svnweb.freebsd.org/changeset/base/261764
Log:
So, it turns out SIGCHLD is discarded by default, so we have to set up
a dummy handler to make it interrupt an ioctl(2) or select(2).
This makes those short-lived ctld(8) zombies disappear.
Sponsored by: The FreeBSD Foundation
Modified:
head/usr.sbin/ctld/ctld.c
Modified: head/usr.sbin/ctld/ctld.c
==============================================================================
--- head/usr.sbin/ctld/ctld.c Tue Feb 11 11:32:36 2014 (r261763)
+++ head/usr.sbin/ctld/ctld.c Tue Feb 11 11:33:44 2014 (r261764)
@@ -1742,6 +1742,17 @@ sigterm_handler(int dummy __unused)
}
static void
+sigchld_handler(int dummy __unused)
+{
+
+ /*
+ * The only purpose of this handler is to make SIGCHLD
+ * interrupt the ISCSIDWAIT ioctl(2), so we can call
+ * wait_for_children().
+ */
+}
+
+static void
register_signals(void)
{
struct sigaction sa;
@@ -1763,6 +1774,11 @@ register_signals(void)
error = sigaction(SIGINT, &sa, NULL);
if (error != 0)
log_err(1, "sigaction");
+
+ sa.sa_handler = sigchld_handler;
+ error = sigaction(SIGCHLD, &sa, NULL);
+ if (error != 0)
+ log_err(1, "sigaction");
}
int
More information about the svn-src-all
mailing list