[Zlib-devel] [PATCH] Avoid testing _LARGEFILE_64_SOURCE and _FILE_OFFSET_BITS directly
Mark Brown
broonie at sirena.org.uk
Fri Mar 26 17:04:51 EDT 2010
On Fri, Mar 26, 2010 at 01:36:17PM -0700, Xin LI wrote:
> On Fri, Mar 26, 2010 at 1:06 PM, Mark Brown <broonie at sirena.org.uk> wrote:
> >> > _FILE_OFFSET_BITS is not defined by the platform. ??This is something
> >> > that can be defined during compilation to force off_t to be whatever the
> >> > value is, boiling down to a noop if off_t is 64 bit anyway.
> >> Or perhaps during zlib's ./configure? ??I think once zlib binary has
> >> been built, the zlib.h (zconf.h actually) installed together with it
> >> should be somewhat "fixed configuration" instead of depending system
> >> headers or arbitrary user-defined macros.
> > Sadly they're not intended to be fixed at system build time, the
> > intended use is dynamic at application compile time.
> But this *only* happens on systems that provide one interface that is
> limited to 32 bit and another limited to 64 bit for the same
> functionality.
> What will happen if, say, zlib is compiled on one of these platforms
> without _FILE_OFFSET_BITS defined, and a program happens to compile
> with _FILE_OFFSET_BITS == 64? I think this would just introduce more
> confusions than usefulness it brought.
On these platforms zlib gets built with both LFS and non-LFS symbols
linked in and the effect of _FILE_OFFSET_BITS=64 is to redirect the
32 bit functions to the 64 bit functions with preprocessor magic. This
means that the program source references the 32 bit versions but the
resulting binary links with the 64 bit versions and so gets a 64 bit
off_t and works as expected while still using the system zlib.
> > They're not Linux specific, they're also supported on some other
> > operating systems that have done the same transition - Solaris is one
> > IIRC. ??I'm pretty sure they come from SuS originally but I'd have to go
> > check.
> No, they are not defined in neither SuS nor IEEE Std 1003.1-2008. I
> found an Open Group white paper [1] on this and am sure that POSIX is
> not even trying to mandate the use of these macros.
Fair enough, but like I say they're definitely not Linux-specific as you
suggested even if nobody is standardising them. See for example
http://docs.sun.com/app/docs/doc/816-5138/appendixa-tbl-10?a=view
for Solaris _FILE_OFFSET_BITS.
More information about the Zlib-devel
mailing list