Skip to content

Commit 9f8f97b

Browse files
authored
Rollup merge of rust-lang#67774 - oxalica:more-statx, r=alexcrichton
Try statx for all linux-gnu target. After rust-lang/libc#1577, which is contained in `libc` 0.2.66, provides `SYS_statx` for all Linux platform, so we can try to use `statx` for ~all Linux target~ all linux-gnu targets. Unfortunately, `struct statx` and `fn statx` is not a part of public interface of musl (currently), ~we still need to invoke it through `syscall`~ we does **not** support statx for musl or other libc impls currently. Previous PR: rust-lang#65094 cc @alexcrichton
2 parents ed6468d + f5baa03 commit 9f8f97b

File tree

1 file changed

+6
-28
lines changed

1 file changed

+6
-28
lines changed

src/libstd/sys/unix/fs.rs

+6-28
Original file line numberDiff line numberDiff line change
@@ -51,44 +51,22 @@ pub use crate::sys_common::fs::remove_dir_all;
5151

5252
pub struct File(FileDesc);
5353

54-
// FIXME: This should be available on Linux with all `target_arch` and `target_env`.
55-
// https://github.com/rust-lang/libc/issues/1545
54+
// FIXME: This should be available on Linux with all `target_env`.
55+
// But currently only glibc exposes `statx` fn and structs.
56+
// We don't want to import unverified raw C structs here directly.
57+
// https://github.com/rust-lang/rust/pull/67774
5658
macro_rules! cfg_has_statx {
5759
({ $($then_tt:tt)* } else { $($else_tt:tt)* }) => {
5860
cfg_if::cfg_if! {
59-
if #[cfg(all(target_os = "linux", target_env = "gnu", any(
60-
target_arch = "x86",
61-
target_arch = "arm",
62-
// target_arch = "mips",
63-
target_arch = "powerpc",
64-
target_arch = "x86_64",
65-
// target_arch = "aarch64",
66-
target_arch = "powerpc64",
67-
// target_arch = "mips64",
68-
// target_arch = "s390x",
69-
target_arch = "sparc64",
70-
target_arch = "riscv64",
71-
)))] {
61+
if #[cfg(all(target_os = "linux", target_env = "gnu"))] {
7262
$($then_tt)*
7363
} else {
7464
$($else_tt)*
7565
}
7666
}
7767
};
7868
($($block_inner:tt)*) => {
79-
#[cfg(all(target_os = "linux", target_env = "gnu", any(
80-
target_arch = "x86",
81-
target_arch = "arm",
82-
// target_arch = "mips",
83-
target_arch = "powerpc",
84-
target_arch = "x86_64",
85-
// target_arch = "aarch64",
86-
target_arch = "powerpc64",
87-
// target_arch = "mips64",
88-
// target_arch = "s390x",
89-
target_arch = "sparc64",
90-
target_arch = "riscv64",
91-
)))]
69+
#[cfg(all(target_os = "linux", target_env = "gnu"))]
9270
{
9371
$($block_inner)*
9472
}

0 commit comments

Comments
 (0)