Fix: enable-channel accepts mismatched option
[lttng-tools.git] / src / bin / lttng / commands / list.c
1 /*
2 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
3 *
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.
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 *
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.
16 */
17
18 #define _GNU_SOURCE
19 #include <inttypes.h>
20 #include <popt.h>
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
24 #include <assert.h>
25
26 #include "../command.h"
27
28 static int opt_userspace;
29 static int opt_kernel;
30 static char *opt_channel;
31 static int opt_domain;
32 static int opt_fields;
33 #if 0
34 /* Not implemented yet */
35 static char *opt_cmd_name;
36 static pid_t opt_pid;
37 #endif
38
39 const char *indent4 = " ";
40 const char *indent6 = " ";
41 const char *indent8 = " ";
42
43 enum {
44 OPT_HELP = 1,
45 OPT_USERSPACE,
46 OPT_LIST_OPTIONS,
47 };
48
49 static struct lttng_handle *handle;
50
51 static struct poptOption long_options[] = {
52 /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
53 {"help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
54 {"kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0},
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
62 {"channel", 'c', POPT_ARG_STRING, &opt_channel, 0, 0, 0},
63 {"domain", 'd', POPT_ARG_VAL, &opt_domain, 1, 0, 0},
64 {"fields", 'f', POPT_ARG_VAL, &opt_fields, 1, 0, 0},
65 {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
66 {0, 0, 0, 0, 0, 0, 0}
67 };
68
69 /*
70 * usage
71 */
72 static void usage(FILE *ofp)
73 {
74 fprintf(ofp, "usage: lttng list [OPTIONS] [SESSION [<OPTIONS>]]\n");
75 fprintf(ofp, "\n");
76 fprintf(ofp, "With no arguments, list available tracing session(s)\n");
77 fprintf(ofp, "\n");
78 fprintf(ofp, "Without a session, -k lists available kernel events\n");
79 fprintf(ofp, "Without a session, -u lists available userspace events\n");
80 fprintf(ofp, "\n");
81 fprintf(ofp, " -h, --help Show this help\n");
82 fprintf(ofp, " --list-options Simple listing of options\n");
83 fprintf(ofp, " -k, --kernel Select kernel domain\n");
84 fprintf(ofp, " -u, --userspace Select user-space domain.\n");
85 fprintf(ofp, " -f, --fields List event fields.\n");
86 #if 0
87 fprintf(ofp, " -p, --pid PID List user-space events by PID\n");
88 #endif
89 fprintf(ofp, "\n");
90 fprintf(ofp, "Session Options:\n");
91 fprintf(ofp, " -c, --channel NAME List details of a channel\n");
92 fprintf(ofp, " -d, --domain List available domain(s)\n");
93 fprintf(ofp, "\n");
94 }
95
96 /*
97 * Get command line from /proc for a specific pid.
98 *
99 * On success, return an allocated string pointer to the proc cmdline.
100 * On error, return NULL.
101 */
102 static char *get_cmdline_by_pid(pid_t pid)
103 {
104 int ret;
105 FILE *fp;
106 char *cmdline = NULL;
107 char path[24]; /* Can't go bigger than /proc/65535/cmdline */
108
109 snprintf(path, sizeof(path), "/proc/%d/cmdline", pid);
110 fp = fopen(path, "r");
111 if (fp == NULL) {
112 goto end;
113 }
114
115 /* Caller must free() *cmdline */
116 cmdline = malloc(PATH_MAX);
117 ret = fread(cmdline, 1, PATH_MAX, fp);
118 if (ret < 0) {
119 perror("fread proc list");
120 }
121 fclose(fp);
122
123 end:
124 return cmdline;
125 }
126
127 static
128 const char *active_string(int value)
129 {
130 switch (value) {
131 case 0: return " [inactive]";
132 case 1: return " [active]";
133 case -1: return "";
134 default: return NULL;
135 }
136 }
137
138 static
139 const char *enabled_string(int value)
140 {
141 switch (value) {
142 case 0: return " [disabled]";
143 case 1: return " [enabled]";
144 case -1: return "";
145 default: return NULL;
146 }
147 }
148
149 static
150 const char *filter_string(int value)
151 {
152 switch (value) {
153 case 1: return " [with filter]";
154 default: return "";
155 }
156 }
157
158 static const char *loglevel_string(int value)
159 {
160 switch (value) {
161 case -1:
162 return "";
163 case LTTNG_LOGLEVEL_EMERG:
164 return "TRACE_EMERG";
165 case LTTNG_LOGLEVEL_ALERT:
166 return "TRACE_ALERT";
167 case LTTNG_LOGLEVEL_CRIT:
168 return "TRACE_CRIT";
169 case LTTNG_LOGLEVEL_ERR:
170 return "TRACE_ERR";
171 case LTTNG_LOGLEVEL_WARNING:
172 return "TRACE_WARNING";
173 case LTTNG_LOGLEVEL_NOTICE:
174 return "TRACE_NOTICE";
175 case LTTNG_LOGLEVEL_INFO:
176 return "TRACE_INFO";
177 case LTTNG_LOGLEVEL_DEBUG_SYSTEM:
178 return "TRACE_DEBUG_SYSTEM";
179 case LTTNG_LOGLEVEL_DEBUG_PROGRAM:
180 return "TRACE_DEBUG_PROGRAM";
181 case LTTNG_LOGLEVEL_DEBUG_PROCESS:
182 return "TRACE_DEBUG_PROCESS";
183 case LTTNG_LOGLEVEL_DEBUG_MODULE:
184 return "TRACE_DEBUG_MODULE";
185 case LTTNG_LOGLEVEL_DEBUG_UNIT:
186 return "TRACE_DEBUG_UNIT";
187 case LTTNG_LOGLEVEL_DEBUG_FUNCTION:
188 return "TRACE_DEBUG_FUNCTION";
189 case LTTNG_LOGLEVEL_DEBUG_LINE:
190 return "TRACE_DEBUG_LINE";
191 case LTTNG_LOGLEVEL_DEBUG:
192 return "TRACE_DEBUG";
193 default:
194 return "<<UNKNOWN>>";
195 }
196 }
197
198 /*
199 * Pretty print single event.
200 */
201 static void print_events(struct lttng_event *event)
202 {
203 switch (event->type) {
204 case LTTNG_EVENT_TRACEPOINT:
205 {
206 if (event->loglevel != -1) {
207 MSG("%s%s (loglevel: %s (%d)) (type: tracepoint)%s%s",
208 indent6,
209 event->name,
210 loglevel_string(event->loglevel),
211 event->loglevel,
212 enabled_string(event->enabled),
213 filter_string(event->filter));
214 } else {
215 MSG("%s%s (type: tracepoint)%s%s",
216 indent6,
217 event->name,
218 enabled_string(event->enabled),
219 filter_string(event->filter));
220 }
221 break;
222 }
223 case LTTNG_EVENT_FUNCTION:
224 MSG("%s%s (type: function)%s%s", indent6,
225 event->name, enabled_string(event->enabled),
226 filter_string(event->filter));
227 if (event->attr.probe.addr != 0) {
228 MSG("%saddr: 0x%" PRIx64, indent8, event->attr.probe.addr);
229 } else {
230 MSG("%soffset: 0x%" PRIx64, indent8, event->attr.probe.offset);
231 MSG("%ssymbol: %s", indent8, event->attr.probe.symbol_name);
232 }
233 break;
234 case LTTNG_EVENT_PROBE:
235 MSG("%s%s (type: probe)%s%s", indent6,
236 event->name, enabled_string(event->enabled),
237 filter_string(event->filter));
238 if (event->attr.probe.addr != 0) {
239 MSG("%saddr: 0x%" PRIx64, indent8, event->attr.probe.addr);
240 } else {
241 MSG("%soffset: 0x%" PRIx64, indent8, event->attr.probe.offset);
242 MSG("%ssymbol: %s", indent8, event->attr.probe.symbol_name);
243 }
244 break;
245 case LTTNG_EVENT_FUNCTION_ENTRY:
246 MSG("%s%s (type: function)%s%s", indent6,
247 event->name, enabled_string(event->enabled),
248 filter_string(event->filter));
249 MSG("%ssymbol: \"%s\"", indent8, event->attr.ftrace.symbol_name);
250 break;
251 case LTTNG_EVENT_SYSCALL:
252 MSG("%ssyscalls (type: syscall)%s%s", indent6,
253 enabled_string(event->enabled),
254 filter_string(event->filter));
255 break;
256 case LTTNG_EVENT_NOOP:
257 MSG("%s (type: noop)%s%s", indent6,
258 enabled_string(event->enabled),
259 filter_string(event->filter));
260 break;
261 case LTTNG_EVENT_ALL:
262 /* We should never have "all" events in list. */
263 assert(0);
264 break;
265 }
266 }
267
268 static const char *field_type(struct lttng_event_field *field)
269 {
270 switch(field->type) {
271 case LTTNG_EVENT_FIELD_INTEGER:
272 return "integer";
273 case LTTNG_EVENT_FIELD_ENUM:
274 return "enum";
275 case LTTNG_EVENT_FIELD_FLOAT:
276 return "float";
277 case LTTNG_EVENT_FIELD_STRING:
278 return "string";
279 case LTTNG_EVENT_FIELD_OTHER:
280 default: /* fall-through */
281 return "unknown";
282 }
283 }
284
285 /*
286 * Pretty print single event fields.
287 */
288 static void print_event_field(struct lttng_event_field *field)
289 {
290 if (!field->field_name[0]) {
291 return;
292 }
293 MSG("%sfield: %s (%s)%s", indent8, field->field_name,
294 field_type(field), field->nowrite ? " [no write]" : "");
295 }
296
297 /*
298 * Ask session daemon for all user space tracepoints available.
299 */
300 static int list_ust_events(void)
301 {
302 int i, size;
303 struct lttng_domain domain;
304 struct lttng_handle *handle;
305 struct lttng_event *event_list;
306 pid_t cur_pid = 0;
307 char *cmdline = NULL;
308
309 memset(&domain, 0, sizeof(domain));
310
311 DBG("Getting UST tracing events");
312
313 domain.type = LTTNG_DOMAIN_UST;
314
315 handle = lttng_create_handle(NULL, &domain);
316 if (handle == NULL) {
317 goto error;
318 }
319
320 size = lttng_list_tracepoints(handle, &event_list);
321 if (size < 0) {
322 ERR("Unable to list UST events: %s", lttng_strerror(size));
323 lttng_destroy_handle(handle);
324 return size;
325 }
326
327 MSG("UST events:\n-------------");
328
329 if (size == 0) {
330 MSG("None");
331 }
332
333 for (i = 0; i < size; i++) {
334 if (cur_pid != event_list[i].pid) {
335 cur_pid = event_list[i].pid;
336 cmdline = get_cmdline_by_pid(cur_pid);
337 MSG("\nPID: %d - Name: %s", cur_pid, cmdline);
338 free(cmdline);
339 }
340 print_events(&event_list[i]);
341 }
342
343 MSG("");
344
345 free(event_list);
346 lttng_destroy_handle(handle);
347
348 return CMD_SUCCESS;
349
350 error:
351 lttng_destroy_handle(handle);
352 return -1;
353 }
354
355 /*
356 * Ask session daemon for all user space tracepoint fields available.
357 */
358 static int list_ust_event_fields(void)
359 {
360 int i, size;
361 struct lttng_domain domain;
362 struct lttng_handle *handle;
363 struct lttng_event_field *event_field_list;
364 pid_t cur_pid = 0;
365 char *cmdline = NULL;
366
367 struct lttng_event cur_event;
368
369 memset(&domain, 0, sizeof(domain));
370 memset(&cur_event, 0, sizeof(cur_event));
371
372 DBG("Getting UST tracing event fields");
373
374 domain.type = LTTNG_DOMAIN_UST;
375
376 handle = lttng_create_handle(NULL, &domain);
377 if (handle == NULL) {
378 goto error;
379 }
380
381 size = lttng_list_tracepoint_fields(handle, &event_field_list);
382 if (size < 0) {
383 ERR("Unable to list UST event fields: %s", lttng_strerror(size));
384 lttng_destroy_handle(handle);
385 return size;
386 }
387
388 MSG("UST events:\n-------------");
389
390 if (size == 0) {
391 MSG("None");
392 }
393
394 for (i = 0; i < size; i++) {
395 if (cur_pid != event_field_list[i].event.pid) {
396 cur_pid = event_field_list[i].event.pid;
397 cmdline = get_cmdline_by_pid(cur_pid);
398 MSG("\nPID: %d - Name: %s", cur_pid, cmdline);
399 free(cmdline);
400 }
401 if (strcmp(cur_event.name, event_field_list[i].event.name) != 0) {
402 print_events(&event_field_list[i].event);
403 memcpy(&cur_event, &event_field_list[i].event,
404 sizeof(cur_event));
405 }
406 print_event_field(&event_field_list[i]);
407 }
408
409 MSG("");
410
411 free(event_field_list);
412 lttng_destroy_handle(handle);
413
414 return CMD_SUCCESS;
415
416 error:
417 lttng_destroy_handle(handle);
418 return -1;
419 }
420
421 /*
422 * Ask for all trace events in the kernel and pretty print them.
423 */
424 static int list_kernel_events(void)
425 {
426 int i, size;
427 struct lttng_domain domain;
428 struct lttng_handle *handle;
429 struct lttng_event *event_list;
430
431 memset(&domain, 0, sizeof(domain));
432
433 DBG("Getting kernel tracing events");
434
435 domain.type = LTTNG_DOMAIN_KERNEL;
436
437 handle = lttng_create_handle(NULL, &domain);
438 if (handle == NULL) {
439 goto error;
440 }
441
442 size = lttng_list_tracepoints(handle, &event_list);
443 if (size < 0) {
444 ERR("Unable to list kernel events: %s", lttng_strerror(size));
445 lttng_destroy_handle(handle);
446 return size;
447 }
448
449 MSG("Kernel events:\n-------------");
450
451 for (i = 0; i < size; i++) {
452 print_events(&event_list[i]);
453 }
454
455 MSG("");
456
457 free(event_list);
458
459 lttng_destroy_handle(handle);
460 return CMD_SUCCESS;
461
462 error:
463 lttng_destroy_handle(handle);
464 return -1;
465 }
466
467 /*
468 * List events of channel of session and domain.
469 */
470 static int list_events(const char *channel_name)
471 {
472 int ret, count, i;
473 struct lttng_event *events = NULL;
474
475 count = lttng_list_events(handle, channel_name, &events);
476 if (count < 0) {
477 ret = count;
478 ERR("%s", lttng_strerror(ret));
479 goto error;
480 }
481
482 MSG("\n%sEvents:", indent4);
483 if (count == 0) {
484 MSG("%sNone\n", indent6);
485 goto end;
486 }
487
488 for (i = 0; i < count; i++) {
489 print_events(&events[i]);
490 }
491
492 MSG("");
493
494 end:
495 free(events);
496 ret = CMD_SUCCESS;
497
498 error:
499 return ret;
500 }
501
502 /*
503 * Pretty print channel
504 */
505 static void print_channel(struct lttng_channel *channel)
506 {
507 MSG("- %s:%s\n", channel->name, enabled_string(channel->enabled));
508
509 MSG("%sAttributes:", indent4);
510 MSG("%soverwrite mode: %d", indent6, channel->attr.overwrite);
511 MSG("%ssubbufers size: %" PRIu64, indent6, channel->attr.subbuf_size);
512 MSG("%snumber of subbufers: %" PRIu64, indent6, channel->attr.num_subbuf);
513 MSG("%sswitch timer interval: %u", indent6, channel->attr.switch_timer_interval);
514 MSG("%sread timer interval: %u", indent6, channel->attr.read_timer_interval);
515 switch (channel->attr.output) {
516 case LTTNG_EVENT_SPLICE:
517 MSG("%soutput: splice()", indent6);
518 break;
519 case LTTNG_EVENT_MMAP:
520 MSG("%soutput: mmap()", indent6);
521 break;
522 }
523 }
524
525 /*
526 * List channel(s) of session and domain.
527 *
528 * If channel_name is NULL, all channels are listed.
529 */
530 static int list_channels(const char *channel_name)
531 {
532 int count, i, ret = CMD_SUCCESS;
533 unsigned int chan_found = 0;
534 struct lttng_channel *channels = NULL;
535
536 DBG("Listing channel(s) (%s)", channel_name ? : "<all>");
537
538 count = lttng_list_channels(handle, &channels);
539 if (count < 0) {
540 switch (-count) {
541 case LTTNG_ERR_KERN_CHAN_NOT_FOUND:
542 ret = CMD_SUCCESS;
543 WARN("No kernel channel");
544 break;
545 default:
546 /* We had a real error */
547 ret = count;
548 ERR("%s", lttng_strerror(ret));
549 break;
550 }
551 goto error_channels;
552 }
553
554 if (channel_name == NULL) {
555 MSG("Channels:\n-------------");
556 }
557
558 for (i = 0; i < count; i++) {
559 if (channel_name != NULL) {
560 if (strncmp(channels[i].name, channel_name, NAME_MAX) == 0) {
561 chan_found = 1;
562 } else {
563 continue;
564 }
565 }
566 print_channel(&channels[i]);
567
568 /* Listing events per channel */
569 ret = list_events(channels[i].name);
570 if (ret < 0) {
571 ERR("%s", lttng_strerror(ret));
572 }
573
574 if (chan_found) {
575 break;
576 }
577 }
578
579 if (!chan_found && channel_name != NULL) {
580 ERR("Channel %s not found", channel_name);
581 goto error;
582 }
583
584 ret = CMD_SUCCESS;
585
586 error:
587 free(channels);
588
589 error_channels:
590 return ret;
591 }
592
593 /*
594 * List available tracing session. List only basic information.
595 *
596 * If session_name is NULL, all sessions are listed.
597 */
598 static int list_sessions(const char *session_name)
599 {
600 int ret, count, i;
601 unsigned int session_found = 0;
602 struct lttng_session *sessions;
603
604 count = lttng_list_sessions(&sessions);
605 DBG("Session count %d", count);
606 if (count < 0) {
607 ret = count;
608 ERR("%s", lttng_strerror(ret));
609 goto error;
610 } else if (count == 0) {
611 MSG("Currently no available tracing session");
612 goto end;
613 }
614
615 if (session_name == NULL) {
616 MSG("Available tracing sessions:");
617 }
618
619 for (i = 0; i < count; i++) {
620 if (session_name != NULL) {
621 if (strncmp(sessions[i].name, session_name, NAME_MAX) == 0) {
622 session_found = 1;
623 MSG("Tracing session %s:%s", session_name, active_string(sessions[i].enabled));
624 MSG("%sTrace path: %s\n", indent4, sessions[i].path);
625 break;
626 }
627 continue;
628 }
629
630 MSG(" %d) %s (%s)%s", i + 1, sessions[i].name, sessions[i].path,
631 active_string(sessions[i].enabled));
632
633 if (session_found) {
634 break;
635 }
636 }
637
638 free(sessions);
639
640 if (!session_found && session_name != NULL) {
641 ERR("Session '%s' not found", session_name);
642 ret = CMD_ERROR;
643 goto error;
644 }
645
646 if (session_name == NULL) {
647 MSG("\nUse lttng list <session_name> for more details");
648 }
649
650 end:
651 return CMD_SUCCESS;
652
653 error:
654 return ret;
655 }
656
657 /*
658 * List available domain(s) for a session.
659 */
660 static int list_domains(const char *session_name)
661 {
662 int i, count, ret = CMD_SUCCESS;
663 struct lttng_domain *domains = NULL;
664
665 MSG("Domains:\n-------------");
666
667 count = lttng_list_domains(session_name, &domains);
668 if (count < 0) {
669 ret = count;
670 ERR("%s", lttng_strerror(ret));
671 goto error;
672 } else if (count == 0) {
673 MSG(" None");
674 goto end;
675 }
676
677 for (i = 0; i < count; i++) {
678 switch (domains[i].type) {
679 case LTTNG_DOMAIN_KERNEL:
680 MSG(" - Kernel");
681 break;
682 case LTTNG_DOMAIN_UST:
683 MSG(" - UST global");
684 break;
685 default:
686 break;
687 }
688 }
689
690 end:
691 free(domains);
692
693 error:
694 return ret;
695 }
696
697 /*
698 * The 'list <options>' first level command
699 */
700 int cmd_list(int argc, const char **argv)
701 {
702 int opt, ret = CMD_SUCCESS;
703 const char *session_name;
704 static poptContext pc;
705 struct lttng_domain domain;
706 struct lttng_domain *domains = NULL;
707
708 memset(&domain, 0, sizeof(domain));
709
710 if (argc < 1) {
711 usage(stderr);
712 ret = CMD_ERROR;
713 goto end;
714 }
715
716 pc = poptGetContext(NULL, argc, argv, long_options, 0);
717 poptReadDefaultConfig(pc, 0);
718
719 while ((opt = poptGetNextOpt(pc)) != -1) {
720 switch (opt) {
721 case OPT_HELP:
722 usage(stdout);
723 goto end;
724 case OPT_USERSPACE:
725 opt_userspace = 1;
726 break;
727 case OPT_LIST_OPTIONS:
728 list_cmd_options(stdout, long_options);
729 goto end;
730 default:
731 usage(stderr);
732 ret = CMD_UNDEFINED;
733 goto end;
734 }
735 }
736
737 /* Get session name (trailing argument) */
738 session_name = poptGetArg(pc);
739 DBG2("Session name: %s", session_name);
740
741 if (opt_kernel) {
742 domain.type = LTTNG_DOMAIN_KERNEL;
743 } else if (opt_userspace) {
744 DBG2("Listing userspace global domain");
745 domain.type = LTTNG_DOMAIN_UST;
746 }
747
748 if (opt_kernel || opt_userspace) {
749 handle = lttng_create_handle(session_name, &domain);
750 if (handle == NULL) {
751 ret = CMD_FATAL;
752 goto end;
753 }
754 }
755
756 if (session_name == NULL) {
757 if (!opt_kernel && !opt_userspace) {
758 ret = list_sessions(NULL);
759 if (ret != 0) {
760 goto end;
761 }
762 }
763 if (opt_kernel) {
764 ret = list_kernel_events();
765 if (ret < 0) {
766 ret = CMD_ERROR;
767 goto end;
768 }
769 }
770 if (opt_userspace) {
771 if (opt_fields) {
772 ret = list_ust_event_fields();
773 } else {
774 ret = list_ust_events();
775 }
776 if (ret < 0) {
777 ret = CMD_ERROR;
778 goto end;
779 }
780 }
781 } else {
782 /* List session attributes */
783 ret = list_sessions(session_name);
784 if (ret != 0) {
785 goto end;
786 }
787
788 /* Domain listing */
789 if (opt_domain) {
790 ret = list_domains(session_name);
791 goto end;
792 }
793
794 if (opt_kernel) {
795 /* Channel listing */
796 ret = list_channels(opt_channel);
797 if (ret < 0) {
798 goto end;
799 }
800 } else {
801 int i, nb_domain;
802
803 /* We want all domain(s) */
804 nb_domain = lttng_list_domains(session_name, &domains);
805 if (nb_domain < 0) {
806 ret = nb_domain;
807 ERR("%s", lttng_strerror(ret));
808 goto end;
809 }
810
811 for (i = 0; i < nb_domain; i++) {
812 switch (domains[i].type) {
813 case LTTNG_DOMAIN_KERNEL:
814 MSG("=== Domain: Kernel ===\n");
815 break;
816 case LTTNG_DOMAIN_UST:
817 MSG("=== Domain: UST global ===\n");
818 MSG("Buffer type: %s\n",
819 domains[i].buf_type ==
820 LTTNG_BUFFER_PER_PID ? "per PID" : "per UID");
821 break;
822 default:
823 MSG("=== Domain: Unimplemented ===\n");
824 break;
825 }
826
827 /* Clean handle before creating a new one */
828 if (handle) {
829 lttng_destroy_handle(handle);
830 }
831
832 handle = lttng_create_handle(session_name, &domains[i]);
833 if (handle == NULL) {
834 ret = CMD_FATAL;
835 goto end;
836 }
837
838 ret = list_channels(opt_channel);
839 if (ret < 0) {
840 goto end;
841 }
842 }
843 }
844 }
845
846 end:
847 free(domains);
848 if (handle) {
849 lttng_destroy_handle(handle);
850 }
851
852 poptFreeContext(pc);
853 return ret;
854 }
This page took 0.058199 seconds and 6 git commands to generate.