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.

process_vm.c 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (c) 2012 Denys Vlasenko <vda.linux@googlemail.com>
  3. * Copyright (c) 2012-2015 Dmitry V. Levin <ldv@altlinux.org>
  4. * Copyright (c) 2014-2018 The strace developers.
  5. * All rights reserved.
  6. *
  7. * SPDX-License-Identifier: LGPL-2.1-or-later
  8. */
  9. #include "defs.h"
  10. SYS_FUNC(process_vm_readv)
  11. {
  12. if (entering(tcp)) {
  13. /* arg 1: pid */
  14. tprintf("%d, ", (int) tcp->u_arg[0]);
  15. } else {
  16. kernel_ulong_t local_iovcnt = tcp->u_arg[2];
  17. kernel_ulong_t remote_iovcnt = tcp->u_arg[4];
  18. kernel_ulong_t flags = tcp->u_arg[5];
  19. /* arg 2: local iov */
  20. tprint_iov_upto(tcp, local_iovcnt, tcp->u_arg[1],
  21. syserror(tcp) ? IOV_DECODE_ADDR : IOV_DECODE_STR,
  22. tcp->u_rval);
  23. /* arg 3: local iovcnt */
  24. tprintf(", %" PRI_klu ", ", local_iovcnt);
  25. /* arg 4: remote iov */
  26. tprint_iov(tcp, remote_iovcnt, tcp->u_arg[3],
  27. IOV_DECODE_ADDR);
  28. /* arg 5: remote iovcnt */
  29. /* arg 6: flags */
  30. tprintf(", %" PRI_klu ", %" PRI_klu, remote_iovcnt, flags);
  31. }
  32. return 0;
  33. }
  34. SYS_FUNC(process_vm_writev)
  35. {
  36. kernel_ulong_t local_iovcnt = tcp->u_arg[2];
  37. kernel_ulong_t remote_iovcnt = tcp->u_arg[4];
  38. kernel_ulong_t flags = tcp->u_arg[5];
  39. /* arg 1: pid */
  40. tprintf("%d, ", (int) tcp->u_arg[0]);
  41. /* arg 2: local iov */
  42. tprint_iov(tcp, local_iovcnt, tcp->u_arg[1], IOV_DECODE_STR);
  43. /* arg 3: local iovcnt */
  44. tprintf(", %" PRI_klu ", ", local_iovcnt);
  45. /* arg 4: remote iov */
  46. tprint_iov(tcp, remote_iovcnt, tcp->u_arg[3], IOV_DECODE_ADDR);
  47. /* arg 5: remote iovcnt */
  48. /* arg 6: flags */
  49. tprintf(", %" PRI_klu ", %" PRI_klu, remote_iovcnt, flags);
  50. return RVAL_DECODED;
  51. }