blob: 4cfd6de5f059083041388ea3b19da72362f70fe3 [file] [log] [blame]
Dmitry V. Levin2307d5c2015-08-03 09:12:26 +00001#include "defs.h"
Dmitry V. Levin30ac0622015-08-03 09:47:25 +00002#include <fcntl.h>
3#ifdef HAVE_SYS_SIGNALFD_H
4# include <sys/signalfd.h>
5#endif
6
7#include "xlat/sfd_flags.h"
Dmitry V. Levin2307d5c2015-08-03 09:12:26 +00008
9static int
10do_signalfd(struct tcb *tcp, int flags_arg)
11{
12 /* NB: kernel requires arg[2] == NSIG / 8 */
13 printfd(tcp, tcp->u_arg[0]);
14 tprints(", ");
15 print_sigset_addr_len(tcp, tcp->u_arg[1], tcp->u_arg[2]);
16 tprintf(", %lu", tcp->u_arg[2]);
17 if (flags_arg >= 0) {
18 tprints(", ");
Dmitry V. Levin30ac0622015-08-03 09:47:25 +000019 printflags(sfd_flags, tcp->u_arg[flags_arg], "SFD_???");
Dmitry V. Levin2307d5c2015-08-03 09:12:26 +000020 }
21
Dmitry V. Levin9e8a84f2015-08-03 09:14:28 +000022 return RVAL_DECODED | RVAL_FD;
Dmitry V. Levin2307d5c2015-08-03 09:12:26 +000023}
24
25SYS_FUNC(signalfd)
26{
27 return do_signalfd(tcp, -1);
28}
29
30SYS_FUNC(signalfd4)
31{
32 return do_signalfd(tcp, 3);
33}