Re: [tip:perf/core] perf tools: Use O_LARGEFILE to open perf data file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux