summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/trace-event-read.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/trace-event-read.c')
-rw-r--r--tools/perf/util/trace-event-read.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c
index 44889c9b5630..43f19c1fed3a 100644
--- a/tools/perf/util/trace-event-read.c
+++ b/tools/perf/util/trace-event-read.c
@@ -51,6 +51,7 @@ static int long_size;
static unsigned long page_size;
static ssize_t calc_data_size;
+static bool repipe;
static int do_read(int fd, void *buf, int size)
{
@@ -62,6 +63,13 @@ static int do_read(int fd, void *buf, int size)
if (ret <= 0)
return -1;
+ if (repipe) {
+ int retw = write(STDOUT_FILENO, buf, ret);
+
+ if (retw <= 0 || retw != ret)
+ die("repiping input file");
+ }
+
size -= ret;
buf += ret;
}
@@ -116,6 +124,13 @@ static char *read_string(void)
if (!r)
die("no data");
+ if (repipe) {
+ int retw = write(STDOUT_FILENO, &c, 1);
+
+ if (retw <= 0 || retw != r)
+ die("repiping input file string");
+ }
+
buf[size++] = c;
if (!c)
@@ -454,7 +469,7 @@ struct record *trace_read_data(int cpu)
return data;
}
-ssize_t trace_report(int fd)
+ssize_t trace_report(int fd, bool __repipe)
{
char buf[BUFSIZ];
char test[] = { 23, 8, 68 };
@@ -465,6 +480,7 @@ ssize_t trace_report(int fd)
ssize_t size;
calc_data_size = 1;
+ repipe = __repipe;
input_fd = fd;
@@ -499,6 +515,7 @@ ssize_t trace_report(int fd)
size = calc_data_size - 1;
calc_data_size = 0;
+ repipe = false;
if (show_funcs) {
print_funcs();