OSDN Git Service

LDP: Update original to LDP v3.68
[linuxjm/LDP_man-pages.git] / original / man2 / alarm.2
1 .\" This manpage is Copyright (C) 1992 Drew Eckhardt;
2 .\"             and Copyright (C) 1993 Michael Haardt, Ian Jackson.
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
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.
13 .\"
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.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
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 .\"
30 .TH ALARM 2 2014-02-23 "Linux" "Linux Programmer's Manual"
31 .SH NAME
32 alarm \- 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
40 .BR alarm ()
41 arranges for a
42 .B SIGALRM
43 signal to be delivered to the calling process in
44 .I seconds
45 seconds.
46
47 If
48 .I seconds
49 is zero, any pending alarm is canceled.
50
51 In any event any previously set
52 .BR alarm ()
53 is canceled.
54 .SH RETURN VALUE
55 .BR alarm ()
56 returns the number of seconds remaining until any previously scheduled
57 alarm was due to be delivered, or zero if there was no previously
58 scheduled alarm.
59 .SH CONFORMING TO
60 SVr4, POSIX.1-2001, 4.3BSD.
61 .SH NOTES
62 .BR alarm ()
63 and
64 .BR setitimer (2)
65 share the same timer; calls to one will interfere with use of the
66 other.
67
68 Alarms created by
69 .BR alarm()
70 are preserved across
71 .BR execve (2)
72 and are not inherited by children created via
73 .BR fork (2).
74 .PP
75 .BR sleep (3)
76 may be implemented using
77 .BR SIGALRM ;
78 mixing calls to
79 .BR alarm ()
80 and
81 .BR sleep (3)
82 is a bad idea.
83
84 Scheduling delays can, as ever, cause the execution of the process to
85 be delayed by an arbitrary amount of time.
86 .SH SEE ALSO
87 .BR gettimeofday (2),
88 .BR pause (2),
89 .BR select (2),
90 .BR setitimer (2),
91 .BR sigaction (2),
92 .BR signal (2),
93 .BR sleep (3),
94 .BR time (7)
95 .SH COLOPHON
96 This page is part of release 3.68 of the Linux
97 .I man-pages
98 project.
99 A description of the project,
100 information about reporting bugs,
101 and the latest version of this page,
102 can be found at
103 \%http://www.kernel.org/doc/man\-pages/.