Skip to content

Commit a9a4ca5

Browse files
weilinwaacmel
authored andcommitted
perf data: Allow to use given fd in data->file.fd
When in PIPE mode, allow to use fd dynamically opened and asigned to data->file.fd instead of STDIN_FILENO or STDOUT_FILENO. Reviewed-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Weilin Wang <weilin.wang@intel.com> Acked-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Caleb Biggers <caleb.biggers@intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Perry Taylor <perry.taylor@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Samantha Alt <samantha.alt@intel.com> Link: https://lore.kernel.org/r/20240720062102.444578-3-weilin.wang@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 807746b commit a9a4ca5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/perf/util/data.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,12 @@ static bool check_pipe(struct perf_data *data)
204204
data->file.fd = fd;
205205
data->use_stdio = false;
206206
}
207-
} else {
207+
208+
/*
209+
* When is_pipe and data->file.fd is given, use given fd
210+
* instead of STDIN_FILENO or STDOUT_FILENO
211+
*/
212+
} else if (data->file.fd <= 0) {
208213
data->file.fd = fd;
209214
}
210215
}

0 commit comments

Comments
 (0)