- switch (opt_event_type) {
- case LTTNG_EVENT_TRACEPOINT:
- MSG("All %s tracepoints are enabled in channel %s for loglevel %s",
- opt_kernel ? "kernel" : "UST", channel_name,
- opt_loglevel ? : "<all>");
- break;
- case LTTNG_EVENT_SYSCALL:
- if (opt_kernel) {
- MSG("All kernel system calls are enabled in channel %s",
- channel_name);
+ switch (opt_event_type) {
+ case LTTNG_EVENT_TRACEPOINT:
+ if (opt_loglevel) {
+ MSG("All %s tracepoints are enabled in channel %s for loglevel %s",
+ opt_kernel ? "kernel" : "UST", channel_name,
+ opt_loglevel);
+ } else {
+ MSG("All %s tracepoints are enabled in channel %s",
+ opt_kernel ? "kernel" : "UST", channel_name);
+
+ }
+ break;
+ case LTTNG_EVENT_SYSCALL:
+ if (opt_kernel) {
+ MSG("All kernel system calls are enabled in channel %s",
+ channel_name);
+ }
+ break;
+ case LTTNG_EVENT_ALL:
+ if (opt_loglevel) {
+ MSG("All %s events are enabled in channel %s for loglevel %s",
+ opt_kernel ? "kernel" : "UST", channel_name,
+ opt_loglevel);
+ } else {
+ MSG("All %s events are enabled in channel %s",
+ opt_kernel ? "kernel" : "UST", channel_name);
+ }
+ break;
+ default:
+ /*
+ * We should not be here since lttng_enable_event should have
+ * failed on the event type.
+ */
+ goto error;
+ }
+ }
+ if (opt_filter) {
+ ret = lttng_enable_event_with_filter(handle, &ev, channel_name,
+ opt_filter);
+ if (ret < 0) {
+ fprintf(stderr, "Ret filter: %d\n", ret);
+ switch (-ret) {
+ case LTTNG_ERR_FILTER_EXIST:
+ WARN("Filter on events is already enabled"
+ " (channel %s, session %s)",
+ channel_name, session_name);
+ break;
+ case LTTNG_ERR_FILTER_INVAL:
+ case LTTNG_ERR_FILTER_NOMEM:
+ ERR("%s", lttng_strerror(ret));
+ default:
+ ERR("Setting filter: '%s'", opt_filter);
+ break;
+ }
+ goto error;
+ } else {
+ MSG("Filter '%s' successfully set", opt_filter);