When calling killproc from a bootscript, it checks if the process is
still running before moving on. If it is still running, it sleeps for
a second and then checks again. It does this for 3 seconds by default
before considering that the kill process has failed. This happens
often and makes the shutdown process slow.
Since sleep is /bin/sleep, and we know that it can handle floating
point arguments, we can trivially change from "sleep 1" to "sleep 0.1"
just by adding one 0 to the KILLDELAY variable. There is a noticeable
difference since many daemons (dbus is an example) haven't quit by the
first time killproc checks to see if they're still running after it
sent TERM. This causes a 1 second delay, which seems far more than
necessary in my testing.
Index: bootscripts/lfs/init.d/functions
===================================================================
--- bootscripts/lfs/init.d/functions (revision 8076)
+++ bootscripts/lfs/init.d/functions (working copy)
@@ -657,11 +657,12 @@
# Wait up to 3 seconds, for ${pid} to terminate
case "${killsig}" in
TERM|SIGTERM|KILL|SIGKILL)
- local dtime=${KILLDELAY}
+ # sleep in 1/10ths of seconds
+ local dtime="${KILLDELAY}0"
while [ "${dtime}" != "0" ]
do
kill -0 ${pid} 2>/dev/null || break
- sleep 1
+ sleep 0.1
dtime=$(( ${dtime} - 1))
done
# If ${pid} is still running, kill it
--
Dan
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page