From owner-freebsd-current Mon Sep 7 14:31:17 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA09574 for freebsd-current-outgoing; Mon, 7 Sep 1998 14:31:17 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from nagual.pp.ru (lsd.relcom.eu.net [193.125.27.73]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA09514 for ; Mon, 7 Sep 1998 14:31:08 -0700 (PDT) (envelope-from ache@nagual.pp.ru) Received: (from ache@localhost) by nagual.pp.ru (8.9.1/8.9.1) id BAA20782; Tue, 8 Sep 1998 01:30:47 +0400 (MSD) (envelope-from ache) Message-ID: <19980908013046.A18599@nagual.pp.ru> Date: Tue, 8 Sep 1998 01:30:46 +0400 From: "Andrey A. Chernov" To: Bruce Evans , current@FreeBSD.ORG Subject: Re: new sleep.c & SIGALRM problem Mail-Followup-To: Bruce Evans , current@FreeBSD.ORG References: <199809072011.GAA16751@godzilla.zeta.org.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2i In-Reply-To: <199809072011.GAA16751@godzilla.zeta.org.au>; from bde@zeta.org.au on Tue, Sep 08, 1998 at 06:11:31AM +1000 Organization: Biomechanoid Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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