Signed-off-by: David Goulet <david.goulet@polymtl.ca>
* Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include <errno.h>
#include <urcu/list.h>
#include <lttng/lttng.h>
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) {
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;
}
free_event:
free(event);
error:
- return -1;
+ return ret;
}
/*