int result;
result = marker_set_probe("subsys_mark1", DO_MARK1_FORMAT,
(marker_probe_func*)do_mark1);
- if(result) goto end;
+ if(!result) goto end;
result = marker_set_probe("subsys_mark2", DO_MARK2_FORMAT,
(marker_probe_func*)do_mark2);
- if(result) goto cleanup1;
+ if(!result) goto cleanup1;
result = marker_set_probe("subsys_mark3", DO_MARK3_FORMAT,
(marker_probe_func*)do_mark3);
- if(result) goto cleanup2;
+ if(!result) goto cleanup2;
- return -result;
+ return 0;
cleanup2:
- marker_disable_probe("subsys_mark2", (marker_probe_func*)do_mark2);
+ marker_remove_probe((marker_probe_func*)do_mark2);
cleanup1:
- marker_disable_probe("subsys_mark1", (marker_probe_func*)do_mark1);
+ marker_remove_probe((marker_probe_func*)do_mark1);
end:
- return -result;
+ return -EPERM;
}
void cleanup_module(void)
{
- marker_disable_probe("subsys_mark1", (marker_probe_func*)do_mark1);
- marker_disable_probe("subsys_mark2", (marker_probe_func*)do_mark2);
- marker_disable_probe("subsys_mark3", (marker_probe_func*)do_mark3);
+ marker_remove_probe((marker_probe_func*)do_mark1);
+ marker_remove_probe((marker_probe_func*)do_mark2);
+ marker_remove_probe((marker_probe_func*)do_mark3);
}
MODULE_LICENSE("GPL");
#include <linux/module.h>
#include <linux/proc_fs.h>
#include <linux/sched.h>
+#include <asm/ptrace.h>
volatile int x=7;
struct proc_dir_entry *pentry = NULL;
+static inline void test(struct pt_regs * regs)
+{
+ MARK(kernel_debug_test, "%d %ld %p", 2, regs->eip, regs);
+}
+
static int my_open(struct inode *inode, struct file *file)
{
unsigned int i;
}
MARK(subsys_mark2, "%d %s", 2, "blah2");
MARK(subsys_mark3, "%d %s %s", x, "blah3", "blah5");
+ test(NULL);
+ test(NULL);
return -EPERM;
}
int init_module(void)
{
+ unsigned int i;
+
pentry = create_proc_entry("testmark", 0444, NULL);
if (pentry)
pentry->proc_fops = &my_operations;
+
+ marker_list_probe(NULL);
+
return 0;
}