Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Sep 1998 01:30:46 +0400
From:      "Andrey A. Chernov" <ache@nagual.pp.ru>
To:        Bruce Evans <bde@zeta.org.au>, current@FreeBSD.ORG
Subject:   Re: new sleep.c & SIGALRM problem
Message-ID:  <19980908013046.A18599@nagual.pp.ru>
In-Reply-To: <199809072011.GAA16751@godzilla.zeta.org.au>; from bde@zeta.org.au on Tue, Sep 08, 1998 at 06:11:31AM %2B1000
References:  <199809072011.GAA16751@godzilla.zeta.org.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Sep 08, 1998 at 06:11:31AM +1000, Bruce Evans wrote:
> >When SIGALRM comes at INT_MAX seconds, new sleep code kill the program
> >instead of stopping sleep.
> 
> This doesn't matter if ints are 32 bits, because the error can't be
> detected without sleeping for a INT_MAX seconds (about 68 years).
> The previous version was correct enough for the same reason.
> 
> >Previous code works, so LONG_MAX comparison
> >must be restored, it is pretty legal in C.
> 
> The LONG_MAX was broken on alphas because time_t is int32_t on alphas,
> so UINT_MAX < LONG_MAX but tv_sec = UINT_MAX overflows to -1 and
> sleep(UINT_MAX) returns immediately.  This should be handled by
> defining TIME_T_MAX in a header file and comparing with it instead
> of LONG_MAX or INT_MAX.  There is no need to loop, because time_t
> must have a range large enough to cover all interesting times.

Well, current version just give wrong programming example for SIGALRM. It
seems that previous one (with INT_MAX) was correct enough. I'll restore it
if nobody object until TIME_T_MAX will be defined.

-- 
Andrey A. Chernov
http://www.nagual.pp.ru/~ache/
MTH/SH/HE S-- W-- N+ PEC>+ D A a++ C G>+ QH+(++) 666+>++ Y

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980908013046.A18599>