DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

alarm(S)


alarm -- set a process alarm clock

Syntax

cc . . . -lc

#include <unistd.h>

unsigned int alarm(unsigned int seconds);

Description

The alarm function causes the system to send the calling process a SIGALRM signal after the number of real time seconds has elapsed. If seconds is zero (0), a pending alarm request, if any, is cancelled. Processor scheduling delays may prevent the process from handling the signal as soon as it is generated.

Refer to signal(M) for more information on SIGALRM.

alarm requests are not stacked; successive calls reset the alarm clock of the calling process.

The fork(S) system call sets the alarm clock of a child process to 0. A process created by the exec(S) family of calls inherits the time left on the old process's alarm clock.

See also

exec(S), fork(S), getitimer(S), signal(M), sigaction(S)

Diagnostics

The alarm function is always successful and no return value is reserved to indicate an error. This function returns the amount of time, in seconds, remaining before the system is scheduled to generate the SIGALRM signal from the previous call to alarm, or zero if there was no previous alarm request.

Standards conformance

alarm is conformant with:

X/Open Portability Guide, Issue 3, 1989 ;
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1) ;
and NIST FIPS 151-1 .


© 2003 System Services (S)
SCO OpenServer Release 5.0.7 -- 11 February 2003