timer_create(2) DG/UX 5.4 Rel. 2.01 timer_create(2)
NAME
timer_create - create a per-process timer
SYNOPSIS
#include <signal.h>
#include <time.h>
timert timercreate (clockid, *expirationsignal)
clockt clockid;
struct sigevent*expirationsignal;
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.
The POSIX-designated structure pointed to by expirationsignal and an
associated union are shown below:
struct sigevent
{
int sigevsigno;
union sigval sigevvalue;
};
union sigval
{
int sivalint;
void *sivalptr;
};
At present, DG/UX ignores the sigevvalue member of sigevent.
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. Note that the current
maximum for DG/UX is 4, and that full POSIX conformance requires at
least 32.
Note
* This routine is based on POSIX realtime extension document P1003.4
Licensed material--property of copyright holder(s) 1
timer_create(2) DG/UX 5.4 Rel. 2.01 timer_create(2)
draft 12. 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 timer ID, unique while the
timer exists, of type timert. 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.
SEE ALSO
clockgetres(2), sysconf(2), timerdelete(2), timersettime(2),
timergettime(2), timergetoverrun(2).
Licensed material--property of copyright holder(s) 2