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
This commit is contained in:
parent
022b237d47
commit
1ecb3c5857
@ -393,6 +393,32 @@ set_timeout(int timeout)
|
|||||||
log_err(1, "setitimer");
|
log_err(1, "setitimer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static void
|
||||||
handle_request(int iscsi_fd, const struct iscsi_daemon_request *request, int timeout)
|
handle_request(int iscsi_fd, const struct iscsi_daemon_request *request, int timeout)
|
||||||
{
|
{
|
||||||
@ -522,6 +548,8 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
pidfile_write(pidfh);
|
pidfile_write(pidfh);
|
||||||
|
|
||||||
|
register_sigchld();
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
log_debugx("waiting for request from the kernel");
|
log_debugx("waiting for request from the kernel");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user