probe test
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 21 Sep 2006 15:41:43 +0000 (15:41 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 21 Sep 2006 15:41:43 +0000 (15:41 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@2131 04897980-b3bd-0310-b5e0-8ef037075253

tests/kernel/Makefile
tests/kernel/probe.c [new file with mode: 0644]

index 30bf09ef3a625c8b2df02f4cde4e8410a9815252..60b38403c5a316fdf66a3a1de0726f0237229684 100644 (file)
@@ -20,6 +20,7 @@ endif
        #obj-m += test-printk.o
        #obj-m += test-debugfs.o
        obj-m += test-mark.o
+       obj-m += probe.o
        #obj-m += marker-loader.o
        #obj-m += test-linuxtrace.o
 else
diff --git a/tests/kernel/probe.c b/tests/kernel/probe.c
new file mode 100644 (file)
index 0000000..96d9ff4
--- /dev/null
@@ -0,0 +1,36 @@
+/* probe.c
+ *
+ * Loads a function at a marker call site.
+ *
+ * (C) Copyright 2006 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
+ *
+ * This file is released under the GPLv2.
+ * See the file COPYING for more details.
+ */
+
+#include <linux/marker.h>
+#include <linux/module.h>
+#include <linux/kallsyms.h>
+
+/* function to install */
+void do_mark1(const char *format, int value)
+{
+       printk("value is %d\n", value);
+}
+
+int init_module(void)
+{
+       return marker_set_probe("subsys_mark1", (marker_probe)do_mark1,
+                       MARKER_CALL);
+}
+
+void cleanup_module(void)
+{
+       marker_disable_probe("subsys_mark1", (marker_probe)do_mark1,
+               MARKER_CALL);
+}
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Mathieu Desnoyers");
+MODULE_DESCRIPTION("Probe");
+
This page took 0.025041 seconds and 4 git commands to generate.