From: "H. Peter Anvin" <hpa@zytor.com>
To: mingo@redhat.com, hpa@zytor.com, paulus@samba.org,
linux-kernel@vger.kernel.org, peterz@infradead.org,
xiaoguangrong@cn.fujitsu.com, fweisbec@gmail.com,
rostedt@goodmis.org, tglx@linutronix.de, mingo@elte.hu
Cc: linux-tip-commits@vger.kernel.org
Subject: Re: [tip:perf/core] perf tools: Use O_LARGEFILE to open perf data file
Date: Wed, 03 Feb 2010 01:23:42 -0800 [thread overview]
Message-ID: <4B69409E.9010301@zytor.com> (raw)
In-Reply-To: <tip-b8f46c5a34fa64fd456295388d18f50ae69d9f37@git.kernel.org>
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.
next prev parent reply other threads:[~2010-02-03 9:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-03 3:53 [PATCH] perf tools: using O_LARGEFILE to open perf data file Xiao Guangrong
2010-02-03 8:45 ` [tip:perf/core] perf tools: Use " tip-bot for Xiao Guangrong
2010-02-03 9:23 ` H. Peter Anvin [this message]
2010-02-03 11:00 ` Xiao Guangrong
2010-02-03 11:06 ` [PATCH] perf tools: using O_LARGEFILE to open perf data file - fix Xiao Guangrong
2010-02-03 13:19 ` Ingo Molnar
2010-02-04 2:31 ` Xiao Guangrong
2010-02-03 17:30 ` H. Peter Anvin
2010-02-04 8:46 ` [PATCH v2] " Xiao Guangrong
2010-02-04 9:57 ` [tip:perf/core] perf tools: Clean up O_LARGEFILE et al usage tip-bot for Xiao Guangrong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B69409E.9010301@zytor.com \
--to=hpa@zytor.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=xiaoguangrong@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox