[lttng-dev] [PATCH lttng-modules] wrapper/perf.h: Fix kernel version condition

Andrew Gabbasov andrew_gabbasov at mentor.com
Sun Dec 9 10:00:30 EST 2012


The pid_t parameter of function perf_event_create_kernel_counter
was changed to task_struct pointer starting from 2.6.37.x.

Signed-off-by: Andrew Gabbasov <andrew_gabbasov at mentor.com>
---
 wrapper/perf.h |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/wrapper/perf.h b/wrapper/perf.h
index 5dfa84b..5de205c 100644
--- a/wrapper/perf.h
+++ b/wrapper/perf.h
@@ -34,7 +34,7 @@ wrapper_perf_event_create_kernel_counter(struct perf_event_attr *attr,
 }
 #else /* defined(CONFIG_PERF_EVENTS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,99)) */
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
 static inline struct perf_event *
 wrapper_perf_event_create_kernel_counter(struct perf_event_attr *attr,
 				int cpu,
@@ -43,7 +43,7 @@ wrapper_perf_event_create_kernel_counter(struct perf_event_attr *attr,
 {
 	return perf_event_create_kernel_counter(attr, cpu, task, callback);
 }
-#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) */
+#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) */
 static inline struct perf_event *
 wrapper_perf_event_create_kernel_counter(struct perf_event_attr *attr,
 				int cpu,
@@ -60,8 +60,11 @@ wrapper_perf_event_create_kernel_counter(struct perf_event_attr *attr,
 	return perf_event_create_kernel_counter(attr, cpu, pid, callback);
 }
 
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) */
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
 #define local64_read(l)		atomic64_read(l)
-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) */
+#endif
 
 #endif /* defined(CONFIG_PERF_EVENTS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,99)) */
 
-- 
1.7.10.4




More information about the lttng-dev mailing list