Add task_prio symbol wrapper
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 1 Jun 2011 18:22:50 +0000 (14:22 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 1 Jun 2011 18:22:50 +0000 (14:22 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Makefile
ltt-events.c
ltt-events.h
lttng-context-prio.c
wrapper/sched.c [new file with mode: 0644]
wrapper/sched.h [new file with mode: 0644]

index fa337a0fd97332dd2586a763f7895ada610f21f6..62698b2af7e76f1584757837df3bb9369e56ad02 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,8 @@ obj-m += ltt-relay.o
 ltt-relay-objs :=  ltt-events.o ltt-debugfs-abi.o \
                        ltt-probes.o ltt-core.o ltt-context.o \
                        lttng-context-pid.o lttng-context-comm.o \
-                       lttng-context-prio.o lttng-context-nice.o
+                       lttng-context-prio.o lttng-context-nice.o \
+                       wrapper/sched.o
 
 obj-m += probes/
 obj-m += lib/
index f98ef309e0ec47e3ee9c4bf8de0abbf2d4c93773..7c08def9d2d4d8935bd5393e832fcdea3ff83a30 100644 (file)
@@ -860,6 +860,9 @@ static int __init ltt_events_init(void)
 {
        int ret;
 
+       ret = wrapper_task_prio_init();
+       if (ret)
+               return ret;
        event_cache = KMEM_CACHE(ltt_event, 0);
        if (!event_cache)
                return -ENOMEM;
index b9bb3bb95d8bba919729afabd17f135a76fe9791..975d1949c6abc6d030e6f05fa1ec7d0df3c00f29 100644 (file)
@@ -272,6 +272,10 @@ int ltt_probes_init(void);
 void ltt_probes_exit(void);
 struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx);
 void lttng_destroy_context(struct lttng_ctx *ctx);
+
+int wrapper_task_prio_init(void);
+int wrapper_task_prio_sym(struct task_struct *t);
+
 int lttng_add_pid_to_ctx(struct lttng_ctx **ctx);
 int lttng_add_comm_to_ctx(struct lttng_ctx **ctx);
 int lttng_add_prio_to_ctx(struct lttng_ctx **ctx);
index c8f83f485c334ac3bd423a499f333341afa61629..a62685f7dc7d7fe578a592097b1b02642fb881ed 100644 (file)
@@ -32,7 +32,7 @@ void prio_record(struct lttng_ctx_field *field,
 {
        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));
 }
diff --git a/wrapper/sched.c b/wrapper/sched.c
new file mode 100644 (file)
index 0000000..229dc07
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers@efficios.com)
+ *
+ * Wrapper around task_prio call.
+ *
+ * Dual LGPL v2.1/GPL v2 license.
+ */
+
+#include <linux/kallsyms.h>
+#include <linux/sched.h>
+
+void (*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;
+}
diff --git a/wrapper/sched.h b/wrapper/sched.h
new file mode 100644 (file)
index 0000000..1332cfe
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef _LTT_WRAPPER_VMALLOC_H
+#define _LTT_WRAPPER_VMALLOC_H
+
+/*
+ * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers@efficios.com)
+ *
+ * Wrapper around task_prio call.
+ *
+ * Dual LGPL v2.1/GPL v2 license.
+ */
+
+#ifdef CONFIG_KALLSYMS
+
+#include "../ltt-events.h"
+
+static inline
+int wrapper_task_prio(struct task_struct *t)
+{
+       return wrapper_task_prio_sym(t);
+}
+#else
+
+#include <linux/sched.h>
+
+static inline
+int wrapper_task_prio(struct task_struct *t)
+{
+       return task_prio(t);
+}
+#endif
+
+#endif /* _LTT_WRAPPER_VMALLOC_H */
This page took 0.028609 seconds and 4 git commands to generate.