From: Francis Deslauriers Date: Thu, 6 Aug 2020 15:03:00 +0000 (-0400) Subject: Fix: mmap enum flags build failures X-Git-Tag: v2.13.0-rc1~182 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=1203baa4cc5a8599346b11141386bf0e006e928f;p=lttng-modules.git Fix: mmap enum flags build failures Some of the mmap option flags are not available on all architectures and are defined to zero by include/linux/mman.h. This is probably done as a way to no-op the use of these flags on configurations that don't support them. To fix this, only define these flags in our enumeration if they are defined and non-zero. Also, the MAP_HUGE_{2MB,1GB} labels were mistakingly named MAP_HUGETLB_{2MB,1GB}. Signed-off-by: Francis Deslauriers Signed-off-by: Mathieu Desnoyers Change-Id: I778a52a0da9da6e04231a52c7f68a22d122dfb83 --- diff --git a/include/instrumentation/syscalls/headers/syscalls_integers_override.h b/include/instrumentation/syscalls/headers/syscalls_integers_override.h index 3ad03526..a97c1d95 100644 --- a/include/instrumentation/syscalls/headers/syscalls_integers_override.h +++ b/include/instrumentation/syscalls/headers/syscalls_integers_override.h @@ -42,29 +42,48 @@ SC_LTTNG_TRACEPOINT_ENUM(lttng_mmap_flags_mapping_type, SC_LTTNG_TRACEPOINT_ENUM(lttng_mmap_flags_options, TP_ENUM_VALUES( ctf_enum_value("", 0) + +#if defined (MAP_32BIT) && MAP_32BIT != 0 ctf_enum_value("MAP_32BIT", LTTNG_MMAP_FLAGS_TO_CTF(MAP_32BIT)) +#endif /* defined (MAP_32BIT) && MAP_32BIT != 0 */ + ctf_enum_value("MAP_ANONYMOUS", LTTNG_MMAP_FLAGS_TO_CTF(MAP_ANONYMOUS)) ctf_enum_value("MAP_DENYWRITE", LTTNG_MMAP_FLAGS_TO_CTF(MAP_DENYWRITE)) ctf_enum_value("MAP_EXECUTABLE", LTTNG_MMAP_FLAGS_TO_CTF(MAP_EXECUTABLE)) ctf_enum_value("MAP_FIXED", LTTNG_MMAP_FLAGS_TO_CTF(MAP_FIXED)) + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,17,0)) ctf_enum_value("MAP_FIXED_NOREPLACE", LTTNG_MMAP_FLAGS_TO_CTF(MAP_FIXED_NOREPLACE)) #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4,17,0)) */ + ctf_enum_value("MAP_GROWSDOWN", LTTNG_MMAP_FLAGS_TO_CTF(MAP_GROWSDOWN)) ctf_enum_value("MAP_HUGETLB", LTTNG_MMAP_FLAGS_TO_CTF(MAP_HUGETLB)) + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) - ctf_enum_value("MAP_HUGETLB_2MB", LTTNG_MMAP_FLAGS_TO_CTF(MAP_HUGE_2MB)) - ctf_enum_value("MAP_HUGETLB_1GB", LTTNG_MMAP_FLAGS_TO_CTF(MAP_HUGE_1GB)) + +#if defined (MAP_HUGE_2MB) && MAP_HUGE_2MB != 0 + ctf_enum_value("MAP_HUGE_2MB", LTTNG_MMAP_FLAGS_TO_CTF(MAP_HUGE_2MB)) +#endif /* defined (MAP_HUGE_2MB) && MAP_HUGE_2MB != 0 */ + +#if defined (MAP_HUGE_1GB) && MAP_HUGE_1GB != 0 + ctf_enum_value("MAP_HUGE_1GB", LTTNG_MMAP_FLAGS_TO_CTF(MAP_HUGE_1GB)) +#endif /* defined (MAP_HUGE_1GB) && MAP_HUGE_1GB != 0 */ + #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) */ + ctf_enum_value("MAP_LOCKED", LTTNG_MMAP_FLAGS_TO_CTF(MAP_LOCKED)) ctf_enum_value("MAP_NONBLOCK", LTTNG_MMAP_FLAGS_TO_CTF(MAP_NONBLOCK)) ctf_enum_value("MAP_NORESERVE", LTTNG_MMAP_FLAGS_TO_CTF(MAP_NORESERVE)) ctf_enum_value("MAP_POPULATE", LTTNG_MMAP_FLAGS_TO_CTF(MAP_POPULATE)) ctf_enum_value("MAP_STACK", LTTNG_MMAP_FLAGS_TO_CTF(MAP_STACK)) + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)) ctf_enum_value("MAP_SYNC", LTTNG_MMAP_FLAGS_TO_CTF(MAP_SYNC)) #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)) */ + +#if defined (MAP_UNINITIALIZED) && MAP_UNINITIALIZED != 0 ctf_enum_value("MAP_UNINITIALIZED", LTTNG_MMAP_FLAGS_TO_CTF(MAP_UNINITIALIZED)) +#endif /* defined (MAP_UNINITIALIZED) && MAP_UNINITIALIZED != 0 */ ) )