Blame man3/ualarm.3

Packit 7cfc04
.\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
Packit 7cfc04
.\" This is free documentation; you can redistribute it and/or
Packit 7cfc04
.\" modify it under the terms of the GNU General Public License as
Packit 7cfc04
.\" published by the Free Software Foundation; either version 2 of
Packit 7cfc04
.\" the License, or (at your option) any later version.
Packit 7cfc04
.\"
Packit 7cfc04
.\" The GNU General Public License's references to "object code"
Packit 7cfc04
.\" and "executables" are to be interpreted as the output of any
Packit 7cfc04
.\" document formatting or typesetting system, including
Packit 7cfc04
.\" intermediate and printed output.
Packit 7cfc04
.\"
Packit 7cfc04
.\" This manual is distributed in the hope that it will be useful,
Packit 7cfc04
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 7cfc04
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 7cfc04
.\" GNU General Public License for more details.
Packit 7cfc04
.\"
Packit 7cfc04
.\" You should have received a copy of the GNU General Public
Packit 7cfc04
.\" License along with this manual; if not, see
Packit 7cfc04
.\" <http://www.gnu.org/licenses/>.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.TH UALARM 3  2017-09-15 "" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
ualarm \- schedule signal after given number of microseconds
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.nf
Packit 7cfc04
.B "#include <unistd.h>"
Packit 7cfc04
.PP
Packit 7cfc04
.BI "useconds_t ualarm(useconds_t " usecs ", useconds_t " interval );
Packit 7cfc04
.fi
Packit 7cfc04
.PP
Packit 7cfc04
.in -4n
Packit 7cfc04
Feature Test Macro Requirements for glibc (see
Packit 7cfc04
.BR feature_test_macros (7)):
Packit 7cfc04
.in
Packit 7cfc04
.PP
Packit 7cfc04
.BR ualarm ():
Packit 7cfc04
.ad l
Packit 7cfc04
.RS 4
Packit 7cfc04
.PD 0
Packit 7cfc04
.TP 4
Packit 7cfc04
Since glibc 2.12:
Packit 7cfc04
.nf
Packit 7cfc04
(_XOPEN_SOURCE\ >=\ 500) && ! (_POSIX_C_SOURCE\ >=\ 200809L)
Packit 7cfc04
    || /* Glibc since 2.19: */ _DEFAULT_SOURCE
Packit 7cfc04
    || /* Glibc versions <= 2.19: */ _BSD_SOURCE
Packit 7cfc04
.TP 4
Packit 7cfc04
.fi
Packit 7cfc04
Before glibc 2.12:
Packit 7cfc04
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
Packit 7cfc04
.\"    || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
Packit 7cfc04
.PD
Packit 7cfc04
.RE
Packit 7cfc04
.ad b
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
The
Packit 7cfc04
.BR ualarm ()
Packit 7cfc04
function causes the signal
Packit 7cfc04
.B SIGALRM
Packit 7cfc04
to be sent to the invoking process after (not less than)
Packit 7cfc04
.I usecs
Packit 7cfc04
microseconds.
Packit 7cfc04
The delay may be lengthened slightly by any system activity
Packit 7cfc04
or by the time spent processing the call or by the
Packit 7cfc04
granularity of system timers.
Packit 7cfc04
.PP
Packit 7cfc04
Unless caught or ignored, the
Packit 7cfc04
.B SIGALRM
Packit 7cfc04
signal will terminate the process.
Packit 7cfc04
.PP
Packit 7cfc04
If the
Packit 7cfc04
.I interval
Packit 7cfc04
argument is nonzero, further
Packit 7cfc04
.B SIGALRM
Packit 7cfc04
signals will be sent every
Packit 7cfc04
.I interval
Packit 7cfc04
microseconds after the first.
Packit 7cfc04
.SH RETURN VALUE
Packit 7cfc04
This function returns the number of microseconds remaining for
Packit 7cfc04
any alarm that was previously set, or 0 if no alarm was pending.
Packit 7cfc04
.SH ERRORS
Packit 7cfc04
.TP
Packit 7cfc04
.B EINTR
Packit 7cfc04
Interrupted by a signal; see
Packit 7cfc04
.BR signal (7).
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
\fIusecs\fP or \fIinterval\fP is not smaller than 1000000.
Packit 7cfc04
(On systems where that is considered an error.)
Packit 7cfc04
.SH ATTRIBUTES
Packit 7cfc04
For an explanation of the terms used in this section, see
Packit 7cfc04
.BR attributes (7).
Packit 7cfc04
.TS
Packit 7cfc04
allbox;
Packit 7cfc04
lb lb lb
Packit 7cfc04
l l l.
Packit 7cfc04
Interface	Attribute	Value
Packit 7cfc04
T{
Packit 7cfc04
.BR ualarm ()
Packit 7cfc04
T}	Thread safety	MT-Safe
Packit 7cfc04
.TE
Packit 7cfc04
.SH CONFORMING TO
Packit 7cfc04
4.3BSD, POSIX.1-2001.
Packit 7cfc04
POSIX.1-2001 marks
Packit 7cfc04
.BR ualarm ()
Packit 7cfc04
as obsolete.
Packit 7cfc04
POSIX.1-2008 removes the specification of
Packit 7cfc04
.BR ualarm ().
Packit 7cfc04
4.3BSD, SUSv2, and POSIX do not define any errors.
Packit 7cfc04
.SH NOTES
Packit 7cfc04
POSIX.1-2001 does not specify what happens if the
Packit 7cfc04
.I usecs
Packit 7cfc04
argument is 0.
Packit 7cfc04
.\" This case is not documented in HP-US, Solar, FreeBSD, NetBSD, or OpenBSD!
Packit 7cfc04
On Linux (and probably most other systems),
Packit 7cfc04
the effect is to cancel any pending alarm.
Packit 7cfc04
.PP
Packit 7cfc04
The type
Packit 7cfc04
.I useconds_t
Packit 7cfc04
is an unsigned integer type capable of holding integers
Packit 7cfc04
in the range [0,1000000].
Packit 7cfc04
On the original BSD implementation, and in glibc before version 2.1,
Packit 7cfc04
the arguments to
Packit 7cfc04
.BR ualarm ()
Packit 7cfc04
were instead typed as
Packit 7cfc04
.IR "unsigned int" .
Packit 7cfc04
Programs will be more portable if they never mention
Packit 7cfc04
.I useconds_t
Packit 7cfc04
explicitly.
Packit 7cfc04
.PP
Packit 7cfc04
The interaction of this function with
Packit 7cfc04
other timer functions such as
Packit 7cfc04
.BR alarm (2),
Packit 7cfc04
.BR sleep (3),
Packit 7cfc04
.BR nanosleep (2),
Packit 7cfc04
.BR setitimer (2),
Packit 7cfc04
.BR timer_create (2),
Packit 7cfc04
.BR timer_delete (2),
Packit 7cfc04
.BR timer_getoverrun (2),
Packit 7cfc04
.BR timer_gettime (2),
Packit 7cfc04
.BR timer_settime (2),
Packit 7cfc04
.BR usleep (3)
Packit 7cfc04
is unspecified.
Packit 7cfc04
.PP
Packit 7cfc04
This function is obsolete.
Packit 7cfc04
Use
Packit 7cfc04
.BR setitimer (2)
Packit 7cfc04
or POSIX interval timers
Packit 7cfc04
.RB ( timer_create (2),
Packit 7cfc04
etc.)
Packit 7cfc04
instead.
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR alarm (2),
Packit 7cfc04
.BR getitimer (2),
Packit 7cfc04
.BR nanosleep (2),
Packit 7cfc04
.BR select (2),
Packit 7cfc04
.BR setitimer (2),
Packit 7cfc04
.BR usleep (3),
Packit 7cfc04
.BR time (7)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.