Non-Linux portability fixes (FreeBSD): xattr/fiemap/sysinfo guards#664
Open
GenericRikka wants to merge 4 commits intohpc:mainfrom
Open
Non-Linux portability fixes (FreeBSD): xattr/fiemap/sysinfo guards#664GenericRikka wants to merge 4 commits intohpc:mainfrom
GenericRikka wants to merge 4 commits intohpc:mainfrom
Conversation
These are the core FreeBSD portability changes extracted from the FreeBSD ports tree work. The port currently is still under review. Port PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=291679 Port review: https://reviews.freebsd.org/D54230 The Patches: - Add FreeBSD compatibility for stat64/lstat64 by mapping them to stat/lstat (which are 64 bit by default on FreeBSD) - Include missing system headers in the path/parameter helper so struct stat and related macros are consistently available - Fix MFU_LOG(... "errno=%d %s" ...) callsites in mfu_util.c to actually pass both errno and strerrno(errno) (prevents format/argument mismatch and undefined behavior) - Include <fcntl.h> in mfu_util.c for file/flag-related definitions used by the code on non-Linux systems
- Use getdents(2) wrapper on non-Linux instead of SYS_getdents syscall in mfu_flist_walk. - Make FIEMAP-based extent discovery Linux-only in mfu_flist_copy and fall back to normal copy on non-Linux when SEEK_DATA/SEEK_HOLE does not provide extents. No behavior changes on linux intended; this unblocks part of the building process of mpifileutils on FreeBSD.
Make the bzip2 compression/decompression code build on FreeBSD and other non-Linux platforms by isolating Linux-only libcircle pieces and keeping a portable fallback. - Keep the existing libcircle-based implementation on Linux. - Guard Linux-only includes/assumptions (e.g. sysinfo / libcircle headers). - Provide a non-Linux fallback for the libcircle entry points that forwards to the portable static bzip2 implementation. - Keep the public interfaces consistent while enabling non-Linux builds. No behavior change intended on Linux; non-Linux builds use the static path instead of libcircle.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR makes mpifileutils build on FreeBSD (and generally non-Linux platforms) by guarding Linux-only APIs/headers and providing small compatibility fallbacks.
These changes were developed while preparing the FreeBSD ports package and are intended to be upstreamable, minimal, and low-risk for Linux behavior.
Key changes
__linux__(e.g.<sys/sysinfo.h>,<linux/fiemap.h>,FS_IOC_FIEMAP).syscall(SYS_getdents)on Linux, andgetdents(2)wrapper on non-Linux inmfu_flist_walk.<sys/xattr.h>on LinuxENOTSUP(so core functionality remains available)stat64/lstat64compatibility mapping where neededHOST_NAME_MAXfallbackS_ISLNK,POSIX_FADV_SEQUENTIAL,O_LARGEFILEif absent)errnologging format issuePlatform impact
Testing
References