Module for Large File Size system support detection?

Hi! We’re looking for a good C/C++/CMake solution for sorting out what the correct/best set of functions and file types is for off_t/off64_t/_off64_t and friends. (fseek,fstat,ftell, and their myriad 32/64/platform-specific variations across platforms, not to mention needed defines such as _FILE_OFFSET_BITS?)

We’re looking for a configure-time set of tests that will let us define a set of wrappers for our code that just work and provide reliable access to large files under as many circumstances as possible - does anybody know of a good pre-packaged solution to this?

These are still necessary today (I thought everyone just defined _FILE_OFFSET_BITS=64 and called it a day)? I don’t know of a good pre-packaged CMake solution, but whatever autotools does would seem like a good starting point to me.

One of the complications is Windows specific types (_off64_t for example). Does `_FILE_OFFSET_BITS=64 work for the Windows API?

Eh, just check for _WIN32 and use the types specified in their docs. Things like time64_t are still being worked out, but stat64_t was migrated from ages ago on pretty much any relevant platform. Assume it is 64-bit where you can and special case the oddballs with a header using preprocessor magic. It’s a lot simpler than doing configure-time detection of feature macros. Basically, the time it takes you to figure out the stuff based on things like __linux__ once is going to be much smaller than writing code to make everyone do it at configure time every time they make a new build tree.

Do you happen to know if anyone’s already rolled a header with those definitions? We can tackle it if need be, but I’d hate to reinvent the wheel needlessly…

I don’t know off-hand, sorry. I recommend searching Debian Code Search and GitHub to see where _FILE_OFFSET_BITS and friends are being handled.

Will do, thanks!