Blame man2/alarm.2

Packit 7cfc04
.\" This manpage is Copyright (C) 1992 Drew Eckhardt;
Packit 7cfc04
.\"             and Copyright (C) 1993 Michael Haardt, Ian Jackson.
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(VERBATIM)
Packit 7cfc04
.\" Permission is granted to make and distribute verbatim copies of this
Packit 7cfc04
.\" manual provided the copyright notice and this permission notice are
Packit 7cfc04
.\" preserved on all copies.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Permission is granted to copy and distribute modified versions of this
Packit 7cfc04
.\" manual under the conditions for verbatim copying, provided that the
Packit 7cfc04
.\" entire resulting derived work is distributed under the terms of a
Packit 7cfc04
.\" permission notice identical to this one.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Since the Linux kernel and libraries are constantly changing, this
Packit 7cfc04
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
Packit 7cfc04
.\" responsibility for errors or omissions, or for damages resulting from
Packit 7cfc04
.\" the use of the information contained herein.  The author(s) may not
Packit 7cfc04
.\" have taken the same level of care in the production of this manual,
Packit 7cfc04
.\" which is licensed free of charge, as they might when working
Packit 7cfc04
.\" professionally.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Formatted or processed versions of this manual, if unaccompanied by
Packit 7cfc04
.\" the source, must acknowledge the copyright and authors of this work.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.\" Modified Wed Jul 21 19:42:57 1993 by Rik Faith <faith@cs.unc.edu>
Packit 7cfc04
.\" Modified Sun Jul 21 21:25:26 1996 by Andries Brouwer <aeb@cwi.nl>
Packit 7cfc04
.\" Modified Wed Nov  6 03:46:05 1996 by Eric S. Raymond <esr@thyrsus.com>
Packit 7cfc04
.\"
Packit 7cfc04
.TH ALARM 2 2017-05-03 "Linux" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
alarm \- set an alarm clock for delivery of a signal
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.nf
Packit 7cfc04
.B #include <unistd.h>
Packit 7cfc04
.PP
Packit 7cfc04
.BI "unsigned int alarm(unsigned int " seconds );
Packit 7cfc04
.fi
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
.BR alarm ()
Packit 7cfc04
arranges for a
Packit 7cfc04
.B SIGALRM
Packit 7cfc04
signal to be delivered to the calling process in
Packit 7cfc04
.I seconds
Packit 7cfc04
seconds.
Packit 7cfc04
.PP
Packit 7cfc04
If
Packit 7cfc04
.I seconds
Packit 7cfc04
is zero, any pending alarm is canceled.
Packit 7cfc04
.PP
Packit 7cfc04
In any event any previously set
Packit 7cfc04
.BR alarm ()
Packit 7cfc04
is canceled.
Packit 7cfc04
.SH RETURN VALUE
Packit 7cfc04
.BR alarm ()
Packit 7cfc04
returns the number of seconds remaining until any previously scheduled
Packit 7cfc04
alarm was due to be delivered, or zero if there was no previously
Packit 7cfc04
scheduled alarm.
Packit 7cfc04
.SH CONFORMING TO
Packit 7cfc04
POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
Packit 7cfc04
.SH NOTES
Packit 7cfc04
.BR alarm ()
Packit 7cfc04
and
Packit 7cfc04
.BR setitimer (2)
Packit 7cfc04
share the same timer; calls to one will interfere with use of the
Packit 7cfc04
other.
Packit 7cfc04
.PP
Packit 7cfc04
Alarms created by
Packit 7cfc04
.BR alarm ()
Packit 7cfc04
are preserved across
Packit 7cfc04
.BR execve (2)
Packit 7cfc04
and are not inherited by children created via
Packit 7cfc04
.BR fork (2).
Packit 7cfc04
.PP
Packit 7cfc04
.BR sleep (3)
Packit 7cfc04
may be implemented using
Packit 7cfc04
.BR SIGALRM ;
Packit 7cfc04
mixing calls to
Packit 7cfc04
.BR alarm ()
Packit 7cfc04
and
Packit 7cfc04
.BR sleep (3)
Packit 7cfc04
is a bad idea.
Packit 7cfc04
.PP
Packit 7cfc04
Scheduling delays can, as ever, cause the execution of the process to
Packit 7cfc04
be delayed by an arbitrary amount of time.
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR gettimeofday (2),
Packit 7cfc04
.BR pause (2),
Packit 7cfc04
.BR select (2),
Packit 7cfc04
.BR setitimer (2),
Packit 7cfc04
.BR sigaction (2),
Packit 7cfc04
.BR signal (2),
Packit 7cfc04
.BR timer_create (2),
Packit 7cfc04
.BR timerfd_create (2),
Packit 7cfc04
.BR sleep (3),
Packit 7cfc04
.BR time (7)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.