diff options
-rw-r--r-- | tools/perf/util/trace-event-read.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c index cb54cd002f49..f55cc3a765a1 100644 --- a/tools/perf/util/trace-event-read.c +++ b/tools/perf/util/trace-event-read.c | |||
@@ -53,12 +53,6 @@ static unsigned long page_size; | |||
53 | static ssize_t calc_data_size; | 53 | static ssize_t calc_data_size; |
54 | static bool repipe; | 54 | static bool repipe; |
55 | 55 | ||
56 | /* If it fails, the next read will report it */ | ||
57 | static void skip(int size) | ||
58 | { | ||
59 | lseek(input_fd, size, SEEK_CUR); | ||
60 | } | ||
61 | |||
62 | static int do_read(int fd, void *buf, int size) | 56 | static int do_read(int fd, void *buf, int size) |
63 | { | 57 | { |
64 | int rsize = size; | 58 | int rsize = size; |
@@ -98,6 +92,19 @@ static int read_or_die(void *data, int size) | |||
98 | return r; | 92 | return r; |
99 | } | 93 | } |
100 | 94 | ||
95 | /* If it fails, the next read will report it */ | ||
96 | static void skip(int size) | ||
97 | { | ||
98 | char buf[BUFSIZ]; | ||
99 | int r; | ||
100 | |||
101 | while (size) { | ||
102 | r = size > BUFSIZ ? BUFSIZ : size; | ||
103 | read_or_die(buf, r); | ||
104 | size -= r; | ||
105 | }; | ||
106 | } | ||
107 | |||
101 | static unsigned int read4(void) | 108 | static unsigned int read4(void) |
102 | { | 109 | { |
103 | unsigned int data; | 110 | unsigned int data; |