[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1

gettimerid Subroutine

Purpose

Allocates a per-process interval timer.

Library

Standard C Library (libc.a)

Syntax


#include <sys/time.h>
#include <sys/events.h>

timer_t gettimerid( TimerType, NotifyType)
int TimerType;
int NotifyType;

Description

The gettimerid subroutine is used to allocate a per-process interval timer based on the timer with the given timer type. The unique ID is used to identify the interval timer in interval timer requests. (See getinterval subroutine). The particular timer type, the TimerType parameter, is defined in the sys/time.h file and can identify either a systemwide timer or a per-process timer. The mechanism by which the process is to be notified of the expiration of the timer event is the NotifyType parameter, which is defined in the sys/events.h file.

The TimerType parameter represents one of the following timer types:

TIMEOFDAY (POSIX system clock timer) This timer represents the time-of-day clock for the system. For this timer, the values returned by the gettimer subroutine and specified by the settimer subroutine represent the amount of time since 00:00:00 GMT, January 1, 1970, in nanoseconds.
TIMERID_ALRM (Alarm timer) This timer schedules the delivery of a SIGALRM signal at a timer specified in the call to the settimer subroutine.
TIMERID_REAL (Real-time timer) The real-time timer decrements in real time. A SIGALRM signal is delivered when this timer expires.
TIMERID_VIRTUAL (Virtual timer) The virtual timer decrements in process virtual time. it runs only when the process is executing in user mode. A SIGVTALRM signal is delivered when it expires.
TIMERID_PROF (Profiling timer) The profiling timer decrements both when running in user mode and when the system is running for the process. It is designed to be used by processes to profile their execution statistically. A SIGPROF signal is delivered when the profiling timer expires.

Interval timers with a notification value of DELIVERY_SIGNAL are inherited across an exec subroutine.

Parameters

NotifyType Notifies the process of the expiration of the timer event.
TimerType Identifies either a systemwide timer or a per-process timer.

Return Values

If the gettimerid subroutine succeeds, it returns a timer_t structure that can be passed to the per-process interval timer subroutines, such as the getinterval subroutine. If an error occurs, the value -1 is returned and errno is set.

Error Codes

If the gettimerid subroutine fails, the value -1 is returned and errno is set to one of the following error codes:

EAGAIN The calling process has already allocated all of the interval timers associated with the specified timer type for this implementation.
EINVAL The specified timer type is not defined.

Related Information

The exec (exec: execl, execle, execlp, execv, execve, execvp, or exect Subroutine) subroutine, fork (fork, f_fork, or vfork Subroutine) subroutine, getinterval, incinterval, absinterval, resinc, or resabs (getinterval, incinterval, absinterval, resinc, resabs, alarm, ualarm, getitimer or setitimer Subroutine) subroutine, gettimer, settimer, or restimer (gettimer, settimer, restimer, stime, or time Subroutine) subroutine, reltimerid subroutine.

List of Time Data Manipulation Services in AIX 5L Version 5.2 System Management Concepts: Operating System and Devices.

Subroutines Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]