malloc.3: ffix
[man-pages.git] / man3 / ualarm.3
blob3b8f50b8a46ed0fe51bf31964ed3f84eadd752a0
1 .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
2 .\"
3 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
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
20 .\" License along with this manual; if not, see
21 .\" <http://www.gnu.org/licenses/>.
22 .\" %%%LICENSE_END
23 .\"
24 .TH UALARM 3  2021-03-22 "" "Linux Programmer's Manual"
25 .SH NAME
26 ualarm \- schedule signal after given number of microseconds
27 .SH SYNOPSIS
28 .nf
29 .B "#include <unistd.h>"
30 .PP
31 .BI "useconds_t ualarm(useconds_t " usecs ", useconds_t " interval );
32 .fi
33 .PP
34 .RS -4
35 Feature Test Macro Requirements for glibc (see
36 .BR feature_test_macros (7)):
37 .RE
38 .PP
39 .BR ualarm ():
40 .nf
41     Since glibc 2.12:
42         (_XOPEN_SOURCE >= 500) && ! (_POSIX_C_SOURCE >= 200809L)
43             || /* Glibc since 2.19: */ _DEFAULT_SOURCE
44             || /* Glibc <= 2.19: */ _BSD_SOURCE
45     Before glibc 2.12:
46         _BSD_SOURCE || _XOPEN_SOURCE >= 500
47 .\"    || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
48 .fi
49 .SH DESCRIPTION
50 The
51 .BR ualarm ()
52 function causes the signal
53 .B SIGALRM
54 to be sent to the invoking process after (not less than)
55 .I usecs
56 microseconds.
57 The delay may be lengthened slightly by any system activity
58 or by the time spent processing the call or by the
59 granularity of system timers.
60 .PP
61 Unless caught or ignored, the
62 .B SIGALRM
63 signal will terminate the process.
64 .PP
65 If the
66 .I interval
67 argument is nonzero, further
68 .B SIGALRM
69 signals will be sent every
70 .I interval
71 microseconds after the first.
72 .SH RETURN VALUE
73 This function returns the number of microseconds remaining for
74 any alarm that was previously set, or 0 if no alarm was pending.
75 .SH ERRORS
76 .TP
77 .B EINTR
78 Interrupted by a signal; see
79 .BR signal (7).
80 .TP
81 .B EINVAL
82 \fIusecs\fP or \fIinterval\fP is not smaller than 1000000.
83 (On systems where that is considered an error.)
84 .SH ATTRIBUTES
85 For an explanation of the terms used in this section, see
86 .BR attributes (7).
87 .ad l
88 .nh
89 .TS
90 allbox;
91 lbx lb lb
92 l l l.
93 Interface       Attribute       Value
95 .BR ualarm ()
96 T}      Thread safety   MT-Safe
97 .TE
98 .hy
99 .ad
100 .sp 1
101 .SH CONFORMING TO
102 4.3BSD, POSIX.1-2001.
103 POSIX.1-2001 marks
104 .BR ualarm ()
105 as obsolete.
106 POSIX.1-2008 removes the specification of
107 .BR ualarm ().
108 4.3BSD, SUSv2, and POSIX do not define any errors.
109 .SH NOTES
110 POSIX.1-2001 does not specify what happens if the
111 .I usecs
112 argument is 0.
113 .\" This case is not documented in HP-US, Solar, FreeBSD, NetBSD, or OpenBSD!
114 On Linux (and probably most other systems),
115 the effect is to cancel any pending alarm.
117 The type
118 .I useconds_t
119 is an unsigned integer type capable of holding integers
120 in the range [0,1000000].
121 On the original BSD implementation, and in glibc before version 2.1,
122 the arguments to
123 .BR ualarm ()
124 were instead typed as
125 .IR "unsigned int" .
126 Programs will be more portable if they never mention
127 .I useconds_t
128 explicitly.
130 The interaction of this function with
131 other timer functions such as
132 .BR alarm (2),
133 .BR sleep (3),
134 .BR nanosleep (2),
135 .BR setitimer (2),
136 .BR timer_create (2),
137 .BR timer_delete (2),
138 .BR timer_getoverrun (2),
139 .BR timer_gettime (2),
140 .BR timer_settime (2),
141 .BR usleep (3)
142 is unspecified.
144 This function is obsolete.
146 .BR setitimer (2)
147 or POSIX interval timers
148 .RB ( timer_create (2),
149 etc.)
150 instead.
151 .SH SEE ALSO
152 .BR alarm (2),
153 .BR getitimer (2),
154 .BR nanosleep (2),
155 .BR select (2),
156 .BR setitimer (2),
157 .BR usleep (3),
158 .BR time (7)