Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable statx on musl-libc #3976

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/install-musl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

set -eux

musl_version=1.1.24
musl_version=1.2.5
musl="musl-${musl_version}"

# Download, configure, build, and install musl:
Expand Down
29 changes: 25 additions & 4 deletions src/unix/linux_like/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,11 @@ s! {
}

cfg_if! {
if #[cfg(any(target_env = "gnu", target_os = "android"))] {
if #[cfg(any(
target_env = "gnu",
target_os = "android",
target_env = "musl"
))] {
s! {
pub struct statx {
pub stx_mask: crate::__u32,
Expand All @@ -239,7 +243,12 @@ cfg_if! {
pub stx_mnt_id: crate::__u64,
pub stx_dio_mem_align: crate::__u32,
pub stx_dio_offset_align: crate::__u32,
__statx_pad3: [crate::__u64; 12],
pub stx_subvol: crate::__u64,
pub stx_atomic_write_unit_min: crate::__u32,
pub stx_atomic_write_unit_max: crate::__u32,
pub stx_atomic_write_segments_max: crate::__u32,
__statx_pad2: [crate::__u32; 1],
__statx_pad3: [crate::__u64; 9],
}

pub struct statx_timestamp {
Expand Down Expand Up @@ -1572,7 +1581,11 @@ cfg_if! {
}

cfg_if! {
if #[cfg(any(target_env = "gnu", target_os = "android"))] {
if #[cfg(any(
target_env = "gnu",
target_os = "android",
target_env = "musl"
))] {
pub const AT_STATX_SYNC_TYPE: c_int = 0x6000;
pub const AT_STATX_SYNC_AS_STAT: c_int = 0x0000;
pub const AT_STATX_FORCE_SYNC: c_int = 0x2000;
Expand All @@ -1593,6 +1606,9 @@ cfg_if! {
pub const STATX_ALL: c_uint = 0x0fff;
pub const STATX_MNT_ID: c_uint = 0x1000;
pub const STATX_DIOALIGN: c_uint = 0x2000;
pub const STATX_MNT_ID_UNIQUE: c_uint = 0x4000;
pub const STATX_SUBVOL: c_uint = 0x8000;
pub const STATX_WRITE_ATOMIC: c_uint = 0x10000;
pub const STATX__RESERVED: c_int = 0x80000000;
pub const STATX_ATTR_COMPRESSED: c_int = 0x0004;
pub const STATX_ATTR_IMMUTABLE: c_int = 0x0010;
Expand All @@ -1603,6 +1619,7 @@ cfg_if! {
pub const STATX_ATTR_MOUNT_ROOT: c_int = 0x2000;
pub const STATX_ATTR_VERITY: c_int = 0x100000;
pub const STATX_ATTR_DAX: c_int = 0x200000;
pub const STATX_ATTR_WRITE_ATOMIC: c_int = 0x400000;
}
}

Expand Down Expand Up @@ -1971,7 +1988,11 @@ cfg_if! {

// The statx syscall, available on some libcs.
cfg_if! {
if #[cfg(any(target_env = "gnu", target_os = "android"))] {
if #[cfg(any(
target_env = "gnu",
target_os = "android",
target_env = "musl"
))] {
extern "C" {
pub fn statx(
dirfd: c_int,
Expand Down
Loading