From 9e861d6e167d518df212114ba59bab0b03f3c552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Neusch=C3=A4fer?= Date: Wed, 16 Oct 2024 18:58:47 +0200 Subject: [PATCH 1/2] Add Linux 6.11 statx fields/constants --- src/unix/linux_like/mod.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 8f6f3db5aed0..73278cffb99d 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -239,7 +239,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 { @@ -1593,6 +1598,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; @@ -1603,6 +1611,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; } } From 60265ba51d93126d13f03c289401fc262b3acfe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Neusch=C3=A4fer?= Date: Wed, 16 Oct 2024 09:05:59 +0200 Subject: [PATCH 2/2] Enable statx on musl-libc Version 1.2.5 of musl-libc added support for the statx system call[1]. [1]: https://musl.libc.org/releases.html --- ci/install-musl.sh | 2 +- src/unix/linux_like/mod.rs | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ci/install-musl.sh b/ci/install-musl.sh index 1cf1ec6500cd..1a4819b55c2d 100755 --- a/ci/install-musl.sh +++ b/ci/install-musl.sh @@ -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: diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 73278cffb99d..bff6efc23a03 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -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, @@ -1577,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; @@ -1980,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,