diff options
author | cperciva <cperciva@FreeBSD.org> | 2015-10-08 15:48:44 +0000 |
---|---|---|
committer | cperciva <cperciva@FreeBSD.org> | 2015-10-08 15:48:44 +0000 |
commit | 7b86f845febc3b375bb02008a456a5514a9396c9 (patch) | |
tree | 7d991b1ff89b8bdaf66d6f797ec32d170165cda5 /sbin | |
parent | 7ff6dd508c4b1f7e015e548ec82f1bf936b529c0 (diff) | |
download | FreeBSD-src-7b86f845febc3b375bb02008a456a5514a9396c9.zip FreeBSD-src-7b86f845febc3b375bb02008a456a5514a9396c9.tar.gz |
MFC r288446: Disable suspend during shutdown.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/init/init.c | 14 |
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; } |