1sigwaitinfo(3C) Standard C Library Functions sigwaitinfo(3C)
2
3
4
6 sigwaitinfo, sigtimedwait - wait for queued signals
7
9 #include <signal.h>
10
11 int sigwaitinfo(const sigset_t *restrict set,
12 siginfo_t *restrict info);
13
14
15 int sigtimedwait(const sigset_t *restrict set,
16 siginfo_t *restrict info,
17 const struct timespec *restrict timeout);
18
19
21 The sigwaitinfo() function selects the pending signal from the set
22 specified by set. Should any of multiple pending signals in the range
23 SIGRTMIN to SIGRTMAX be selected, it will be the lowest numbered one.
24 The selection order between realtime and non-realtime signals, or
25 between multiple pending non-realtime signals, is unspecified. If no
26 signal in set is pending at the time of the call, the calling thread is
27 suspended until one or more signals in set become pending or until it
28 is interrupted by an unblocked, caught signal.
29
30
31 The sigwaitinfo() function behaves the same as the sigwait(2) function
32 if the info argument is NULL. If the info argument is non-NULL, the
33 sigwaitinfo() function behaves the same as sigwait(2), except that the
34 selected signal number is stored in the si_signo member, and the cause
35 of the signal is stored in the si_code member. If any value is queued
36 to the selected signal, the first such queued value is dequeued and, if
37 the info argument is non-NULL, the value is stored in the si_value mem‐
38 ber of info. The system resource used to queue the signal will be
39 released and made available to queue other signals. If no value is
40 queued, the content of the si_value member is undefined. If no further
41 signals are queued for the selected signal, the pending indication for
42 that signal will be reset. If the value of the si_code member is
43 SI_NOINFO, only the si_signo member of siginfo_t is meaningful, and the
44 value of all other members is unspecified.
45
46
47 The sigtimedwait() function behaves the same as sigwaitinfo() except
48 that if none of the signals specified by set are pending, sigtimed‐
49 wait() waits for the time interval specified in the timespec structure
50 referenced by timeout. If the timespec structure pointed to by timeout
51 is zero-valued and if none of the signals specified by set are pending,
52 then sigtimedwait() returns immediately with an error. If timeout is
53 the NULL pointer, the behavior is unspecified.
54
55
56 If, while sigwaitinfo() or sigtimedwait() is waiting, a signal occurs
57 which is eligible for delivery (that is, not blocked by the process
58 signal mask), that signal is handled asynchronously and the wait is
59 interrupted.
60
62 Upon successful completion (that is, one of the signals specified by
63 set is pending or is generated) sigwaitinfo() and sigtimedwait() will
64 return the selected signal number. Otherwise, the function returns −1
65 and sets errno to indicate the error.
66
68 The sigwaitinfo() and sigtimedwait() functions will fail if:
69
70 EINTR The wait was interrupted by an unblocked, caught signal.
71
72
73 ENOSYS The sigwaitinfo() and sigtimedwait() functions are not sup‐
74 ported.
75
76
77
78 The sigtimedwait() function will fail if:
79
80 EAGAIN No signal specified by set was generated within the specified
81 timeout period.
82
83
84
85 The sigwaitinfo() and sigtimedwait() functions may fail if:
86
87 EFAULT The set, info, or timeout argument points to an invalid
88 address.
89
90
91
92 The sigtimedwait() function may fail if:
93
94 EINVAL The timeout argument specified a tv_nsec value less than zero
95 or greater than or equal to 1000 million. The system only
96 checks for this error if no signal is pending in set and it
97 is necessary to wait.
98
99
101 See attributes(5) for descriptions of the following attributes:
102
103
104
105
106 ┌─────────────────────────────┬─────────────────────────────┐
107 │ATTRIBUTE TYPE │ATTRIBUTE VALUE │
108 ├─────────────────────────────┼─────────────────────────────┤
109 │Interface Stability │Committed │
110 ├─────────────────────────────┼─────────────────────────────┤
111 │MT-Level │Async-Safe │
112 ├─────────────────────────────┼─────────────────────────────┤
113 │Standard │See standards(5). │
114 └─────────────────────────────┴─────────────────────────────┘
115
117 time(2), sigqueue(3C), siginfo.h(3HEAD), signal.h(3HEAD),
118 time.h(3HEAD), attributes(5), standards(5)
119
120
121
122SunOS 5.11 5 Feb 2008 sigwaitinfo(3C)