{
int size, i, ret;
struct ltt_kernel_event *kevent;
- struct lttng_event *event_list;
+ struct lttng_event *event_list = NULL;
/* For each event in the kernel session */
cds_list_for_each_entry(kevent, &kchan->events_list.head, list) {
- ret = kernel_enable_event(kevent);
- if (ret < 0) {
- /* Enable failed but still continue */
- continue;
+ if (kevent->enabled == 0) {
+ ret = kernel_enable_event(kevent);
+ if (ret < 0) {
+ /* Enable failed but still continue */
+ continue;
+ }
}
}
}
}
free(event_list);
+
ret = LTTCOMM_OK;
end:
return ret;
ret = kernel_create_event(&event, kchan);
if (ret < 0) {
+ if (ret == -EEXIST) {
+ ret = LTTCOMM_KERN_EVENT_EXIST;
+ } else {
+ ret = LTTCOMM_KERN_ENABLE_FAIL;
+ }
goto end;
}
+
ret = LTTCOMM_OK;
end:
return ret;
if (ret != LTTCOMM_OK) {
goto error;
}
- }
- /* Get the newly created kernel channel pointer */
- kchan = trace_kernel_get_channel_by_name(channel_name,
- session->kernel_session);
- if (kchan == NULL) {
- /* This sould not happen... */
- ret = LTTCOMM_FATAL;
- goto error;
+ /* Get the newly created kernel channel pointer */
+ kchan = trace_kernel_get_channel_by_name(channel_name,
+ session->kernel_session);
+ if (kchan == NULL) {
+ /* This sould not happen... */
+ ret = LTTCOMM_FATAL;
+ goto error;
+ }
+
}
switch (event_type) {
ret = LTTCOMM_KERN_ENABLE_FAIL;
goto error;
}
+
+ /* Manage return value */
if (ret != LTTCOMM_OK) {
goto error;
}