diff options
author | trasz <trasz@FreeBSD.org> | 2014-03-06 11:15:54 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2014-03-06 11:15:54 +0000 |
commit | 2e120a0184c35b953e3eec0bbe2d04d201b4e238 (patch) | |
tree | 6961c90a360a562384134b6f2a1c3b632ad1d8e3 /usr.sbin/iscsid | |
parent | 222c71033f3068a1124e34bdbfb8ab0c41e1f964 (diff) | |
download | FreeBSD-src-2e120a0184c35b953e3eec0bbe2d04d201b4e238.zip FreeBSD-src-2e120a0184c35b953e3eec0bbe2d04d201b4e238.tar.gz |
MFC r261748:
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 iscsid(8) zombies disappear.
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.sbin/iscsid')
-rw-r--r-- | usr.sbin/iscsid/iscsid.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/usr.sbin/iscsid/iscsid.c b/usr.sbin/iscsid/iscsid.c index c22d7fd..7504eb9 100644 --- a/usr.sbin/iscsid/iscsid.c +++ b/usr.sbin/iscsid/iscsid.c @@ -394,6 +394,32 @@ set_timeout(int timeout) } 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_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 void handle_request(int iscsi_fd, const struct iscsi_daemon_request *request, int timeout) { struct connection *conn; @@ -522,6 +548,8 @@ main(int argc, char **argv) pidfile_write(pidfh); + register_sigchld(); + for (;;) { log_debugx("waiting for request from the kernel"); |