text
stringlengths
0
234
argument.
.pp
the
.i flags
argument is a bit mask that can include the following values:
.tp
.b tfd_timer_abstime
interpret
.i new_value.it_value
as an absolute value on the timer's clock.
the timer will expire when the value of the timer's
clock reaches the value specified in
.ir new_value.it_value .
.tp
.br tfd_timer_cancel_on_set
if this flag is specified along with
.b tfd_timer_abstime
and the clock for this timer is
.br clock_realtime
or
.br clock_realtime_alarm ,
then mark this timer as cancelable if the real-time clock
undergoes a discontinuous change
.rb ( settimeofday (2),
.br clock_settime (2),
or similar).
when such changes occur, a current or future
.br read (2)
from the file descriptor will fail with the error
.br ecanceled .
.pp
if the
.i old_value
argument is not null, then the
.i itimerspec
structure that it points to is used to return the setting of the timer
that was current at the time of the call;
see the description of
.br timerfd_gettime ()
following.
.\"
.ss timerfd_gettime()
.br timerfd_gettime ()
returns, in
.ir curr_value ,
an
.ir itimerspec
structure that contains the current setting of the timer
referred to by the file descriptor
.ir fd .
.pp
the
.i it_value
field returns the amount of time
until the timer will next expire.
if both fields of this structure are zero,
then the timer is currently disarmed.
this field always contains a relative value, regardless of whether the
.br tfd_timer_abstime
flag was specified when setting the timer.
.pp
the
.i it_interval
field returns the interval of the timer.
if both fields of this structure are zero,
then the timer is set to expire just once, at the time specified by
.ir curr_value.it_value .
.ss operating on a timer file descriptor
the file descriptor returned by
.br timerfd_create ()
supports the following additional operations:
.tp
.br read (2)
if the timer has already expired one or more times since
its settings were last modified using
.br timerfd_settime (),
or since the last successful
.br read (2),
then the buffer given to
.br read (2)
returns an unsigned 8-byte integer
.ri ( uint64_t )
containing the number of expirations that have occurred.
(the returned value is in host byte order\(emthat is,
the native byte order for integers on the host machine.)
.ip
if no timer expirations have occurred at the time of the
.br read (2),
then the call either blocks until the next timer expiration,
or fails with the error
.b eagain
if the file descriptor has been made nonblocking
(via the use of the
.br fcntl (2)
.b f_setfl
operation to set the
.b o_nonblock
flag).
.ip
a