getitimer.3p (4703B)
- '\" et
- .TH GETITIMER "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
- .\"
- .SH PROLOG
- This manual page is part of the POSIX Programmer's Manual.
- The Linux implementation of this interface may differ (consult
- the corresponding Linux manual page for details of Linux behavior),
- or the interface may not be implemented on Linux.
- .\"
- .SH NAME
- getitimer,
- setitimer
- \(em get and set value of interval timer
- .SH SYNOPSIS
- .LP
- .nf
- #include <sys/time.h>
- .P
- int getitimer(int \fIwhich\fP, struct itimerval *\fIvalue\fP);
- int setitimer(int \fIwhich\fP, const struct itimerval *restrict \fIvalue\fP,
- struct itimerval *restrict \fIovalue\fP);
- .fi
- .SH DESCRIPTION
- The
- \fIgetitimer\fR()
- function shall store the current value of the timer specified by
- .IR which
- into the structure pointed to by
- .IR value .
- The
- \fIsetitimer\fR()
- function shall set the timer specified by
- .IR which
- to the value specified in the structure pointed to by
- .IR value ,
- and if
- .IR ovalue
- is not a null pointer, store the previous value of the timer in the
- structure pointed to by
- .IR ovalue .
- .P
- A timer value is defined by the
- .BR itimerval
- structure, specified in
- .IR <sys/time.h> .
- If
- .IR it_value
- is non-zero, it shall indicate the time to the next timer expiration.
- If
- .IR it_interval
- is non-zero, it shall specify a value to be used in reloading
- .IR it_value
- when the timer expires. Setting
- .IR it_value
- to 0 shall disable a timer, regardless of the value of
- .IR it_interval .
- Setting
- .IR it_interval
- to 0 shall disable a timer after its next expiration (assuming
- .IR it_value
- is non-zero).
- .P
- Implementations may place limitations on the granularity of timer
- values. For each interval timer, if the requested timer value requires
- a finer granularity than the implementation supports, the actual timer
- value shall be rounded up to the next supported value.
- .P
- An XSI-conforming implementation provides each process with at least
- three interval timers, which are indicated by the
- .IR which
- argument:
- .IP ITIMER_PROF 14
- Decrements both in process virtual time and when the system is running
- on behalf of the process. It is designed to be used by interpreters in
- statistically profiling the execution of interpreted programs. Each
- time the ITIMER_PROF timer expires, the SIGPROF signal is delivered.
- .IP ITIMER_REAL 14
- Decrements in real time. A SIGALRM signal is delivered when this timer
- expires.
- .IP ITIMER_VIRTUAL 14
- Decrements in process virtual time. It runs only when the process is
- executing. A SIGVTALRM signal is delivered when it expires.
- .P
- The interaction between
- \fIsetitimer\fR()
- and
- \fIalarm\fR()
- or
- \fIsleep\fR()
- is unspecified.
- .SH "RETURN VALUE"
- Upon successful completion,
- \fIgetitimer\fR()
- or
- \fIsetitimer\fR()
- shall return 0; otherwise, \-1 shall be returned and
- .IR errno
- set to indicate the error.
- .SH ERRORS
- The
- \fIsetitimer\fR()
- function shall fail if:
- .TP
- .BR EINVAL
- The
- .IR value
- argument is not in canonical form. (In canonical form, the number of
- microseconds is a non-negative integer less than 1\|000\|000 and the
- number of seconds is a non-negative integer.)
- .P
- The
- \fIgetitimer\fR()
- and
- \fIsetitimer\fR()
- functions may fail if:
- .TP
- .BR EINVAL
- The
- .IR which
- argument is not recognized.
- .LP
- .IR "The following sections are informative."
- .SH EXAMPLES
- None.
- .SH "APPLICATION USAGE"
- Applications should use the
- \fItimer_gettime\fR()
- and
- \fItimer_settime\fR()
- functions instead of the obsolescent
- \fIgetitimer\fR()
- and
- \fIsetitimer\fR()
- functions, respectively.
- .SH RATIONALE
- None.
- .SH "FUTURE DIRECTIONS"
- The
- \fIgetitimer\fR()
- and
- \fIsetitimer\fR()
- functions may be removed in a future version.
- .SH "SEE ALSO"
- .IR "\fIalarm\fR\^(\|)",
- .IR "\fIexec\fR\^",
- .IR "\fIsleep\fR\^(\|)",
- .IR "\fItimer_getoverrun\fR\^(\|)"
- .P
- The Base Definitions volume of POSIX.1\(hy2017,
- .IR "\fB<signal.h>\fP",
- .IR "\fB<sys_time.h>\fP"
- .\"
- .SH COPYRIGHT
- Portions of this text are reprinted and reproduced in electronic form
- from IEEE Std 1003.1-2017, Standard for Information Technology
- -- Portable Operating System Interface (POSIX), The Open Group Base
- Specifications Issue 7, 2018 Edition,
- Copyright (C) 2018 by the Institute of
- Electrical and Electronics Engineers, Inc and The Open Group.
- In the event of any discrepancy between this version and the original IEEE and
- The Open Group Standard, the original IEEE and The Open Group Standard
- is the referee document. The original Standard can be obtained online at
- http://www.opengroup.org/unix/online.html .
- .PP
- Any typographical or formatting errors that appear
- in this page are most likely
- to have been introduced during the conversion of the source files to
- man page format. To report such errors, see
- https://www.kernel.org/doc/man-pages/reporting_bugs.html .