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.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. # if SIZEOF_KERNEL_LONG_T > SIZEOF_LONG
  22. # define PRI_kl "ll"
  23. # else
  24. # define PRI_kl "l"
  25. # endif
  26. # define PRI_kld PRI_kl"d"
  27. # define PRI_klu PRI_kl"u"
  28. # define PRI_klx PRI_kl"x"
  29. /*
  30. * The kernel used to define 64-bit types on 64-bit systems on a per-arch
  31. * basis. Some architectures would use unsigned long and others would use
  32. * unsigned long long. These types were exported as part of the
  33. * kernel-userspace ABI and now must be maintained forever. This matches
  34. * what the kernel exports for each architecture so we don't need to cast
  35. * every printing of __u64 or __s64 to stdint types.
  36. * The exception is Android, where for MIPS64 unsigned long long is used.
  37. */
  38. # if SIZEOF_LONG == 4
  39. # define PRI__64 "ll"
  40. # elif defined ALPHA || defined IA64 || defined __powerpc64__ \
  41. || (defined MIPS && !defined __ANDROID__)
  42. # define PRI__64 "l"
  43. # else
  44. # define PRI__64 "ll"
  45. # endif
  46. # define PRI__d64 PRI__64"d"
  47. # define PRI__u64 PRI__64"u"
  48. # define PRI__x64 PRI__64"x"
  49. #endif /* !STRACE_KERNEL_TYPES_H */