[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200831131927.GD406859@krava>
Date: Mon, 31 Aug 2020 15:19:27 +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
Subject: Re: [PATCH 4/6] perf tools: Add FIFO file names as alternative
options to --control
On Sat, Aug 29, 2020 at 01:50:13PM +0300, Adrian Hunter wrote:
SNIP
> + *p = '\0';
> +
> + /*
> + * O_RDWR avoids POLLHUPs which is necessary to allow the other
> + * end of a FIFO to be repeatedly opened and closed.
> + */
> + 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);
do we want to mention somewhere that the fifo name is everything
except for 'fd:' ?
also how likely is that we will add another channel type that
will need another keyword (likd 'fd:')? I originaly thought
we'd use 'fifo:filename' for this ... would be great to somehow
avoid future confusions
thanks,
jirka
Powered by blists - more mailing lists