From 83d396572c23895accf8eaae5887285e638d749d Mon Sep 17 00:00:00 2001 From: claudio Date: Sun, 13 Jul 2014 17:07:00 +0000 Subject: [PATCH] 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. --- usr.sbin/iscsid/iscsid.c | 10 ++++++++-- 1 file 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 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -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); -- 2.20.1