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