Update version to 2.0-pre22
[lttng-tools.git] / src / bin / lttng / commands / list.c
CommitLineData
f3ed775e
DG
1/*
2 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
82a3637f
DG
6 * as published by the Free Software Foundation; only version 2
7 * of the License.
f3ed775e
DG
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#define _GNU_SOURCE
9f19cc17 20#include <inttypes.h>
f3ed775e
DG
21#include <popt.h>
22#include <stdio.h>
23#include <stdlib.h>
24#include <string.h>
7a3d1328 25#include <assert.h>
f3ed775e 26
c399183f 27#include "../command.h"
f3ed775e 28
9f19cc17
DG
29static int opt_userspace;
30static int opt_kernel;
31static char *opt_channel;
32static int opt_domain;
d78d6610
DG
33#if 0
34/* Not implemented yet */
35static char *opt_cmd_name;
36static pid_t opt_pid;
37#endif
9f19cc17
DG
38
39const char *indent4 = " ";
40const char *indent6 = " ";
41const char *indent8 = " ";
f3ed775e
DG
42
43enum {
44 OPT_HELP = 1,
eeac7d46 45 OPT_USERSPACE,
679b4943 46 OPT_LIST_OPTIONS,
f3ed775e
DG
47};
48
cd80958d
DG
49static struct lttng_handle *handle;
50
f3ed775e
DG
51static struct poptOption long_options[] = {
52 /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
53 {"help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
9f19cc17 54 {"kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0},
d78d6610
DG
55#if 0
56 /* Not implemented yet */
57 {"userspace", 'u', POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_cmd_name, OPT_USERSPACE, 0, 0},
58 {"pid", 'p', POPT_ARG_INT, &opt_pid, 0, 0, 0},
59#else
60 {"userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0},
61#endif
9f19cc17
DG
62 {"channel", 'c', POPT_ARG_STRING, &opt_channel, 0, 0, 0},
63 {"domain", 'd', POPT_ARG_VAL, &opt_domain, 1, 0, 0},
679b4943 64 {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
f3ed775e
DG
65 {0, 0, 0, 0, 0, 0, 0}
66};
67
68/*
69 * usage
70 */
71static void usage(FILE *ofp)
72{
27221701 73 fprintf(ofp, "usage: lttng list [OPTIONS] [SESSION [<OPTIONS>]]\n");
9f19cc17
DG
74 fprintf(ofp, "\n");
75 fprintf(ofp, "With no arguments, list available tracing session(s)\n");
76 fprintf(ofp, "\n");
27221701
DG
77 fprintf(ofp, "Without a session, -k lists available kernel events\n");
78 fprintf(ofp, "Without a session, -u lists available userspace events\n");
9f19cc17
DG
79 fprintf(ofp, "\n");
80 fprintf(ofp, " -h, --help Show this help\n");
27221701 81 fprintf(ofp, " --list-options Simple listing of options\n");
9f19cc17
DG
82 fprintf(ofp, " -k, --kernel Select kernel domain\n");
83 fprintf(ofp, " -u, --userspace Select user-space domain.\n");
d78d6610 84#if 0
9f19cc17 85 fprintf(ofp, " -p, --pid PID List user-space events by PID\n");
d78d6610 86#endif
f3ed775e 87 fprintf(ofp, "\n");
27221701 88 fprintf(ofp, "Session Options:\n");
9f19cc17
DG
89 fprintf(ofp, " -c, --channel NAME List details of a channel\n");
90 fprintf(ofp, " -d, --domain List available domain(s)\n");
f3ed775e
DG
91 fprintf(ofp, "\n");
92}
93
94/*
9f19cc17 95 * Get command line from /proc for a specific pid.
f3ed775e 96 *
9f19cc17
DG
97 * On success, return an allocated string pointer to the proc cmdline.
98 * On error, return NULL.
f3ed775e
DG
99 */
100static char *get_cmdline_by_pid(pid_t pid)
101{
102 int ret;
103 FILE *fp;
104 char *cmdline = NULL;
105 char path[24]; /* Can't go bigger than /proc/65535/cmdline */
106
107 snprintf(path, sizeof(path), "/proc/%d/cmdline", pid);
108 fp = fopen(path, "r");
109 if (fp == NULL) {
110 goto end;
111 }
112
113 /* Caller must free() *cmdline */
114 cmdline = malloc(PATH_MAX);
115 ret = fread(cmdline, 1, PATH_MAX, fp);
f40799e8
DG
116 if (ret < 0) {
117 perror("fread proc list");
118 }
f3ed775e
DG
119 fclose(fp);
120
121end:
122 return cmdline;
123}
b551a063 124
464dd62d
MD
125static
126const char *active_string(int value)
127{
128 switch (value) {
b09f0429
MD
129 case 0: return " [inactive]";
130 case 1: return " [active]";
464dd62d
MD
131 case -1: return "";
132 default: return NULL;
133 }
134}
135
136static
137const char *enabled_string(int value)
138{
139 switch (value) {
b09f0429
MD
140 case 0: return " [disabled]";
141 case 1: return " [enabled]";
464dd62d
MD
142 case -1: return "";
143 default: return NULL;
144 }
145}
146
8005f29a
MD
147static const char *loglevel_string(int value)
148{
149 switch (value) {
255a5dab
MD
150 case -1:
151 return "";
152 case LTTNG_LOGLEVEL_EMERG:
153 return "TRACE_EMERG";
154 case LTTNG_LOGLEVEL_ALERT:
155 return "TRACE_ALERT";
156 case LTTNG_LOGLEVEL_CRIT:
157 return "TRACE_CRIT";
158 case LTTNG_LOGLEVEL_ERR:
159 return "TRACE_ERR";
160 case LTTNG_LOGLEVEL_WARNING:
161 return "TRACE_WARNING";
162 case LTTNG_LOGLEVEL_NOTICE:
163 return "TRACE_NOTICE";
164 case LTTNG_LOGLEVEL_INFO:
165 return "TRACE_INFO";
166 case LTTNG_LOGLEVEL_DEBUG_SYSTEM:
167 return "TRACE_DEBUG_SYSTEM";
168 case LTTNG_LOGLEVEL_DEBUG_PROGRAM:
169 return "TRACE_DEBUG_PROGRAM";
170 case LTTNG_LOGLEVEL_DEBUG_PROCESS:
171 return "TRACE_DEBUG_PROCESS";
172 case LTTNG_LOGLEVEL_DEBUG_MODULE:
173 return "TRACE_DEBUG_MODULE";
174 case LTTNG_LOGLEVEL_DEBUG_UNIT:
175 return "TRACE_DEBUG_UNIT";
176 case LTTNG_LOGLEVEL_DEBUG_FUNCTION:
177 return "TRACE_DEBUG_FUNCTION";
178 case LTTNG_LOGLEVEL_DEBUG_LINE:
179 return "TRACE_DEBUG_LINE";
180 case LTTNG_LOGLEVEL_DEBUG:
181 return "TRACE_DEBUG";
182 default:
183 return "<<UNKNOWN>>";
8005f29a
MD
184 }
185}
186
b551a063
DG
187/*
188 * Pretty print single event.
189 */
190static void print_events(struct lttng_event *event)
191{
192 switch (event->type) {
193 case LTTNG_EVENT_TRACEPOINT:
e4baff1e 194 {
8b703175
MD
195 if (event->loglevel != -1) {
196 MSG("%s%s (loglevel: %s (%d)) (type: tracepoint)%s",
197 indent6,
81afa345 198 event->name,
8005f29a 199 loglevel_string(event->loglevel),
8b703175 200 event->loglevel,
81afa345 201 enabled_string(event->enabled));
8b703175
MD
202 } else {
203 MSG("%s%s (type: tracepoint)%s",
204 indent6,
205 event->name,
206 enabled_string(event->enabled));
207 }
b551a063 208 break;
e4baff1e 209 }
b551a063 210 case LTTNG_EVENT_PROBE:
464dd62d
MD
211 MSG("%s%s (type: probe)%s", indent6,
212 event->name, enabled_string(event->enabled));
b551a063
DG
213 if (event->attr.probe.addr != 0) {
214 MSG("%saddr: 0x%" PRIx64, indent8, event->attr.probe.addr);
215 } else {
216 MSG("%soffset: 0x%" PRIx64, indent8, event->attr.probe.offset);
217 MSG("%ssymbol: %s", indent8, event->attr.probe.symbol_name);
218 }
219 break;
220 case LTTNG_EVENT_FUNCTION:
221 case LTTNG_EVENT_FUNCTION_ENTRY:
464dd62d
MD
222 MSG("%s%s (type: function)%s", indent6,
223 event->name, enabled_string(event->enabled));
b551a063
DG
224 MSG("%ssymbol: \"%s\"", indent8, event->attr.ftrace.symbol_name);
225 break;
226 case LTTNG_EVENT_SYSCALL:
2c425ff7 227 MSG("%ssyscalls (type: syscall)%s", indent6,
464dd62d 228 enabled_string(event->enabled));
b551a063
DG
229 break;
230 case LTTNG_EVENT_NOOP:
464dd62d
MD
231 MSG("%s (type: noop)%s", indent6,
232 enabled_string(event->enabled));
b551a063
DG
233 break;
234 case LTTNG_EVENT_ALL:
235 /* We should never have "all" events in list. */
236 assert(0);
237 break;
238 }
239}
240
241/*
242 * Ask session daemon for all user space tracepoints available.
243 */
244static int list_ust_events(void)
245{
246 int i, size;
247 struct lttng_domain domain;
248 struct lttng_handle *handle;
249 struct lttng_event *event_list;
250 pid_t cur_pid = 0;
251
441c16a7
MD
252 memset(&domain, 0, sizeof(domain));
253
b551a063
DG
254 DBG("Getting UST tracing events");
255
256 domain.type = LTTNG_DOMAIN_UST;
257
258 handle = lttng_create_handle(NULL, &domain);
259 if (handle == NULL) {
260 goto error;
261 }
262
263 size = lttng_list_tracepoints(handle, &event_list);
264 if (size < 0) {
265 ERR("Unable to list UST events");
ef021732 266 lttng_destroy_handle(handle);
b551a063
DG
267 return size;
268 }
269
270 MSG("UST events:\n-------------");
271
272 if (size == 0) {
273 MSG("None");
274 }
275
276 for (i = 0; i < size; i++) {
277 if (cur_pid != event_list[i].pid) {
278 cur_pid = event_list[i].pid;
279 MSG("\nPID: %d - Name: %s", cur_pid, get_cmdline_by_pid(cur_pid));
280 }
281 print_events(&event_list[i]);
282 }
283
284 MSG("");
285
286 free(event_list);
ef021732 287 lttng_destroy_handle(handle);
b551a063
DG
288
289 return CMD_SUCCESS;
290
291error:
ef021732 292 lttng_destroy_handle(handle);
b551a063
DG
293 return -1;
294}
f3ed775e
DG
295
296/*
9f19cc17 297 * Ask for all trace events in the kernel and pretty print them.
f3ed775e 298 */
9f19cc17 299static int list_kernel_events(void)
f3ed775e 300{
9f19cc17 301 int i, size;
b551a063
DG
302 struct lttng_domain domain;
303 struct lttng_handle *handle;
9f19cc17 304 struct lttng_event *event_list;
f3ed775e 305
441c16a7
MD
306 memset(&domain, 0, sizeof(domain));
307
b551a063
DG
308 DBG("Getting kernel tracing events");
309
310 domain.type = LTTNG_DOMAIN_KERNEL;
311
312 handle = lttng_create_handle(NULL, &domain);
313 if (handle == NULL) {
314 goto error;
315 }
f3ed775e 316
cd80958d 317 size = lttng_list_tracepoints(handle, &event_list);
9f19cc17
DG
318 if (size < 0) {
319 ERR("Unable to list kernel events");
ef021732 320 lttng_destroy_handle(handle);
9f19cc17 321 return size;
f3ed775e
DG
322 }
323
9f19cc17 324 MSG("Kernel events:\n-------------");
f3ed775e 325
9f19cc17 326 for (i = 0; i < size; i++) {
b551a063 327 print_events(&event_list[i]);
f3ed775e
DG
328 }
329
b551a063
DG
330 MSG("");
331
f3ed775e
DG
332 free(event_list);
333
ef021732 334 lttng_destroy_handle(handle);
f3ed775e 335 return CMD_SUCCESS;
b551a063
DG
336
337error:
ef021732 338 lttng_destroy_handle(handle);
b551a063 339 return -1;
f3ed775e
DG
340}
341
342/*
9f19cc17 343 * List events of channel of session and domain.
f3ed775e 344 */
cd80958d 345static int list_events(const char *channel_name)
f3ed775e
DG
346{
347 int ret, count, i;
9f19cc17 348 struct lttng_event *events = NULL;
f3ed775e 349
cd80958d 350 count = lttng_list_events(handle, channel_name, &events);
f3ed775e
DG
351 if (count < 0) {
352 ret = count;
353 goto error;
354 }
355
9f19cc17
DG
356 MSG("\n%sEvents:", indent4);
357 if (count == 0) {
5edd7e09 358 MSG("%sNone\n", indent6);
9f19cc17
DG
359 goto end;
360 }
361
f3ed775e 362 for (i = 0; i < count; i++) {
b551a063 363 print_events(&events[i]);
f3ed775e
DG
364 }
365
9f19cc17 366 MSG("");
f3ed775e 367
9f19cc17
DG
368end:
369 if (events) {
370 free(events);
371 }
372 ret = CMD_SUCCESS;
f3ed775e
DG
373
374error:
375 return ret;
376}
377
378/*
9f19cc17
DG
379 * Pretty print channel
380 */
381static void print_channel(struct lttng_channel *channel)
382{
464dd62d 383 MSG("- %s:%s\n", channel->name, enabled_string(channel->enabled));
9f19cc17
DG
384
385 MSG("%sAttributes:", indent4);
386 MSG("%soverwrite mode: %d", indent6, channel->attr.overwrite);
387 MSG("%ssubbufers size: %" PRIu64, indent6, channel->attr.subbuf_size);
388 MSG("%snumber of subbufers: %" PRIu64, indent6, channel->attr.num_subbuf);
389 MSG("%sswitch timer interval: %u", indent6, channel->attr.switch_timer_interval);
390 MSG("%sread timer interval: %u", indent6, channel->attr.read_timer_interval);
391 switch (channel->attr.output) {
392 case LTTNG_EVENT_SPLICE:
393 MSG("%soutput: splice()", indent6);
394 break;
395 case LTTNG_EVENT_MMAP:
396 MSG("%soutput: mmap()", indent6);
397 break;
398 }
399}
400
401/*
402 * List channel(s) of session and domain.
f3ed775e 403 *
9f19cc17 404 * If channel_name is NULL, all channels are listed.
f3ed775e 405 */
cd80958d 406static int list_channels(const char *channel_name)
f3ed775e 407{
9f19cc17
DG
408 int count, i, ret = CMD_SUCCESS;
409 unsigned int chan_found = 0;
410 struct lttng_channel *channels = NULL;
f3ed775e 411
3e25cb20 412 DBG("Listing channel(s) (%s)", channel_name ? : "<all>");
9f19cc17 413
cd80958d 414 count = lttng_list_channels(handle, &channels);
f3ed775e
DG
415 if (count < 0) {
416 ret = count;
ae856491 417 goto error_channels;
9f19cc17 418 } else if (count == 0) {
ae856491
DG
419 ERR("Channel %s not found", channel_name);
420 goto error;
f3ed775e
DG
421 }
422
9f19cc17
DG
423 if (channel_name == NULL) {
424 MSG("Channels:\n-------------");
425 }
426
427 for (i = 0; i < count; i++) {
428 if (channel_name != NULL) {
429 if (strncmp(channels[i].name, channel_name, NAME_MAX) == 0) {
430 chan_found = 1;
431 } else {
432 continue;
433 }
434 }
435 print_channel(&channels[i]);
436
437 /* Listing events per channel */
cd80958d 438 ret = list_events(channels[i].name);
9f19cc17 439 if (ret < 0) {
9a745bc7 440 MSG("%s", lttng_strerror(ret));
9f19cc17
DG
441 }
442
443 if (chan_found) {
444 break;
f3ed775e 445 }
f3ed775e
DG
446 }
447
9f19cc17 448 if (!chan_found && channel_name != NULL) {
ae856491
DG
449 ERR("Channel %s not found", channel_name);
450 goto error;
9f19cc17 451 }
f3ed775e 452
9f19cc17 453 ret = CMD_SUCCESS;
f3ed775e
DG
454
455error:
ae856491
DG
456 free(channels);
457
458error_channels:
f3ed775e
DG
459 return ret;
460}
461
462/*
9f19cc17 463 * List available tracing session. List only basic information.
f3ed775e 464 *
9f19cc17 465 * If session_name is NULL, all sessions are listed.
f3ed775e 466 */
9f19cc17 467static int list_sessions(const char *session_name)
f3ed775e 468{
9f19cc17
DG
469 int ret, count, i;
470 unsigned int session_found = 0;
471 struct lttng_session *sessions;
472
473 count = lttng_list_sessions(&sessions);
474 DBG("Session count %d", count);
475 if (count < 0) {
476 ret = count;
477 goto error;
478 }
479
480 if (session_name == NULL) {
481 MSG("Available tracing sessions:");
482 }
483
484 for (i = 0; i < count; i++) {
485 if (session_name != NULL) {
486 if (strncmp(sessions[i].name, session_name, NAME_MAX) == 0) {
487 session_found = 1;
464dd62d 488 MSG("Tracing session %s:%s", session_name, active_string(sessions[i].enabled));
9f19cc17
DG
489 MSG("%sTrace path: %s\n", indent4, sessions[i].path);
490 break;
491 }
cd80958d 492 continue;
9f19cc17
DG
493 }
494
b6913340
DG
495 MSG(" %d) %s (%s)%s", i + 1, sessions[i].name, sessions[i].path,
496 active_string(sessions[i].enabled));
9f19cc17
DG
497
498 if (session_found) {
499 break;
500 }
501 }
502
503 free(sessions);
504
505 if (!session_found && session_name != NULL) {
b6913340
DG
506 ERR("Session '%s' not found", session_name);
507 ret = CMD_ERROR;
508 goto error;
9f19cc17
DG
509 }
510
511 if (session_name == NULL) {
6e0de39b 512 MSG("\nUse lttng list <session_name> for more details");
9f19cc17 513 }
f3ed775e
DG
514
515 return CMD_SUCCESS;
516
517error:
518 return ret;
519}
f3ed775e
DG
520
521/*
9f19cc17 522 * List available domain(s) for a session.
f3ed775e 523 */
330be774 524static int list_domains(const char *session_name)
f3ed775e 525{
9f19cc17
DG
526 int i, count, ret = CMD_SUCCESS;
527 struct lttng_domain *domains = NULL;
528
529 MSG("Domains:\n-------------");
530
330be774 531 count = lttng_list_domains(session_name, &domains);
9f19cc17
DG
532 if (count < 0) {
533 ret = count;
534 goto error;
535 } else if (count == 0) {
536 MSG(" None");
537 goto end;
538 }
539
540 for (i = 0; i < count; i++) {
541 switch (domains[i].type) {
542 case LTTNG_DOMAIN_KERNEL:
543 MSG(" - Kernel");
b551a063
DG
544 break;
545 case LTTNG_DOMAIN_UST:
546 MSG(" - UST global");
547 break;
9f19cc17
DG
548 default:
549 break;
550 }
551 }
552
553end:
554 free(domains);
555
556error:
557 return ret;
f3ed775e 558}
f3ed775e
DG
559
560/*
9f19cc17 561 * The 'list <options>' first level command
f3ed775e
DG
562 */
563int cmd_list(int argc, const char **argv)
564{
9f19cc17 565 int opt, i, ret = CMD_SUCCESS;
c3919711 566 int nb_domain;
9f19cc17 567 const char *session_name;
f3ed775e 568 static poptContext pc;
9f19cc17
DG
569 struct lttng_domain domain;
570 struct lttng_domain *domains = NULL;
f3ed775e 571
441c16a7
MD
572 memset(&domain, 0, sizeof(domain));
573
9f19cc17 574 if (argc < 1) {
f3ed775e 575 usage(stderr);
ca1c3607 576 ret = CMD_ERROR;
f3ed775e
DG
577 goto end;
578 }
579
580 pc = poptGetContext(NULL, argc, argv, long_options, 0);
581 poptReadDefaultConfig(pc, 0);
582
583 while ((opt = poptGetNextOpt(pc)) != -1) {
584 switch (opt) {
585 case OPT_HELP:
ca1c3607 586 usage(stdout);
f3ed775e 587 goto end;
eeac7d46
MD
588 case OPT_USERSPACE:
589 opt_userspace = 1;
eeac7d46 590 break;
679b4943
SM
591 case OPT_LIST_OPTIONS:
592 list_cmd_options(stdout, long_options);
679b4943 593 goto end;
f3ed775e
DG
594 default:
595 usage(stderr);
596 ret = CMD_UNDEFINED;
597 goto end;
598 }
599 }
600
9f19cc17
DG
601 /* Get session name (trailing argument) */
602 session_name = poptGetArg(pc);
b551a063 603 DBG2("Session name: %s", session_name);
9f19cc17 604
cd80958d
DG
605 if (opt_kernel) {
606 domain.type = LTTNG_DOMAIN_KERNEL;
b551a063
DG
607 } else if (opt_userspace) {
608 DBG2("Listing userspace global domain");
609 domain.type = LTTNG_DOMAIN_UST;
cd80958d
DG
610 }
611
aa5de748
MD
612 if (opt_kernel || opt_userspace) {
613 handle = lttng_create_handle(session_name, &domain);
614 if (handle == NULL) {
615 ret = CMD_FATAL;
616 goto end;
617 }
cd80958d
DG
618 }
619
9f19cc17 620 if (session_name == NULL) {
b551a063
DG
621 if (!opt_kernel && !opt_userspace) {
622 ret = list_sessions(NULL);
b6913340 623 if (ret != 0) {
b551a063
DG
624 goto end;
625 }
626 }
9f19cc17
DG
627 if (opt_kernel) {
628 ret = list_kernel_events();
629 if (ret < 0) {
630 goto end;
631 }
b551a063
DG
632 }
633 if (opt_userspace) {
634 ret = list_ust_events();
9f19cc17
DG
635 if (ret < 0) {
636 goto end;
637 }
638 }
639 } else {
640 /* List session attributes */
641 ret = list_sessions(session_name);
b6913340 642 if (ret != 0) {
9f19cc17
DG
643 goto end;
644 }
645
646 /* Domain listing */
647 if (opt_domain) {
330be774 648 ret = list_domains(session_name);
9f19cc17
DG
649 goto end;
650 }
651
652 if (opt_kernel) {
9f19cc17 653 /* Channel listing */
cd80958d 654 ret = list_channels(opt_channel);
9f19cc17
DG
655 if (ret < 0) {
656 goto end;
657 }
9f19cc17
DG
658 } else {
659 /* We want all domain(s) */
330be774 660 nb_domain = lttng_list_domains(session_name, &domains);
b551a063 661 if (nb_domain < 0) {
67635185 662 ret = nb_domain;
9f19cc17
DG
663 goto end;
664 }
665
b551a063 666 for (i = 0; i < nb_domain; i++) {
9f19cc17
DG
667 switch (domains[i].type) {
668 case LTTNG_DOMAIN_KERNEL:
669 MSG("=== Domain: Kernel ===\n");
670 break;
b551a063
DG
671 case LTTNG_DOMAIN_UST:
672 MSG("=== Domain: UST global ===\n");
673 break;
9f19cc17
DG
674 default:
675 MSG("=== Domain: Unimplemented ===\n");
676 break;
677 }
678
cd80958d 679 /* Clean handle before creating a new one */
aa5de748
MD
680 if (handle) {
681 lttng_destroy_handle(handle);
682 }
cd80958d
DG
683
684 handle = lttng_create_handle(session_name, &domains[i]);
685 if (handle == NULL) {
ca1c3607 686 ret = CMD_FATAL;
cd80958d
DG
687 goto end;
688 }
689
690 ret = list_channels(opt_channel);
9f19cc17
DG
691 if (ret < 0) {
692 goto end;
693 }
694 }
695 }
f3ed775e
DG
696 }
697
698end:
9f19cc17
DG
699 if (domains) {
700 free(domains);
701 }
aa5de748
MD
702 if (handle) {
703 lttng_destroy_handle(handle);
704 }
cd80958d 705
ca1c3607 706 poptFreeContext(pc);
f3ed775e
DG
707 return ret;
708}
This page took 0.067415 seconds and 4 git commands to generate.