From: Mathieu Desnoyers Date: Sat, 17 Sep 2011 14:29:08 +0000 (-0400) Subject: Fix syscall exit X-Git-Tag: v2.0-pre9~42 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2f804c0a57ec75c126cdde7c244ad9eafe35358a;p=lttng-modules.git Fix syscall exit Signed-off-by: Mathieu Desnoyers --- diff --git a/ltt-events.h b/ltt-events.h index a53e2e89..dfab9a5f 100644 --- a/ltt-events.h +++ b/ltt-events.h @@ -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; }; diff --git a/lttng-syscalls.c b/lttng-syscalls.c index 682a3875..378d9f1e 100644 --- a/lttng-syscalls.c +++ b/lttng-syscalls.c @@ -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",