]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/ualarm.3
CPU_SET.3, INFINITY.3, __ppc_get_timebase.3, __ppc_set_ppr_med.3, __ppc_yield.3,...
[thirdparty/man-pages.git] / man3 / ualarm.3
CommitLineData
fea681da
MK
1.\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
2.\"
1dd72f9c 3.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
fea681da
MK
4.\" This is free documentation; you can redistribute it and/or
5.\" modify it under the terms of the GNU General Public License as
6.\" published by the Free Software Foundation; either version 2 of
7.\" the License, or (at your option) any later version.
8.\"
9.\" The GNU General Public License's references to "object code"
10.\" and "executables" are to be interpreted as the output of any
11.\" document formatting or typesetting system, including
12.\" intermediate and printed output.
13.\"
14.\" This manual is distributed in the hope that it will be useful,
15.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17.\" GNU General Public License for more details.
18.\"
19.\" You should have received a copy of the GNU General Public
c715f741
MK
20.\" License along with this manual; if not, see
21.\" <http://www.gnu.org/licenses/>.
6a8d8745 22.\" %%%LICENSE_END
fea681da 23.\"
97986708 24.TH UALARM 3 2016-03-15 "" "Linux Programmer's Manual"
fea681da
MK
25.SH NAME
26ualarm \- schedule signal after given number of microseconds
27.SH SYNOPSIS
28.nf
fea681da 29.B "#include <unistd.h>"
68e4db0a 30.PP
fea681da
MK
31.BI "useconds_t ualarm(useconds_t " usecs ", useconds_t " interval );
32.fi
68e4db0a 33.PP
cc4615cc
MK
34.in -4n
35Feature Test Macro Requirements for glibc (see
36.BR feature_test_macros (7)):
37.in
68e4db0a 38.PP
cc4615cc 39.BR ualarm ():
2df50e3d
MK
40.ad l
41.RS 4
42.PD 0
43.TP 4
44Since glibc 2.12:
45.nf
6e0869f7
MK
46(_XOPEN_SOURCE\ >=\ 500) && ! (_POSIX_C_SOURCE\ >=\ 200809L)
47 || /* Glibc since 2.19: */ _DEFAULT_SOURCE
48 || /* Glibc versions <= 2.19: */ _BSD_SOURCE
2df50e3d
MK
49.TP 4
50.fi
51Before glibc 2.12:
cf7fa0a1
MK
52_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
53.\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
2df50e3d
MK
54.PD
55.RE
56.ad b
fea681da 57.SH DESCRIPTION
60a90ecd
MK
58The
59.BR ualarm ()
8bd58774
MK
60function causes the signal
61.B SIGALRM
62to be sent to the invoking process after (not less than)
fea681da
MK
63.I usecs
64microseconds.
65The delay may be lengthened slightly by any system activity
66or by the time spent processing the call or by the
67granularity of system timers.
68.LP
8bd58774
MK
69Unless caught or ignored, the
70.B SIGALRM
71signal will terminate the process.
fea681da
MK
72.LP
73If the
74.I interval
c7094399 75argument is nonzero, further
8bd58774
MK
76.B SIGALRM
77signals will be sent every
fea681da
MK
78.I interval
79microseconds after the first.
47297adb 80.SH RETURN VALUE
f42373f6
MK
81This function returns the number of microseconds remaining for
82any alarm that was previously set, or 0 if no alarm was pending.
fea681da
MK
83.SH ERRORS
84.TP
f16c6510 85.B EINTR
bb14af39
MK
86Interrupted by a signal; see
87.BR signal (7).
fea681da 88.TP
f16c6510 89.B EINVAL
fea681da
MK
90\fIusecs\fP or \fIinterval\fP is not smaller than 1000000.
91(On systems where that is considered an error.)
2b50e960 92.SH ATTRIBUTES
c433a1f8
PH
93For an explanation of the terms used in this section, see
94.BR attributes (7).
95.TS
96allbox;
97lb lb lb
98l l l.
99Interface Attribute Value
100T{
2b50e960 101.BR ualarm ()
c433a1f8
PH
102T} Thread safety MT-Safe
103.TE
47297adb 104.SH CONFORMING TO
c13182ef 1054.3BSD, POSIX.1-2001.
f42373f6
MK
106POSIX.1-2001 marks
107.BR ualarm ()
108as obsolete.
0a2ab09e
MK
109POSIX.1-2008 removes the specification of
110.BR ualarm ().
f42373f6 1114.3BSD, SUSv2, and POSIX do not define any errors.
fea681da 112.SH NOTES
70ef44de
MK
113POSIX.1-2001 does not specify what happens if the
114.I usecs
115argument is 0.
116.\" This case is not documented in HP-US, Solar, FreeBSD, NetBSD, or OpenBSD!
117On Linux (and probably most other systems),
118the effect is to cancel any pending alarm.
847e0d88 119.PP
fea681da 120The type
f42373f6 121.I useconds_t
fea681da
MK
122is an unsigned integer type capable of holding integers
123in the range [0,1000000].
f42373f6 124On the original BSD implementation, and in glibc before version 2.1,
c13182ef 125the arguments to
f42373f6
MK
126.BR ualarm ()
127were instead typed as
128.IR "unsigned int" .
c13182ef 129Programs will be more portable if they never mention
f42373f6
MK
130.I useconds_t
131explicitly.
fea681da
MK
132.LP
133The interaction of this function with
134other timer functions such as
1272ab18 135.BR alarm (2),
fb186734
MK
136.BR sleep (3),
137.BR nanosleep (2),
138.BR setitimer (2),
804f03e6
MK
139.BR timer_create (2),
140.BR timer_delete (2),
141.BR timer_getoverrun (2),
142.BR timer_gettime (2),
143.BR timer_settime (2),
fb186734 144.BR usleep (3)
fea681da
MK
145is unspecified.
146.LP
c13182ef
MK
147This function is obsolete.
148Use
fea681da 149.BR setitimer (2)
f42373f6 150or POSIX interval timers
804f03e6 151.RB ( timer_create (2),
f42373f6 152etc.)
fea681da 153instead.
47297adb 154.SH SEE ALSO
fea681da
MK
155.BR alarm (2),
156.BR getitimer (2),
157.BR nanosleep (2),
158.BR select (2),
159.BR setitimer (2),
50e5322c 160.BR usleep (3),
60bb61aa 161.BR time (7)