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.

ustat.c 805B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com>
  3. * Copyright (c) 2017-2018 The strace developers.
  4. * All rights reserved.
  5. *
  6. * SPDX-License-Identifier: LGPL-2.1-or-later
  7. */
  8. #include "defs.h"
  9. #ifdef HAVE_USTAT_H
  10. # include DEF_MPERS_TYPE(struct_ustat)
  11. # include <ustat.h>
  12. typedef struct ustat struct_ustat;
  13. #endif /* HAVE_USTAT_H */
  14. #include MPERS_DEFS
  15. SYS_FUNC(ustat)
  16. {
  17. if (entering(tcp))
  18. print_dev_t((unsigned int) tcp->u_arg[0]);
  19. else {
  20. tprints(", ");
  21. #ifdef HAVE_USTAT_H
  22. struct_ustat ust;
  23. if (!umove_or_printaddr(tcp, tcp->u_arg[1], &ust))
  24. tprintf("{f_tfree=%llu, f_tinode=%llu}",
  25. zero_extend_signed_to_ull(ust.f_tfree),
  26. zero_extend_signed_to_ull(ust.f_tinode));
  27. #else /* !HAVE_USTAT_H */
  28. printaddr(tcp->u_arg[1]);
  29. #endif /* HAVE_USTAT_H */
  30. }
  31. return 0;
  32. }