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.
diff --git a/signalfd.c b/signalfd.c
index f574d1b..4cfd6de 100644
--- a/signalfd.c
+++ b/signalfd.c
@@ -1,4 +1,10 @@
 #include "defs.h"
+#include <fcntl.h>
+#ifdef HAVE_SYS_SIGNALFD_H
+# include <sys/signalfd.h>
+#endif
+
+#include "xlat/sfd_flags.h"
 
 static int
 do_signalfd(struct tcb *tcp, int flags_arg)
@@ -10,7 +16,7 @@
 	tprintf(", %lu", tcp->u_arg[2]);
 	if (flags_arg >= 0) {
 		tprints(", ");
-		printflags(open_mode_flags, tcp->u_arg[flags_arg], "O_???");
+		printflags(sfd_flags, tcp->u_arg[flags_arg], "SFD_???");
 	}
 
 	return RVAL_DECODED | RVAL_FD;