*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
static struct poptOption long_options[] = {
/* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
{"help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
static struct poptOption long_options[] = {
/* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
{"help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
{"kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0},
{"kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0},
- {"userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0},
+ {"userspace", 'u', POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_cmd_name, OPT_USERSPACE, 0, 0},
{"all", 0, POPT_ARG_VAL, &opt_pid_all, 1, 0, 0},
{"pid", 'p', POPT_ARG_INT, &opt_pid, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0}
{"all", 0, POPT_ARG_VAL, &opt_pid_all, 1, 0, 0},
{"pid", 'p', POPT_ARG_INT, &opt_pid, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0}
fprintf(ofp, "usage: lttng disable-channel NAME[,NAME2,...] [options]\n");
fprintf(ofp, "\n");
fprintf(ofp, " -h, --help Show this help\n");
fprintf(ofp, "usage: lttng disable-channel NAME[,NAME2,...] [options]\n");
fprintf(ofp, "\n");
fprintf(ofp, " -h, --help Show this help\n");
fprintf(ofp, " -k, --kernel Apply for the kernel tracer\n");
fprintf(ofp, " -u, --userspace Apply for the user-space tracer\n");
fprintf(ofp, " --all If -u, apply on all traceable apps\n");
fprintf(ofp, " -k, --kernel Apply for the kernel tracer\n");
fprintf(ofp, " -u, --userspace Apply for the user-space tracer\n");
fprintf(ofp, " --all If -u, apply on all traceable apps\n");
/* Kernel tracer action */
if (opt_kernel) {
DBG("Disabling kernel channel %s", channel_name);
/* Kernel tracer action */
if (opt_kernel) {
DBG("Disabling kernel channel %s", channel_name);
pc = poptGetContext(NULL, argc, argv, long_options, 0);
poptReadDefaultConfig(pc, 0);
pc = poptGetContext(NULL, argc, argv, long_options, 0);
poptReadDefaultConfig(pc, 0);
- ret = disable_channels();
+ if (!opt_session_name) {
+ session_name = get_session_name();
+ if (session_name == NULL) {
+ ret = -1;
+ goto end;
+ }
+ } else {
+ session_name = opt_session_name;
+ }
+
+ ret = disable_channels(session_name);