Mirror of strace – the linux syscall tracer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

signalfd.c 816B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2008-2015 Dmitry V. Levin <ldv@altlinux.org>
  3. * Copyright (c) 2015-2018 The strace developers.
  4. * All rights reserved.
  5. *
  6. * SPDX-License-Identifier: LGPL-2.1-or-later
  7. */
  8. #include "defs.h"
  9. #include <fcntl.h>
  10. #ifdef HAVE_SYS_SIGNALFD_H
  11. # include <sys/signalfd.h>
  12. #endif
  13. #include "xlat/sfd_flags.h"
  14. static int
  15. do_signalfd(struct tcb *tcp, int flags_arg)
  16. {
  17. /* NB: kernel requires arg[2] == NSIG_BYTES */
  18. printfd(tcp, tcp->u_arg[0]);
  19. tprints(", ");
  20. print_sigset_addr_len(tcp, tcp->u_arg[1], tcp->u_arg[2]);
  21. tprintf(", %" PRI_klu, tcp->u_arg[2]);
  22. if (flags_arg >= 0) {
  23. tprints(", ");
  24. printflags(sfd_flags, tcp->u_arg[flags_arg], "SFD_???");
  25. }
  26. return RVAL_DECODED | RVAL_FD;
  27. }
  28. SYS_FUNC(signalfd)
  29. {
  30. return do_signalfd(tcp, -1);
  31. }
  32. SYS_FUNC(signalfd4)
  33. {
  34. return do_signalfd(tcp, 3);
  35. }