X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fevent.c;h=099cbd18db8ea42d767951f094df5dfd81856fbe;hp=cdfc1a8649cd0c8c7242c745ad4733df4b6829fd;hb=6e911cad03751b6814fddd65b19a592acdc2b7b7;hpb=c6aa2d41cdd9daddc133e43cf6e1f2daae818cdd diff --git a/src/bin/lttng-sessiond/event.c b/src/bin/lttng-sessiond/event.c index cdfc1a864..099cbd18d 100644 --- a/src/bin/lttng-sessiond/event.c +++ b/src/bin/lttng-sessiond/event.c @@ -57,21 +57,6 @@ static void add_unique_ust_event(struct lttng_ht *ht, assert(node_ptr == &event->node.node); } -/* - * Setup a lttng_event used to enable *all* syscall tracing. - */ -static void init_syscalls_kernel_event(struct lttng_event *event) -{ - assert(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. */ @@ -104,6 +89,57 @@ error: return ret; } +/* + * Enable kernel system call for a channel from the kernel session. + */ +int event_kernel_enable_syscall(struct ltt_kernel_channel *kchan, + char *syscall_name) +{ + int ret; + + assert(kchan); + + ret = kernel_enable_syscall(syscall_name, kchan); + if (ret < 0) { + ret = LTTNG_ERR_KERN_ENABLE_FAIL; + goto error; + } + + DBG("Kernel event %s enable for channel %s.", + syscall_name, kchan->channel->name); + + ret = LTTNG_OK; + +error: + return ret; +} + +/* + * Disable kernel system call for a channel from the kernel session. + */ +int event_kernel_disable_syscall(struct ltt_kernel_channel *kchan, + char *syscall_name) +{ + int ret; + + assert(kchan); + + ret = kernel_disable_syscall(syscall_name, kchan); + if (ret < 0) { + ret = LTTNG_ERR_KERN_DISABLE_FAIL; + goto error; + } + + DBG("Kernel syscall %s disable for channel %s.", + syscall_name[0] == '\0' ? "" : syscall_name, + kchan->channel->name); + + ret = LTTNG_OK; + +error: + return ret; +} + /* * Disable kernel tracepoint events for a channel from the kernel session. */ @@ -126,15 +162,6 @@ int event_kernel_disable_all_tracepoints(struct ltt_kernel_channel *kchan) return ret; } -/* - * Disable kernel syscall events for a channel from the kernel session. - */ -int event_kernel_disable_all_syscalls(struct ltt_kernel_channel *kchan) -{ - ERR("Cannot disable syscall tracing for existing session. Please destroy session instead."); - return LTTNG_OK; /* Return OK so disable all succeeds */ -} - /* * Disable all kernel event for a channel from the kernel session. */ @@ -147,7 +174,7 @@ int event_kernel_disable_all(struct ltt_kernel_channel *kchan) ret = event_kernel_disable_all_tracepoints(kchan); if (ret != LTTNG_OK) return ret; - ret = event_kernel_disable_all_syscalls(kchan); + ret = event_kernel_disable_syscall(kchan, ""); return ret; } @@ -245,36 +272,6 @@ end: return ret; } -/* - * Enable all kernel sycalls events of a channel of the kernel session. - */ -int event_kernel_enable_all_syscalls(struct ltt_kernel_channel *kchan, - int kernel_tracer_fd) -{ - int ret; - struct lttng_event event; - - assert(kchan); - - init_syscalls_kernel_event(&event); - - DBG("Enabling all syscall tracing"); - - ret = kernel_create_event(&event, kchan); - if (ret < 0) { - if (ret == -EEXIST) { - ret = LTTNG_ERR_KERN_EVENT_EXIST; - } else { - ret = LTTNG_ERR_KERN_ENABLE_FAIL; - } - goto end; - } - - ret = LTTNG_OK; -end: - return ret; -} - /* * Enable all kernel events of a channel of the kernel session. */ @@ -299,7 +296,7 @@ int event_kernel_enable_all(struct ltt_kernel_channel *kchan, * tracepoints did not fail. Future work will allow us to send back * multiple errors to the client in one API call. */ - (void) event_kernel_enable_all_syscalls(kchan, kernel_tracer_fd); + (void) event_kernel_enable_syscall(kchan, ""); end: return tp_ret;