[PATCH] Speedup killproc

Matthew Burgess matthew at linuxfromscratch.org
Tue Apr 17 10:18:27 PDT 2007


On Tuesday 17 April 2007 05:15, Dan Nicholson wrote:

> 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))

I think the above needs to be:

dtime=$(( ${dtime - 0.1)) otherwise we're not going to wait for 3 seconds.  I 
suspect this might be why your bootups have a far shorter delay ;)

Thinking about it a little bit more, it might be worth changing the KILLDELAY 
variable to KILLTIMEOUT, then having the '0.1' above as KILLDELAY.  I don't 
know how often, if ever, we might want to change the length of time we sleep 
for, so not sure this suggestion is worth it.

Other than that, the patch looks good to me.

Thanks,

Matt.



More information about the lfs-dev mailing list