Skip to content

Commit 74cd336

Browse files
committed
Use rustix::fs::statx on Android.
Now that cap-std is using rustix 0.35.6, it can use `rustix::fs::statx` on Android.
1 parent c6748ba commit 74cd336

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

cap-primitives/src/rustix/fs/metadata_ext.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
use crate::fs::{FileTypeExt, Metadata, PermissionsExt};
44
use crate::time::{Duration, SystemClock, SystemTime};
5-
// TODO: update all these to
6-
// #[cfg(any(target_os = "android", target_os = "linux"))]
7-
// once we're on restix >= v0.34.3.
8-
#[cfg(all(target_os = "linux", target_env = "gnu"))]
5+
#[cfg(any(target_os = "android", target_os = "linux"))]
96
use rustix::fs::{makedev, Statx};
107
use rustix::fs::{RawMode, Stat};
118
use std::convert::{TryFrom, TryInto};
@@ -222,7 +219,7 @@ impl MetadataExt {
222219
}
223220

224221
/// Constructs a new instance of `Metadata` from the given `Statx`.
225-
#[cfg(all(target_os = "linux", target_env = "gnu"))]
222+
#[cfg(any(target_os = "android", target_os = "linux"))]
226223
#[inline]
227224
pub(crate) fn from_rustix_statx(statx: Statx) -> Metadata {
228225
Metadata {

cap-primitives/src/rustix/fs/stat_unchecked.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ use rustix::fs::{statat, AtFlags};
33
use std::path::Path;
44
use std::{fs, io};
55

6-
// TODO: update all these to
7-
// #[cfg(any(target_os = "android", target_os = "linux"))]
8-
// once we're on restix >= v0.34.3.
9-
#[cfg(all(target_os = "linux", target_env = "gnu"))]
6+
#[cfg(any(target_os = "android", target_os = "linux"))]
107
use rustix::fs::{statx, StatxFlags};
11-
#[cfg(all(target_os = "linux", target_env = "gnu"))]
8+
#[cfg(any(target_os = "android", target_os = "linux"))]
129
use std::sync::atomic::{AtomicU8, Ordering};
1310

1411
/// *Unsandboxed* function similar to `stat`, but which does not perform
@@ -28,7 +25,7 @@ pub(crate) fn stat_unchecked(
2825
// Older versions of Docker/seccomp would return `EPERM` for `statx`; see
2926
// <https://github.com/rust-lang/rust/pull/65685/>. We store the
3027
// availability in a global to avoid unnecessary syscalls.
31-
#[cfg(all(target_os = "linux", target_env = "gnu"))]
28+
#[cfg(any(target_os = "android", target_os = "linux"))]
3229
{
3330
// 0: Unknown
3431
// 1: Not available

0 commit comments

Comments
 (0)