[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    sigwaitinfo(3R) manual page Table of Contents

Name

sigwaitinfo, sigtimedwait - wait for queued signals

Synopsis

cc [ flag ... ] file ... -lposix4 [ library ... ]

#include <signal.h>

int sigwaitinfo(const sigset_t *set, siginfo_t *info);

int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout);

typedef struct siginfo {
int    si_signo;    /* signal from signal.h */

int    si_code;    /* code from above */

...

int    si_value;

...

} siginfo_t;

struct timespec {
time_t    tv_sec;    /* seconds */

long    tv_nsec;    /* and nanoseconds */

};

MT-Level

Async-Safe

Description

sigwaitinfo() and sigtimedwait() select the pending signal from the set specified by set. When multiple signals are pending, the lowest numbered one will be selected. The selection order between realtime and non-realtime signals, or between multiple pending non-realtime signals, is unspecified.

If no signal in set is pending at the time of the call, sigwaitinfo() suspends the calling process until one or more signals in set become pending or until it is interrupted by an unblocked, caught signal. sigtimedwait(), on the other hand, suspends itself for the time interval specified in the timespec structure referenced by timeout. If the timespec structure pointed to by timeout is zero-valued, and if none of the signals specified by set are pending, then sigtimedwait() returns immediately with the error EAGAIN.

If, while sigwaitinfo() or sigtimedwait() is waiting, a signal occurs which is eligible for delivery (i.e., not blocked by the process signal mask), that signal is handled asynchronously and the wait is interrupted.

If info is non-NULL , the selected signal number is stored in si_signo, and the cause of the signal is stored in the si_code. If any value is queued to the selected signal, the first such queued value is dequeued and, if info is non-NULL , the value is stored in the si_value member of info. The system resource used to queue the signal is released and made available to queue other signals.

If the value of the si_code member is SI_NOINFO, only the si_signo member of siginfo_t is meaningful, and the value of all other members is unspecified.

If no further signals are queued for the selected signal, the pending indication for that signal is reset.

Return Values

If one of the signals specified by set is either pending or generated, sigwaitinfo() or sigtimedwait() returns the selected signal number. Otherwise, the function returns -1 and sets errno to indicate the error condition.

Errors

EINTR
The wait was interrupted by an unblocked, caught signal.
ENOSYS
sigwaitinfo() or sigtimedwait() is not supported by this implementation.

The following errors relate to only sigtimedwait():

EAGAIN
No signal specified by set was delivered within the specified timeout period.
EINVAL
timeout specified a tv_nsec value less than 0 or greater than 1,000,000,000.

See Also

time(2) , sigqueue(3R) , siginfo(5) , signal(5)


Table of Contents