diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2014-07-13 17:07:01 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2014-07-13 17:07:01 +0000 |
commit | 6eb46530fb9fb056035f7e47aca03dca048c7b39 (patch) | |
tree | d22cfca434bbfd483ab5fc9bc58f481bc7cfff19 | |
parent | 176e51c12c2a3c29c16cc256ad0f53de3768bf37 (diff) |
Set KERN_PROC_NOBROADCASTKILL so that iscsid is not killed by init
when terminating multi-user so that we have a chance to sync the
file systems mounted via iscsi.
-rw-r--r-- | usr.sbin/iscsid/iscsid.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/iscsid/iscsid.c b/usr.sbin/iscsid/iscsid.c index 05621df9e9d..5d211043191 100644 --- a/usr.sbin/iscsid/iscsid.c +++ b/usr.sbin/iscsid/iscsid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iscsid.c,v 1.15 2014/05/10 11:30:47 claudio Exp $ */ +/* $OpenBSD: iscsid.c,v 1.16 2014/07/13 17:07:00 claudio Exp $ */ /* * Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org> @@ -20,6 +20,7 @@ #include <sys/param.h> #include <sys/queue.h> #include <sys/socket.h> +#include <sys/sysctl.h> #include <sys/time.h> #include <sys/uio.h> @@ -69,7 +70,8 @@ main(int argc, char *argv[]) struct passwd *pw; char *ctrlsock = ISCSID_CONTROL; char *vscsidev = ISCSID_DEVICE; - int ch, debug = 0, verbose = 0; + int name[] = { CTL_KERN, KERN_PROC_NOBROADCASTKILL, 0 }; + int ch, debug = 0, verbose = 0, nobkill = 1; log_init(1); /* log to stderr until daemonized */ log_verbose(1); @@ -114,6 +116,10 @@ main(int argc, char *argv[]) daemon(1, 0); log_info("startup"); + name[2] = getpid(); + if (sysctl(name, 3, NULL, 0, &nobkill, sizeof(nobkill)) != 0) + fatal("sysctl"); + event_init(); vscsi_open(vscsidev); |