]>
Commit | Line | Data |
---|---|---|
fea681da MK |
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 | .\" | |
50831f9b | 23 | .TH UALARM 3 2010-09-20 "" "Linux Programmer's Manual" |
fea681da MK |
24 | .SH NAME |
25 | ualarm \- schedule signal after given number of microseconds | |
26 | .SH SYNOPSIS | |
27 | .nf | |
fea681da MK |
28 | .B "#include <unistd.h>" |
29 | .sp | |
30 | .BI "useconds_t ualarm(useconds_t " usecs ", useconds_t " interval ); | |
31 | .fi | |
cc4615cc MK |
32 | .sp |
33 | .in -4n | |
34 | Feature Test Macro Requirements for glibc (see | |
35 | .BR feature_test_macros (7)): | |
36 | .in | |
37 | .sp | |
38 | .BR ualarm (): | |
2df50e3d MK |
39 | .ad l |
40 | .RS 4 | |
41 | .PD 0 | |
42 | .TP 4 | |
43 | Since glibc 2.12: | |
44 | .nf | |
45 | _BSD_SOURCE || | |
98dbe7af | 46 | (_XOPEN_SOURCE\ >=\ 500 || |
7b072c4d | 47 | _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED) && |
98dbe7af | 48 | !(_POSIX_C_SOURCE\ >=\ 200809L || _XOPEN_SOURCE\ >=\ 700) |
2df50e3d MK |
49 | .TP 4 |
50 | .fi | |
51 | Before glibc 2.12: | |
98dbe7af 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 |
58 | The |
59 | .BR ualarm () | |
8bd58774 MK |
60 | function causes the signal |
61 | .B SIGALRM | |
62 | to be sent to the invoking process after (not less than) | |
fea681da MK |
63 | .I usecs |
64 | microseconds. | |
65 | The delay may be lengthened slightly by any system activity | |
66 | or by the time spent processing the call or by the | |
67 | granularity of system timers. | |
68 | .LP | |
8bd58774 MK |
69 | Unless caught or ignored, the |
70 | .B SIGALRM | |
71 | signal will terminate the process. | |
fea681da MK |
72 | .LP |
73 | If the | |
74 | .I interval | |
c7094399 | 75 | argument is nonzero, further |
8bd58774 MK |
76 | .B SIGALRM |
77 | signals will be sent every | |
fea681da MK |
78 | .I interval |
79 | microseconds after the first. | |
47297adb | 80 | .SH RETURN VALUE |
f42373f6 MK |
81 | This function returns the number of microseconds remaining for |
82 | any alarm that was previously set, or 0 if no alarm was pending. | |
fea681da MK |
83 | .SH ERRORS |
84 | .TP | |
f16c6510 | 85 | .B EINTR |
fea681da MK |
86 | Interrupted by a signal. |
87 | .TP | |
f16c6510 | 88 | .B EINVAL |
fea681da MK |
89 | \fIusecs\fP or \fIinterval\fP is not smaller than 1000000. |
90 | (On systems where that is considered an error.) | |
47297adb | 91 | .SH CONFORMING TO |
c13182ef | 92 | 4.3BSD, POSIX.1-2001. |
f42373f6 MK |
93 | POSIX.1-2001 marks |
94 | .BR ualarm () | |
95 | as obsolete. | |
0a2ab09e MK |
96 | POSIX.1-2008 removes the specification of |
97 | .BR ualarm (). | |
f42373f6 | 98 | 4.3BSD, SUSv2, and POSIX do not define any errors. |
fea681da MK |
99 | .SH NOTES |
100 | The type | |
f42373f6 | 101 | .I useconds_t |
fea681da MK |
102 | is an unsigned integer type capable of holding integers |
103 | in the range [0,1000000]. | |
f42373f6 | 104 | On the original BSD implementation, and in glibc before version 2.1, |
c13182ef | 105 | the arguments to |
f42373f6 MK |
106 | .BR ualarm () |
107 | were instead typed as | |
108 | .IR "unsigned int" . | |
c13182ef | 109 | Programs will be more portable if they never mention |
f42373f6 MK |
110 | .I useconds_t |
111 | explicitly. | |
fea681da MK |
112 | .LP |
113 | The interaction of this function with | |
114 | other timer functions such as | |
1272ab18 | 115 | .BR alarm (2), |
fb186734 MK |
116 | .BR sleep (3), |
117 | .BR nanosleep (2), | |
118 | .BR setitimer (2), | |
804f03e6 MK |
119 | .BR timer_create (2), |
120 | .BR timer_delete (2), | |
121 | .BR timer_getoverrun (2), | |
122 | .BR timer_gettime (2), | |
123 | .BR timer_settime (2), | |
fb186734 | 124 | .BR usleep (3) |
fea681da MK |
125 | is unspecified. |
126 | .LP | |
c13182ef MK |
127 | This function is obsolete. |
128 | Use | |
fea681da | 129 | .BR setitimer (2) |
f42373f6 | 130 | or POSIX interval timers |
804f03e6 | 131 | .RB ( timer_create (2), |
f42373f6 | 132 | etc.) |
fea681da | 133 | instead. |
47297adb | 134 | .SH SEE ALSO |
fea681da MK |
135 | .BR alarm (2), |
136 | .BR getitimer (2), | |
137 | .BR nanosleep (2), | |
138 | .BR select (2), | |
139 | .BR setitimer (2), | |
50e5322c | 140 | .BR usleep (3), |
60bb61aa | 141 | .BR time (7) |