X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fstart.c;h=b1840c3e85f2cfd1ce4e82debb035663894a0908;hp=1db0a31c5b49a48efea44cdbd841d0801849c9f4;hb=32a6298d8929c91842c9a5c09f1a3f4660c32eec;hpb=ca1c3607d2f5654163875cda874f43971df0f696 diff --git a/src/bin/lttng/commands/start.c b/src/bin/lttng/commands/start.c index 1db0a31c5..b1840c3e8 100644 --- a/src/bin/lttng/commands/start.c +++ b/src/bin/lttng/commands/start.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 @@ -27,6 +26,8 @@ #include "../command.h" +#include + static char *opt_session_name; enum { @@ -46,11 +47,12 @@ static struct poptOption long_options[] = { */ static void usage(FILE *ofp) { - fprintf(ofp, "usage: lttng start [options] [NAME]\n"); + fprintf(ofp, "usage: lttng start [NAME] [OPTIONS]\n"); fprintf(ofp, "\n"); fprintf(ofp, "Where NAME is an optional session name. If not specified, lttng will\n"); fprintf(ofp, "get it from the configuration directory (.lttng).\n"); fprintf(ofp, "\n"); + fprintf(ofp, "Options:\n"); fprintf(ofp, " -h, --help Show this help\n"); fprintf(ofp, " --list-options Simple listing of options\n"); fprintf(ofp, "\n"); @@ -63,7 +65,7 @@ static void usage(FILE *ofp) */ static int start_tracing(void) { - int ret = CMD_SUCCESS; + int ret; char *session_name; if (opt_session_name == NULL) { @@ -80,9 +82,19 @@ static int start_tracing(void) ret = lttng_start_tracing(session_name); if (ret < 0) { + switch (-ret) { + case LTTCOMM_TRACE_ALREADY_STARTED: + WARN("Tracing already started for session %s", session_name); + break; + default: + ERR("%s", lttng_strerror(ret)); + break; + } goto free_name; } + ret = CMD_SUCCESS; + MSG("Tracing started for session %s", session_name); free_name: