+ * process_opt_kernel_list_events
+ *
+ * Ask for all trace events in the kernel and pretty print them.
+ */
+static int process_opt_kernel_list_events(void)
+{
+ int ret, pos, size;
+ char *event_list, *event, *ptr;
+
+ DBG("Getting all tracing events");
+
+ ret = lttng_kernel_list_events(&event_list);
+ if (ret < 0) {
+ ERR("Unable to list events.");
+ return ret;
+ }
+
+ MSG("Kernel tracepoints:\n-------------");
+
+ ptr = event_list;
+ while ((size = sscanf(ptr, "event { name = %m[^;]; };%n\n", &event, &pos)) == 1) {
+ MSG(" - %s", event);
+ /* Move pointer to the next line */
+ ptr += pos + 1;
+ free(event);
+ }
+
+ free(event_list);
+
+ return 0;
+}
+
+/*
+ * process_opt_kernel_event