tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: alarm(3) bug?



On Tue, 23 Oct 2012, enh wrote:
the user-observable difference between glibc/POSIX and NetBSD is for alarm(0xffffffff).

0xffffffff seconds is about 136 years. I suggest that you avoid trying to pass such long timeouts to the alarm function. The maximum value guaranteed by POSIX is 65535 seconds (about 18 hours); see the paragraph beginning "Application developers should note" near the top of the page at <http://pubs.opengroup.org/onlinepubs/9699919799/functions/alarm.html>. The maximum value documented in NetBSD's alarm(3) man page is 2147483647 seconds (0x7fffffff seconds, about 68 years).

NetBSD's alarm(3) will return an error code only if the underlying setitimer(2) syscall fails. That is quite unlikely, but what would you suggest should be done in that case?

--apb (Alan Barrett)


Home | Main Index | Thread Index | Old Index