diff mbox series

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

Message ID 1541055413-29268-1-git-send-email-yangx.jy@cn.fujitsu.com
State Accepted
Headers show
Series tracing/pt_test.c: Fix compiler errors on old distros | expand

Commit Message

Xiao Yang Nov. 1, 2018, 6:56 a.m. UTC
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.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 testcases/kernel/tracing/pt_test/pt_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Cyril Hrubis Nov. 1, 2018, 1:28 p.m. UTC | #1
Hi!
Pushed, thanks.
diff mbox series

Patch

diff --git a/testcases/kernel/tracing/pt_test/pt_test.c b/testcases/kernel/tracing/pt_test/pt_test.c
index fe5b1e9..5feb1aa 100644
--- a/testcases/kernel/tracing/pt_test/pt_test.c
+++ b/testcases/kernel/tracing/pt_test/pt_test.c
@@ -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)