lseek32 and lseek64

Richard Genoud richard.genoud at gmail.com
Tue Sep 11 03:10:53 EDT 2012


2012/9/11 Cheney Chen <cheneychencl2012 at gmail.com>:
> I add the case _FILE_OFFSET_BITS=64 into the file Android.mk, compile them
> and try it again. it dose not work.
>
> + LOCAL_CFLAGS = -O2 -Wall -D_FILE_OFFSET_BITS=64
>
> Why not use uint64_t?
It seems that there's a problem somewhere in the android makefiles,
because you don't need to define _FILE_OFFSET_BITS yourself, it should
be enabled by common.mk (in mtd-utils), unless WITHOUT_LARGEFILE=1 is
set.
maybe try to grep WITHOUT_LARGEFILE in your project, and make the
mtd_utils with V=1.
you should see -D_FILE_OFFSET_BITS=64 in the compilation log. If not,
something in your project had disabled it.
(maybe you're using µClibc without large file support, or buildroot
which disables it for mtd-utils or...)

It's better to use off_t because the prototype of lseek is:
off_t lseek(int fd, off_t offset, int whence);
cf man lseek64:
lseek(2) uses the type off_t.  This is a 32-bit signed type on 32-bit
architectures, unless one compiles with
           #define _FILE_OFFSET_BITS 64
       in which case it is a 64-bit signed type.
(and off_t is signed, not unsigned)


-- 
for me, ck means con kolivas and not calvin klein... does it mean I'm a geek ?



More information about the linux-mtd mailing list