summaryrefslogtreecommitdiffstats
path: root/sbin/init/init.c
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-10-13 13:45:58 -0300
committerRenato Botelho <renato@netgate.com>2015-10-13 13:45:58 -0300
commite52aa5f667faebee85874ec39c29fa1257dd554f (patch)
treeb08cff1a8d0fb8f667942aca5b9a8be9fb5dca03 /sbin/init/init.c
parent945ed01c4bae06169f63978e43029c04d4abd731 (diff)
parent8096b85f202b18e1be6a5dd5251a10fcdb255a78 (diff)
downloadFreeBSD-src-e52aa5f667faebee85874ec39c29fa1257dd554f.zip
FreeBSD-src-e52aa5f667faebee85874ec39c29fa1257dd554f.tar.gz
Merge branch 'stable/10' into devel
Diffstat (limited to 'sbin/init/init.c')
-rw-r--r--sbin/init/init.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sbin/init/init.c b/sbin/init/init.c
index 99041c9..e6f567c 100644
--- a/sbin/init/init.c
+++ b/sbin/init/init.c
@@ -1499,6 +1499,15 @@ static state_func_t
death(void)
{
session_t *sp;
+ int block, blocked;
+ size_t len;
+
+ /* Temporarily block suspend. */
+ len = sizeof(blocked);
+ block = 1;
+ if (sysctlbyname("kern.suspend_blocked", &blocked, &len,
+ &block, sizeof(block)) == -1)
+ blocked = 0;
/*
* Also revoke the TTY here. Because runshutdown() may reopen
@@ -1515,6 +1524,11 @@ death(void)
/* Try to run the rc.shutdown script within a period of time */
runshutdown();
+ /* Unblock suspend if we blocked it. */
+ if (!blocked)
+ sysctlbyname("kern.suspend_blocked", NULL, NULL,
+ &blocked, sizeof(blocked));
+
return (state_func_t) death_single;
}
OpenPOWER on IntegriCloud