Prio context: fix symbol lookup
[lttng-modules.git] / lttng-context-prio.c
index a62685f7dc7d7fe578a592097b1b02642fb881ed..d159e02d4dbf270bcd3059e31d6fc41e88120b31 100644 (file)
 #include "wrapper/vmalloc.h"
 #include "ltt-tracer.h"
 
+static
+int (*wrapper_task_prio_sym)(struct task_struct *t);
+
+int wrapper_task_prio_init(void)
+{
+       wrapper_task_prio_sym = (void *) kallsyms_lookup_name("task_prio");
+       if (!wrapper_task_prio_sym) {
+               printk(KERN_WARNING "LTTng: task_prio symbol lookup failed.\n");
+               return -EINVAL;
+       }
+       return 0;
+}
+
 static
 size_t prio_get_size(size_t offset)
 {
@@ -42,6 +55,12 @@ int lttng_add_prio_to_ctx(struct lttng_ctx **ctx)
        struct lttng_ctx_field *field;
        int ret;
 
+       if (!wrapper_task_prio_sym) {
+               ret = wrapper_task_prio_init();
+               if (ret)
+                       return ret;
+       }
+
        field = lttng_append_context(ctx);
        if (!field)
                return ret;
This page took 0.022828 seconds and 4 git commands to generate.