Fix syscall exit
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 17 Sep 2011 14:29:08 +0000 (10:29 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 17 Sep 2011 14:29:08 +0000 (10:29 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
ltt-events.h
lttng-syscalls.c

index a53e2e8922c5b7c17264aa80dc10dd5e53091ad1..dfab9a5ffe5c8f3d443da293e0db845e3d87d9f9 100644 (file)
@@ -243,6 +243,7 @@ struct ltt_channel {
        struct ltt_transport *transport;
        struct ltt_event **sc_table;    /* for syscall tracing */
        struct ltt_event *sc_unknown;   /* for unknown syscalls */
+       struct ltt_event *sc_exit;      /* for syscall exit */
        int header_type;                /* 0: unset, 1: compact, 2: large */
        int metadata_dumped:1;
 };
index 682a38759ff787802ff5370b6dace643e64e85f2..378d9f1ef64a68344fe0f2b0586b4bcbebdbbb47 100644 (file)
@@ -29,18 +29,18 @@ static void syscall_entry_probe(void *__data, struct pt_regs *regs, long id);
  */
 #define LTTNG_PACKAGE_BUILD
 #define CREATE_TRACE_POINTS
+#define TP_MODULE_OVERRIDE
+#define TRACE_INCLUDE_PATH ../instrumentation/syscalls/headers
 
 /* Hijack probe callback for system calls */
 #define TP_PROBE_CB(_template)         &syscall_entry_probe
-#define TP_MODULE_OVERRIDE
-
-#define TRACE_INCLUDE_PATH ../instrumentation/syscalls/headers
 #include "instrumentation/syscalls/headers/syscalls_integers.h"
 #include "instrumentation/syscalls/headers/syscalls_pointers.h"
+#undef TP_PROBE_CB
+
 #include "instrumentation/syscalls/headers/syscalls_unknown.h"
 
 #undef TP_MODULE_OVERRIDE
-#undef TP_PROBE_CB
 #undef LTTNG_PACKAGE_BUILD
 #undef CREATE_TRACE_POINTS
 
@@ -203,9 +203,9 @@ int lttng_syscalls_register(struct ltt_channel *chan, void *filter)
 
        if (!chan->sc_unknown) {
                struct lttng_kernel_event ev;
-
                const struct lttng_event_desc *desc =
                        &__event_desc___sys_unknown;
+
                memset(&ev, 0, sizeof(ev));
                strncpy(ev.name, desc->name, LTTNG_SYM_NAME_LEN);
                ev.name[LTTNG_SYM_NAME_LEN - 1] = '\0';
@@ -217,6 +217,22 @@ int lttng_syscalls_register(struct ltt_channel *chan, void *filter)
                }
        }
 
+       if (!chan->sc_exit) {
+               struct lttng_kernel_event ev;
+               const struct lttng_event_desc *desc =
+                       &__event_desc___exit_syscall;
+
+               memset(&ev, 0, sizeof(ev));
+               strncpy(ev.name, desc->name, LTTNG_SYM_NAME_LEN);
+               ev.name[LTTNG_SYM_NAME_LEN - 1] = '\0';
+               ev.instrumentation = LTTNG_KERNEL_NOOP;
+               chan->sc_exit = ltt_event_create(chan, &ev, filter,
+                                                desc);
+               if (!chan->sc_exit) {
+                       return -EINVAL;
+               }
+       }
+
        /* Allocate events for each syscall, insert into table */
        for (i = 0; i < ARRAY_SIZE(sc_table); i++) {
                struct lttng_kernel_event ev;
@@ -258,7 +274,7 @@ int lttng_syscalls_register(struct ltt_channel *chan, void *filter)
         */
        ret = tracepoint_probe_register("sys_exit",
                        (void *) __event_probe__exit_syscall,
-                       chan->sc_unknown);
+                       chan->sc_exit);
        if (ret) {
                WARN_ON_ONCE(tracepoint_probe_unregister("sys_enter",
                        (void *) syscall_entry_probe, chan));
@@ -277,7 +293,7 @@ int lttng_syscalls_unregister(struct ltt_channel *chan)
                return 0;
        ret = tracepoint_probe_unregister("sys_exit",
                        (void *) __event_probe__exit_syscall,
-                       chan->sc_unknown);
+                       chan->sc_exit);
        if (ret)
                return ret;
        ret = tracepoint_probe_unregister("sys_enter",
This page took 0.027853 seconds and 4 git commands to generate.