tests: fix S_IFMT
undeclared at statx.c
#17294
Merged
+3
−0
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.
S_IFMT
is declared insys/stat.h
, but we cannot include this header because it redeclares thestatx
function with different argument types. Therefore, we defineS_IFMT
ourselves, in the same way as the other definitions.Closes: #17293
Motivation and Context
OpenZFS 2.3.2 fails to compile with musl libc due to
S_IFMT
not being defined. This issue did not exist in 2.3.1.The breaking change was introduced in commit 6503f8c, which added a new test command (
tests/zfs-tests/cmd/statx
). Unfortunately, on some systems (notably musl), including<sys/stat.h>
redefines thestatx
function with incompatible argument types, making it unusable.To avoid including
<sys/stat.h>
while still usingS_IFMT
, we defineS_IFMT
manually if it is not already defined.Description
Define
S_IFMT
as0170000
if it is not already defined. This value is consistent across major libc implementations, including musl, glibc, and uClibc.How Has This Been Tested?
Compiling OpenZFS 2.3.2 with this patch using glibc, musl and uClibc.
Types of changes
Checklist:
Signed-off-by
.