Re: [PATCH 1/2] [BUGFIX] perf probe: Fix --list option to show events only with uprobe events

From: Namhyung Kim
Date: Wed Aug 13 2014 - 01:22:43 EST


Hi Masami,

On Wed, 13 Aug 2014 00:50:55 +0000, Masami Hiramatsu wrote:
> + if (kp_fd < 0 && up_fd < 0) {
> + /* Both kprobes and uprobes are disabled, warn it. */
> + if (kp_fd == -ENOTSUP && up_fd == -ENOTSUP)
> + pr_warning("Debugfs is not mounted.\n");
> + else if (kp_fd == -ENOENT && up_fd == -ENOENT)
> + pr_warning("Please rebuild kernel with "
> + "CONFIG_KPROBE_EVENTS or/and "
> + "CONFIG_UPROBE_EVENTS.\n");
> + else
> + pr_warning("Failed to open kprobe events: %s.\n" \
> + "Failed to open uprobe events: %s.\n",
> + strerror(-kp_fd), strerror(-up_fd));

It seems the second strerror() might overwrite the message of the
first. You'd better using strerror_r() IMHO.

Thanks,
Namhyung


> + ret = kp_fd;
> + goto out;
> }
>
> + if (up_fd >= 0) {
> + ret = __show_perf_probe_events(up_fd, false);
> + close(up_fd);
> + }
> +out:
> exit_symbol_maps();
> return ret;
> }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/