text
stringlengths 0
234
|
---|
.\" copyright (c) 2008 michael kerrisk <[email protected]> |
.\" |
.\" %%%license_start(gplv2+_sw_3_para) |
.\" this program is free software; you can redistribute it and/or modify |
.\" it under the terms of the gnu general public license as published by |
.\" the free software foundation; either version 2 of the license, or |
.\" (at your option) any later version. |
.\" |
.\" this program is distributed in the hope that it will be useful, |
.\" but without any warranty; without even the implied warranty of |
.\" merchantability or fitness for a particular purpose. see the |
.\" gnu general public license for more details. |
.\" |
.\" you should have received a copy of the gnu general public |
.\" license along with this manual; if not, see |
.\" <http://www.gnu.org/licenses/>. |
.\" %%%license_end |
.\" |
.th timerfd_create 2 2021-03-22 linux "linux programmer's manual" |
.sh name |
timerfd_create, timerfd_settime, timerfd_gettime \- |
timers that notify via file descriptors |
.sh synopsis |
.nf |
.b #include <sys/timerfd.h> |
.pp |
.bi "int timerfd_create(int " clockid ", int " flags ); |
.pp |
.bi "int timerfd_settime(int " fd ", int " flags , |
.bi " const struct itimerspec *" new_value , |
.bi " struct itimerspec *" old_value ); |
.bi "int timerfd_gettime(int " fd ", struct itimerspec *" curr_value ); |
.fi |
.sh description |
these system calls create and operate on a timer |
that delivers timer expiration notifications via a file descriptor. |
they provide an alternative to the use of |
.br setitimer (2) |
or |
.br timer_create (2), |
with the advantage that the file descriptor may be monitored by |
.br select (2), |
.br poll (2), |
and |
.br epoll (7). |
.pp |
the use of these three system calls is analogous to the use of |
.br timer_create (2), |
.br timer_settime (2), |
and |
.br timer_gettime (2). |
(there is no analog of |
.br timer_getoverrun (2), |
since that functionality is provided by |
.br read (2), |
as described below.) |
.\" |
.ss timerfd_create() |
.br timerfd_create () |
creates a new timer object, |
and returns a file descriptor that refers to that timer. |
the |
.i clockid |
argument specifies the clock that is used to mark the progress |
of the timer, and must be one of the following: |
.tp |
.b clock_realtime |
a settable system-wide real-time clock. |
.tp |
.b clock_monotonic |
a nonsettable monotonically increasing clock that measures time |
from some unspecified point in the past that does not change |
after system startup. |
.tp |
.br clock_boottime " (since linux 3.15)" |
.\" commit 4a2378a943f09907fb1ae35c15de917f60289c14 |
like |
.br clock_monotonic , |
this is a monotonically increasing clock. |
however, whereas the |
.br clock_monotonic |
clock does not measure the time while a system is suspended, the |
.br clock_boottime |
clock does include the time during which the system is suspended. |
this is useful for applications that need to be suspend-aware. |
.br clock_realtime |
is not suitable for such applications, since that clock is affected |
by discontinuous changes to the system clock. |
.tp |
.br clock_realtime_alarm " (since linux 3.11)" |
.\" commit 11ffa9d6065f344a9bd769a2452f26f2f671e5f8 |
this clock is like |
.br clock_realtime , |
but will wake the system if it is suspended. |
the caller must have the |
.b cap_wake_alarm |
capability in order to set a timer against this clock. |
.tp |
.br clock_boottime_alarm " (since linux 3.11)" |
.\" commit 11ffa9d6065f344a9bd769a2452f26f2f671e5f8 |