From owner-freebsd-current Mon Sep 7 13:11:49 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA27936 for freebsd-current-outgoing; Mon, 7 Sep 1998 13:11:49 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.15.68.22]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA27928 for ; Mon, 7 Sep 1998 13:11:47 -0700 (PDT) (envelope-from bde@godzilla.zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.7/8.8.7) id GAA16751; Tue, 8 Sep 1998 06:11:31 +1000 Date: Tue, 8 Sep 1998 06:11:31 +1000 From: Bruce Evans Message-Id: <199809072011.GAA16751@godzilla.zeta.org.au> To: ache@nagual.pp.ru, current@FreeBSD.ORG Subject: Re: new sleep.c & SIGALRM problem Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >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. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message