Dmitry V. Levin | 30ac062 | 2015-08-03 09:47:25 +0000 | [diff] [blame] | 1 | #ifdef HAVE_CONFIG_H |
| 2 | # include "config.h" |
| 3 | #endif |
| 4 | |
| 5 | #include <fcntl.h> |
| 6 | #include <signal.h> |
| 7 | #include <unistd.h> |
| 8 | #ifdef HAVE_SYS_SIGNALFD_H |
| 9 | # include <sys/signalfd.h> |
| 10 | #endif |
| 11 | |
| 12 | int |
| 13 | main(void) |
| 14 | { |
Dmitry V. Levin | 857adac | 2015-08-26 21:02:04 +0000 | [diff] [blame] | 15 | #if defined HAVE_SYS_SIGNALFD_H && defined HAVE_SIGNALFD && defined O_CLOEXEC |
Dmitry V. Levin | 30ac062 | 2015-08-03 09:47:25 +0000 | [diff] [blame] | 16 | sigset_t mask; |
| 17 | sigemptyset(&mask); |
| 18 | sigaddset(&mask, SIGUSR2); |
| 19 | sigaddset(&mask, SIGCHLD); |
| 20 | (void) close(0); |
| 21 | return signalfd(-1, &mask, O_CLOEXEC | O_NONBLOCK) == 0 ? |
| 22 | 0 : 77; |
| 23 | #else |
| 24 | return 77; |
| 25 | #endif |
| 26 | } |