[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fXcdUYY8KBTTq3QNxkBF2K6YjuQGtLSujRoRfehgLLKgA@mail.gmail.com>
Date: Thu, 16 May 2024 09:11:15 -0700
From: Ian Rogers <irogers@...gle.com>
To: weilin.wang@...el.com
Cc: Namhyung Kim <namhyung@...nel.org>, Arnaldo Carvalho de Melo <acme@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>, Kan Liang <kan.liang@...ux.intel.com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
Perry Taylor <perry.taylor@...el.com>, Samantha Alt <samantha.alt@...el.com>,
Caleb Biggers <caleb.biggers@...el.com>
Subject: Re: [RFC PATCH v8 2/7] perf data: Allow to use given fd in data->file.fd
On Tue, May 14, 2024 at 10:44 PM <weilin.wang@...el.com> wrote:
>
> From: Weilin Wang <weilin.wang@...el.com>
>
> When in PIPE mode, allow to use fd dynamically opened and asigned to
> data->file.fd instead of STDIN_FILENO or STDOUT_FILENO.
>
> Signed-off-by: Weilin Wang <weilin.wang@...el.com>
Reviewed-by: Ian Rogers <irogers@...gle.com>
Thanks,
Ian
> ---
> tools/perf/util/data.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
> index 08c4bfbd817f..98661ede2a73 100644
> --- a/tools/perf/util/data.c
> +++ b/tools/perf/util/data.c
> @@ -204,7 +204,12 @@ static bool check_pipe(struct perf_data *data)
> data->file.fd = fd;
> data->use_stdio = false;
> }
> - } else {
> +
> + /*
> + * When is_pipe and data->file.fd is given, use given fd
> + * instead of STDIN_FILENO or STDOUT_FILENO
> + */
> + } else if (data->file.fd <= 0) {
> data->file.fd = fd;
> }
> }
> --
> 2.43.0
>
Powered by blists - more mailing lists