summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ctld
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2014-03-25 12:24:18 +0000
committertrasz <trasz@FreeBSD.org>2014-03-25 12:24:18 +0000
commitb25383a8f96c54eb2828c68551a617758bdbee41 (patch)
treeb2b78f7875f0744a84ba2379f071c6e5bcafe70b /usr.sbin/ctld
parent5fb75e3b8f09c689ffcda3c05dad773f6f6625f2 (diff)
downloadFreeBSD-src-b25383a8f96c54eb2828c68551a617758bdbee41.zip
FreeBSD-src-b25383a8f96c54eb2828c68551a617758bdbee41.tar.gz
MFC r261764:
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
Diffstat (limited to 'usr.sbin/ctld')
-rw-r--r--usr.sbin/ctld/ctld.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c
index d082227..56092db 100644
--- a/usr.sbin/ctld/ctld.c
+++ b/usr.sbin/ctld/ctld.c
@@ -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
OpenPOWER on IntegriCloud