212-tools_portability.patch 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. From 48232d3d931c95953ce2ddfe7da7bb164aef6a73 Mon Sep 17 00:00:00 2001
  2. From: Felix Fietkau <[email protected]>
  3. Date: Fri, 7 Jul 2017 17:03:16 +0200
  4. Subject: fix portability of some includes files in tools/ used on the host
  5. Signed-off-by: Felix Fietkau <[email protected]>
  6. ---
  7. tools/include/tools/be_byteshift.h | 4 ++++
  8. tools/include/tools/le_byteshift.h | 4 ++++
  9. tools/include/tools/linux_types.h | 22 ++++++++++++++++++++++
  10. 3 files changed, 30 insertions(+)
  11. create mode 100644 tools/include/tools/linux_types.h
  12. --- a/tools/include/tools/be_byteshift.h
  13. +++ b/tools/include/tools/be_byteshift.h
  14. @@ -2,6 +2,10 @@
  15. #ifndef _TOOLS_BE_BYTESHIFT_H
  16. #define _TOOLS_BE_BYTESHIFT_H
  17. +#ifndef __linux__
  18. +#include "linux_types.h"
  19. +#endif
  20. +
  21. #include <stdint.h>
  22. static inline uint16_t __get_unaligned_be16(const uint8_t *p)
  23. --- a/tools/include/tools/le_byteshift.h
  24. +++ b/tools/include/tools/le_byteshift.h
  25. @@ -2,6 +2,10 @@
  26. #ifndef _TOOLS_LE_BYTESHIFT_H
  27. #define _TOOLS_LE_BYTESHIFT_H
  28. +#ifndef __linux__
  29. +#include "linux_types.h"
  30. +#endif
  31. +
  32. #include <stdint.h>
  33. static inline uint16_t __get_unaligned_le16(const uint8_t *p)
  34. --- /dev/null
  35. +++ b/tools/include/tools/linux_types.h
  36. @@ -0,0 +1,26 @@
  37. +#ifndef __LINUX_TYPES_H
  38. +#define __LINUX_TYPES_H
  39. +
  40. +#include <stdint.h>
  41. +
  42. +typedef int8_t __s8;
  43. +typedef uint8_t __u8;
  44. +typedef uint8_t __be8;
  45. +typedef uint8_t __le8;
  46. +
  47. +typedef int16_t __s16;
  48. +typedef uint16_t __u16;
  49. +typedef uint16_t __be16;
  50. +typedef uint16_t __le16;
  51. +
  52. +typedef int32_t __s32;
  53. +typedef uint32_t __u32;
  54. +typedef uint32_t __be32;
  55. +typedef uint32_t __le32;
  56. +
  57. +typedef int64_t __s64;
  58. +typedef uint64_t __u64;
  59. +typedef uint64_t __be64;
  60. +typedef uint64_t __le64;
  61. +
  62. +#endif
  63. --- a/tools/include/linux/types.h
  64. +++ b/tools/include/linux/types.h
  65. @@ -10,8 +10,12 @@
  66. #define __SANE_USERSPACE_TYPES__ /* For PPC64, to get LL64 types */
  67. #endif
  68. +#ifndef __linux__
  69. +#include <tools/linux_types.h>
  70. +#else
  71. #include <asm/types.h>
  72. #include <asm/posix_types.h>
  73. +#endif
  74. struct page;
  75. struct kmem_cache;
  76. --- a/tools/perf/pmu-events/jevents.py
  77. +++ b/tools/perf/pmu-events/jevents.py
  78. @@ -684,6 +684,7 @@ def main() -> None:
  79. #include "util/header.h"
  80. #include "util/pmu.h"
  81. #include <string.h>
  82. +#include <strings.h>
  83. #include <stddef.h>
  84. struct compact_pmu_event {