#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)
{
{
int prio;
- prio = task_prio(current);
+ prio = wrapper_task_prio_sym(current);
lib_ring_buffer_align_ctx(ctx, ltt_alignof(prio));
chan->ops->event_write(ctx, &prio, sizeof(prio));
}
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;
+ return -ENOMEM;
+ if (lttng_find_context(*ctx, "prio")) {
+ lttng_remove_context_field(ctx, field);
+ return -EEXIST;
+ }
field->event_field.name = "prio";
field->event_field.type.atype = atype_integer;
field->event_field.type.u.basic.integer.size = sizeof(int) * CHAR_BIT;