]> sourceware.org Git - systemtap.git/commitdiff
compatibility: perf_event.h updates for kernel 2.6.37
authorFrank Ch. Eigler <fche@redhat.com>
Fri, 7 Jan 2011 21:22:49 +0000 (16:22 -0500)
committerFrank Ch. Eigler <fche@redhat.com>
Sat, 8 Jan 2011 00:19:55 +0000 (19:19 -0500)
* runtime/autoconf-perf-structpid.c: New file.
* buildrun.cxx: Use it to define STAPCONF_PERF_STRUCTPID.
* runtime/perf.c: Respect it for perf_event_create_kernel_counter param 3.

buildrun.cxx
runtime/autoconf-perf-structpid.c [new file with mode: 0644]
runtime/perf.c

index 1e5dfbf59ab3fbc8569f803bbc9935ef6cf6c5f9..8ba7b4919588c3c4dd756dd255e0218ecc3ac31e 100644 (file)
@@ -206,6 +206,7 @@ compile_pass (systemtap_session& s)
   output_autoconf(s, o, "autoconf-walk-stack.c", "STAPCONF_WALK_STACK", NULL);
   output_autoconf(s, o, "autoconf-mm-context-vdso.c", "STAPCONF_MM_CONTEXT_VDSO", NULL);
   output_autoconf(s, o, "autoconf-blk-types.c", "STAPCONF_BLK_TYPES", NULL);
+  output_autoconf(s, o, "autoconf-perf-structpid.c", "STAPCONF_PERF_STRUCTPID", NULL);
 
   o << module_cflags << " += -include $(STAPCONF_HEADER)" << endl;
 
diff --git a/runtime/autoconf-perf-structpid.c b/runtime/autoconf-perf-structpid.c
new file mode 100644 (file)
index 0000000..cbf07ff
--- /dev/null
@@ -0,0 +1,14 @@
+#include <linux/perf_event.h>
+
+void fn (void) {
+  struct perf_event_attr *attr = NULL;
+  int cpu = 0;
+  struct task_struct *tsk = NULL;
+  perf_overflow_handler_t callback = NULL;
+
+  /* linux-2.6 commit 38a81da2205f94 */
+  (void) perf_event_create_kernel_counter(attr,
+                                   cpu,                  
+                                   tsk, /* as opposed to int pid */
+                                   callback);  
+}
index bf31cdaabbdede23e6331d3152eaed054207c4d4..164912800e283c72daaf3dd369ffa3bbd296fa86 100644 (file)
@@ -44,7 +44,12 @@ static long _stp_perf_init (struct stap_perf_probe *stp)
                        continue;
                }
                *event = perf_event_create_kernel_counter(&stp->attr,
-                                                         cpu, -1,
+                                                         cpu,
+#if STAPCONF_PERF_STRUCTPID
+                                                          NULL,
+#else
+                                                          -1,
+#endif
                                                          stp->callback);
 
                if (IS_ERR(*event)) {
This page took 0.030872 seconds and 5 git commands to generate.