Visit The New, Modern Unix Linux Community

Linux and UNIX Man Pages

Test Your Knowledge in Computers #627
Difficulty: Medium
When a function clones itself, it is considered to be recursive-clone function.
True or False?
Linux & Unix Commands - Search Man Pages

timer_getoverrun(2) [linux man page]

TIMER_GETOVERRUN(2)					     Linux Programmer's Manual					       TIMER_GETOVERRUN(2)

timer_getoverrun - get overrun count for a POSIX per-process timer SYNOPSIS
#include <time.h> int timer_getoverrun(timer_t timerid); Link with -lrt. Feature Test Macro Requirements for glibc (see feature_test_macros(7)): timer_getoverrun(): _POSIX_C_SOURCE >= 199309L DESCRIPTION
timer_getoverrun() returns the "overrun count" for the timer referred to by timerid. An application can use the overrun count to accu- rately calculate the number of timer expirations that would have occurred over a given time interval. Timer overruns can occur both when receiving expiration notifications via signals (SIGEV_SIGNAL), and via threads (SIGEV_THREAD). When expiration notifications are delivered via a signal, overruns can occur as follows. Regardless of whether or not a real-time signal is used for timer notifications, the system queues at most one signal per timer. (This is the behavior specified by POSIX.1-2001. The alternative, queuing one signal for each timer expiration, could easily result in overflowing the allowed limits for queued signals on the system.) Because of system scheduling delays, or because the signal may be temporarily blocked, there can be a delay between the time when the notification signal is generated and the time when it is delivered (e.g., caught by a signal handler) or accepted (e.g., using sigwait- info(2)). In this interval, further timer expirations may occur. The timer overrun count is the number of additional timer expirations that occurred between the time when the signal was generated and when it was delivered or accepted. Timer overruns can also occur when expiration notifications are delivered via invocation of a thread, since there may be an arbitrary delay between an expiration of the timer and the invocation of the notification thread, and in that delay interval, additional timer expirations may occur RETURN VALUE
On success, timer_getoverrun() returns the overrun count of the specified timer; this count may be 0 if no overruns have occurred. On failure, -1 is returned, and errno is set to indicate the error. ERRORS
EINVAL timerid is not a valid timer ID. VERSIONS
This system call is available since Linux 2.6. CONFORMING TO
When timer notifications are delivered via signals (SIGEV_SIGNAL), on Linux it is also possible to obtain the overrun count via the si_overrun field of the siginfo_t structure (see sigaction(2)). This allows an application to avoid the overhead of making a system call to obtain the overrun count, but is a nonportable extension to POSIX.1-2001. POSIX.1-2001 only discusses timer overruns in the context of timer notifications using signals. BUGS
POSIX.1-2001 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, Linux does not implement this feature: instead, if the timer overrun value exceeds the maximum representable integer, the counter cycles, starting once more from low values. EXAMPLE
See timer_create(2). SEE ALSO
clock_gettime(2), sigaction(2), signalfd(2), sigwaitinfo(2), timer_create(2), timer_delete(2), timer_settime(2), signal(7), time(7) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at Linux 2009-02-20 TIMER_GETOVERRUN(2)

Check Out this Related Man Page

timer_settime(3RT)					    Realtime Library Functions						timer_settime(3RT)

timer_settime, timer_gettime, timer_getoverrun - per-process timers SYNOPSIS
cc [ flag... ] file... -lrt [ library... ] #include <time.h> int timer_settime(timer_t timerid, int flags, const struct itimerspec *restrict value, struct itimerspec *restrict ovalue); int timer_gettime(timer_t timerid, struct itimerspec *value); int timer_getoverrun(timer_t timerid); DESCRIPTION
The timer_settime() function sets the time until the next expiration of the timer specified by timerid from the it_value member of the value argument and arm the timer if the it_value member of value is non-zero. If the specified timer was already armed when timer_settime() is called, this call resets the time until next expiration to the value specified. If the it_value member of value is 0, the timer is dis- armed. The effect of disarming or resetting a timer on pending expiration notifications is unspecified. If the flag TIMER_ABSTIME is not set in the argument flags, timer_settime() behaves as if the time until next expiration is set to be equal to the interval specified by the it_value member of value. That is, the timer expires in it_value nanoseconds from when the call is made. If the flag TIMER_ABSTIME is set in the argument flags, timer_settime() behaves as if the time until next expiration is set to be equal to the difference between the absolute time specified by the it_value member of value and the current value of the clock associated with timerid. That is, the timer expires when the clock reaches the value specified by the it_value member of value. If the specified time has already passed, the function succeeds and the expiration notification is made. The reload value of the timer is set to the value specified by the it_interval member of value. When a timer is armed with a non-zero it_interval, a periodic (or repetitive) timer is specified. Time values that are between two consecutive non-negative integer multiples of the resolution of the specified timer will be rounded up to the larger multiple of the resolution. Quantization error will not cause the timer to expire earlier than the rounded time value. If the argument ovalue is not NULL, the function timer_settime() stores, in the location referenced by ovalue, a value representing the previous amount of time before the timer would have expired or 0 if the timer was disarmed, together with the previous timer reload value. The members of ovalue are subject to the resolution of the timer, and they are the same values that would be returned by a timer_gettime() call at that point in time. The timer_gettime() function stores the amount of time until the specified timer, timerid, expires and the reload value of the timer into the space pointed to by the value argument. The it_value member of this structure contains the amount of time before the timer expires, or 0 if the timer is disarmed. This value is returned as the interval until timer expiration, even if the timer was armed with absolute time. The it_interval member of value contains the reload value last set by timer_settime(). Only a single signal will be queued to the process for a given timer at any point in time. When a timer for which a signal is still pending expires, no signal will be queued, and a timer overrun occurs. When a timer expiration signal is delivered to or accepted by a process, the timer_getoverrun() function returns the timer expiration overrun count for the specified timer. The overrun count returned contains the number of extra timer expirations that occurred between the time the signal was generated (queued) and when it was delivered or accepted, up to but not including an implementation-dependent maximum of DELAYTIMER_MAX. If the number of such extra expirations is greater than or equal to DELAYTIMER_MAX, then the overrun count will be set to DELAYTIMER_MAX. The value returned by timer_getoverrun() applies to the most recent expiration signal delivery or acceptance for the timer. If no expiration signal has been delivered for the timer, the meaning of the overrun count returned is undefined. RETURN VALUES
If the timer_settime() or timer_gettime() functions succeed, 0 is returned. If an error occurs for either of these functions, -1 is returned, and errno is set to indicate the error. If the timer_getoverrun() function succeeds, it returns the timer expiration overrun count as explained above. ERRORS
The timer_settime(), timer_gettime() and timer_getoverrun() functions will fail if: EINVAL The timerid argument does not correspond to a timer returned by timer_create(3RT) but not yet deleted by timer_delete(3RT). ENOSYS The timer_settime(), timer_gettime(), and timer_getoverrun() functions are not supported by the system. The timer_settime() function will fail if: EINVAL A value structure specified a nanosecond value less than zero or greater than or equal to 1000 million. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Async-Signal-Safe | +-----------------------------+-----------------------------+ SEE ALSO
time.h(3HEAD), clock_settime(3RT), timer_create(3RT), timer_delete(3RT), attributes(5), standards(5) SunOS 5.10 1 Nov 2003 timer_settime(3RT)

Featured Tech Videos