summaryrefslogtreecommitdiffstats
path: root/runtime/docs/examples
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/docs/examples')
-rw-r--r--runtime/docs/examples/template.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/runtime/docs/examples/template.c b/runtime/docs/examples/template.c
index 68d821fe..73cbc06e 100644
--- a/runtime/docs/examples/template.c
+++ b/runtime/docs/examples/template.c
@@ -95,18 +95,19 @@ static struct kprobe kp[] = {
#define NUM_KPROBES (sizeof(kp)/sizeof(struct kprobe))
/* called when the module loads. */
-int init_module(void)
+int probe_start(void)
{
- int ret;
+ /* initialize any data or variables */
- TRANSPORT_OPEN;
/* register any jprobes */
- ret = _stp_register_jprobes (jp, NUM_JPROBES);
+ int ret = _stp_register_jprobes (jp, NUM_JPROBES);
- /* register any kprobes */
+ /* Register any kprobes and jprobes. */
+ /* You probably only have one type */
if (ret >= 0)
- ret = _stp_register_kprobes (kp, NUM_KPROBES);
+ if ((ret = _stp_register_kprobes (kp, NUM_KPROBES)) < 0)
+ _stp_unregister_jprobes (jp, NUM_JPROBES);
return ret;
}
@@ -122,11 +123,3 @@ static void probe_exit (void)
_stp_printf ("whatever I want to say\n");
_stp_print_flush();
}
-
-/* required */
-void cleanup_module(void)
-{
- _stp_transport_close();
-}
-
-MODULE_LICENSE("GPL");