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.

sigaltstack.c 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
  3. * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
  4. * Copyright (c) 1993-1996 Rick Sladkey <jrs@world.std.com>
  5. * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
  6. * Copyright (c) 2005-2015 Dmitry V. Levin <ldv@altlinux.org>
  7. * Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com>
  8. * Copyright (c) 2015-2018 The strace developers.
  9. * All rights reserved.
  10. *
  11. * SPDX-License-Identifier: LGPL-2.1-or-later
  12. */
  13. #include "defs.h"
  14. #include DEF_MPERS_TYPE(stack_t)
  15. #include <signal.h>
  16. #include MPERS_DEFS
  17. #include "xlat/sigaltstack_flags.h"
  18. static void
  19. print_stack_t(struct tcb *const tcp, const kernel_ulong_t addr)
  20. {
  21. stack_t ss;
  22. if (umove_or_printaddr(tcp, addr, &ss))
  23. return;
  24. tprints("{ss_sp=");
  25. printaddr(ptr_to_kulong(ss.ss_sp));
  26. tprints(", ss_flags=");
  27. printflags(sigaltstack_flags, ss.ss_flags, "SS_???");
  28. tprintf(", ss_size=%" PRI_klu "}", (kernel_ulong_t) ss.ss_size);
  29. }
  30. SYS_FUNC(sigaltstack)
  31. {
  32. if (entering(tcp)) {
  33. print_stack_t(tcp, tcp->u_arg[0]);
  34. tprints(", ");
  35. } else {
  36. print_stack_t(tcp, tcp->u_arg[1]);
  37. }
  38. return 0;
  39. }