summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/header.c
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>2010-02-04 16:46:42 +0800
committerIngo Molnar <mingo@elte.hu>2010-02-04 10:03:03 +0100
commitf887f3019e56389a73617f4e70f512e82cc89adb (patch)
tree176b13e6d9713715d1b4eef75e702b47e6923606 /tools/perf/util/header.c
parent447a194b393f32699607fd99617a40abd6a95114 (diff)
downloadblackbird-op-linux-f887f3019e56389a73617f4e70f512e82cc89adb.tar.gz
blackbird-op-linux-f887f3019e56389a73617f4e70f512e82cc89adb.zip
perf tools: Clean up O_LARGEFILE et al usage
Setting _FILE_OFFSET_BITS and using O_LARGEFILE, lseek64, etc, is redundant. Thanks H. Peter Anvin for pointing it out. So, this patch removes O_LARGEFILE, lseek64, etc. Suggested-by: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> LKML-Reference: <4B6A8972.3070605@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
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 @@
-#define _LARGEFILE64_SOURCE
#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
@@ -388,7 +387,7 @@ static int perf_header__adds_write(struct perf_header *self, int fd)
sec_size = sizeof(*feat_sec) * nr_sections;
sec_start = self->data_offset + self->data_size;
- lseek64(fd, sec_start + sec_size, SEEK_SET);
+ lseek(fd, sec_start + sec_size, SEEK_SET);
if (perf_header__has_feat(self, HEADER_TRACE_INFO)) {
struct perf_file_section *trace_sec;
@@ -396,9 +395,9 @@ static int perf_header__adds_write(struct perf_header *self, int fd)
trace_sec = &feat_sec[idx++];
/* Write trace info */
- trace_sec->offset = lseek64(fd, 0, SEEK_CUR);
+ trace_sec->offset = lseek(fd, 0, SEEK_CUR);
read_tracing_data(fd, attrs, nr_counters);
- trace_sec->size = lseek64(fd, 0, SEEK_CUR) - trace_sec->offset;
+ trace_sec->size = lseek(fd, 0, SEEK_CUR) - trace_sec->offset;
}
@@ -408,18 +407,18 @@ static int perf_header__adds_write(struct perf_header *self, int fd)
buildid_sec = &feat_sec[idx++];
/* Write build-ids */
- buildid_sec->offset = lseek64(fd, 0, SEEK_CUR);
+ buildid_sec->offset = lseek(fd, 0, SEEK_CUR);
err = dsos__write_buildid_table(fd);
if (err < 0) {
pr_debug("failed to write buildid table\n");
goto out_free;
}
- buildid_sec->size = lseek64(fd, 0, SEEK_CUR) -
- buildid_sec->offset;
+ buildid_sec->size = lseek(fd, 0, SEEK_CUR) -
+ buildid_sec->offset;
dsos__cache_build_ids();
}
- lseek64(fd, sec_start, SEEK_SET);
+ lseek(fd, sec_start, SEEK_SET);
err = do_write(fd, feat_sec, sec_size);
if (err < 0)
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)
pr_debug("failed to write perf header\n");
return err;
}
- lseek64(fd, self->data_offset + self->data_size, SEEK_SET);
+ lseek(fd, self->data_offset + self->data_size, SEEK_SET);
self->frozen = 1;
return 0;
@@ -567,7 +566,7 @@ int perf_header__process_sections(struct perf_header *self, int fd,
sec_size = sizeof(*feat_sec) * nr_sections;
- lseek64(fd, self->data_offset + self->data_size, SEEK_SET);
+ lseek(fd, self->data_offset + self->data_size, SEEK_SET);
if (perf_header__getbuffer64(self, fd, feat_sec, sec_size))
goto out_free;
@@ -641,7 +640,7 @@ static int perf_file_section__process(struct perf_file_section *self,
struct perf_header *ph,
int feat, int fd)
{
- if (lseek64(fd, self->offset, SEEK_SET) < 0) {
+ if (lseek(fd, self->offset, SEEK_SET) == (off_t)-1) {
pr_debug("Failed to lseek to %Ld offset for feature %d, "
"continuing...\n", self->offset, feat);
return 0;
OpenPOWER on IntegriCloud