From owner-freebsd-bugs Mon Dec 7 12:20:02 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id MAA11029 for freebsd-bugs-outgoing; Mon, 7 Dec 1998 12:20:02 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id MAA10974 for ; Mon, 7 Dec 1998 12:20:00 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from Unknown UID 563@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id MAA26456; Mon, 7 Dec 1998 12:20:00 -0800 (PST) Received: (from nobody@localhost) by hub.freebsd.org (8.8.8/8.8.8) id MAA10740; Mon, 7 Dec 1998 12:16:45 -0800 (PST) (envelope-from nobody) Message-Id: <199812072016.MAA10740@hub.freebsd.org> Date: Mon, 7 Dec 1998 12:16:45 -0800 (PST) From: z@rentaboat.se To: freebsd-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: www-1.0 Subject: misc/8998: Problem with alarm(3) Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 8998 >Category: misc >Synopsis: Problem with alarm(3) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Dec 7 12:20:00 PST 1998 >Last-Modified: >Originator: Zs >Organization: >Release: FreeBSD 2.2.7 >Environment: FreeBSD 2.2.7-RELEASE FreeBSD 2.2.7-RELEASE #0: Wed Oct 21 15:42: 16 GMT 1998 z@:/usr/src/sys/compile/-KERN i386 >Description: The manual for alarm(3) states that the maximum number of seconds allowed is 2147483647, but alarm() calls setitimer() which accepts only 100000000 seconds. >How-To-Repeat: #include #include #include int main(void) { (void) alarm(100000001); if (sleep(1) != 0) { (void) fprintf(stderr, "Sleep got interrupted\n"); return EXIT_FAILURE; } (void) printf("Seconds left of the timer: %u\n", alarm(0)); return EXIT_SUCCESS; } >Fix: Change the limit stated in the man page to 100000000, and in /usr/src/lib/libc/gen/alarm.c, check if the caller has specified a larger value and return -1 if so. >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message