]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/ualarm.3
getent.1, intro.1, time.1, _exit.2, _syscall.2, accept.2, access.2, acct.2, adjtimex...
[thirdparty/man-pages.git] / man3 / ualarm.3
CommitLineData
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
25ualarm \- 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
34Feature 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
43Since 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
51Before 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
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
fea681da
MK
86Interrupted 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 924.3BSD, POSIX.1-2001.
f42373f6
MK
93POSIX.1-2001 marks
94.BR ualarm ()
95as obsolete.
0a2ab09e
MK
96POSIX.1-2008 removes the specification of
97.BR ualarm ().
f42373f6 984.3BSD, SUSv2, and POSIX do not define any errors.
fea681da
MK
99.SH NOTES
100The type
f42373f6 101.I useconds_t
fea681da
MK
102is an unsigned integer type capable of holding integers
103in the range [0,1000000].
f42373f6 104On the original BSD implementation, and in glibc before version 2.1,
c13182ef 105the arguments to
f42373f6
MK
106.BR ualarm ()
107were instead typed as
108.IR "unsigned int" .
c13182ef 109Programs will be more portable if they never mention
f42373f6
MK
110.I useconds_t
111explicitly.
fea681da
MK
112.LP
113The interaction of this function with
114other 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
125is unspecified.
126.LP
c13182ef
MK
127This function is obsolete.
128Use
fea681da 129.BR setitimer (2)
f42373f6 130or POSIX interval timers
804f03e6 131.RB ( timer_create (2),
f42373f6 132etc.)
fea681da 133instead.
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)