Add EEXIST support for kernel event on the tracer side
authorDavid Goulet <david.goulet@polymtl.ca>
Wed, 5 Oct 2011 22:20:34 +0000 (18:20 -0400)
committerDavid Goulet <david.goulet@polymtl.ca>
Wed, 5 Oct 2011 22:20:34 +0000 (18:20 -0400)
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
ltt-sessiond/event.c
ltt-sessiond/kernel-ctl.c

index e8f54504cd1c7081e0b8fcce8fa5cec8a1075e70..c12e385b31015bd41207947d42a807db22d75a92 100644 (file)
@@ -15,6 +15,7 @@
  * Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#include <errno.h>
 #include <urcu/list.h>
 
 #include <lttng/lttng.h>
@@ -127,7 +128,11 @@ int event_kernel_enable_tracepoint(struct ltt_kernel_session *ksession,
        if (kevent == NULL) {
                ret = kernel_create_event(event, kchan);
                if (ret < 0) {
-                       ret = LTTCOMM_KERN_ENABLE_FAIL;
+                       if (ret == -EEXIST) {
+                               ret = LTTCOMM_KERN_EVENT_EXIST;
+                       } else {
+                               ret = LTTCOMM_KERN_ENABLE_FAIL;
+                       }
                        goto end;
                }
        } else if (kevent->enabled == 0) {
index e486fa10ada0002e8e2f7437ce677a0f24475ba6..9c270edb3325674be28ed3886c646b8267ba0022 100644 (file)
@@ -189,12 +189,16 @@ int kernel_create_event(struct lttng_event *ev,
 
        event = trace_kernel_create_event(ev);
        if (event == NULL) {
+               ret = -1;
                goto error;
        }
 
        ret = kernctl_create_event(channel->fd, event->event);
        if (ret < 0) {
-               PERROR("create event ioctl");
+               if (errno != EEXIST) {
+                       PERROR("create event ioctl");
+               }
+               ret = -errno;
                goto free_event;
        }
 
@@ -226,7 +230,7 @@ end:
 free_event:
        free(event);
 error:
-       return -1;
+       return ret;
 }
 
 /*
This page took 0.034796 seconds and 4 git commands to generate.