*/
#define _GNU_SOURCE
+#define _LGPL_SOURCE
#include <inttypes.h>
#include <popt.h>
#include <stdio.h>
}
/* Caller must free() *cmdline */
- cmdline = malloc(PATH_MAX);
+ cmdline = zmalloc(PATH_MAX);
if (!cmdline) {
- perror("malloc cmdline");
+ PERROR("malloc cmdline");
goto end;
}
ret = fread(cmdline, 1, PATH_MAX, fp);
if (ret < 0) {
- perror("fread proc list");
+ PERROR("fread proc list");
}
end:
}
} else {
/* Pretty print */
- if (channel_name == NULL) {
+ if (count) {
MSG("Channels:\n-------------");
}
return ret;
}
+/*
+ * List tracker PID(s) of session and domain.
+ */
+static int list_tracker_pids(void)
+{
+ int enabled, ret;
+ int *pids = NULL;
+ size_t nr_pids, i;
+
+ ret = lttng_list_tracker_pids(handle,
+ &enabled, &pids, &nr_pids);
+ if (ret) {
+ return ret;
+ }
+ _MSG("PID tracker: [%s]", enabled ? "enabled" : "disabled");
+ if (enabled) {
+ _MSG(", pids: [");
+
+ for (i = 0; i < nr_pids; i++) {
+ if (i) {
+ _MSG(",");
+ }
+ _MSG(" %d", pids[i]);
+ }
+ _MSG(" ]");
+ }
+ _MSG("\n\n");
+ free(pids);
+ return 0;
+}
+
/*
* Machine interface
* Find the session with session_name as name
}
+ ret = list_tracker_pids();
+ if (ret) {
+ goto end;
+ }
+
ret = list_channels(opt_channel);
if (ret) {
goto end;
continue;
}
+ switch (domains[i].type) {
+ case LTTNG_DOMAIN_KERNEL:
+ case LTTNG_DOMAIN_UST:
+ ret = list_tracker_pids();
+ if (ret) {
+ goto end;
+ }
+ break;
+ default:
+ break;
+ }
+
ret = list_channels(opt_channel);
if (ret) {
goto end;