New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LFS, Large File Support, can it be dropped? #445
Comments
I have encountered some people on Android mention it not supporting LFS: This is what I did for minizip: open and close functions do not need 64-bit versions. So instead of making my own 64-bit compatible functions I removed stuff like this found in gzguts.h which was also in ioapi.h in minizip (but worse):
And my CMakeLists.txt just defines all necessary #defines. I have a single MZ_FILE32_API which determines whether or not it should use the 32-bit functions but the public interface always supports 64-bit fixed types. |
One of the sources I used when looking at this is the second answer here: https://stackoverflow.com/questions/9073667/where-to-find-the-complete-definition-of-off-t-type
Since off_t and off64_t are posix and not in C99, it would make sense to changing to using int64_t instead, at least for the zlib-ng native ABI. That is another cludge (see zconf.h) that we could avoid. Feel free to pitch in your thoughts on the matter. |
@nmoinvaz Interesting. Android API version 23 (Andoid 6) is no longer supported by google, so I guess that might no longer be so critical. |
I think it should be possible to continue to provide compiler support for 32-bit file api while making our interface 64-bit only. |
For zlib-ng native API if we export 64-bit functions without "64" ending, how do we also export 32-bit and 64-bit functions for zlib compatible API? Zlib-ng native API would export So there is a naming conflict. Only way would be in zlib-ng native API |
Obviously zlib compatible API would export the 32-bit version as "gzseek" without the prefix. |
mtl1979 is right. |
Only when we dual link both stock zlib and zlib-ng in compatibility mode, we need compatibility mode functions to have prefix, but the default is that compatibility mode does not use prefix. |
Yeah, compat mode should not use a prefix. Dual linking in compat mode is not something we plan to support, only for the zlib-ng native api. |
Dual linking stock zlib and zlib-ng might be more likely to happen unintentionally when linking against another library that contains zlib as dependency. |
Yes, that is why people should use zlib-ng for that instead. |
I believe this work has been done in #602. If there is work left I can reopen. |
I am considering whether we should drop support for LFS in zlib-ng's native ABI and possibly partially in the compat code as well.
Assume we always define:
_FILE_OFFSET_BITS=64?
, that should replace all the LFS-affected libc functions with 64-bit capable ones (without requiring us to call the *64 variants).Assuming we always have 64-bit file-functions and a off64_t data-type could simplify some parts of the zlib-ng native ABI, and it would be great to drop that legacy stuff before a stable release if possible. I am pretty sure we have at least 2 bugs and probably more in the current LFS support because we likely never test on a platform that lacks this support.
The question is, what platforms exist where this would not work? Any at all?
I have been unable to find any kind of table showing where this is supported/required and not, and the only platform I can think of that most likely don't support it would be Arduino-class 8bit stuff, but using zlib-ng there would be crazy anyhow.
In any case we can drop support for the 32-bit functions from our exported ABI and enforce the use of 64-bit parameters (and without using the 64-suffix for the function names). Worst case, this would mean false-advertising of 64bit functions if the underlying libc does not support it, but in that case it is probably an OS-wide issue and not really a problem.
Zlib-ng native ABI:
Zlib-ng zlib-compat ABI:
We could possibly drop support LFS-special handling and define _FILE_OFFSET_BITS=64. We must still export the legacy 32-bit functions, but internally they can be 64bit. This is the same as the _FILE_OFFSET_BITS=64 case in fact, and is likely what always occurs on 64-bit platforms anyhow. Doing the same for 32bit platforms should probably not be a problem any more, if we require that the libc in use supports the 64bit functions that is.
The text was updated successfully, but these errors were encountered: