X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttng-context-prio.c;fp=lttng-context-prio.c;h=d159e02d4dbf270bcd3059e31d6fc41e88120b31;hb=979133c547728a541098dd7051e1e72ab7631788;hp=a62685f7dc7d7fe578a592097b1b02642fb881ed;hpb=8fefc8a2d93a06a032c7983cf621ab3fb0c2acde;p=lttng-modules.git diff --git a/lttng-context-prio.c b/lttng-context-prio.c index a62685f7..d159e02d 100644 --- a/lttng-context-prio.c +++ b/lttng-context-prio.c @@ -15,6 +15,19 @@ #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;