perf tools: Convert lseek + read to pread
When dso_cache__read() is called, it reads data from the given offset
using lseek + normal read syscall. It can be combined to a single
pread syscall.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index d8ee1fd..95c8d5a 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -593,10 +593,7 @@
}
}
- if (-1 == lseek(dso->data.fd, cache_offset, SEEK_SET))
- goto err_unlock;
-
- ret = read(dso->data.fd, cache->data, DSO__DATA_CACHE_SIZE);
+ ret = pread(dso->data.fd, cache->data, DSO__DATA_CACHE_SIZE, cache_offset);
if (ret <= 0)
goto err_unlock;