Skip to content

Conversation

@alex-moch
Copy link
Contributor

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:

  • glibc: x86_64, i686, aarch64, armv7l, armv6l
  • musl: x86_64, aarch64, armv7l, armv6l

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.h instead of linux/stat.h. This approach works correctly with both glibc and musl.

How Has This Been Tested?

  • Clean cherry pick from the master branch: ccf5a8a.
  • Patch is included in the Gentoo ebuild for ZFS.
    • Tested on ~arm64/llvm/musl/openrc.
    • Tested on 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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Quality assurance (non-breaking change which makes the code more robust against bugs)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

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:
  - glibc: x86_64, i686, aarch64, armv7l, armv6l
  - musl: x86_64, aarch64, armv7l, armv6l

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Tested-By: Achill Gilgenast <achill@achill.org>
Signed-off-by: classabbyamp <dev@placeviolette.net>
Closes openzfs#17675
(cherry picked from commit ccf5a8a)
Signed-off-by: Alexander Moch <mail@alexmoch.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants