Backport #17675 to 2.3: linux: use sys/stat.h instead of linux/stat.h #18016
+5
−5
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.
glibc includes linux/stat.h for statx, but musl defines its own statx struct and associated constants, which does not include STATX_MNT_ID yet. Thus, including linux/stat.h directly should be avoided for maximum libc compatibility.
Tested on:
Reviewed-by: Brian Behlendorf behlendorf1@llnl.gov
Tested-By: Achill Gilgenast achill@achill.org
Closes #17675
(cherry picked from commit ccf5a8a)
Motivation and Context
This fixes building ZFS v2.3 against the musl C library. Original commit message above.
Description
Changed to use
sys/stat.hinstead oflinux/stat.h. This approach works correctly with both glibc and musl.How Has This Been Tested?
masterbranch: ccf5a8a.~arm64/llvm/musl/openrc.arm64/gcc/glibc/systemd.I am co-maintaining the sys-fs/zfs package on Gentoo and thus test against musl and LLVM toolchains.
Types of changes
Checklist:
Signed-off-by.