]>
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 | .\" | |
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 | |
e2ba4f8e | 28 | .B "#define _XOPEN_SOURCE 500 /* Or: #define _BSD_SOURCE */" |
fea681da MK |
29 | .B "#include <unistd.h>" |
30 | .sp | |
31 | .BI "useconds_t ualarm(useconds_t " usecs ", useconds_t " interval ); | |
32 | .fi | |
33 | .SH DESCRIPTION | |
60a90ecd MK |
34 | The |
35 | .BR ualarm () | |
8bd58774 MK |
36 | function causes the signal |
37 | .B SIGALRM | |
38 | to be sent to the invoking process after (not less than) | |
fea681da MK |
39 | .I usecs |
40 | microseconds. | |
41 | The delay may be lengthened slightly by any system activity | |
42 | or by the time spent processing the call or by the | |
43 | granularity of system timers. | |
44 | .LP | |
8bd58774 MK |
45 | Unless caught or ignored, the |
46 | .B SIGALRM | |
47 | signal will terminate the process. | |
fea681da MK |
48 | .LP |
49 | If the | |
50 | .I interval | |
8bd58774 MK |
51 | argument is non-zero, further |
52 | .B SIGALRM | |
53 | signals will be sent every | |
fea681da MK |
54 | .I interval |
55 | microseconds after the first. | |
56 | .SH "RETURN VALUE" | |
f42373f6 MK |
57 | This function returns the number of microseconds remaining for |
58 | any alarm that was previously set, or 0 if no alarm was pending. | |
fea681da MK |
59 | .SH ERRORS |
60 | .TP | |
61 | EINTR | |
62 | Interrupted by a signal. | |
63 | .TP | |
64 | EINVAL | |
65 | \fIusecs\fP or \fIinterval\fP is not smaller than 1000000. | |
66 | (On systems where that is considered an error.) | |
67 | .SH "CONFORMING TO" | |
c13182ef | 68 | 4.3BSD, POSIX.1-2001. |
f42373f6 MK |
69 | POSIX.1-2001 marks |
70 | .BR ualarm () | |
71 | as obsolete. | |
72 | 4.3BSD, SUSv2, and POSIX do not define any errors. | |
fea681da MK |
73 | .SH NOTES |
74 | The type | |
f42373f6 | 75 | .I useconds_t |
fea681da MK |
76 | is an unsigned integer type capable of holding integers |
77 | in the range [0,1000000]. | |
f42373f6 | 78 | On the original BSD implementation, and in glibc before version 2.1, |
c13182ef | 79 | the arguments to |
f42373f6 MK |
80 | .BR ualarm () |
81 | were instead typed as | |
82 | .IR "unsigned int" . | |
c13182ef | 83 | Programs will be more portable if they never mention |
f42373f6 MK |
84 | .I useconds_t |
85 | explicitly. | |
fea681da MK |
86 | .LP |
87 | The interaction of this function with | |
88 | other timer functions such as | |
1272ab18 | 89 | .BR alarm (2), |
fb186734 MK |
90 | .BR sleep (3), |
91 | .BR nanosleep (2), | |
92 | .BR setitimer (2), | |
93 | .BR timer_create (3), | |
94 | .BR timer_delete (3), | |
95 | .BR timer_getoverrun (3), | |
96 | .BR timer_gettime (3), | |
97 | .BR timer_settime (3), | |
98 | .BR usleep (3) | |
fea681da MK |
99 | is unspecified. |
100 | .LP | |
c13182ef MK |
101 | This function is obsolete. |
102 | Use | |
fea681da | 103 | .BR setitimer (2) |
f42373f6 | 104 | or POSIX interval timers |
fb186734 | 105 | .RB ( timer_create (3), |
f42373f6 | 106 | etc.) |
fea681da MK |
107 | instead. |
108 | .SH "SEE ALSO" | |
109 | .BR alarm (2), | |
110 | .BR getitimer (2), | |
111 | .BR nanosleep (2), | |
112 | .BR select (2), | |
113 | .BR setitimer (2), | |
50e5322c | 114 | .BR usleep (3), |
60bb61aa MK |
115 | .BR feature_test_macros (7), |
116 | .BR time (7) |