Fix: mmap enum flags build failures
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 6 Aug 2020 15:03:00 +0000 (11:03 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 6 Aug 2020 15:42:57 +0000 (11:42 -0400)
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 <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I778a52a0da9da6e04231a52c7f68a22d122dfb83

include/instrumentation/syscalls/headers/syscalls_integers_override.h

index 3ad03526381f3af51829df20aec38c6df636c689..a97c1d954acceb4b88f67e64c4c02a6caa5589df 100644 (file)
@@ -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("<none>",                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 */
        )
 )
 
This page took 0.026952 seconds and 4 git commands to generate.