[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B69409E.9010301@zytor.com>
Date: Wed, 03 Feb 2010 01:23:42 -0800
From: "H. Peter Anvin" <hpa@...or.com>
To: mingo@...hat.com, hpa@...or.com, paulus@...ba.org,
linux-kernel@...r.kernel.org, peterz@...radead.org,
xiaoguangrong@...fujitsu.com, fweisbec@...il.com,
rostedt@...dmis.org, tglx@...utronix.de, mingo@...e.hu
CC: linux-tip-commits@...r.kernel.org
Subject: Re: [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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists