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.

kernel_types.h 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (c) 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. #ifndef STRACE_KERNEL_TYPES_H
  9. # define STRACE_KERNEL_TYPES_H
  10. # if defined HAVE___KERNEL_LONG_T && defined HAVE___KERNEL_ULONG_T
  11. # include <asm/posix_types.h>
  12. typedef __kernel_long_t kernel_long_t;
  13. typedef __kernel_ulong_t kernel_ulong_t;
  14. # elif (defined __x86_64__ && defined __ILP32__) || defined LINUX_MIPSN32
  15. typedef long long kernel_long_t;
  16. typedef unsigned long long kernel_ulong_t;
  17. # else
  18. typedef long kernel_long_t;
  19. typedef unsigned long kernel_ulong_t;
  20. # endif
  21. typedef struct {
  22. kernel_ulong_t d_ino;
  23. kernel_ulong_t d_off;
  24. unsigned short d_reclen;
  25. char d_name[1];
  26. } kernel_dirent;
  27. # if SIZEOF_KERNEL_LONG_T > SIZEOF_LONG
  28. # define PRI_kl "ll"
  29. # else
  30. # define PRI_kl "l"
  31. # endif
  32. # define PRI_kld PRI_kl"d"
  33. # define PRI_klu PRI_kl"u"
  34. # define PRI_klx PRI_kl"x"
  35. /*
  36. * The kernel used to define 64-bit types on 64-bit systems on a per-arch
  37. * basis. Some architectures would use unsigned long and others would use
  38. * unsigned long long. These types were exported as part of the
  39. * kernel-userspace ABI and now must be maintained forever. This matches
  40. * what the kernel exports for each architecture so we don't need to cast
  41. * every printing of __u64 or __s64 to stdint types.
  42. * The exception is Android, where for MIPS64 unsigned long long is used.
  43. */
  44. # if SIZEOF_LONG == 4
  45. # define PRI__64 "ll"
  46. # elif defined ALPHA || defined IA64 || defined __powerpc64__ \
  47. || (defined MIPS && !defined __ANDROID__)
  48. # define PRI__64 "l"
  49. # else
  50. # define PRI__64 "ll"
  51. # endif
  52. # define PRI__d64 PRI__64"d"
  53. # define PRI__u64 PRI__64"u"
  54. # define PRI__x64 PRI__64"x"
  55. #endif /* !STRACE_KERNEL_TYPES_H */