[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200901200655.GC470123@krava>
Date: Tue, 1 Sep 2020 22:06:55 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Adrian Hunter <adrian.hunter@...el.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Andi Kleen <ak@...ux.intel.com>,
Alexey Budankov <alexey.budankov@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
linux-kernel@...r.kernel.org, mpetlan@...hat.com
Subject: Re: [PATCH V2 4/6] perf tools: Add FIFO file names as alternative
options to --control
On Tue, Sep 01, 2020 at 12:37:56PM +0300, Adrian Hunter wrote:
SNIP
> + fd = open(s, O_RDWR | O_NONBLOCK | O_CLOEXEC);
> + if (fd < 0) {
> + pr_err("Failed to open '%s'\n", s);
> + ret = -errno;
> + goto out_free;
> + }
> + *ctl_fd = fd;
> + *ctl_fd_close = true;
> +
> + if (p && *++p) {
> + /* O_RDWR | O_NONBLOCK means the other end need not be open */
> + fd = open(p, O_RDWR | O_NONBLOCK | O_CLOEXEC);
> + if (fd < 0) {
> + pr_err("Failed to open '%s'\n", p);
> + ret = -errno;
> + goto out_free;
> + }
> + *ctl_fd_ack = fd;
> + }
> +
> +out_free:
> + free(s);
> + return ret;
> +}
> +
> +int evlist__parse_control(const char *str, int *ctl_fd, int *ctl_fd_ack, bool *ctl_fd_close)
> {
> char *comma = NULL, *endptr = NULL;
>
> if (strncmp(str, "fd:", 3))
> - return -EINVAL;
> + return evlist__parse_control_names(str, ctl_fd, ctl_fd_ack, ctl_fd_close);
could you please proactively set *ctl_fd_close = false in here,
so it's obvious.. also evlist__parse_control_fifo might be better
name, other that that it all looks great
we were recently asked to prvide faster intel_pt snapshot control
and we were thinking of putting input_pt support to libperf, but
your change might just fix this
for the patchset:
Acked-by: Jiri Olsa <jolsa@...hat.com>
Alexey, could you please check on this?
thanks,
jirka
>
> *ctl_fd = strtoul(&str[3], &endptr, 0);
> if (endptr == &str[3])
SNIP
Powered by blists - more mailing lists