Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getitimer(2) — SunOS 0.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

signal(2)

getimeofday(2)

GETITIMER(2)  —  System Interface Manual — System Calls

NAME

getitimer, setitimer − get/set value of interval timer

SYNOPSIS

#include <time.h>

getitimer(which, value)
int which;
struct itimerval ∗value;

setitimer(which, value)
int which;
struct itimerval ∗value;

DESCRIPTION

The system provides each process with three interval timers, defined in <time.h> as:

#defineITIMER_REAL   0/∗ real time intervals ∗/
#defineITIMER_VIRTUAL1/∗ virtual time intervals ∗/
#defineITIMER_PROF   2/∗ user and system virtual time ∗/

The getitimer call returns the current value for the timer specified in which, while the setitimer call sets the value of a timer.  A timer may be disabled by setting it to a value of 0. 

A timer value is defined by the itimerval structure:

struct itimerval {
structtimeval itimer_interval;/∗ timer interval ∗/
structtimeval itimer_value;/∗ current value ∗/
};

The ITIMER_REAL timer decrements in real time.  A SIGALRM signal is delivered when this timer expires. 

The ITIMER_VIRTUAL timer decrements in process virtual time.  It runs only when the process is executing.  A SIGVTALRM signal is delivered when it expires. 

Thee ITIMER_PROF timer decrements both in process virtual time and when the system is running on behalf of the process.  It is designed to be used by interpreters to statistically profile their executions.  A SIGPROF signal is delivered when it expires.  Because this signal may interrupt some in-progress system calls, programs must be prepared to deal with this interruption to run with this timer enabled. 

RETURN VALUE

If the calls succeed, a value of 0 is returned.  If an error occurs, the value −1 is returned, and a more precise error code is placed in the global variable errno. 

ERRORS

The possible errors are:

[EFAULT] The value structure specified a bad address. 

SEE ALSO

signal(2), getimeofday(2)

Sun System Release 0.3  —  12 February 1983

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