X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=ltt-sessiond%2Fevent.c;h=e8f54504cd1c7081e0b8fcce8fa5cec8a1075e70;hb=7a3d132871a4414b6cd232e7f41e6a1f50d9bf16;hp=3e3ecd32049c07b10e9979d967e1e12034676dbc;hpb=54d01ffb43587b221dc50ec42b6070fad89bd255;p=lttng-tools.git diff --git a/ltt-sessiond/event.c b/ltt-sessiond/event.c index 3e3ecd320..e8f54504c 100644 --- a/ltt-sessiond/event.c +++ b/ltt-sessiond/event.c @@ -26,9 +26,22 @@ #include "kernel-ctl.h" /* - * Disable kernel event for a channel from the kernel session. + * Setup a lttng_event used to enable *all* syscall tracing. */ -int event_kernel_disable(struct ltt_kernel_session *ksession, +static void init_syscalls_kernel_event(struct lttng_event *event) +{ + event->name[0] = '\0'; + /* + * We use LTTNG_EVENT* here since the trace kernel creation will make the + * right changes for the kernel. + */ + event->type = LTTNG_EVENT_SYSCALL; +} + +/* + * Disable kernel tracepoint event for a channel from the kernel session. + */ +int event_kernel_disable_tracepoint(struct ltt_kernel_session *ksession, struct ltt_kernel_channel *kchan, char *event_name) { int ret; @@ -56,9 +69,9 @@ error: } /* - * Disable all kernel event for a channel from the kernel session. + * Disable kernel tracepoint events for a channel from the kernel session. */ -int event_kernel_disable_all(struct ltt_kernel_session *ksession, +int event_kernel_disable_all_tracepoints(struct ltt_kernel_session *ksession, struct ltt_kernel_channel *kchan) { int ret; @@ -72,16 +85,39 @@ int event_kernel_disable_all(struct ltt_kernel_session *ksession, continue; } } - ret = LTTCOMM_OK; + return ret; +} + +/* + * Disable kernel syscall events for a channel from the kernel session. + */ +int event_kernel_disable_all_syscalls(struct ltt_kernel_session *ksession, + struct ltt_kernel_channel *kchan) +{ + ERR("Cannot disable syscall tracing for existing session. Please destroy session instead."); + return LTTCOMM_OK; /* Return OK so disable all succeeds */ +} + +/* + * Disable all kernel event for a channel from the kernel session. + */ +int event_kernel_disable_all(struct ltt_kernel_session *ksession, + struct ltt_kernel_channel *kchan) +{ + int ret; + ret = event_kernel_disable_all_tracepoints(ksession, kchan); + if (ret != LTTCOMM_OK) + return ret; + ret = event_kernel_disable_all_syscalls(ksession, kchan); return ret; } /* - * Enable kernel event for a channel from the kernel session. + * Enable kernel tracepoint event for a channel from the kernel session. */ -int event_kernel_enable(struct ltt_kernel_session *ksession, +int event_kernel_enable_tracepoint(struct ltt_kernel_session *ksession, struct ltt_kernel_channel *kchan, struct lttng_event *event) { int ret; @@ -92,26 +128,24 @@ int event_kernel_enable(struct ltt_kernel_session *ksession, ret = kernel_create_event(event, kchan); if (ret < 0) { ret = LTTCOMM_KERN_ENABLE_FAIL; - goto error; + goto end; } } else if (kevent->enabled == 0) { ret = kernel_enable_event(kevent); if (ret < 0) { ret = LTTCOMM_KERN_ENABLE_FAIL; - goto error; + goto end; } } - ret = LTTCOMM_OK; - -error: +end: return ret; } /* - * Enable all kernel event of a channel of the kernel session. + * Enable all kernel tracepoint events of a channel of the kernel session. */ -int event_kernel_enable_all(struct ltt_kernel_session *ksession, +int event_kernel_enable_all_tracepoints(struct ltt_kernel_session *ksession, struct ltt_kernel_channel *kchan, int kernel_tracer_fd) { int size, i, ret; @@ -130,7 +164,7 @@ int event_kernel_enable_all(struct ltt_kernel_session *ksession, size = kernel_list_events(kernel_tracer_fd, &event_list); if (size < 0) { ret = LTTCOMM_KERN_LIST_FAIL; - goto error; + goto end; } for (i = 0; i < size; i++) { @@ -145,11 +179,48 @@ int event_kernel_enable_all(struct ltt_kernel_session *ksession, } } } - free(event_list); + ret = LTTCOMM_OK; +end: + return ret; + +} + +/* + * Enable all kernel tracepoint events of a channel of the kernel session. + */ +int event_kernel_enable_all_syscalls(struct ltt_kernel_session *ksession, + struct ltt_kernel_channel *kchan, int kernel_tracer_fd) +{ + int ret; + struct lttng_event event; + + init_syscalls_kernel_event(&event); + + DBG("Enabling all syscall tracing"); + ret = kernel_create_event(&event, kchan); + if (ret < 0) { + goto end; + } ret = LTTCOMM_OK; +end: + return ret; +} -error: +/* + * Enable all kernel events of a channel of the kernel session. + */ +int event_kernel_enable_all(struct ltt_kernel_session *ksession, + struct ltt_kernel_channel *kchan, int kernel_tracer_fd) +{ + int ret; + + ret = event_kernel_enable_all_tracepoints(ksession, kchan, kernel_tracer_fd); + if (ret != LTTCOMM_OK) { + goto end; + } + ret = event_kernel_enable_all_syscalls(ksession, kchan, kernel_tracer_fd); +end: return ret; }