Fix bad return value on enable syscalls making it freeze
authorDavid Goulet <david.goulet@polymtl.ca>
Mon, 5 Dec 2011 17:06:35 +0000 (12:06 -0500)
committerDavid Goulet <david.goulet@polymtl.ca>
Mon, 5 Dec 2011 17:06:35 +0000 (12:06 -0500)
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
lttng-sessiond/event.c
lttng-sessiond/main.c

index c7331956f91e486a5f2a06caf3f8b20f71d53f26..247a4c6d7c7cae013d586439a9194561fbcf751e 100644 (file)
@@ -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;
index fcae0235c099751af1f4119466d26f3a382d15d4..75732a334c376cb5a0b5c7fd666c10ffc3cbccde 100644 (file)
@@ -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;
                }
This page took 0.03073 seconds and 4 git commands to generate.