lkml.org 
[lkml]   [2010]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [tip:perf/core] perf tools: Use O_LARGEFILE to open perf data file
On 02/03/2010 12:45 AM, tip-bot for Xiao Guangrong wrote:
>
> perf tools: Use O_LARGEFILE to open perf data file
>
> Open perf data file with O_LARGEFILE flag since its size is
> easily larger that 2G.
>
> +#define _LARGEFILE64_SOURCE
> +#define _FILE_OFFSET_BITS 64
> +
> #include "builtin.h"
>
> #include "perf.h"
> @@ -451,7 +454,7 @@ static int __cmd_record(int argc, const char **argv)
> append_file = 0;
> }
>
> - flags = O_CREAT|O_RDWR;
> + flags = O_CREAT|O_RDWR|O_LARGEFILE;
> if (append_file)
> file_new = 0;
> else
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index 2bb2bdb..ed3efd7 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -1,3 +1,6 @@
> +#define _LARGEFILE64_SOURCE
> +#define _FILE_OFFSET_BITS 64
> +
> #include <sys/types.h>
> #include <byteswap.h>
> #include <unistd.h>
> @@ -382,7 +385,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;
> - lseek(fd, sec_start + sec_size, SEEK_SET);
> + lseek64(fd, sec_start + sec_size, SEEK_SET);
>

Setting _FILE_OFFSET_BITS *and* using O_LARGEFILE, lseek64, etc, is
redundant...

-hpa

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.



\
 
 \ /
  Last update: 2010-02-03 10:31    [from the cache]
©2003-2011 Jasper Spaans