2004-11-03 13:51:07 +00:00
|
|
|
.\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
|
|
|
|
.\"
|
|
|
|
.\" This is free documentation; you can redistribute it and/or
|
|
|
|
.\" modify it under the terms of the GNU General Public License as
|
|
|
|
.\" published by the Free Software Foundation; either version 2 of
|
|
|
|
.\" the License, or (at your option) any later version.
|
|
|
|
.\"
|
|
|
|
.\" The GNU General Public License's references to "object code"
|
|
|
|
.\" and "executables" are to be interpreted as the output of any
|
|
|
|
.\" document formatting or typesetting system, including
|
|
|
|
.\" intermediate and printed output.
|
|
|
|
.\"
|
|
|
|
.\" This manual is distributed in the hope that it will be useful,
|
|
|
|
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
.\" GNU General Public License for more details.
|
|
|
|
.\"
|
|
|
|
.\" You should have received a copy of the GNU General Public
|
|
|
|
.\" License along with this manual; if not, write to the Free
|
|
|
|
.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
|
|
|
|
.\" USA.
|
|
|
|
.\"
|
2008-08-06 12:42:51 +00:00
|
|
|
.TH UALARM 3 2008-08-06 "" "Linux Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
|
|
|
ualarm \- schedule signal after given number of microseconds
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
.B "#include <unistd.h>"
|
|
|
|
.sp
|
|
|
|
.BI "useconds_t ualarm(useconds_t " usecs ", useconds_t " interval );
|
|
|
|
.fi
|
2007-07-08 12:11:40 +00:00
|
|
|
.sp
|
|
|
|
.in -4n
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
|
|
.BR feature_test_macros (7)):
|
|
|
|
.in
|
|
|
|
.sp
|
|
|
|
.BR ualarm ():
|
|
|
|
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH DESCRIPTION
|
2007-05-12 09:06:04 +00:00
|
|
|
The
|
|
|
|
.BR ualarm ()
|
2007-06-21 05:38:48 +00:00
|
|
|
function causes the signal
|
|
|
|
.B SIGALRM
|
|
|
|
to be sent to the invoking process after (not less than)
|
2004-11-03 13:51:07 +00:00
|
|
|
.I usecs
|
|
|
|
microseconds.
|
|
|
|
The delay may be lengthened slightly by any system activity
|
|
|
|
or by the time spent processing the call or by the
|
|
|
|
granularity of system timers.
|
|
|
|
.LP
|
2007-06-21 05:38:48 +00:00
|
|
|
Unless caught or ignored, the
|
|
|
|
.B SIGALRM
|
|
|
|
signal will terminate the process.
|
2004-11-03 13:51:07 +00:00
|
|
|
.LP
|
|
|
|
If the
|
|
|
|
.I interval
|
2008-03-19 13:16:39 +00:00
|
|
|
argument is non-zero, further
|
2007-06-21 05:38:48 +00:00
|
|
|
.B SIGALRM
|
|
|
|
signals will be sent every
|
2004-11-03 13:51:07 +00:00
|
|
|
.I interval
|
|
|
|
microseconds after the first.
|
|
|
|
.SH "RETURN VALUE"
|
2007-02-02 05:38:10 +00:00
|
|
|
This function returns the number of microseconds remaining for
|
|
|
|
any alarm that was previously set, or 0 if no alarm was pending.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH ERRORS
|
|
|
|
.TP
|
2007-12-14 05:32:30 +00:00
|
|
|
.B EINTR
|
2004-11-03 13:51:07 +00:00
|
|
|
Interrupted by a signal.
|
|
|
|
.TP
|
2007-12-14 05:32:30 +00:00
|
|
|
.B EINVAL
|
2004-11-03 13:51:07 +00:00
|
|
|
\fIusecs\fP or \fIinterval\fP is not smaller than 1000000.
|
|
|
|
(On systems where that is considered an error.)
|
|
|
|
.SH "CONFORMING TO"
|
2007-04-12 22:42:49 +00:00
|
|
|
4.3BSD, POSIX.1-2001.
|
2007-02-02 05:38:10 +00:00
|
|
|
POSIX.1-2001 marks
|
|
|
|
.BR ualarm ()
|
|
|
|
as obsolete.
|
2008-08-06 12:42:51 +00:00
|
|
|
POSIX.1-2008 removes the specification of
|
|
|
|
.BR ualarm ().
|
2007-02-02 05:38:10 +00:00
|
|
|
4.3BSD, SUSv2, and POSIX do not define any errors.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NOTES
|
|
|
|
The type
|
2007-02-02 05:38:10 +00:00
|
|
|
.I useconds_t
|
2004-11-03 13:51:07 +00:00
|
|
|
is an unsigned integer type capable of holding integers
|
|
|
|
in the range [0,1000000].
|
2007-02-02 05:38:10 +00:00
|
|
|
On the original BSD implementation, and in glibc before version 2.1,
|
2007-04-12 22:42:49 +00:00
|
|
|
the arguments to
|
2007-02-02 05:38:10 +00:00
|
|
|
.BR ualarm ()
|
|
|
|
were instead typed as
|
|
|
|
.IR "unsigned int" .
|
2007-04-12 22:42:49 +00:00
|
|
|
Programs will be more portable if they never mention
|
2007-02-02 05:38:10 +00:00
|
|
|
.I useconds_t
|
|
|
|
explicitly.
|
2004-11-03 13:51:07 +00:00
|
|
|
.LP
|
|
|
|
The interaction of this function with
|
|
|
|
other timer functions such as
|
2007-06-02 13:13:35 +00:00
|
|
|
.BR alarm (2),
|
2007-05-12 00:30:29 +00:00
|
|
|
.BR sleep (3),
|
|
|
|
.BR nanosleep (2),
|
|
|
|
.BR setitimer (2),
|
clock_nanosleep.2, execve.2, fork.2, nanosleep.2, sigaction.2, timerfd_create.2, pthread_getcpuclockid.3, ualarm.3, usleep.3, pthreads.7, time.7: Global fix: s/(3)/(2)/ in section number xrefs for timer_*() API
The POSIX timers API is implemented (mostly) within the kernel,
so thse interfaces are system calls. Although there are as yet
no man pages, when they are added they should be in Section 2,
not 3. Therefore fix those pages that currently refer to these
interfaces as being in Section 3.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2009-02-07 20:21:03 +00:00
|
|
|
.BR timer_create (2),
|
|
|
|
.BR timer_delete (2),
|
|
|
|
.BR timer_getoverrun (2),
|
|
|
|
.BR timer_gettime (2),
|
|
|
|
.BR timer_settime (2),
|
2007-05-12 00:30:29 +00:00
|
|
|
.BR usleep (3)
|
2004-11-03 13:51:07 +00:00
|
|
|
is unspecified.
|
|
|
|
.LP
|
2007-04-12 22:42:49 +00:00
|
|
|
This function is obsolete.
|
|
|
|
Use
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR setitimer (2)
|
2007-02-02 05:38:10 +00:00
|
|
|
or POSIX interval timers
|
clock_nanosleep.2, execve.2, fork.2, nanosleep.2, sigaction.2, timerfd_create.2, pthread_getcpuclockid.3, ualarm.3, usleep.3, pthreads.7, time.7: Global fix: s/(3)/(2)/ in section number xrefs for timer_*() API
The POSIX timers API is implemented (mostly) within the kernel,
so thse interfaces are system calls. Although there are as yet
no man pages, when they are added they should be in Section 2,
not 3. Therefore fix those pages that currently refer to these
interfaces as being in Section 3.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2009-02-07 20:21:03 +00:00
|
|
|
.RB ( timer_create (2),
|
2007-02-02 05:38:10 +00:00
|
|
|
etc.)
|
2004-11-03 13:51:07 +00:00
|
|
|
instead.
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR alarm (2),
|
|
|
|
.BR getitimer (2),
|
|
|
|
.BR nanosleep (2),
|
|
|
|
.BR select (2),
|
|
|
|
.BR setitimer (2),
|
2006-04-21 06:49:34 +00:00
|
|
|
.BR usleep (3),
|
2007-02-02 05:47:09 +00:00
|
|
|
.BR time (7)
|