1SIGWAITINFO(2)             Linux Programmer's Manual            SIGWAITINFO(2)
2
3
4

NAME

6       sigwaitinfo, sigtimedwait - synchronously wait for queued signals
7

SYNOPSIS

9       #include <signal.h>
10
11       int sigwaitinfo(const sigset_t *set, siginfo_t *info);
12
13       int sigtimedwait(const sigset_t *set, siginfo_t *info,
14                        const struct timespec *timeout);
15

DESCRIPTION

17       sigwaitinfo()  suspends  execution  of the calling process until one of
18       the signals in set is delivered.  (If one of  the  signals  in  set  is
19       already  pending  for  the  calling  process, sigwaitinfo() will return
20       immediately with information about that signal.)
21
22       sigwaitinfo() removes the delivered signal from the  calling  process's
23       list  of  pending signals and returns the signal number as its function
24       result.  If the info argument is not NULL, then it returns a  structure
25       of  type  siginfo_t (see sigaction(2)) containing information about the
26       signal.
27
28       Signals returned via sigwaitinfo() are delivered in  the  usual  order;
29       see signal(7) for further details.
30
31       sigtimedwait() operates in exactly the same way as sigwaitinfo() except
32       that it has an additional argument, timeout,  which  enables  an  upper
33       bound  to  be  placed  on  the time for which the process is suspended.
34       This argument is of the following type:
35
36         struct timespec {
37             long    tv_sec;         /* seconds */
38             long    tv_nsec;        /* nanoseconds */
39         }
40
41       If both fields of this structure are specified as 0,  a  poll  is  per‐
42       formed:  sigtimedwait()  returns  immediately,  either with information
43       about a signal that was pending for the caller, or  with  an  error  if
44       none of the signals in set was pending.
45

RETURN VALUE

47       On  success, both sigwaitinfo() and sigtimedwait() return a signal num‐
48       ber (i.e., a value greater than zero).  On failure  both  calls  return
49       -1, with errno set to indicate the error.
50

ERRORS

52       EAGAIN No  signal in set was delivered within the timeout period speci‐
53              fied to sigtimedwait().
54
55       EINTR  The wait was interrupted by a signal handler.  (This handler was
56              for a signal other than one of those in set.)
57
58       EINVAL timeout was invalid.
59

NOTES

61       In  normal  usage,  the calling program blocks the signals in set via a
62       prior call to sigprocmask() (so that the default disposition for  these
63       signals  does  not occur if they are delivered between successive calls
64       to sigwaitinfo() or sigtimedwait()) and does not establish handlers for
65       these  signals.   In  a  multithreaded  program,  the  signal should be
66       blocked in all threads to prevent  the  signal  being  delivered  to  a
67       thread other than the one calling sigwaitinfo() or sigtimedwait()).
68
69       POSIX  leaves  the  meaning of a NULL value for the timeout argument of
70       sigtimedwait() unspecified, permitting the possibility  that  this  has
71       the same meaning as a call to sigwaitinfo(), and indeed this is what is
72       done on Linux.
73

CONFORMING TO

75       POSIX.1-2001
76

SEE ALSO

78       kill(2),  sigaction(2),   signal(2),   sigpending(2),   sigprocmask(2),
79       sigqueue(2), sigsetops(3), signal(7)
80
81
82
83Linux 2.4.18                      2002-06-07                    SIGWAITINFO(2)
Impressum