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.

print_timespec.c 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
  3. * Copyright (c) 2016-2019 The strace developers.
  4. * All rights reserved.
  5. *
  6. * SPDX-License-Identifier: LGPL-2.1-or-later
  7. */
  8. #include "defs.h"
  9. #include DEF_MPERS_TYPE(timespec_t)
  10. #include "kernel_timespec.h"
  11. #if defined MPERS_IS_mx32
  12. # define TIMESPEC_IS_32BIT 0
  13. #elif defined MPERS_IS_m32
  14. # define TIMESPEC_IS_32BIT 1
  15. #elif ARCH_TIMESIZE == 4
  16. # define TIMESPEC_IS_32BIT 1
  17. #else
  18. # define TIMESPEC_IS_32BIT 0
  19. #endif
  20. #if TIMESPEC_IS_32BIT
  21. typedef kernel_timespec32_t timespec_t;
  22. # define PRINT_TIMESPEC_DATA_SIZE print_timespec32_data_size
  23. # define PRINT_TIMESPEC_ARRAY_DATA_SIZE print_timespec32_array_data_size
  24. #else
  25. typedef kernel_timespec64_t timespec_t;
  26. # define PRINT_TIMESPEC_DATA_SIZE print_timespec64_data_size
  27. # define PRINT_TIMESPEC_ARRAY_DATA_SIZE print_timespec64_array_data_size
  28. #endif
  29. #include MPERS_DEFS
  30. MPERS_PRINTER_DECL(bool, print_struct_timespec_data_size,
  31. const void *arg, const size_t size)
  32. {
  33. return PRINT_TIMESPEC_DATA_SIZE(arg, size);
  34. }
  35. MPERS_PRINTER_DECL(bool, print_struct_timespec_array_data_size,
  36. const void *arg, const unsigned int nmemb,
  37. const size_t size)
  38. {
  39. return PRINT_TIMESPEC_ARRAY_DATA_SIZE(arg, nmemb, size);
  40. }