[PATCH] Speedup killproc

Dan Nicholson dbn.lists at gmail.com
Tue Apr 17 12:18:01 PDT 2007


On 4/17/07, Matthew Burgess <matthew at linuxfromscratch.org> wrote:
> 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"

A 0 is added to KILLDELAY to essentially multiply by 10.

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

This isn't possible because the shell arithmetic $(( )) only handles
integers. But multiplying the value of KILLDELAY (seconds) should make
this work. I.e., dtime="${KILLDELAY}0" (dtime=30), sleep 0.1, dtime--
(dtime=29).

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

It's set at the top of functions, but I don't know how many people
start editing that file.

--
Dan



More information about the lfs-dev mailing list