]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/ualarm.3
tfix
[thirdparty/man-pages.git] / man3 / ualarm.3
1 .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
2 .\"
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
7 .\"
8 .\" The GNU General Public License's references to "object code"
9 .\" and "executables" are to be interpreted as the output of any
10 .\" document formatting or typesetting system, including
11 .\" intermediate and printed output.
12 .\"
13 .\" This manual is distributed in the hope that it will be useful,
14 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
15 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 .\" GNU General Public License for more details.
17 .\"
18 .\" You should have received a copy of the GNU General Public
19 .\" License along with this manual; if not, write to the Free
20 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
21 .\" USA.
22 .\"
23 .TH UALARM 3 2003-07-24 "" "Linux Programmer's Manual"
24 .SH NAME
25 ualarm \- schedule signal after given number of microseconds
26 .SH SYNOPSIS
27 .nf
28 .B "#define _XOPEN_SOURCE 500 /* Or: #define _BSD_SOURCE */"
29 .B "#include <unistd.h>"
30 .sp
31 .BI "useconds_t ualarm(useconds_t " usecs ", useconds_t " interval );
32 .fi
33 .SH DESCRIPTION
34 The \fBualarm\fP() function causes the signal SIGALRM to be sent
35 to the invoking process after (not less than)
36 .I usecs
37 microseconds.
38 The delay may be lengthened slightly by any system activity
39 or by the time spent processing the call or by the
40 granularity of system timers.
41 .LP
42 Unless caught or ignored, the SIGALRM signal will terminate the process.
43 .LP
44 If the
45 .I interval
46 argument is non-zero, further SIGALRM signals will be sent every
47 .I interval
48 microseconds after the first.
49 .SH "RETURN VALUE"
50 This function returns the number of microseconds remaining for
51 any alarm that was previously set, or 0 if no alarm was pending.
52 .SH ERRORS
53 .TP
54 EINTR
55 Interrupted by a signal.
56 .TP
57 EINVAL
58 \fIusecs\fP or \fIinterval\fP is not smaller than 1000000.
59 (On systems where that is considered an error.)
60 .SH "CONFORMING TO"
61 4.3BSD, POSIX.1-2001.
62 POSIX.1-2001 marks
63 .BR ualarm ()
64 as obsolete.
65 4.3BSD, SUSv2, and POSIX do not define any errors.
66 .SH NOTES
67 The type
68 .I useconds_t
69 is an unsigned integer type capable of holding integers
70 in the range [0,1000000].
71 On the original BSD implementation, and in glibc before version 2.1,
72 the arguments to
73 .BR ualarm ()
74 were instead typed as
75 .IR "unsigned int" .
76 Programs will be more portable if they never mention
77 .I useconds_t
78 explicitly.
79 .LP
80 The interaction of this function with
81 other timer functions such as
82 .BR alarm (),
83 .BR sleep (),
84 .BR nanosleep (),
85 .BR setitimer (),
86 .BR timer_create (),
87 .BR timer_delete (),
88 .BR timer_getoverrun (),
89 .BR timer_gettime (),
90 .BR timer_settime (),
91 .BR usleep ()
92 is unspecified.
93 .LP
94 This function is obsolete. Use
95 .BR setitimer (2)
96 or POSIX interval timers
97 .RB ( timer_create (),
98 etc.)
99 instead.
100 .SH "SEE ALSO"
101 .BR alarm (2),
102 .BR getitimer (2),
103 .BR nanosleep (2),
104 .BR select (2),
105 .BR setitimer (2),
106 .BR usleep (3),
107 .BR feature_test_macros (7),
108 .BR time (7)