From: David Goulet Date: Mon, 5 Dec 2011 17:06:35 +0000 (-0500) Subject: Fix bad return value on enable syscalls making it freeze X-Git-Tag: v2.0-pre15~41 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=8f69e5eb13ccfc939f1a014d7244c687e1a49450;p=lttng-tools.git Fix bad return value on enable syscalls making it freeze Signed-off-by: David Goulet --- diff --git a/lttng-sessiond/event.c b/lttng-sessiond/event.c index c7331956f..247a4c6d7 100644 --- a/lttng-sessiond/event.c +++ b/lttng-sessiond/event.c @@ -161,14 +161,16 @@ int event_kernel_enable_all_tracepoints(struct ltt_kernel_session *ksession, { 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; + } } } @@ -191,6 +193,7 @@ int event_kernel_enable_all_tracepoints(struct ltt_kernel_session *ksession, } } free(event_list); + ret = LTTCOMM_OK; end: return ret; @@ -212,8 +215,14 @@ int event_kernel_enable_all_syscalls(struct ltt_kernel_session *ksession, 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; diff --git a/lttng-sessiond/main.c b/lttng-sessiond/main.c index fcae0235c..75732a334 100644 --- a/lttng-sessiond/main.c +++ b/lttng-sessiond/main.c @@ -2677,15 +2677,16 @@ static int cmd_enable_event_all(struct ltt_session *session, int domain, 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) { @@ -2710,6 +2711,8 @@ static int cmd_enable_event_all(struct ltt_session *session, int domain, ret = LTTCOMM_KERN_ENABLE_FAIL; goto error; } + + /* Manage return value */ if (ret != LTTCOMM_OK) { goto error; }