summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorrse <rse@FreeBSD.org>2005-09-15 13:16:07 +0000
committerrse <rse@FreeBSD.org>2005-09-15 13:16:07 +0000
commit56379f0e5b28374b47acdcb20c9eaf599d2429ad (patch)
tree8b597919ea5904ebe1451b1ea7d97643da09cba8 /sbin
parent75ed14bc1f58fed47fa9deb5431524d11ba6a974 (diff)
downloadFreeBSD-src-56379f0e5b28374b47acdcb20c9eaf599d2429ad.zip
FreeBSD-src-56379f0e5b28374b47acdcb20c9eaf599d2429ad.tar.gz
Fix system shutdown timeout handling by again supporting longer running
shutdown procedures (which have a duration of more than 120 seconds). We have two user-space affecting shutdown timeouts: a "soft" one in /etc/rc.shutdown and a "hard" one in init(8). The first one can be configured via /etc/rc.conf variable "rcshutdown_timeout" and defaults to 30 seconds. The second one was originally (in 1998) intended to be configured via sysctl(8) variable "kern.shutdown_timeout" and defaults to 120 seconds. Unfortunately, the "kern.shutdown_timeout" was declared "unused" in 1999 (as it obviously is actually not used within the kernel itself) and hence was intentionally but misleadingly removed in revision 1.107 from init_main.c. Kernel sysctl(8) variables are certainly a wrong way to control user-space processes in general, but in this particular case the sysctl(8) variable should have remained as it supports init(8), which isn't passed command line flags (which in turn could have been set via /etc/rc.conf), etc. As there is already a similar "kern.init_path" sysctl(8) variable which directly affects init(8), resurrect the init(8) shutdown timeout under sysctl(8) variable "kern.init_shutdown_timeout". But this time document it as being intentionally unused within the kernel and used by init(8). Also document it in the manpages init(8) and rc.conf(5). Reviewed by: phk MFC after: 2 weeks
Diffstat (limited to 'sbin')
-rw-r--r--sbin/init/init.88
-rw-r--r--sbin/init/init.c2
2 files changed, 8 insertions, 2 deletions
diff --git a/sbin/init/init.8 b/sbin/init/init.8
index 6c39343..833e2f6 100644
--- a/sbin/init/init.8
+++ b/sbin/init/init.8
@@ -31,7 +31,7 @@
.\" @(#)init.8 8.3 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
-.Dd April 18, 1994
+.Dd September 15, 2005
.Dt INIT 8
.Os
.Sh NAME
@@ -270,6 +270,12 @@ This script can be used to cleanly terminate specific programs such
as
.Nm innd
(the InterNetNews server).
+If this script does not terminate within 120 seconds,
+.Nm
+will terminate it. The timeout can be configured via the
+.Xr sysctl 8
+variable
+.Va kern.init_shutdown_timeout .
.Pp
The role of
.Nm
diff --git a/sbin/init/init.c b/sbin/init/init.c
index cfba319..393955f 100644
--- a/sbin/init/init.c
+++ b/sbin/init/init.c
@@ -1520,7 +1520,7 @@ runshutdown(void)
}
len = sizeof(shutdowntimeout);
- if (sysctlbyname("kern.shutdown_timeout",
+ if (sysctlbyname("kern.init_shutdown_timeout",
&shutdowntimeout,
&len, NULL, 0) == -1 || shutdowntimeout < 2)
shutdowntimeout = DEATH_SCRIPT;
OpenPOWER on IntegriCloud