X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fkernel.c;h=dd815c44536fd8629d01537d6a6d749f70033147;hb=4222434939b65c3abf144866564732d7fd14ed13;hp=fea51b761c8ea2f0b224f2dfd2dc8589a9c8ad8b;hpb=e71aad1fa4b06a5f91ddceace42366f3d79bd77e;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/kernel.c b/src/bin/lttng-sessiond/kernel.c index fea51b761..dd815c445 100644 --- a/src/bin/lttng-sessiond/kernel.c +++ b/src/bin/lttng-sessiond/kernel.c @@ -1,19 +1,18 @@ /* * Copyright (C) 2011 - David Goulet * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; only version 2 - * of the License. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2 only, + * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #define _GNU_SOURCE @@ -26,6 +25,7 @@ #include #include +#include #include "kernel.h" #include "kern-modules.h" @@ -291,8 +291,15 @@ int kernel_enable_event(struct ltt_kernel_event *event) int ret; ret = kernctl_enable(event->fd); - if (ret < 0 && errno != EEXIST) { - PERROR("enable kernel event"); + if (ret < 0) { + switch (errno) { + case EEXIST: + ret = LTTCOMM_KERN_EVENT_EXIST; + break; + default: + PERROR("enable kernel event"); + break; + } goto error; } @@ -313,8 +320,15 @@ int kernel_disable_event(struct ltt_kernel_event *event) int ret; ret = kernctl_disable(event->fd); - if (ret < 0 && errno != EEXIST) { - PERROR("disable kernel event"); + if (ret < 0) { + switch (errno) { + case EEXIST: + ret = LTTCOMM_KERN_EVENT_EXIST; + break; + default: + PERROR("disable kernel event"); + break; + } goto error; }