*/
static void usage(FILE *ofp)
{
- fprintf(ofp, "usage: lttng list [OPTIONS] [SESSION [<OPTIONS>]]\n");
+ fprintf(ofp, "usage: lttng list [OPTIONS] [SESSION [SESSION OPTIONS]]\n");
fprintf(ofp, "\n");
fprintf(ofp, "With no arguments, list available tracing session(s)\n");
fprintf(ofp, "\n");
int ret;
FILE *fp;
char *cmdline = NULL;
- char path[24]; /* Can't go bigger than /proc/65535/cmdline */
+ char path[20]; /* Can't go bigger than /proc/65535/cmdline */
snprintf(path, sizeof(path), "/proc/%d/cmdline", pid);
fp = fopen(path, "r");
/* Caller must free() *cmdline */
cmdline = malloc(PATH_MAX);
+ if (!cmdline) {
+ perror("malloc cmdline");
+ goto end;
+ }
ret = fread(cmdline, 1, PATH_MAX, fp);
if (ret < 0) {
perror("fread proc list");
cmdline = get_cmdline_by_pid(cur_pid);
MSG("\nPID: %d - Name: %s", cur_pid, cmdline);
free(cmdline);
+ /* Wipe current event since we are about to print a new PID. */
+ memset(&cur_event, 0, sizeof(cur_event));
}
if (strcmp(cur_event.name, event_field_list[i].event.name) != 0) {
print_events(&event_field_list[i].event);
goto end;
}
- if (opt_kernel) {
+ if (opt_kernel || opt_userspace) {
/* Channel listing */
ret = list_channels(opt_channel);
if (ret < 0) {