aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/header.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/header.c')
-rw-r--r--tools/perf/util/header.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index d5facd5ab1f7..6c9aa16ee51f 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1,4 +1,3 @@
1#define _LARGEFILE64_SOURCE
2#define _FILE_OFFSET_BITS 64 1#define _FILE_OFFSET_BITS 64
3 2
4#include <sys/types.h> 3#include <sys/types.h>
@@ -388,7 +387,7 @@ static int perf_header__adds_write(struct perf_header *self, int fd)
388 sec_size = sizeof(*feat_sec) * nr_sections; 387 sec_size = sizeof(*feat_sec) * nr_sections;
389 388
390 sec_start = self->data_offset + self->data_size; 389 sec_start = self->data_offset + self->data_size;
391 lseek64(fd, sec_start + sec_size, SEEK_SET); 390 lseek(fd, sec_start + sec_size, SEEK_SET);
392 391
393 if (perf_header__has_feat(self, HEADER_TRACE_INFO)) { 392 if (perf_header__has_feat(self, HEADER_TRACE_INFO)) {
394 struct perf_file_section *trace_sec; 393 struct perf_file_section *trace_sec;
@@ -396,9 +395,9 @@ static int perf_header__adds_write(struct perf_header *self, int fd)
396 trace_sec = &feat_sec[idx++]; 395 trace_sec = &feat_sec[idx++];
397 396
398 /* Write trace info */ 397 /* Write trace info */
399 trace_sec->offset = lseek64(fd, 0, SEEK_CUR); 398 trace_sec->offset = lseek(fd, 0, SEEK_CUR);
400 read_tracing_data(fd, attrs, nr_counters); 399 read_tracing_data(fd, attrs, nr_counters);
401 trace_sec->size = lseek64(fd, 0, SEEK_CUR) - trace_sec->offset; 400 trace_sec->size = lseek(fd, 0, SEEK_CUR) - trace_sec->offset;
402 } 401 }
403 402
404 403
@@ -408,18 +407,18 @@ static int perf_header__adds_write(struct perf_header *self, int fd)
408 buildid_sec = &feat_sec[idx++]; 407 buildid_sec = &feat_sec[idx++];
409 408
410 /* Write build-ids */ 409 /* Write build-ids */
411 buildid_sec->offset = lseek64(fd, 0, SEEK_CUR); 410 buildid_sec->offset = lseek(fd, 0, SEEK_CUR);
412 err = dsos__write_buildid_table(fd); 411 err = dsos__write_buildid_table(fd);
413 if (err < 0) { 412 if (err < 0) {
414 pr_debug("failed to write buildid table\n"); 413 pr_debug("failed to write buildid table\n");
415 goto out_free; 414 goto out_free;
416 } 415 }
417 buildid_sec->size = lseek64(fd, 0, SEEK_CUR) - 416 buildid_sec->size = lseek(fd, 0, SEEK_CUR) -
418 buildid_sec->offset; 417 buildid_sec->offset;
419 dsos__cache_build_ids(); 418 dsos__cache_build_ids();
420 } 419 }
421 420
422 lseek64(fd, sec_start, SEEK_SET); 421 lseek(fd, sec_start, SEEK_SET);
423 err = do_write(fd, feat_sec, sec_size); 422 err = do_write(fd, feat_sec, sec_size);
424 if (err < 0) 423 if (err < 0)
425 pr_debug("failed to write feature section\n"); 424 pr_debug("failed to write feature section\n");
@@ -513,7 +512,7 @@ int perf_header__write(struct perf_header *self, int fd, bool at_exit)
513 pr_debug("failed to write perf header\n"); 512 pr_debug("failed to write perf header\n");
514 return err; 513 return err;
515 } 514 }
516 lseek64(fd, self->data_offset + self->data_size, SEEK_SET); 515 lseek(fd, self->data_offset + self->data_size, SEEK_SET);
517 516
518 self->frozen = 1; 517 self->frozen = 1;
519 return 0; 518 return 0;
@@ -567,7 +566,7 @@ int perf_header__process_sections(struct perf_header *self, int fd,
567 566
568 sec_size = sizeof(*feat_sec) * nr_sections; 567 sec_size = sizeof(*feat_sec) * nr_sections;
569 568
570 lseek64(fd, self->data_offset + self->data_size, SEEK_SET); 569 lseek(fd, self->data_offset + self->data_size, SEEK_SET);
571 570
572 if (perf_header__getbuffer64(self, fd, feat_sec, sec_size)) 571 if (perf_header__getbuffer64(self, fd, feat_sec, sec_size))
573 goto out_free; 572 goto out_free;
@@ -641,7 +640,7 @@ static int perf_file_section__process(struct perf_file_section *self,
641 struct perf_header *ph, 640 struct perf_header *ph,
642 int feat, int fd) 641 int feat, int fd)
643{ 642{
644 if (lseek64(fd, self->offset, SEEK_SET) < 0) { 643 if (lseek(fd, self->offset, SEEK_SET) == (off_t)-1) {
645 pr_debug("Failed to lseek to %Ld offset for feature %d, " 644 pr_debug("Failed to lseek to %Ld offset for feature %d, "
646 "continuing...\n", self->offset, feat); 645 "continuing...\n", self->offset, feat);
647 return 0; 646 return 0;