Skip to content

Commit 7cc91bc

Browse files
committed
Enable statx on musl
1 parent 532f8f1 commit 7cc91bc

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

library/std/src/sys/fs/unix.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#[cfg(test)]
77
mod tests;
88

9-
#[cfg(all(target_os = "linux", target_env = "gnu"))]
9+
#[cfg(all(target_os = "linux"))]
1010
use libc::c_char;
1111
#[cfg(any(
1212
all(target_os = "linux", not(target_env = "musl")),
@@ -93,7 +93,7 @@ use crate::sys::fd::FileDesc;
9393
pub use crate::sys::fs::common::exists;
9494
use crate::sys::helpers::run_path_with_cstr;
9595
use crate::sys::time::SystemTime;
96-
#[cfg(all(target_os = "linux", target_env = "gnu"))]
96+
#[cfg(all(target_os = "linux"))]
9797
use crate::sys::weak::syscall;
9898
#[cfg(target_os = "android")]
9999
use crate::sys::weak::weak;
@@ -102,14 +102,14 @@ use crate::{mem, ptr};
102102

103103
pub struct File(FileDesc);
104104

105-
// FIXME: This should be available on Linux with all `target_env`.
106-
// But currently only glibc exposes `statx` fn and structs.
107-
// We don't want to import unverified raw C structs here directly.
105+
// statx is available on Linux when:
106+
// - target_env = "gnu": added in glibc >= 2.28
107+
// - target_env = "musl": added in musl >= 1.2.5
108108
// https://github.com/rust-lang/rust/pull/67774
109109
macro_rules! cfg_has_statx {
110110
({ $($then_tt:tt)* } else { $($else_tt:tt)* }) => {
111111
cfg_select! {
112-
all(target_os = "linux", target_env = "gnu") => {
112+
all(target_os = "linux") => {
113113
$($then_tt)*
114114
}
115115
_ => {
@@ -118,7 +118,7 @@ macro_rules! cfg_has_statx {
118118
}
119119
};
120120
($($block_inner:tt)*) => {
121-
#[cfg(all(target_os = "linux", target_env = "gnu"))]
121+
#[cfg(all(target_os = "linux"))]
122122
{
123123
$($block_inner)*
124124
}

0 commit comments

Comments
 (0)