On 4/17/07, Dan Nicholson <[EMAIL PROTECTED]> wrote:
> On 4/17/07, Matthew Burgess <[EMAIL PROTECTED]> 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).

I just installed another system without the above tweak and noticed
how slow it makes shutdown. No one replied confirming/denying my above
statements, so here's a quick test to show that this is functionally
equivalent.

$ time {
KILLDELAY=3
dtime=$KILLDELAY
while [ "$dtime" != 0 ]; do
    sleep 1
    dtime=$(($dtime - 1))
done
}

real    0m3.007s
user    0m0.001s
sys     0m0.001s

$ time {
KILLDELAY=30
dtime=$KILLDELAY
while [ "$dtime" != 0 ]; do
    sleep 0.1
    dtime=$(($dtime - 1))
done
}

real    0m3.070s
user    0m0.000s
sys     0m0.001s

Does anyone object to this?

--
Dan
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to