Skip to contentSkip to conversation

tracing/pt_test.c: Fix compiler errors on old distros

PATCH New Xiao Yang 2 participants 2 messages Nov 1, 2018

lore
Share & tools
lore

Xiao Yang

author
#0 lore raw

PATCH 1/1 tracing/pt_test.c: Fix compiler errors on old distros

Compilation fails on old distros which don't have linux/perf_event.h and LTP_CHECK_PERF_EVENT can check the existence of linux/perf_event.h as well, so we just include perf_event.h header file when HAVE_STRUCT_PERF_EVENT_MMAP_PAGE_AUX_HEAD is defined.

---
 testcases/kernel/tracing/pt_test/pt_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/tracing/pt_test/pt_test.c +1 -1
index fe5b1e9..5feb1aa 100644
@@ -14,7 +14,6 @@
  * kconfig requirement: CONFIG_PERF_EVENTS
  */
 
-#include <linux/perf_event.h>
 #include <sched.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -24,6 +23,7 @@
 #include "config.h"
 
 #ifdef HAVE_STRUCT_PERF_EVENT_MMAP_PAGE_AUX_HEAD
+# include <linux/perf_event.h>
 
 #define PAGESIZE 4096
 #define INTEL_PT_MEMSIZE (17*PAGESIZE)
Signature · 1 line
1.8.3.1