Get information about a timer
#include <sys/neutrino.h> int TimerInfo( pid_t pid, timer_t id, int flags, struct _timer_info* info ); int TimerInfo_r( pid_t pid, timer_t id, int flags, struct _timer_info* info );
- The process ID that you're requesting the timer information for.
- The ID of the timer, as returned by TimerCreate().
- Supported flags are:
- _NTO_TIMER_SEARCH — if this flag is specified and the timer ID doesn't exist, return information on the next timer ID. This provides a mechanism to discover all of the timers in the process.
- _NTO_RESET_OVERRUNS — reset the overrun count to zero in the _timer_info structure.
- _NTO_TI_REPORT_TOLERANCE — store the timer tolerance in the otime.interval_nsec member of the _timer_info structure.
- A pointer to a _timer_info structure where the function can store the information about the specified timer. For more details, see struct _timer_info, below.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
These kernel calls get information about a previously created timer specified by id, and store the information in the buffer pointed to by info.
The TimerInfo() and TimerInfo_r() functions are identical except in the way they indicate errors. See the Returns section for details.
The _timer_info structure pointed to by info contains at least these members:
- uint32_t flags
- One or more of these bit flags:
- The timer is active.
- The timer is waiting for an absolute time to occur; otherwise, the timer is relative.
- The timer has expired.
- The timer is precise, and is excluded from timer harmonization.
- int32_t tid
- The thread to which the timer is directed (0 if it's directed to the process).
- int32_t notify
- The notify type.
- clockid_t clockid
- The type of clock used.
- uint32_t overruns
- The number of overruns.
- struct sigevent event
- The event dispatched when the timer expires.
- struct itimerspec itime
- Time when the timer was started.
- struct itimerspec otime
- Time remaining before the timer expires. If you specified _NTO_TI_REPORT_TOLERANCE in the flags argument, otime.interval_nsec is set to the timer tolerance.
For more information, see the description of TimerCreate().
These calls don't block.
The only difference between these functions is the way they indicate errors:
- The ID of the timer that the information is for. If an error occurs, -1 is returned and errno is set.
- The ID of the timer that the information is for. This function does NOT set errno. If an error occurs, the negative of a value from the Errors section is returned.
- The timer specified by id doesn't exist.
- The calling process doesn't have the required permission; see procmgr_ability().
- The process specified by pid doesn't exist.