Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ alarm(2) — HP-UX 5.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sleep(1)

pause(2)

getitimer(2)

signal(2)

sleep(3)

ALARM(2)

NAME

alarm − set a process’s alarm clock

SYNOPSIS

unsigned long alarm (sec)
unsigned long sec;

HP-UX COMPATIBILITY

Level: HP-UX/RUN ONLY

Origin: System V

DESCRIPTION

Alarm instructs the alarm clock of the calling process to send the signal SIGALRM to the calling process after the number of real time seconds specified by sec have elapsed; see signal(2). Sec must be less than 2^32.  Specific implementations may place further limitations on the maximum alarm time supported.  The constant MAX_ALARM defined in <sys/param.h> specifies the implementation-specific maximum.  Whenever sec is greater than this maximum but less than 2^32, it is silently rounded down to this maximum.  On all implementations, MAX_ALARM is guaranteed to be at least 31 days (in seconds). 

The alarm will be signaled within a 0.5 second tolerance.  For example, if you specify an alarm time of 1 second, the alarm  will be signaled between 0.5 seconds and 1.5 seconds later.  Due to variations in scheduling, the receipt of the signal may be delayed, particularly if the process is not running at the time the signal occurs. 

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

If sec is 0, any previously made alarm request is canceled. 

Alarms are not inherited by a child process across a fork, but are inherited across an exec.

On systems which support the getitimer(2) and setitimer(2), the timer mechanism used by alarm is the same as that used by ITIMER_REAL.  Thus successive calls to alarm, getitimer, and setitimer will set and return the state of a single timer. 

RETURN VALUE

Alarm returns the amount of time previously remaining in the alarm clock of the calling process. 

SEE ALSO

sleep(1), pause(2), getitimer(2), signal(2), sleep(3). 

Hewlett-Packard  —  last mod. May 11, 2021

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026