Merge branch 'perf/urgent' into perf/core
[firefly-linux-kernel-4.4.55.git] / tools / perf / util / trace-event-read.c
index 1744422cafcb43cf7872b2d7daf67c4409f56e3c..7cd1193918c76ccef904e03c7ed6f37fcc66a5b8 100644 (file)
@@ -18,7 +18,7 @@
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  */
-#define _LARGEFILE64_SOURCE
+#define _FILE_OFFSET_BITS 64
 
 #include <dirent.h>
 #include <stdio.h>
@@ -83,7 +83,7 @@ static char *read_string(void)
        char *str = NULL;
        int size = 0;
        int i;
-       int r;
+       off_t r;
 
        for (;;) {
                r = read(input_fd, buf, BUFSIZ);
@@ -118,7 +118,7 @@ static char *read_string(void)
 
        /* move the file descriptor to the end of the string */
        r = lseek(input_fd, -(r - i), SEEK_CUR);
-       if (r < 0)
+       if (r == (off_t)-1)
                die("lseek");
 
        if (str) {
@@ -282,8 +282,8 @@ static void update_cpu_data_index(int cpu)
 
 static void get_next_page(int cpu)
 {
-       off64_t save_seek;
-       off64_t ret;
+       off_t save_seek;
+       off_t ret;
 
        if (!cpu_data[cpu].page)
                return;
@@ -298,17 +298,17 @@ static void get_next_page(int cpu)
                update_cpu_data_index(cpu);
 
                /* other parts of the code may expect the pointer to not move */
-               save_seek = lseek64(input_fd, 0, SEEK_CUR);
+               save_seek = lseek(input_fd, 0, SEEK_CUR);
 
-               ret = lseek64(input_fd, cpu_data[cpu].offset, SEEK_SET);
-               if (ret < 0)
+               ret = lseek(input_fd, cpu_data[cpu].offset, SEEK_SET);
+               if (ret == (off_t)-1)
                        die("failed to lseek");
                ret = read(input_fd, cpu_data[cpu].page, page_size);
                if (ret < 0)
                        die("failed to read page");
 
                /* reset the file pointer back */
-               lseek64(input_fd, save_seek, SEEK_SET);
+               lseek(input_fd, save_seek, SEEK_SET);
 
                return;
        }