Bug 12665
Summary: | POSIX timers API does not support DELAYTIMER_MAX | ||
---|---|---|---|
Product: | Timers | Reporter: | Michael Kerrisk (mtk.manpages) |
Component: | Interval Timers | Assignee: | timers_interval-timers |
Status: | RESOLVED CODE_FIX | ||
Severity: | normal | CC: | alan, fransklaver, xerofoify |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 3.17rc2 | Subsystem: | |
Regression: | No | Bisected commit-id: |
Description
Michael Kerrisk
2009-02-08 12:08:51 UTC
This bug is very old, test against newer kernel to see if it's still a valid bug. Cheers Nick Just ran this on 3.17-r2. It produces a similar result: frans@bugger 12665 % ./posix_timers_signal 5 1 Establishing handler for signal 34 Blocking signal 34 timer ID is 0x9614008 Sleeping for 5 seconds Unblocking signal 34 Caught signal 34 sival_ptr = 0xbf89d4c4; *sival_ptr = 0x9614008 overrun count = 705233439 Eventually fixed by: commit 78c9c4dfbf8c04883941445a195276bb4bb92c76 Author: Thomas Gleixner <tglx@linutronix.de> Date: Tue Jun 26 15:21:32 2018 +0200 posix-timers: Sanitize overrun handling Now, the return value from timer_getoverrun() is clamped to MAX_INT $ uname -r 5.8.16-300.fc33.x86_64 $ ./posix_timers_signal 5 1 Establishing handler for signal 34 Blocking signal 34 timer ID is 0xd536b0 Sleeping for 5 seconds Unblocking signal 34 Caught signal 34 sival_ptr = 0x7fff162dd270; *sival_ptr = 0xd536b0 overrun count = 2147483647 I've revised the manual page as below, and am closing this bug. BUGS POSIX.1 specifies that if the timer overrun count is equal to or greater than an implementation-defined maximum, DELAYTIMER_MAX, then timer_getoverrun() should return DELAYTIMER_MAX. However, before Linux 4.19, if the timer overrun value exceeds the maximum representable integer, the counter cycles, starting once more from low values. Since Linux 4.19, timer_getoverrun() returns DELAY‐ TIMER_MAX (defined as INT_MAX in <limits.h>) in this case (and the overrun value is reset to 0). |