Auto merge of #125935 - madsmtm:merge-os-apple, r=workingjubilee
Merge Apple `std::os` extensions modules into `std::os::darwin` The functionality available on Apple platforms are very similar, and were (basically) duplicated for each platform. This PR rectifies that by merging the code into one module. Ultimately, I've done this to fix `./x build library --target=aarch64-apple-tvos,aarch64-apple-watchos,aarch64-apple-visionos`, as that currently fails because of dead code warnings. Publically exposing these to tvOS/watchOS/visionOS targets is considered in https://github.com/rust-lang/rust/pull/123723, but that seems to be dragging out, and in any case I think it makes sense to do the refactor separately from stabilization. r? libs Fixes https://github.com/rust-lang/rust/issues/121640 and https://github.com/rust-lang/rust/issues/124825.
This commit is contained in:
commit
09682988f2
@ -1638,16 +1638,8 @@ fn rename_directory() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_file_times() {
|
fn test_file_times() {
|
||||||
#[cfg(target_os = "ios")]
|
#[cfg(target_vendor = "apple")]
|
||||||
use crate::os::ios::fs::FileTimesExt;
|
use crate::os::darwin::fs::FileTimesExt;
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
use crate::os::macos::fs::FileTimesExt;
|
|
||||||
#[cfg(target_os = "tvos")]
|
|
||||||
use crate::os::tvos::fs::FileTimesExt;
|
|
||||||
#[cfg(target_os = "visionos")]
|
|
||||||
use crate::os::visionos::fs::FileTimesExt;
|
|
||||||
#[cfg(target_os = "watchos")]
|
|
||||||
use crate::os::watchos::fs::FileTimesExt;
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use crate::os::windows::fs::FileTimesExt;
|
use crate::os::windows::fs::FileTimesExt;
|
||||||
|
|
||||||
@ -1693,16 +1685,7 @@ fn test_file_times() {
|
|||||||
#[test]
|
#[test]
|
||||||
#[cfg(target_vendor = "apple")]
|
#[cfg(target_vendor = "apple")]
|
||||||
fn test_file_times_pre_epoch_with_nanos() {
|
fn test_file_times_pre_epoch_with_nanos() {
|
||||||
#[cfg(target_os = "ios")]
|
use crate::os::darwin::fs::FileTimesExt;
|
||||||
use crate::os::ios::fs::FileTimesExt;
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
use crate::os::macos::fs::FileTimesExt;
|
|
||||||
#[cfg(target_os = "tvos")]
|
|
||||||
use crate::os::tvos::fs::FileTimesExt;
|
|
||||||
#[cfg(target_os = "visionos")]
|
|
||||||
use crate::os::visionos::fs::FileTimesExt;
|
|
||||||
#[cfg(target_os = "watchos")]
|
|
||||||
use crate::os::watchos::fs::FileTimesExt;
|
|
||||||
|
|
||||||
let tmp = tmpdir();
|
let tmp = tmpdir();
|
||||||
let file = File::create(tmp.join("foo")).unwrap();
|
let file = File::create(tmp.join("foo")).unwrap();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use crate::fs::{self, Metadata};
|
use crate::fs::{self, Metadata};
|
||||||
use crate::sealed::Sealed;
|
use crate::sealed::Sealed;
|
||||||
@ -6,7 +6,7 @@
|
|||||||
use crate::time::SystemTime;
|
use crate::time::SystemTime;
|
||||||
|
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
use crate::os::macos::raw;
|
use super::raw;
|
||||||
|
|
||||||
/// OS-specific extensions to [`fs::Metadata`].
|
/// OS-specific extensions to [`fs::Metadata`].
|
||||||
///
|
///
|
||||||
@ -70,6 +70,7 @@ pub trait MetadataExt {
|
|||||||
fn st_gen(&self) -> u32;
|
fn st_gen(&self) -> u32;
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||||
fn st_lspare(&self) -> u32;
|
fn st_lspare(&self) -> u32;
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||||
fn st_qspare(&self) -> [u64; 2];
|
fn st_qspare(&self) -> [u64; 2];
|
||||||
}
|
}
|
||||||
@ -143,6 +144,7 @@ fn st_flags(&self) -> u32 {
|
|||||||
fn st_lspare(&self) -> u32 {
|
fn st_lspare(&self) -> u32 {
|
||||||
self.as_inner().as_inner().st_lspare as u32
|
self.as_inner().as_inner().st_lspare as u32
|
||||||
}
|
}
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
fn st_qspare(&self) -> [u64; 2] {
|
fn st_qspare(&self) -> [u64; 2] {
|
||||||
let qspare = self.as_inner().as_inner().st_qspare;
|
let qspare = self.as_inner().as_inner().st_qspare;
|
||||||
[qspare[0] as u64, qspare[1] as u64]
|
[qspare[0] as u64, qspare[1] as u64]
|
20
library/std/src/os/darwin/mod.rs
Normal file
20
library/std/src/os/darwin/mod.rs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
//! Platform-specific extensions to `std` for Darwin / Apple platforms.
|
||||||
|
//!
|
||||||
|
//! This is available on the following operating systems:
|
||||||
|
//! - macOS
|
||||||
|
//! - iOS
|
||||||
|
//! - tvOS
|
||||||
|
//! - watchOS
|
||||||
|
//! - visionOS
|
||||||
|
//!
|
||||||
|
//! Note: This module is called "Darwin" as that's the name of the underlying
|
||||||
|
//! core OS of the above operating systems, but it should not be confused with
|
||||||
|
//! the `-darwin` suffix in the `x86_64-apple-darwin` and
|
||||||
|
//! `aarch64-apple-darwin` target names, which are mostly named that way for
|
||||||
|
//! legacy reasons.
|
||||||
|
|
||||||
|
pub(crate) mod fs;
|
||||||
|
// deprecated, but used for public reexport under `std::os::unix::raw`, as
|
||||||
|
// well as `std::os::macos`/`std::os::ios`, because those modules precede the
|
||||||
|
// decision to remove these.
|
||||||
|
pub(super) mod raw;
|
@ -1,15 +1,4 @@
|
|||||||
//! iOS-specific raw type definitions
|
//! Apple-specific raw type definitions
|
||||||
|
|
||||||
#![stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
#![deprecated(
|
|
||||||
since = "1.8.0",
|
|
||||||
note = "these type aliases are no longer supported by \
|
|
||||||
the standard library, the `libc` crate on \
|
|
||||||
crates.io should be used instead for the correct \
|
|
||||||
definitions"
|
|
||||||
)]
|
|
||||||
#![allow(deprecated)]
|
|
||||||
|
|
||||||
use crate::os::raw::c_long;
|
use crate::os::raw::c_long;
|
||||||
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
@ -35,6 +24,7 @@
|
|||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
#[allow(dead_code)]
|
||||||
pub struct stat {
|
pub struct stat {
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
pub st_dev: i32,
|
pub st_dev: i32,
|
@ -1,160 +0,0 @@
|
|||||||
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
|
||||||
|
|
||||||
use crate::fs::{self, Metadata};
|
|
||||||
use crate::sealed::Sealed;
|
|
||||||
use crate::sys_common::{AsInner, AsInnerMut, IntoInner};
|
|
||||||
use crate::time::SystemTime;
|
|
||||||
|
|
||||||
#[allow(deprecated)]
|
|
||||||
use super::raw;
|
|
||||||
|
|
||||||
/// OS-specific extensions to [`fs::Metadata`].
|
|
||||||
///
|
|
||||||
/// [`fs::Metadata`]: crate::fs::Metadata
|
|
||||||
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
|
||||||
pub trait MetadataExt {
|
|
||||||
/// Gain a reference to the underlying `stat` structure which contains
|
|
||||||
/// the raw information returned by the OS.
|
|
||||||
///
|
|
||||||
/// The contents of the returned `stat` are **not** consistent across
|
|
||||||
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
|
||||||
/// cross-Unix abstractions contained within the raw stat.
|
|
||||||
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
|
||||||
#[deprecated(
|
|
||||||
since = "1.8.0",
|
|
||||||
note = "deprecated in favor of the accessor \
|
|
||||||
methods of this trait"
|
|
||||||
)]
|
|
||||||
#[allow(deprecated)]
|
|
||||||
fn as_raw_stat(&self) -> &raw::stat;
|
|
||||||
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_dev(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_ino(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_mode(&self) -> u32;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_nlink(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_uid(&self) -> u32;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_gid(&self) -> u32;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_rdev(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_size(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_atime(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_atime_nsec(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_mtime(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_mtime_nsec(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_ctime(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_ctime_nsec(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_birthtime(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_birthtime_nsec(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_blksize(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_blocks(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_flags(&self) -> u32;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_gen(&self) -> u32;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_lspare(&self) -> u32;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
|
||||||
impl MetadataExt for Metadata {
|
|
||||||
#[allow(deprecated)]
|
|
||||||
fn as_raw_stat(&self) -> &raw::stat {
|
|
||||||
unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) }
|
|
||||||
}
|
|
||||||
fn st_dev(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_dev as u64
|
|
||||||
}
|
|
||||||
fn st_ino(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_ino as u64
|
|
||||||
}
|
|
||||||
fn st_mode(&self) -> u32 {
|
|
||||||
self.as_inner().as_inner().st_mode as u32
|
|
||||||
}
|
|
||||||
fn st_nlink(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_nlink as u64
|
|
||||||
}
|
|
||||||
fn st_uid(&self) -> u32 {
|
|
||||||
self.as_inner().as_inner().st_uid as u32
|
|
||||||
}
|
|
||||||
fn st_gid(&self) -> u32 {
|
|
||||||
self.as_inner().as_inner().st_gid as u32
|
|
||||||
}
|
|
||||||
fn st_rdev(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_rdev as u64
|
|
||||||
}
|
|
||||||
fn st_size(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_size as u64
|
|
||||||
}
|
|
||||||
fn st_atime(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_atime as i64
|
|
||||||
}
|
|
||||||
fn st_atime_nsec(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_atime_nsec as i64
|
|
||||||
}
|
|
||||||
fn st_mtime(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_mtime as i64
|
|
||||||
}
|
|
||||||
fn st_mtime_nsec(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_mtime_nsec as i64
|
|
||||||
}
|
|
||||||
fn st_ctime(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_ctime as i64
|
|
||||||
}
|
|
||||||
fn st_ctime_nsec(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_ctime_nsec as i64
|
|
||||||
}
|
|
||||||
fn st_birthtime(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_birthtime as i64
|
|
||||||
}
|
|
||||||
fn st_birthtime_nsec(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_birthtime_nsec as i64
|
|
||||||
}
|
|
||||||
fn st_blksize(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_blksize as u64
|
|
||||||
}
|
|
||||||
fn st_blocks(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_blocks as u64
|
|
||||||
}
|
|
||||||
fn st_gen(&self) -> u32 {
|
|
||||||
self.as_inner().as_inner().st_gen as u32
|
|
||||||
}
|
|
||||||
fn st_flags(&self) -> u32 {
|
|
||||||
self.as_inner().as_inner().st_flags as u32
|
|
||||||
}
|
|
||||||
fn st_lspare(&self) -> u32 {
|
|
||||||
self.as_inner().as_inner().st_lspare as u32
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// OS-specific extensions to [`fs::FileTimes`].
|
|
||||||
#[stable(feature = "file_set_times", since = "1.75.0")]
|
|
||||||
pub trait FileTimesExt: Sealed {
|
|
||||||
/// Set the creation time of a file.
|
|
||||||
#[stable(feature = "file_set_times", since = "1.75.0")]
|
|
||||||
fn set_created(self, t: SystemTime) -> Self;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "file_set_times", since = "1.75.0")]
|
|
||||||
impl FileTimesExt for fs::FileTimes {
|
|
||||||
fn set_created(mut self, t: SystemTime) -> Self {
|
|
||||||
self.as_inner_mut().set_created(t.into_inner());
|
|
||||||
self
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,5 +2,29 @@
|
|||||||
|
|
||||||
#![stable(feature = "raw_ext", since = "1.1.0")]
|
#![stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
|
||||||
pub mod fs;
|
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
||||||
pub mod raw;
|
pub mod fs {
|
||||||
|
#[doc(inline)]
|
||||||
|
#[stable(feature = "file_set_times", since = "1.75.0")]
|
||||||
|
pub use crate::os::darwin::fs::FileTimesExt;
|
||||||
|
|
||||||
|
#[doc(inline)]
|
||||||
|
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
||||||
|
pub use crate::os::darwin::fs::MetadataExt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// iOS-specific raw type definitions
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
#[deprecated(
|
||||||
|
since = "1.8.0",
|
||||||
|
note = "these type aliases are no longer supported by \
|
||||||
|
the standard library, the `libc` crate on \
|
||||||
|
crates.io should be used instead for the correct \
|
||||||
|
definitions"
|
||||||
|
)]
|
||||||
|
#[allow(deprecated)]
|
||||||
|
pub mod raw {
|
||||||
|
#[doc(inline)]
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub use crate::os::darwin::raw::*;
|
||||||
|
}
|
||||||
|
@ -2,5 +2,29 @@
|
|||||||
|
|
||||||
#![stable(feature = "raw_ext", since = "1.1.0")]
|
#![stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
|
||||||
pub mod fs;
|
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
||||||
pub mod raw;
|
pub mod fs {
|
||||||
|
#[doc(inline)]
|
||||||
|
#[stable(feature = "file_set_times", since = "1.75.0")]
|
||||||
|
pub use crate::os::darwin::fs::FileTimesExt;
|
||||||
|
|
||||||
|
#[doc(inline)]
|
||||||
|
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
||||||
|
pub use crate::os::darwin::fs::MetadataExt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// macOS-specific raw type definitions
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
#[deprecated(
|
||||||
|
since = "1.8.0",
|
||||||
|
note = "these type aliases are no longer supported by \
|
||||||
|
the standard library, the `libc` crate on \
|
||||||
|
crates.io should be used instead for the correct \
|
||||||
|
definitions"
|
||||||
|
)]
|
||||||
|
#[allow(deprecated)]
|
||||||
|
pub mod raw {
|
||||||
|
#[doc(inline)]
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub use crate::os::darwin::raw::*;
|
||||||
|
}
|
||||||
|
@ -1,83 +0,0 @@
|
|||||||
//! macOS-specific raw type definitions
|
|
||||||
|
|
||||||
#![stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
#![deprecated(
|
|
||||||
since = "1.8.0",
|
|
||||||
note = "these type aliases are no longer supported by \
|
|
||||||
the standard library, the `libc` crate on \
|
|
||||||
crates.io should be used instead for the correct \
|
|
||||||
definitions"
|
|
||||||
)]
|
|
||||||
#![allow(deprecated)]
|
|
||||||
|
|
||||||
use crate::os::raw::c_long;
|
|
||||||
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type blkcnt_t = u64;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type blksize_t = u64;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type dev_t = u64;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type ino_t = u64;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type mode_t = u32;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type nlink_t = u64;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type off_t = u64;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type time_t = i64;
|
|
||||||
|
|
||||||
#[stable(feature = "pthread_t", since = "1.8.0")]
|
|
||||||
pub type pthread_t = usize;
|
|
||||||
|
|
||||||
#[repr(C)]
|
|
||||||
#[derive(Clone)]
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub struct stat {
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_dev: i32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_mode: u16,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_nlink: u16,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_ino: u64,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_uid: u32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_gid: u32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_rdev: i32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_atime: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_atime_nsec: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_mtime: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_mtime_nsec: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_ctime: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_ctime_nsec: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_birthtime: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_birthtime_nsec: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_size: i64,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_blocks: i64,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_blksize: i32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_flags: u32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_gen: u32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_lspare: i32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_qspare: [i64; 2],
|
|
||||||
}
|
|
@ -14,7 +14,7 @@
|
|||||||
// documented don't compile (missing things in `libc` which is empty),
|
// documented don't compile (missing things in `libc` which is empty),
|
||||||
// so just omit them with an empty module and add the "unstable" attribute.
|
// so just omit them with an empty module and add the "unstable" attribute.
|
||||||
|
|
||||||
// Unix, linux, wasi and windows are handled a bit differently.
|
// unix, linux, wasi and windows are handled a bit differently.
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
doc,
|
doc,
|
||||||
any(
|
any(
|
||||||
@ -104,6 +104,8 @@ pub mod windows {}
|
|||||||
pub mod aix;
|
pub mod aix;
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
pub mod android;
|
pub mod android;
|
||||||
|
#[cfg(target_vendor = "apple")]
|
||||||
|
pub(crate) mod darwin;
|
||||||
#[cfg(target_os = "dragonfly")]
|
#[cfg(target_os = "dragonfly")]
|
||||||
pub mod dragonfly;
|
pub mod dragonfly;
|
||||||
#[cfg(target_os = "emscripten")]
|
#[cfg(target_os = "emscripten")]
|
||||||
@ -144,19 +146,12 @@ pub mod windows {}
|
|||||||
pub mod solaris;
|
pub mod solaris;
|
||||||
#[cfg(target_os = "solid_asp3")]
|
#[cfg(target_os = "solid_asp3")]
|
||||||
pub mod solid;
|
pub mod solid;
|
||||||
#[cfg(target_os = "tvos")]
|
|
||||||
#[path = "ios/mod.rs"]
|
|
||||||
pub(crate) mod tvos;
|
|
||||||
#[cfg(target_os = "uefi")]
|
#[cfg(target_os = "uefi")]
|
||||||
pub mod uefi;
|
pub mod uefi;
|
||||||
#[cfg(target_os = "visionos")]
|
|
||||||
pub(crate) mod visionos;
|
|
||||||
#[cfg(target_os = "vita")]
|
#[cfg(target_os = "vita")]
|
||||||
pub mod vita;
|
pub mod vita;
|
||||||
#[cfg(target_os = "vxworks")]
|
#[cfg(target_os = "vxworks")]
|
||||||
pub mod vxworks;
|
pub mod vxworks;
|
||||||
#[cfg(target_os = "watchos")]
|
|
||||||
pub(crate) mod watchos;
|
|
||||||
#[cfg(target_os = "xous")]
|
#[cfg(target_os = "xous")]
|
||||||
pub mod xous;
|
pub mod xous;
|
||||||
|
|
||||||
|
@ -41,6 +41,8 @@ mod platform {
|
|||||||
pub use crate::os::aix::*;
|
pub use crate::os::aix::*;
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
pub use crate::os::android::*;
|
pub use crate::os::android::*;
|
||||||
|
#[cfg(target_vendor = "apple")]
|
||||||
|
pub(super) use crate::os::darwin::*;
|
||||||
#[cfg(target_os = "dragonfly")]
|
#[cfg(target_os = "dragonfly")]
|
||||||
pub use crate::os::dragonfly::*;
|
pub use crate::os::dragonfly::*;
|
||||||
#[cfg(target_os = "emscripten")]
|
#[cfg(target_os = "emscripten")]
|
||||||
@ -59,14 +61,10 @@ mod platform {
|
|||||||
pub use crate::os::hurd::*;
|
pub use crate::os::hurd::*;
|
||||||
#[cfg(target_os = "illumos")]
|
#[cfg(target_os = "illumos")]
|
||||||
pub use crate::os::illumos::*;
|
pub use crate::os::illumos::*;
|
||||||
#[cfg(target_os = "ios")]
|
|
||||||
pub use crate::os::ios::*;
|
|
||||||
#[cfg(target_os = "l4re")]
|
#[cfg(target_os = "l4re")]
|
||||||
pub use crate::os::l4re::*;
|
pub use crate::os::l4re::*;
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
pub use crate::os::linux::*;
|
pub use crate::os::linux::*;
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
pub use crate::os::macos::*;
|
|
||||||
#[cfg(target_os = "netbsd")]
|
#[cfg(target_os = "netbsd")]
|
||||||
pub use crate::os::netbsd::*;
|
pub use crate::os::netbsd::*;
|
||||||
#[cfg(target_os = "nto")]
|
#[cfg(target_os = "nto")]
|
||||||
@ -77,16 +75,10 @@ mod platform {
|
|||||||
pub use crate::os::redox::*;
|
pub use crate::os::redox::*;
|
||||||
#[cfg(target_os = "solaris")]
|
#[cfg(target_os = "solaris")]
|
||||||
pub use crate::os::solaris::*;
|
pub use crate::os::solaris::*;
|
||||||
#[cfg(target_os = "tvos")]
|
|
||||||
pub use crate::os::tvos::*;
|
|
||||||
#[cfg(target_os = "visionos")]
|
|
||||||
pub use crate::os::visionos::*;
|
|
||||||
#[cfg(target_os = "vita")]
|
#[cfg(target_os = "vita")]
|
||||||
pub use crate::os::vita::*;
|
pub use crate::os::vita::*;
|
||||||
#[cfg(target_os = "vxworks")]
|
#[cfg(target_os = "vxworks")]
|
||||||
pub use crate::os::vxworks::*;
|
pub use crate::os::vxworks::*;
|
||||||
#[cfg(target_os = "watchos")]
|
|
||||||
pub use crate::os::watchos::*;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod ffi;
|
pub mod ffi;
|
||||||
|
@ -1,160 +0,0 @@
|
|||||||
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
|
||||||
|
|
||||||
use crate::fs::{self, Metadata};
|
|
||||||
use crate::sealed::Sealed;
|
|
||||||
use crate::sys_common::{AsInner, AsInnerMut, IntoInner};
|
|
||||||
use crate::time::SystemTime;
|
|
||||||
|
|
||||||
#[allow(deprecated)]
|
|
||||||
use super::raw;
|
|
||||||
|
|
||||||
/// OS-specific extensions to [`fs::Metadata`].
|
|
||||||
///
|
|
||||||
/// [`fs::Metadata`]: crate::fs::Metadata
|
|
||||||
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
|
||||||
pub trait MetadataExt {
|
|
||||||
/// Gain a reference to the underlying `stat` structure which contains
|
|
||||||
/// the raw information returned by the OS.
|
|
||||||
///
|
|
||||||
/// The contents of the returned `stat` are **not** consistent across
|
|
||||||
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
|
||||||
/// cross-Unix abstractions contained within the raw stat.
|
|
||||||
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
|
||||||
#[deprecated(
|
|
||||||
since = "1.8.0",
|
|
||||||
note = "deprecated in favor of the accessor \
|
|
||||||
methods of this trait"
|
|
||||||
)]
|
|
||||||
#[allow(deprecated)]
|
|
||||||
fn as_raw_stat(&self) -> &raw::stat;
|
|
||||||
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_dev(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_ino(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_mode(&self) -> u32;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_nlink(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_uid(&self) -> u32;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_gid(&self) -> u32;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_rdev(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_size(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_atime(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_atime_nsec(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_mtime(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_mtime_nsec(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_ctime(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_ctime_nsec(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_birthtime(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_birthtime_nsec(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_blksize(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_blocks(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_flags(&self) -> u32;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_gen(&self) -> u32;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_lspare(&self) -> u32;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
|
||||||
impl MetadataExt for Metadata {
|
|
||||||
#[allow(deprecated)]
|
|
||||||
fn as_raw_stat(&self) -> &raw::stat {
|
|
||||||
unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) }
|
|
||||||
}
|
|
||||||
fn st_dev(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_dev as u64
|
|
||||||
}
|
|
||||||
fn st_ino(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_ino as u64
|
|
||||||
}
|
|
||||||
fn st_mode(&self) -> u32 {
|
|
||||||
self.as_inner().as_inner().st_mode as u32
|
|
||||||
}
|
|
||||||
fn st_nlink(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_nlink as u64
|
|
||||||
}
|
|
||||||
fn st_uid(&self) -> u32 {
|
|
||||||
self.as_inner().as_inner().st_uid as u32
|
|
||||||
}
|
|
||||||
fn st_gid(&self) -> u32 {
|
|
||||||
self.as_inner().as_inner().st_gid as u32
|
|
||||||
}
|
|
||||||
fn st_rdev(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_rdev as u64
|
|
||||||
}
|
|
||||||
fn st_size(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_size as u64
|
|
||||||
}
|
|
||||||
fn st_atime(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_atime as i64
|
|
||||||
}
|
|
||||||
fn st_atime_nsec(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_atime_nsec as i64
|
|
||||||
}
|
|
||||||
fn st_mtime(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_mtime as i64
|
|
||||||
}
|
|
||||||
fn st_mtime_nsec(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_mtime_nsec as i64
|
|
||||||
}
|
|
||||||
fn st_ctime(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_ctime as i64
|
|
||||||
}
|
|
||||||
fn st_ctime_nsec(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_ctime_nsec as i64
|
|
||||||
}
|
|
||||||
fn st_birthtime(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_birthtime as i64
|
|
||||||
}
|
|
||||||
fn st_birthtime_nsec(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_birthtime_nsec as i64
|
|
||||||
}
|
|
||||||
fn st_blksize(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_blksize as u64
|
|
||||||
}
|
|
||||||
fn st_blocks(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_blocks as u64
|
|
||||||
}
|
|
||||||
fn st_gen(&self) -> u32 {
|
|
||||||
self.as_inner().as_inner().st_gen as u32
|
|
||||||
}
|
|
||||||
fn st_flags(&self) -> u32 {
|
|
||||||
self.as_inner().as_inner().st_flags as u32
|
|
||||||
}
|
|
||||||
fn st_lspare(&self) -> u32 {
|
|
||||||
self.as_inner().as_inner().st_lspare as u32
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// OS-specific extensions to [`fs::FileTimes`].
|
|
||||||
#[stable(feature = "file_set_times", since = "1.75.0")]
|
|
||||||
pub trait FileTimesExt: Sealed {
|
|
||||||
/// Set the creation time of a file.
|
|
||||||
#[stable(feature = "file_set_times", since = "1.75.0")]
|
|
||||||
fn set_created(self, t: SystemTime) -> Self;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "file_set_times", since = "1.75.0")]
|
|
||||||
impl FileTimesExt for fs::FileTimes {
|
|
||||||
fn set_created(mut self, t: SystemTime) -> Self {
|
|
||||||
self.as_inner_mut().set_created(t.into_inner());
|
|
||||||
self
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
//! visionos-specific definitions
|
|
||||||
|
|
||||||
#![stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
|
|
||||||
pub mod fs;
|
|
||||||
pub mod raw;
|
|
@ -1,83 +0,0 @@
|
|||||||
//! visionos-specific raw type definitions
|
|
||||||
|
|
||||||
#![stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
#![deprecated(
|
|
||||||
since = "1.8.0",
|
|
||||||
note = "these type aliases are no longer supported by \
|
|
||||||
the standard library, the `libc` crate on \
|
|
||||||
crates.io should be used instead for the correct \
|
|
||||||
definitions"
|
|
||||||
)]
|
|
||||||
#![allow(deprecated)]
|
|
||||||
|
|
||||||
use crate::os::raw::c_long;
|
|
||||||
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type blkcnt_t = u64;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type blksize_t = u64;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type dev_t = u64;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type ino_t = u64;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type mode_t = u32;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type nlink_t = u64;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type off_t = u64;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type time_t = i64;
|
|
||||||
|
|
||||||
#[stable(feature = "pthread_t", since = "1.8.0")]
|
|
||||||
pub type pthread_t = usize;
|
|
||||||
|
|
||||||
#[repr(C)]
|
|
||||||
#[derive(Clone)]
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub struct stat {
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_dev: i32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_mode: u16,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_nlink: u16,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_ino: u64,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_uid: u32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_gid: u32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_rdev: i32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_atime: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_atime_nsec: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_mtime: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_mtime_nsec: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_ctime: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_ctime_nsec: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_birthtime: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_birthtime_nsec: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_size: i64,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_blocks: i64,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_blksize: i32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_flags: u32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_gen: u32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_lspare: i32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_qspare: [i64; 2],
|
|
||||||
}
|
|
@ -1,160 +0,0 @@
|
|||||||
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
|
||||||
|
|
||||||
use crate::fs::{self, Metadata};
|
|
||||||
use crate::sealed::Sealed;
|
|
||||||
use crate::sys_common::{AsInner, AsInnerMut, IntoInner};
|
|
||||||
use crate::time::SystemTime;
|
|
||||||
|
|
||||||
#[allow(deprecated)]
|
|
||||||
use crate::os::watchos::raw;
|
|
||||||
|
|
||||||
/// OS-specific extensions to [`fs::Metadata`].
|
|
||||||
///
|
|
||||||
/// [`fs::Metadata`]: crate::fs::Metadata
|
|
||||||
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
|
||||||
pub trait MetadataExt {
|
|
||||||
/// Gain a reference to the underlying `stat` structure which contains
|
|
||||||
/// the raw information returned by the OS.
|
|
||||||
///
|
|
||||||
/// The contents of the returned `stat` are **not** consistent across
|
|
||||||
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
|
||||||
/// cross-Unix abstractions contained within the raw stat.
|
|
||||||
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
|
||||||
#[deprecated(
|
|
||||||
since = "1.8.0",
|
|
||||||
note = "deprecated in favor of the accessor \
|
|
||||||
methods of this trait"
|
|
||||||
)]
|
|
||||||
#[allow(deprecated)]
|
|
||||||
fn as_raw_stat(&self) -> &raw::stat;
|
|
||||||
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_dev(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_ino(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_mode(&self) -> u32;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_nlink(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_uid(&self) -> u32;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_gid(&self) -> u32;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_rdev(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_size(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_atime(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_atime_nsec(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_mtime(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_mtime_nsec(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_ctime(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_ctime_nsec(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_birthtime(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_birthtime_nsec(&self) -> i64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_blksize(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_blocks(&self) -> u64;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_flags(&self) -> u32;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_gen(&self) -> u32;
|
|
||||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
|
||||||
fn st_lspare(&self) -> u32;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
|
||||||
impl MetadataExt for Metadata {
|
|
||||||
#[allow(deprecated)]
|
|
||||||
fn as_raw_stat(&self) -> &raw::stat {
|
|
||||||
unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) }
|
|
||||||
}
|
|
||||||
fn st_dev(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_dev as u64
|
|
||||||
}
|
|
||||||
fn st_ino(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_ino as u64
|
|
||||||
}
|
|
||||||
fn st_mode(&self) -> u32 {
|
|
||||||
self.as_inner().as_inner().st_mode as u32
|
|
||||||
}
|
|
||||||
fn st_nlink(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_nlink as u64
|
|
||||||
}
|
|
||||||
fn st_uid(&self) -> u32 {
|
|
||||||
self.as_inner().as_inner().st_uid as u32
|
|
||||||
}
|
|
||||||
fn st_gid(&self) -> u32 {
|
|
||||||
self.as_inner().as_inner().st_gid as u32
|
|
||||||
}
|
|
||||||
fn st_rdev(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_rdev as u64
|
|
||||||
}
|
|
||||||
fn st_size(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_size as u64
|
|
||||||
}
|
|
||||||
fn st_atime(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_atime as i64
|
|
||||||
}
|
|
||||||
fn st_atime_nsec(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_atime_nsec as i64
|
|
||||||
}
|
|
||||||
fn st_mtime(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_mtime as i64
|
|
||||||
}
|
|
||||||
fn st_mtime_nsec(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_mtime_nsec as i64
|
|
||||||
}
|
|
||||||
fn st_ctime(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_ctime as i64
|
|
||||||
}
|
|
||||||
fn st_ctime_nsec(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_ctime_nsec as i64
|
|
||||||
}
|
|
||||||
fn st_birthtime(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_birthtime as i64
|
|
||||||
}
|
|
||||||
fn st_birthtime_nsec(&self) -> i64 {
|
|
||||||
self.as_inner().as_inner().st_birthtime_nsec as i64
|
|
||||||
}
|
|
||||||
fn st_blksize(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_blksize as u64
|
|
||||||
}
|
|
||||||
fn st_blocks(&self) -> u64 {
|
|
||||||
self.as_inner().as_inner().st_blocks as u64
|
|
||||||
}
|
|
||||||
fn st_gen(&self) -> u32 {
|
|
||||||
self.as_inner().as_inner().st_gen as u32
|
|
||||||
}
|
|
||||||
fn st_flags(&self) -> u32 {
|
|
||||||
self.as_inner().as_inner().st_flags as u32
|
|
||||||
}
|
|
||||||
fn st_lspare(&self) -> u32 {
|
|
||||||
self.as_inner().as_inner().st_lspare as u32
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// OS-specific extensions to [`fs::FileTimes`].
|
|
||||||
#[stable(feature = "file_set_times", since = "1.75.0")]
|
|
||||||
pub trait FileTimesExt: Sealed {
|
|
||||||
/// Set the creation time of a file.
|
|
||||||
#[stable(feature = "file_set_times", since = "1.75.0")]
|
|
||||||
fn set_created(self, t: SystemTime) -> Self;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "file_set_times", since = "1.75.0")]
|
|
||||||
impl FileTimesExt for fs::FileTimes {
|
|
||||||
fn set_created(mut self, t: SystemTime) -> Self {
|
|
||||||
self.as_inner_mut().set_created(t.into_inner());
|
|
||||||
self
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
//! watchOS-specific definitions
|
|
||||||
|
|
||||||
#![stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
|
|
||||||
pub mod fs;
|
|
||||||
pub mod raw;
|
|
@ -1,83 +0,0 @@
|
|||||||
//! watchOS-specific raw type definitions
|
|
||||||
|
|
||||||
#![stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
#![deprecated(
|
|
||||||
since = "1.8.0",
|
|
||||||
note = "these type aliases are no longer supported by \
|
|
||||||
the standard library, the `libc` crate on \
|
|
||||||
crates.io should be used instead for the correct \
|
|
||||||
definitions"
|
|
||||||
)]
|
|
||||||
#![allow(deprecated)]
|
|
||||||
|
|
||||||
use crate::os::raw::c_long;
|
|
||||||
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type blkcnt_t = u64;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type blksize_t = u64;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type dev_t = u64;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type ino_t = u64;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type mode_t = u32;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type nlink_t = u64;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type off_t = u64;
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub type time_t = i64;
|
|
||||||
|
|
||||||
#[stable(feature = "pthread_t", since = "1.8.0")]
|
|
||||||
pub type pthread_t = usize;
|
|
||||||
|
|
||||||
#[repr(C)]
|
|
||||||
#[derive(Clone)]
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub struct stat {
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_dev: i32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_mode: u16,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_nlink: u16,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_ino: u64,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_uid: u32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_gid: u32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_rdev: i32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_atime: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_atime_nsec: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_mtime: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_mtime_nsec: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_ctime: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_ctime_nsec: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_birthtime: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_birthtime_nsec: c_long,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_size: i64,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_blocks: i64,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_blksize: i32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_flags: u32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_gen: u32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_lspare: i32,
|
|
||||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
|
||||||
pub st_qspare: [i64; 2],
|
|
||||||
}
|
|
@ -221,6 +221,13 @@ trigger_files = [
|
|||||||
"library/std/src/os/android"
|
"library/std/src/os/android"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[autolabel."O-apple"]
|
||||||
|
trigger_files = [
|
||||||
|
"library/std/src/os/darwin",
|
||||||
|
"library/std/src/sys/pal/unix/thread_parking/darwin.rs",
|
||||||
|
"compiler/rustc_target/src/spec/base/apple",
|
||||||
|
]
|
||||||
|
|
||||||
[autolabel."O-fuchsia"]
|
[autolabel."O-fuchsia"]
|
||||||
trigger_files = [
|
trigger_files = [
|
||||||
"library/std/src/os/fuchsia"
|
"library/std/src/os/fuchsia"
|
||||||
@ -250,8 +257,6 @@ trigger_files = [
|
|||||||
[autolabel."O-macos"]
|
[autolabel."O-macos"]
|
||||||
trigger_files = [
|
trigger_files = [
|
||||||
"library/std/src/os/macos",
|
"library/std/src/os/macos",
|
||||||
"library/std/src/sys/pal/unix/thread_parking/darwin.rs",
|
|
||||||
"compiler/rustc_target/src/spec/base/apple",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[autolabel."O-netbsd"]
|
[autolabel."O-netbsd"]
|
||||||
@ -299,22 +304,12 @@ trigger_files = [
|
|||||||
"library/std/src/os/wasm"
|
"library/std/src/os/wasm"
|
||||||
]
|
]
|
||||||
|
|
||||||
[autolabel."O-watchos"]
|
|
||||||
trigger_files = [
|
|
||||||
"library/std/src/os/watchos"
|
|
||||||
]
|
|
||||||
|
|
||||||
[autolabel."O-windows"]
|
[autolabel."O-windows"]
|
||||||
trigger_files = [
|
trigger_files = [
|
||||||
"library/std/src/sys/pal/windows",
|
"library/std/src/sys/pal/windows",
|
||||||
"library/std/src/os/windows"
|
"library/std/src/os/windows"
|
||||||
]
|
]
|
||||||
|
|
||||||
[autolabel."O-visionos"]
|
|
||||||
trigger_files = [
|
|
||||||
"library/std/src/os/visionos"
|
|
||||||
]
|
|
||||||
|
|
||||||
[autolabel."T-bootstrap"]
|
[autolabel."T-bootstrap"]
|
||||||
trigger_files = [
|
trigger_files = [
|
||||||
"x.py",
|
"x.py",
|
||||||
|
Loading…
Reference in New Issue
Block a user