timer_create(2) SDK R4.11 timer_create(2)
NAME
timer_create - create a per-process timer
SYNOPSIS
#include <signal.h>
#include <time.h>
int timercreate (clockid, *expirationsignal, *timerid)
clockt clockid;
struct sigevent*expirationsignal;
timert *timerid;
DESCRIPTION
Use timercreate(2) to create a process timer:
clockid is CLOCK_REALTIME.
expirationsignal
is a pointer to a structure containing the signal number
to be sent to the calling process on expiration. If
expirationsignal is NULL, signal SIGALRM is sent to the
calling process upon the timer's expiration.
timerid If successful, timercreate returns a timer ID in this
location. The timer ID is unique within the calling
process, until the timer is deleted. This timer ID is
used to identify the timer in other timer requests.
At present, the only capability provided by sigevent supported by
DG/UX is to define the signal number to be sent to the calling
process on expiration. The sigevnotify member of sigevent must be
set to SIGEV_SIGNAL. The sigevsigno member of sigevent is the
signal number to send. All other fields of sigevent are ignored.
Sending application-supplied data to a signal handler depends on the
POSIX realtime signal extensions, which DG/UX does not currently
support. To compensate for this lack, DG/UX defines four user-defined
signals that you can specify in sigevsigno and easily check for in a
signal handler: SIGDGTIMER1, SIGDGTIMER2, SIGDGTIMER3, SIGDGTIMER4.
Child processes of the caller created with fork(2) do not inherit the
timer. An exec(2) call disables and deletes the timer.
The maximum number of per-process timers is stored in the system
variable _POSIX_TIMER_MAX. You can obtain this value by calling
sysconf(2) with parameter _SC_TIMER_MAX. The current maximum for
DG/UX is 32.
Note
* This routine is based on POSIX realtime extension document P1003.4
draft 14. It is therefore subject to change.
* Compilation of a source file using this routine requires that
feature macro _POSIX4_DRAFT_SOURCE be defined. This feature macro
is not enabled by any other feature macro, nor does it enable any
other feature macro.
* The compiled routine must be linked to library librte.a.
RETURN VALUE
If successful, timercreate returns a zero, and updates the location
referenced by timerid to a timert which can be passed to the other
timer calls. If unsuccessful, the routine returns -1 and sets ERRNO
to one of the following:
EAGAIN The system lacks the resources to honor the request.
EAGAIN The calling process already has the maximum number of timers
open.
EFAULT The address of expirationsignal is bad.
EINVAL The value of clockid is not CLOCK_REALTIME.
EINVAL The signal pointed to by expirationsignal is not valid.
EINVAL The notification pointed to by expirationsignal is not
SIGEV_SIGNAL.
SEE ALSO
clockgetres(2), sysconf(2), timerdelete(2), timersettime(2),
timergettime(2), timergetoverrun(2).
Licensed material--property of copyright holder(s)