]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/alarm.2
intro.1, _exit.2, access.2, alarm.2, alloc_hugepages.2, arch_prctl.2, bind.2, chdir...
[thirdparty/man-pages.git] / man2 / alarm.2
CommitLineData
fea681da
MK
1.\" This manpage is Copyright (C) 1992 Drew Eckhardt;
2.\" 1993 Michael Haardt, Ian Jackson.
3.\"
93015253 4.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
5.\" Permission is granted to make and distribute verbatim copies of this
6.\" manual provided the copyright notice and this permission notice are
7.\" preserved on all copies.
8.\"
9.\" Permission is granted to copy and distribute modified versions of this
10.\" manual under the conditions for verbatim copying, provided that the
11.\" entire resulting derived work is distributed under the terms of a
12.\" permission notice identical to this one.
c13182ef 13.\"
fea681da
MK
14.\" Since the Linux kernel and libraries are constantly changing, this
15.\" manual page may be incorrect or out-of-date. The author(s) assume no
16.\" responsibility for errors or omissions, or for damages resulting from
17.\" the use of the information contained herein. The author(s) may not
18.\" have taken the same level of care in the production of this manual,
19.\" which is licensed free of charge, as they might when working
20.\" professionally.
c13182ef 21.\"
fea681da
MK
22.\" Formatted or processed versions of this manual, if unaccompanied by
23.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 24.\" %%%LICENSE_END
fea681da
MK
25.\"
26.\" Modified Wed Jul 21 19:42:57 1993 by Rik Faith <faith@cs.unc.edu>
27.\" Modified Sun Jul 21 21:25:26 1996 by Andries Brouwer <aeb@cwi.nl>
28.\" Modified Wed Nov 6 03:46:05 1996 by Eric S. Raymond <esr@thyrsus.com>
29.\"
ffe84477 30.TH ALARM 2 2008-06-12 "Linux" "Linux Programmer's Manual"
fea681da
MK
31.SH NAME
32alarm \- set an alarm clock for delivery of a signal
33.SH SYNOPSIS
34.nf
35.B #include <unistd.h>
36.sp
37.BI "unsigned int alarm(unsigned int " seconds );
38.fi
39.SH DESCRIPTION
c13182ef
MK
40.BR alarm ()
41arranges for a
ae050d9a 42.B SIGALRM
ffe84477 43signal to be delivered to the calling process in
fea681da
MK
44.I seconds
45seconds.
46
47If
48.I seconds
49is zero, no new
e511ffb6 50.BR alarm ()
fea681da
MK
51is scheduled.
52
53In any event any previously set
e511ffb6 54.BR alarm ()
d9bfdb9c 55is canceled.
47297adb 56.SH RETURN VALUE
e511ffb6 57.BR alarm ()
fea681da
MK
58returns the number of seconds remaining until any previously scheduled
59alarm was due to be delivered, or zero if there was no previously
60scheduled alarm.
47297adb 61.SH CONFORMING TO
44a2c328 62SVr4, POSIX.1-2001, 4.3BSD.
fea681da 63.SH NOTES
ae050d9a 64.BR alarm ()
c13182ef 65and
0bfa087b 66.BR setitimer (2)
fea681da
MK
67share the same timer; calls to one will interfere with use of the
68other.
69.PP
0bfa087b 70.BR sleep (3)
fea681da
MK
71may be implemented using
72.BR SIGALRM ;
73mixing calls to
63aa9df0 74.BR alarm ()
fea681da 75and
0bfa087b 76.BR sleep (3)
fea681da
MK
77is a bad idea.
78
79Scheduling delays can, as ever, cause the execution of the process to
80be delayed by an arbitrary amount of time.
47297adb 81.SH SEE ALSO
fea681da
MK
82.BR gettimeofday (2),
83.BR pause (2),
84.BR select (2),
85.BR setitimer (2),
86.BR sigaction (2),
87.BR signal (2),
60bb61aa
MK
88.BR sleep (3),
89.BR time (7)