From: David Goulet Date: Wed, 5 Oct 2011 22:20:34 +0000 (-0400) Subject: Add EEXIST support for kernel event on the tracer side X-Git-Tag: v2.0-pre15~191 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d87bfb32097dd9dddb5de2b05dd87b53e3d3ad73;p=lttng-tools.git Add EEXIST support for kernel event on the tracer side Signed-off-by: David Goulet --- diff --git a/ltt-sessiond/event.c b/ltt-sessiond/event.c index e8f54504c..c12e385b3 100644 --- a/ltt-sessiond/event.c +++ b/ltt-sessiond/event.c @@ -15,6 +15,7 @@ * Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include #include #include @@ -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) { diff --git a/ltt-sessiond/kernel-ctl.c b/ltt-sessiond/kernel-ctl.c index e486fa10a..9c270edb3 100644 --- a/ltt-sessiond/kernel-ctl.c +++ b/ltt-sessiond/kernel-ctl.c @@ -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; } /*