DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

alarm(S-osr5)


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-osr5) system call sets the alarm clock of a child process to 0. A process created by the exec(S-osr5) family of calls inherits the time left on the old process's alarm clock.

See also

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

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 .


© 2005 System Services (S-osr5)
SCO OpenServer Release 6.0.0 -- 02 June 2005