Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Dec 1998 12:16:45 -0800 (PST)
From:      z@rentaboat.se
To:        freebsd-gnats-submit@FreeBSD.ORG
Subject:   misc/8998: Problem with alarm(3)
Message-ID:  <199812072016.MAA10740@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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 <fqdn> 2.2.7-RELEASE FreeBSD 2.2.7-RELEASE #0: Wed Oct 21 15:42:
16 GMT 1998     z@<fqdn>:/usr/src/sys/compile/<HOSTNAME>-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 <stdio.h>
#include <stdlib.h>
#include <unistd.h>

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



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