strace/tests/signalfd.c
Dmitry V. Levin 30ac0627f2 signalfd4: fix flags decoding
* configure.ac (AC_CHECK_FUNCS): Add eventfd.
(AC_CHECK_HEADERS): Add sys/signalfd.h.
* signalfd.c: Include <fcntl.h>.
[HAVE_SYS_SIGNALFD_H] Include <sys/signalfd.h>.
Include "xlat/sfd_flags.h".
(do_signalfd): Use sfd_flags for flags decoding.
* xlat/sfd_flags.in: New file.
* tests/signalfd.c: Likewise.
* tests/signalfd.expected: Likewise.
* tests/signalfd.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add signalfd.
(TESTS): Add signalfd.test.
(EXTRA_DIST): Add signalfd.expected.
* tests/.gitignore: Add signalfd.
2015-08-03 09:57:14 +00:00

27 lines
459 B
C

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>
#ifdef HAVE_SYS_SIGNALFD_H
# include <sys/signalfd.h>
#endif
int
main(void)
{
#if defined HAVE_SYS_SIGNALFD_H && defined HAVE_SIGNALFD
sigset_t mask;
sigemptyset(&mask);
sigaddset(&mask, SIGUSR2);
sigaddset(&mask, SIGCHLD);
(void) close(0);
return signalfd(-1, &mask, O_CLOEXEC | O_NONBLOCK) == 0 ?
0 : 77;
#else
return 77;
#endif
}