2009-02-10 00:37:07 +00:00
|
|
|
.\" Copyright (c) 2009 Linux Foundation, written by Michael Kerrisk
|
|
|
|
.\" <mtk.manpages@gmail.com>
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
|
|
.\" preserved on all copies.
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
|
|
.\" permission notice identical to this one.
|
|
|
|
.\"
|
|
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
|
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
|
|
.\" have taken the same level of care in the production of this manual,
|
|
|
|
.\" which is licensed free of charge, as they might when working
|
|
|
|
.\" professionally.
|
|
|
|
.\"
|
|
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
2009-02-19 23:21:49 +00:00
|
|
|
.TH TIMER_GETOVERRUN 2 2009-02-20 Linux "Linux Programmer's Manual"
|
2009-02-10 00:37:07 +00:00
|
|
|
.SH NAME
|
|
|
|
timer_getoverrun \- get overrun count for a POSIX per-process timer
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
.B #include <time.h>
|
|
|
|
|
|
|
|
.BI "int timer_getoverrun(timer_t " timerid );
|
|
|
|
.fi
|
|
|
|
|
2009-02-23 18:46:09 +00:00
|
|
|
Link with \fI\-lrt\fP.
|
2009-02-10 00:37:07 +00:00
|
|
|
.sp
|
|
|
|
.in -4n
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
|
|
.BR feature_test_macros (7)):
|
|
|
|
.in
|
|
|
|
.sp
|
|
|
|
.BR timer_getoverrun ():
|
brk.2, chroot.2, faccessat.2, fchmodat.2, fchownat.2, fstatat.2, futimesat.2, getdtablesize.2, getpagesize.2, getsid.2, linkat.2, mkdirat.2, mknodat.2, openat.2, pread.2, readlinkat.2, renameat.2, setpgid.2, sigaltstack.2, symlinkat.2, sync.2, timer_create.2, timer_delete.2, timer_getoverrun.2, timer_settime.2, unlinkat.2, utimensat.2, vfork.2, acosh.3, asinh.3, atanh.3, dirfd.3, dprintf.3, ecvt.3, expm1.3, fexecve.3, fmemopen.3, gcvt.3, getcwd.3, gethostid.3, getpass.3, getsubopt.3, getw.3, mbsnrtowcs.3, mkfifoat.3, mkstemp.3, mktemp.3, opendir.3, posix_memalign.3, rint.3, siginterrupt.3, stpcpy.3, stpncpy.3, strdup.3, strerror.3, strnlen.3, strsignal.3, strtol.3, strtoul.3, ualarm.3, usleep.3, wcpcpy.3, wcpncpy.3, wcscasecmp.3, wcsdup.3, wcsncasecmp.3, wcsnlen.3, wcsnrtombs.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-09-19 06:02:38 +00:00
|
|
|
_POSIX_C_SOURCE\ >=\ 199309L
|
2009-02-10 00:37:07 +00:00
|
|
|
.SH DESCRIPTION
|
|
|
|
.BR timer_getoverrun ()
|
|
|
|
returns the "overrun count" for the timer referred to by
|
|
|
|
.IR timerid .
|
|
|
|
An application can use the overrun count to accurately 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
|
|
|
|
.RB ( SIGEV_SIGNAL ),
|
|
|
|
and via threads
|
|
|
|
.RB ( 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
|
|
|
|
.BR sigwaitinfo (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
|
|
|
|
.SH RETURN VALUE
|
|
|
|
On success,
|
|
|
|
.BR 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
|
|
|
|
.I errno
|
|
|
|
is set to indicate the error.
|
|
|
|
.SH ERRORS
|
|
|
|
.TP
|
|
|
|
.B EINVAL
|
|
|
|
.I timerid
|
|
|
|
is not a valid timer ID.
|
|
|
|
.SH VERSIONS
|
|
|
|
This system call is available since Linux 2.6.
|
|
|
|
.SH CONFORMING TO
|
2010-11-01 06:21:04 +00:00
|
|
|
POSIX.1-2001.
|
2009-02-10 00:37:07 +00:00
|
|
|
.SH NOTES
|
|
|
|
When timer notifications are delivered via signals
|
|
|
|
.RB ( SIGEV_SIGNAL ),
|
|
|
|
on Linux it is also possible to obtain the overrun count via the
|
|
|
|
.I si_overrun
|
|
|
|
field of the
|
|
|
|
.I siginfo_t
|
|
|
|
structure (see
|
|
|
|
.BR sigaction (2)).
|
|
|
|
This allows an application to avoid the overhead of making
|
|
|
|
a system call to obtain the overrun count,
|
execve.2, fallocate.2, futex.2, sched_rr_get_interval.2, select_tut.2, shmget.2, timer_getoverrun.2, times.2, pthread_attr_init.3, pthread_attr_setaffinity_np.3, pthread_cleanup_push_defer_np.3, pthread_getattr_np.3, pthread_self.3, pthread_setaffinity_np.3, pthread_tryjoin_np.3, sem_open.3, stdin.3, rtc.4, tty_ioctl.4, unix.7: Global fix: s/non-portable/nonportable/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 16:46:09 +00:00
|
|
|
but is a nonportable extension to POSIX.1-2001.
|
2009-02-10 00:37:07 +00:00
|
|
|
|
|
|
|
POSIX.1-2001 only discusses timer overruns in the context of
|
|
|
|
timer notifications using signals.
|
|
|
|
.\" FIXME . Austin bug filed, 11 Feb 09
|
|
|
|
.SH BUGS
|
|
|
|
POSIX.1-2001 specifies that if the timer overrun count
|
|
|
|
is equal to or greater than an implementation-defined maximum,
|
|
|
|
.BR DELAYTIMER_MAX ,
|
|
|
|
then
|
|
|
|
.BR timer_getoverrun ()
|
|
|
|
should return
|
|
|
|
.BR 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.
|
|
|
|
.\" Bug filed: http://bugzilla.kernel.org/show_bug.cgi?id=12665
|
|
|
|
.\" http://thread.gmane.org/gmane.linux.kernel/113276/
|
2009-02-11 10:27:36 +00:00
|
|
|
.SH EXAMPLE
|
|
|
|
See
|
|
|
|
.BR timer_create (2).
|
2009-02-10 00:37:07 +00:00
|
|
|
.SH SEE ALSO
|
|
|
|
.BR clock_gettime (2),
|
|
|
|
.BR sigaction (2),
|
|
|
|
.BR signalfd (2),
|
|
|
|
.BR sigwaitinfo (2),
|
|
|
|
.BR timer_create (2),
|
|
|
|
.BR timer_delete (2),
|
|
|
|
.BR timer_settime (2),
|
|
|
|
.BR signal (7),
|
|
|
|
.BR time (7)
|