Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/aix/fs.rs +348 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/aix/mod.rs +6 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/aix/raw.rs +8 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/android/fs.rs +116 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/android/mod.rs +7 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/android/net.rs +10 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/android/raw.rs +230 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/cygwin/fs.rs +102 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/cygwin/mod.rs +5 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/cygwin/net.rs +17 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/cygwin/raw.rs +4 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/darwin/fs.rs +172 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/darwin/mod.rs +25 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/darwin/objc.rs +13 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/darwin/raw.rs +73 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/dragonfly/fs.rs +131 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/dragonfly/mod.rs +6 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/dragonfly/raw.rs +83 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/emscripten/fs.rs +116 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/emscripten/mod.rs +6 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/emscripten/raw.rs +78 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/espidf/fs.rs +116 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/espidf/mod.rs +6 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/espidf/raw.rs +69 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fd/mod.rs +31 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fd/net.rs +46 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fd/owned.rs +580 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fd/raw.rs +338 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fd/stdio.rs +53 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fd/tests.rs +52 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fortanix_sgx/arch.rs +81 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fortanix_sgx/ffi.rs +41 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fortanix_sgx/io.rs +151 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fortanix_sgx/mod.rs +47 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/freebsd/fs.rs +143 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/freebsd/mod.rs +7 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/freebsd/net.rs +91 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/freebsd/raw.rs +86 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fuchsia/fs.rs +95 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fuchsia/mod.rs +6 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fuchsia/raw.rs +294 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/haiku/fs.rs +126 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/haiku/mod.rs +6 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/haiku/raw.rs +79 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/hermit/ffi.rs +41 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/hermit/mod.rs +19 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/horizon/fs.rs +95 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/horizon/mod.rs +7 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/horizon/raw.rs +71 -0
- rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/hurd/fs.rs +348 -0
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/aix/fs.rs
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! AIX specific extensions to primitives in the [`std::fs`] module.
|
| 2 |
+
//!
|
| 3 |
+
//! [`std::fs`]: crate::fs
|
| 4 |
+
|
| 5 |
+
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
| 6 |
+
|
| 7 |
+
use crate::fs::Metadata;
|
| 8 |
+
use crate::sys::AsInner;
|
| 9 |
+
|
| 10 |
+
/// OS-specific extensions to [`fs::Metadata`].
|
| 11 |
+
///
|
| 12 |
+
/// [`fs::Metadata`]: crate::fs::Metadata
|
| 13 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 14 |
+
pub trait MetadataExt {
|
| 15 |
+
/// Returns the device ID on which this file resides.
|
| 16 |
+
///
|
| 17 |
+
/// # Examples
|
| 18 |
+
///
|
| 19 |
+
/// ```no_run
|
| 20 |
+
/// use std::fs;
|
| 21 |
+
/// use std::io;
|
| 22 |
+
/// use std::os::aix::fs::MetadataExt;
|
| 23 |
+
///
|
| 24 |
+
/// fn main() -> io::Result<()> {
|
| 25 |
+
/// let meta = fs::metadata("some_file")?;
|
| 26 |
+
/// println!("{}", meta.st_dev());
|
| 27 |
+
/// Ok(())
|
| 28 |
+
/// }
|
| 29 |
+
/// ```
|
| 30 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 31 |
+
fn st_dev(&self) -> u64;
|
| 32 |
+
/// Returns the inode number.
|
| 33 |
+
///
|
| 34 |
+
/// # Examples
|
| 35 |
+
///
|
| 36 |
+
/// ```no_run
|
| 37 |
+
/// use std::fs;
|
| 38 |
+
/// use std::io;
|
| 39 |
+
/// use std::os::aix::fs::MetadataExt;
|
| 40 |
+
///
|
| 41 |
+
/// fn main() -> io::Result<()> {
|
| 42 |
+
/// let meta = fs::metadata("some_file")?;
|
| 43 |
+
/// println!("{}", meta.st_ino());
|
| 44 |
+
/// Ok(())
|
| 45 |
+
/// }
|
| 46 |
+
/// ```
|
| 47 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 48 |
+
fn st_ino(&self) -> u64;
|
| 49 |
+
/// Returns the file type and mode.
|
| 50 |
+
///
|
| 51 |
+
/// # Examples
|
| 52 |
+
///
|
| 53 |
+
/// ```no_run
|
| 54 |
+
/// use std::fs;
|
| 55 |
+
/// use std::io;
|
| 56 |
+
/// use std::os::aix::fs::MetadataExt;
|
| 57 |
+
///
|
| 58 |
+
/// fn main() -> io::Result<()> {
|
| 59 |
+
/// let meta = fs::metadata("some_file")?;
|
| 60 |
+
/// println!("{}", meta.st_mode());
|
| 61 |
+
/// Ok(())
|
| 62 |
+
/// }
|
| 63 |
+
/// ```
|
| 64 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 65 |
+
fn st_mode(&self) -> u32;
|
| 66 |
+
/// Returns the number of hard links to file.
|
| 67 |
+
///
|
| 68 |
+
/// # Examples
|
| 69 |
+
///
|
| 70 |
+
/// ```no_run
|
| 71 |
+
/// use std::fs;
|
| 72 |
+
/// use std::io;
|
| 73 |
+
/// use std::os::aix::fs::MetadataExt;
|
| 74 |
+
///
|
| 75 |
+
/// fn main() -> io::Result<()> {
|
| 76 |
+
/// let meta = fs::metadata("some_file")?;
|
| 77 |
+
/// println!("{}", meta.st_nlink());
|
| 78 |
+
/// Ok(())
|
| 79 |
+
/// }
|
| 80 |
+
/// ```
|
| 81 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 82 |
+
fn st_nlink(&self) -> u64;
|
| 83 |
+
/// Returns the user ID of the file owner.
|
| 84 |
+
///
|
| 85 |
+
/// # Examples
|
| 86 |
+
///
|
| 87 |
+
/// ```no_run
|
| 88 |
+
/// use std::fs;
|
| 89 |
+
/// use std::io;
|
| 90 |
+
/// use std::os::aix::fs::MetadataExt;
|
| 91 |
+
///
|
| 92 |
+
/// fn main() -> io::Result<()> {
|
| 93 |
+
/// let meta = fs::metadata("some_file")?;
|
| 94 |
+
/// println!("{}", meta.st_uid());
|
| 95 |
+
/// Ok(())
|
| 96 |
+
/// }
|
| 97 |
+
/// ```
|
| 98 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 99 |
+
fn st_uid(&self) -> u32;
|
| 100 |
+
/// Returns the group ID of the file owner.
|
| 101 |
+
///
|
| 102 |
+
/// # Examples
|
| 103 |
+
///
|
| 104 |
+
/// ```no_run
|
| 105 |
+
/// use std::fs;
|
| 106 |
+
/// use std::io;
|
| 107 |
+
/// use std::os::aix::fs::MetadataExt;
|
| 108 |
+
///
|
| 109 |
+
/// fn main() -> io::Result<()> {
|
| 110 |
+
/// let meta = fs::metadata("some_file")?;
|
| 111 |
+
/// println!("{}", meta.st_gid());
|
| 112 |
+
/// Ok(())
|
| 113 |
+
/// }
|
| 114 |
+
/// ```
|
| 115 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 116 |
+
fn st_gid(&self) -> u32;
|
| 117 |
+
/// Returns the device ID that this file represents. Only relevant for special file.
|
| 118 |
+
///
|
| 119 |
+
/// # Examples
|
| 120 |
+
///
|
| 121 |
+
/// ```no_run
|
| 122 |
+
/// use std::fs;
|
| 123 |
+
/// use std::io;
|
| 124 |
+
/// use std::os::aix::fs::MetadataExt;
|
| 125 |
+
///
|
| 126 |
+
/// fn main() -> io::Result<()> {
|
| 127 |
+
/// let meta = fs::metadata("some_file")?;
|
| 128 |
+
/// println!("{}", meta.st_rdev());
|
| 129 |
+
/// Ok(())
|
| 130 |
+
/// }
|
| 131 |
+
/// ```
|
| 132 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 133 |
+
fn st_rdev(&self) -> u64;
|
| 134 |
+
/// Returns the size of the file (if it is a regular file or a symbolic link) in bytes.
|
| 135 |
+
///
|
| 136 |
+
/// The size of a symbolic link is the length of the pathname it contains,
|
| 137 |
+
/// without a terminating null byte.
|
| 138 |
+
///
|
| 139 |
+
/// # Examples
|
| 140 |
+
///
|
| 141 |
+
/// ```no_run
|
| 142 |
+
/// use std::fs;
|
| 143 |
+
/// use std::io;
|
| 144 |
+
/// use std::os::aix::fs::MetadataExt;
|
| 145 |
+
///
|
| 146 |
+
/// fn main() -> io::Result<()> {
|
| 147 |
+
/// let meta = fs::metadata("some_file")?;
|
| 148 |
+
/// println!("{}", meta.st_size());
|
| 149 |
+
/// Ok(())
|
| 150 |
+
/// }
|
| 151 |
+
/// ```
|
| 152 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 153 |
+
fn st_size(&self) -> u64;
|
| 154 |
+
/// Returns the last access time of the file, in seconds since Unix Epoch.
|
| 155 |
+
///
|
| 156 |
+
/// # Examples
|
| 157 |
+
///
|
| 158 |
+
/// ```no_run
|
| 159 |
+
/// use std::fs;
|
| 160 |
+
/// use std::io;
|
| 161 |
+
/// use std::os::aix::fs::MetadataExt;
|
| 162 |
+
///
|
| 163 |
+
/// fn main() -> io::Result<()> {
|
| 164 |
+
/// let meta = fs::metadata("some_file")?;
|
| 165 |
+
/// println!("{}", meta.st_atime());
|
| 166 |
+
/// Ok(())
|
| 167 |
+
/// }
|
| 168 |
+
/// ```
|
| 169 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 170 |
+
fn st_atime(&self) -> i64;
|
| 171 |
+
/// Returns the last access time of the file, in nanoseconds since [`st_atime`].
|
| 172 |
+
///
|
| 173 |
+
/// [`st_atime`]: Self::st_atime
|
| 174 |
+
///
|
| 175 |
+
/// # Examples
|
| 176 |
+
///
|
| 177 |
+
/// ```no_run
|
| 178 |
+
/// use std::fs;
|
| 179 |
+
/// use std::io;
|
| 180 |
+
/// use std::os::aix::fs::MetadataExt;
|
| 181 |
+
///
|
| 182 |
+
/// fn main() -> io::Result<()> {
|
| 183 |
+
/// let meta = fs::metadata("some_file")?;
|
| 184 |
+
/// println!("{}", meta.st_atime_nsec());
|
| 185 |
+
/// Ok(())
|
| 186 |
+
/// }
|
| 187 |
+
/// ```
|
| 188 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 189 |
+
fn st_atime_nsec(&self) -> i64;
|
| 190 |
+
/// Returns the last modification time of the file, in seconds since Unix Epoch.
|
| 191 |
+
///
|
| 192 |
+
/// # Examples
|
| 193 |
+
///
|
| 194 |
+
/// ```no_run
|
| 195 |
+
/// use std::fs;
|
| 196 |
+
/// use std::io;
|
| 197 |
+
/// use std::os::aix::fs::MetadataExt;
|
| 198 |
+
///
|
| 199 |
+
/// fn main() -> io::Result<()> {
|
| 200 |
+
/// let meta = fs::metadata("some_file")?;
|
| 201 |
+
/// println!("{}", meta.st_mtime());
|
| 202 |
+
/// Ok(())
|
| 203 |
+
/// }
|
| 204 |
+
/// ```
|
| 205 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 206 |
+
fn st_mtime(&self) -> i64;
|
| 207 |
+
/// Returns the last modification time of the file, in nanoseconds since [`st_mtime`].
|
| 208 |
+
///
|
| 209 |
+
/// [`st_mtime`]: Self::st_mtime
|
| 210 |
+
///
|
| 211 |
+
/// # Examples
|
| 212 |
+
///
|
| 213 |
+
/// ```no_run
|
| 214 |
+
/// use std::fs;
|
| 215 |
+
/// use std::io;
|
| 216 |
+
/// use std::os::aix::fs::MetadataExt;
|
| 217 |
+
///
|
| 218 |
+
/// fn main() -> io::Result<()> {
|
| 219 |
+
/// let meta = fs::metadata("some_file")?;
|
| 220 |
+
/// println!("{}", meta.st_mtime_nsec());
|
| 221 |
+
/// Ok(())
|
| 222 |
+
/// }
|
| 223 |
+
/// ```
|
| 224 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 225 |
+
fn st_mtime_nsec(&self) -> i64;
|
| 226 |
+
/// Returns the last status change time of the file, in seconds since Unix Epoch.
|
| 227 |
+
///
|
| 228 |
+
/// # Examples
|
| 229 |
+
///
|
| 230 |
+
/// ```no_run
|
| 231 |
+
/// use std::fs;
|
| 232 |
+
/// use std::io;
|
| 233 |
+
/// use std::os::aix::fs::MetadataExt;
|
| 234 |
+
///
|
| 235 |
+
/// fn main() -> io::Result<()> {
|
| 236 |
+
/// let meta = fs::metadata("some_file")?;
|
| 237 |
+
/// println!("{}", meta.st_ctime());
|
| 238 |
+
/// Ok(())
|
| 239 |
+
/// }
|
| 240 |
+
/// ```
|
| 241 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 242 |
+
fn st_ctime(&self) -> i64;
|
| 243 |
+
/// Returns the last status change time of the file, in nanoseconds since [`st_ctime`].
|
| 244 |
+
///
|
| 245 |
+
/// [`st_ctime`]: Self::st_ctime
|
| 246 |
+
///
|
| 247 |
+
/// # Examples
|
| 248 |
+
///
|
| 249 |
+
/// ```no_run
|
| 250 |
+
/// use std::fs;
|
| 251 |
+
/// use std::io;
|
| 252 |
+
/// use std::os::aix::fs::MetadataExt;
|
| 253 |
+
///
|
| 254 |
+
/// fn main() -> io::Result<()> {
|
| 255 |
+
/// let meta = fs::metadata("some_file")?;
|
| 256 |
+
/// println!("{}", meta.st_ctime_nsec());
|
| 257 |
+
/// Ok(())
|
| 258 |
+
/// }
|
| 259 |
+
/// ```
|
| 260 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 261 |
+
fn st_ctime_nsec(&self) -> i64;
|
| 262 |
+
/// Returns the "preferred" block size for efficient filesystem I/O.
|
| 263 |
+
///
|
| 264 |
+
/// # Examples
|
| 265 |
+
///
|
| 266 |
+
/// ```no_run
|
| 267 |
+
/// use std::fs;
|
| 268 |
+
/// use std::io;
|
| 269 |
+
/// use std::os::aix::fs::MetadataExt;
|
| 270 |
+
///
|
| 271 |
+
/// fn main() -> io::Result<()> {
|
| 272 |
+
/// let meta = fs::metadata("some_file")?;
|
| 273 |
+
/// println!("{}", meta.st_blksize());
|
| 274 |
+
/// Ok(())
|
| 275 |
+
/// }
|
| 276 |
+
/// ```
|
| 277 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 278 |
+
fn st_blksize(&self) -> u64;
|
| 279 |
+
/// Returns the number of blocks allocated to the file, 512-byte units.
|
| 280 |
+
///
|
| 281 |
+
/// # Examples
|
| 282 |
+
///
|
| 283 |
+
/// ```no_run
|
| 284 |
+
/// use std::fs;
|
| 285 |
+
/// use std::io;
|
| 286 |
+
/// use std::os::aix::fs::MetadataExt;
|
| 287 |
+
///
|
| 288 |
+
/// fn main() -> io::Result<()> {
|
| 289 |
+
/// let meta = fs::metadata("some_file")?;
|
| 290 |
+
/// println!("{}", meta.st_blocks());
|
| 291 |
+
/// Ok(())
|
| 292 |
+
/// }
|
| 293 |
+
/// ```
|
| 294 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 295 |
+
fn st_blocks(&self) -> u64;
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 299 |
+
impl MetadataExt for Metadata {
|
| 300 |
+
fn st_dev(&self) -> u64 {
|
| 301 |
+
self.as_inner().as_inner().st_dev as u64
|
| 302 |
+
}
|
| 303 |
+
fn st_ino(&self) -> u64 {
|
| 304 |
+
self.as_inner().as_inner().st_ino as u64
|
| 305 |
+
}
|
| 306 |
+
fn st_mode(&self) -> u32 {
|
| 307 |
+
self.as_inner().as_inner().st_mode as u32
|
| 308 |
+
}
|
| 309 |
+
fn st_nlink(&self) -> u64 {
|
| 310 |
+
self.as_inner().as_inner().st_nlink as u64
|
| 311 |
+
}
|
| 312 |
+
fn st_uid(&self) -> u32 {
|
| 313 |
+
self.as_inner().as_inner().st_uid as u32
|
| 314 |
+
}
|
| 315 |
+
fn st_gid(&self) -> u32 {
|
| 316 |
+
self.as_inner().as_inner().st_gid as u32
|
| 317 |
+
}
|
| 318 |
+
fn st_rdev(&self) -> u64 {
|
| 319 |
+
self.as_inner().as_inner().st_rdev as u64
|
| 320 |
+
}
|
| 321 |
+
fn st_size(&self) -> u64 {
|
| 322 |
+
self.as_inner().as_inner().st_size as u64
|
| 323 |
+
}
|
| 324 |
+
fn st_atime(&self) -> i64 {
|
| 325 |
+
self.as_inner().as_inner().st_atime.tv_sec as i64
|
| 326 |
+
}
|
| 327 |
+
fn st_atime_nsec(&self) -> i64 {
|
| 328 |
+
self.as_inner().as_inner().st_atime.tv_nsec as i64
|
| 329 |
+
}
|
| 330 |
+
fn st_mtime(&self) -> i64 {
|
| 331 |
+
self.as_inner().as_inner().st_mtime.tv_sec as i64
|
| 332 |
+
}
|
| 333 |
+
fn st_mtime_nsec(&self) -> i64 {
|
| 334 |
+
self.as_inner().as_inner().st_mtime.tv_nsec as i64
|
| 335 |
+
}
|
| 336 |
+
fn st_ctime(&self) -> i64 {
|
| 337 |
+
self.as_inner().as_inner().st_ctime.tv_sec as i64
|
| 338 |
+
}
|
| 339 |
+
fn st_ctime_nsec(&self) -> i64 {
|
| 340 |
+
self.as_inner().as_inner().st_ctime.tv_nsec as i64
|
| 341 |
+
}
|
| 342 |
+
fn st_blksize(&self) -> u64 {
|
| 343 |
+
self.as_inner().as_inner().st_blksize as u64
|
| 344 |
+
}
|
| 345 |
+
fn st_blocks(&self) -> u64 {
|
| 346 |
+
self.as_inner().as_inner().st_blocks as u64
|
| 347 |
+
}
|
| 348 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/aix/mod.rs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! AIX specific definitions.
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 4 |
+
|
| 5 |
+
pub mod fs;
|
| 6 |
+
pub mod raw;
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/aix/raw.rs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! AIX specific raw type definitions.
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 4 |
+
|
| 5 |
+
#[stable(feature = "pthread_t", since = "1.8.0")]
|
| 6 |
+
pub use libc::pthread_t;
|
| 7 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 8 |
+
pub use libc::{blkcnt_t, blksize_t, dev_t, ino_t, mode_t, nlink_t, off_t, stat, time_t};
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/android/fs.rs
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
| 2 |
+
|
| 3 |
+
use crate::fs::Metadata;
|
| 4 |
+
#[allow(deprecated)]
|
| 5 |
+
use crate::os::android::raw;
|
| 6 |
+
use crate::sys::AsInner;
|
| 7 |
+
|
| 8 |
+
/// OS-specific extensions to [`fs::Metadata`].
|
| 9 |
+
///
|
| 10 |
+
/// [`fs::Metadata`]: crate::fs::Metadata
|
| 11 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 12 |
+
pub trait MetadataExt {
|
| 13 |
+
/// Gain a reference to the underlying `stat` structure which contains
|
| 14 |
+
/// the raw information returned by the OS.
|
| 15 |
+
///
|
| 16 |
+
/// The contents of the returned `stat` are **not** consistent across
|
| 17 |
+
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
| 18 |
+
/// cross-Unix abstractions contained within the raw stat.
|
| 19 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 20 |
+
#[deprecated(
|
| 21 |
+
since = "1.8.0",
|
| 22 |
+
note = "deprecated in favor of the accessor \
|
| 23 |
+
methods of this trait"
|
| 24 |
+
)]
|
| 25 |
+
#[allow(deprecated)]
|
| 26 |
+
fn as_raw_stat(&self) -> &raw::stat;
|
| 27 |
+
|
| 28 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 29 |
+
fn st_dev(&self) -> u64;
|
| 30 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 31 |
+
fn st_ino(&self) -> u64;
|
| 32 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 33 |
+
fn st_mode(&self) -> u32;
|
| 34 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 35 |
+
fn st_nlink(&self) -> u64;
|
| 36 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 37 |
+
fn st_uid(&self) -> u32;
|
| 38 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 39 |
+
fn st_gid(&self) -> u32;
|
| 40 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 41 |
+
fn st_rdev(&self) -> u64;
|
| 42 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 43 |
+
fn st_size(&self) -> u64;
|
| 44 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 45 |
+
fn st_atime(&self) -> i64;
|
| 46 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 47 |
+
fn st_atime_nsec(&self) -> i64;
|
| 48 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 49 |
+
fn st_mtime(&self) -> i64;
|
| 50 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 51 |
+
fn st_mtime_nsec(&self) -> i64;
|
| 52 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 53 |
+
fn st_ctime(&self) -> i64;
|
| 54 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 55 |
+
fn st_ctime_nsec(&self) -> i64;
|
| 56 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 57 |
+
fn st_blksize(&self) -> u64;
|
| 58 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 59 |
+
fn st_blocks(&self) -> u64;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 63 |
+
impl MetadataExt for Metadata {
|
| 64 |
+
#[allow(deprecated)]
|
| 65 |
+
fn as_raw_stat(&self) -> &raw::stat {
|
| 66 |
+
unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) }
|
| 67 |
+
}
|
| 68 |
+
fn st_dev(&self) -> u64 {
|
| 69 |
+
self.as_inner().as_inner().st_dev as u64
|
| 70 |
+
}
|
| 71 |
+
fn st_ino(&self) -> u64 {
|
| 72 |
+
self.as_inner().as_inner().st_ino as u64
|
| 73 |
+
}
|
| 74 |
+
fn st_mode(&self) -> u32 {
|
| 75 |
+
self.as_inner().as_inner().st_mode as u32
|
| 76 |
+
}
|
| 77 |
+
fn st_nlink(&self) -> u64 {
|
| 78 |
+
self.as_inner().as_inner().st_nlink as u64
|
| 79 |
+
}
|
| 80 |
+
fn st_uid(&self) -> u32 {
|
| 81 |
+
self.as_inner().as_inner().st_uid as u32
|
| 82 |
+
}
|
| 83 |
+
fn st_gid(&self) -> u32 {
|
| 84 |
+
self.as_inner().as_inner().st_gid as u32
|
| 85 |
+
}
|
| 86 |
+
fn st_rdev(&self) -> u64 {
|
| 87 |
+
self.as_inner().as_inner().st_rdev as u64
|
| 88 |
+
}
|
| 89 |
+
fn st_size(&self) -> u64 {
|
| 90 |
+
self.as_inner().as_inner().st_size as u64
|
| 91 |
+
}
|
| 92 |
+
fn st_atime(&self) -> i64 {
|
| 93 |
+
self.as_inner().as_inner().st_atime as i64
|
| 94 |
+
}
|
| 95 |
+
fn st_atime_nsec(&self) -> i64 {
|
| 96 |
+
self.as_inner().as_inner().st_atime_nsec as i64
|
| 97 |
+
}
|
| 98 |
+
fn st_mtime(&self) -> i64 {
|
| 99 |
+
self.as_inner().as_inner().st_mtime as i64
|
| 100 |
+
}
|
| 101 |
+
fn st_mtime_nsec(&self) -> i64 {
|
| 102 |
+
self.as_inner().as_inner().st_mtime_nsec as i64
|
| 103 |
+
}
|
| 104 |
+
fn st_ctime(&self) -> i64 {
|
| 105 |
+
self.as_inner().as_inner().st_ctime as i64
|
| 106 |
+
}
|
| 107 |
+
fn st_ctime_nsec(&self) -> i64 {
|
| 108 |
+
self.as_inner().as_inner().st_ctime_nsec as i64
|
| 109 |
+
}
|
| 110 |
+
fn st_blksize(&self) -> u64 {
|
| 111 |
+
self.as_inner().as_inner().st_blksize as u64
|
| 112 |
+
}
|
| 113 |
+
fn st_blocks(&self) -> u64 {
|
| 114 |
+
self.as_inner().as_inner().st_blocks as u64
|
| 115 |
+
}
|
| 116 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/android/mod.rs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Android-specific definitions
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 4 |
+
|
| 5 |
+
pub mod fs;
|
| 6 |
+
pub mod net;
|
| 7 |
+
pub mod raw;
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/android/net.rs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Android-specific networking functionality.
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "unix_socket_abstract", since = "1.70.0")]
|
| 4 |
+
|
| 5 |
+
#[stable(feature = "unix_socket_abstract", since = "1.70.0")]
|
| 6 |
+
pub use crate::os::net::linux_ext::addr::SocketAddrExt;
|
| 7 |
+
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
|
| 8 |
+
pub use crate::os::net::linux_ext::socket::UnixSocketExt;
|
| 9 |
+
#[stable(feature = "tcp_quickack", since = "1.89.0")]
|
| 10 |
+
pub use crate::os::net::linux_ext::tcp::TcpStreamExt;
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/android/raw.rs
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Android-specific raw type definitions
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 4 |
+
#![deprecated(
|
| 5 |
+
since = "1.8.0",
|
| 6 |
+
note = "these type aliases are no longer supported by \
|
| 7 |
+
the standard library, the `libc` crate on \
|
| 8 |
+
crates.io should be used instead for the correct \
|
| 9 |
+
definitions"
|
| 10 |
+
)]
|
| 11 |
+
#![allow(deprecated)]
|
| 12 |
+
|
| 13 |
+
use crate::os::raw::c_long;
|
| 14 |
+
|
| 15 |
+
#[stable(feature = "pthread_t", since = "1.8.0")]
|
| 16 |
+
pub type pthread_t = c_long;
|
| 17 |
+
|
| 18 |
+
#[doc(inline)]
|
| 19 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 20 |
+
pub use self::arch::{blkcnt_t, blksize_t, dev_t, ino_t, mode_t, nlink_t, off_t, stat, time_t};
|
| 21 |
+
|
| 22 |
+
#[cfg(any(target_arch = "arm", target_arch = "x86"))]
|
| 23 |
+
mod arch {
|
| 24 |
+
use crate::os::raw::{c_long, c_longlong, c_uchar, c_uint, c_ulong, c_ulonglong};
|
| 25 |
+
use crate::os::unix::raw::{gid_t, uid_t};
|
| 26 |
+
|
| 27 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 28 |
+
pub type dev_t = u32;
|
| 29 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 30 |
+
pub type mode_t = c_uint;
|
| 31 |
+
|
| 32 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 33 |
+
pub type blkcnt_t = c_ulong;
|
| 34 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 35 |
+
pub type blksize_t = c_ulong;
|
| 36 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 37 |
+
pub type ino_t = c_ulong;
|
| 38 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 39 |
+
pub type nlink_t = u32;
|
| 40 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 41 |
+
pub type off_t = i32;
|
| 42 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 43 |
+
pub type time_t = c_long;
|
| 44 |
+
|
| 45 |
+
#[repr(C)]
|
| 46 |
+
#[derive(Clone)]
|
| 47 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 48 |
+
pub struct stat {
|
| 49 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 50 |
+
pub st_dev: c_ulonglong,
|
| 51 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 52 |
+
pub __pad0: [c_uchar; 4],
|
| 53 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 54 |
+
pub __st_ino: u32,
|
| 55 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 56 |
+
pub st_mode: c_uint,
|
| 57 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 58 |
+
pub st_nlink: c_uint,
|
| 59 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 60 |
+
pub st_uid: uid_t,
|
| 61 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 62 |
+
pub st_gid: gid_t,
|
| 63 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 64 |
+
pub st_rdev: c_ulonglong,
|
| 65 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 66 |
+
pub __pad3: [c_uchar; 4],
|
| 67 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 68 |
+
pub st_size: c_longlong,
|
| 69 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 70 |
+
pub st_blksize: u32,
|
| 71 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 72 |
+
pub st_blocks: c_ulonglong,
|
| 73 |
+
|
| 74 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 75 |
+
pub st_atime: time_t,
|
| 76 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 77 |
+
pub st_atime_nsec: c_long,
|
| 78 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 79 |
+
pub st_mtime: time_t,
|
| 80 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 81 |
+
pub st_mtime_nsec: c_long,
|
| 82 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 83 |
+
pub st_ctime: time_t,
|
| 84 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 85 |
+
pub st_ctime_nsec: c_long,
|
| 86 |
+
|
| 87 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 88 |
+
pub st_ino: c_ulonglong,
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
|
| 93 |
+
mod arch {
|
| 94 |
+
use crate::os::raw::{c_int, c_long, c_uint, c_ulong};
|
| 95 |
+
use crate::os::unix::raw::{gid_t, uid_t};
|
| 96 |
+
|
| 97 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 98 |
+
pub type dev_t = u64;
|
| 99 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 100 |
+
pub type mode_t = c_uint;
|
| 101 |
+
|
| 102 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 103 |
+
pub type blkcnt_t = c_ulong;
|
| 104 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 105 |
+
pub type blksize_t = c_ulong;
|
| 106 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 107 |
+
pub type ino_t = c_ulong;
|
| 108 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 109 |
+
pub type nlink_t = u32;
|
| 110 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 111 |
+
pub type off_t = i64;
|
| 112 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 113 |
+
pub type time_t = c_long;
|
| 114 |
+
|
| 115 |
+
#[repr(C)]
|
| 116 |
+
#[derive(Clone)]
|
| 117 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 118 |
+
pub struct stat {
|
| 119 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 120 |
+
pub st_dev: dev_t,
|
| 121 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 122 |
+
pub st_ino: ino_t,
|
| 123 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 124 |
+
pub st_mode: mode_t,
|
| 125 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 126 |
+
pub st_nlink: nlink_t,
|
| 127 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 128 |
+
pub st_uid: uid_t,
|
| 129 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 130 |
+
pub st_gid: gid_t,
|
| 131 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 132 |
+
pub st_rdev: dev_t,
|
| 133 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 134 |
+
pub __pad1: c_ulong,
|
| 135 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 136 |
+
pub st_size: off_t,
|
| 137 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 138 |
+
pub st_blksize: c_int,
|
| 139 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 140 |
+
pub __pad2: c_int,
|
| 141 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 142 |
+
pub st_blocks: c_long,
|
| 143 |
+
|
| 144 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 145 |
+
pub st_atime: time_t,
|
| 146 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 147 |
+
pub st_atime_nsec: c_long,
|
| 148 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 149 |
+
pub st_mtime: time_t,
|
| 150 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 151 |
+
pub st_mtime_nsec: c_long,
|
| 152 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 153 |
+
pub st_ctime: time_t,
|
| 154 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 155 |
+
pub st_ctime_nsec: c_long,
|
| 156 |
+
|
| 157 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 158 |
+
pub __unused4: c_uint,
|
| 159 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 160 |
+
pub __unused5: c_uint,
|
| 161 |
+
}
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
#[cfg(target_arch = "x86_64")]
|
| 165 |
+
mod arch {
|
| 166 |
+
use crate::os::raw::{c_long, c_uint, c_ulong};
|
| 167 |
+
use crate::os::unix::raw::{gid_t, uid_t};
|
| 168 |
+
|
| 169 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 170 |
+
pub type dev_t = u64;
|
| 171 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 172 |
+
pub type mode_t = c_uint;
|
| 173 |
+
|
| 174 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 175 |
+
pub type blkcnt_t = c_ulong;
|
| 176 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 177 |
+
pub type blksize_t = c_ulong;
|
| 178 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 179 |
+
pub type ino_t = c_ulong;
|
| 180 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 181 |
+
pub type nlink_t = u32;
|
| 182 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 183 |
+
pub type off_t = i64;
|
| 184 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 185 |
+
pub type time_t = c_long;
|
| 186 |
+
|
| 187 |
+
#[repr(C)]
|
| 188 |
+
#[derive(Clone)]
|
| 189 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 190 |
+
pub struct stat {
|
| 191 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 192 |
+
pub st_dev: dev_t,
|
| 193 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 194 |
+
pub st_ino: ino_t,
|
| 195 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 196 |
+
pub st_nlink: c_ulong,
|
| 197 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 198 |
+
pub st_mode: c_uint,
|
| 199 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 200 |
+
pub st_uid: uid_t,
|
| 201 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 202 |
+
pub st_gid: gid_t,
|
| 203 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 204 |
+
pub __pad0: c_uint,
|
| 205 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 206 |
+
pub st_rdev: dev_t,
|
| 207 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 208 |
+
pub st_size: off_t,
|
| 209 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 210 |
+
pub st_blksize: c_long,
|
| 211 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 212 |
+
pub st_blocks: c_long,
|
| 213 |
+
|
| 214 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 215 |
+
pub st_atime: time_t,
|
| 216 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 217 |
+
pub st_atime_nsec: c_long,
|
| 218 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 219 |
+
pub st_mtime: time_t,
|
| 220 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 221 |
+
pub st_mtime_nsec: c_long,
|
| 222 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 223 |
+
pub st_ctime: time_t,
|
| 224 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 225 |
+
pub st_ctime_nsec: c_long,
|
| 226 |
+
|
| 227 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 228 |
+
pub __pad3: [c_long; 3],
|
| 229 |
+
}
|
| 230 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/cygwin/fs.rs
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
| 2 |
+
use crate::fs::Metadata;
|
| 3 |
+
use crate::sys::AsInner;
|
| 4 |
+
/// OS-specific extensions to [`fs::Metadata`].
|
| 5 |
+
///
|
| 6 |
+
/// [`fs::Metadata`]: crate::fs::Metadata
|
| 7 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 8 |
+
pub trait MetadataExt {
|
| 9 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 10 |
+
fn st_dev(&self) -> u64;
|
| 11 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 12 |
+
fn st_ino(&self) -> u64;
|
| 13 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 14 |
+
fn st_mode(&self) -> u32;
|
| 15 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 16 |
+
fn st_nlink(&self) -> u64;
|
| 17 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 18 |
+
fn st_uid(&self) -> u32;
|
| 19 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 20 |
+
fn st_gid(&self) -> u32;
|
| 21 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 22 |
+
fn st_rdev(&self) -> u64;
|
| 23 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 24 |
+
fn st_size(&self) -> u64;
|
| 25 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 26 |
+
fn st_atime(&self) -> i64;
|
| 27 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 28 |
+
fn st_atime_nsec(&self) -> i64;
|
| 29 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 30 |
+
fn st_mtime(&self) -> i64;
|
| 31 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 32 |
+
fn st_mtime_nsec(&self) -> i64;
|
| 33 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 34 |
+
fn st_ctime(&self) -> i64;
|
| 35 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 36 |
+
fn st_ctime_nsec(&self) -> i64;
|
| 37 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 38 |
+
fn st_blksize(&self) -> u64;
|
| 39 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 40 |
+
fn st_blocks(&self) -> u64;
|
| 41 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 42 |
+
fn st_birthtime(&self) -> i64;
|
| 43 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 44 |
+
fn st_birthtime_nsec(&self) -> i64;
|
| 45 |
+
}
|
| 46 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 47 |
+
impl MetadataExt for Metadata {
|
| 48 |
+
fn st_dev(&self) -> u64 {
|
| 49 |
+
self.as_inner().as_inner().st_dev as u64
|
| 50 |
+
}
|
| 51 |
+
fn st_ino(&self) -> u64 {
|
| 52 |
+
self.as_inner().as_inner().st_ino as u64
|
| 53 |
+
}
|
| 54 |
+
fn st_mode(&self) -> u32 {
|
| 55 |
+
self.as_inner().as_inner().st_mode as u32
|
| 56 |
+
}
|
| 57 |
+
fn st_nlink(&self) -> u64 {
|
| 58 |
+
self.as_inner().as_inner().st_nlink as u64
|
| 59 |
+
}
|
| 60 |
+
fn st_uid(&self) -> u32 {
|
| 61 |
+
self.as_inner().as_inner().st_uid as u32
|
| 62 |
+
}
|
| 63 |
+
fn st_gid(&self) -> u32 {
|
| 64 |
+
self.as_inner().as_inner().st_gid as u32
|
| 65 |
+
}
|
| 66 |
+
fn st_rdev(&self) -> u64 {
|
| 67 |
+
self.as_inner().as_inner().st_rdev as u64
|
| 68 |
+
}
|
| 69 |
+
fn st_size(&self) -> u64 {
|
| 70 |
+
self.as_inner().as_inner().st_size as u64
|
| 71 |
+
}
|
| 72 |
+
fn st_atime(&self) -> i64 {
|
| 73 |
+
self.as_inner().as_inner().st_atime as i64
|
| 74 |
+
}
|
| 75 |
+
fn st_atime_nsec(&self) -> i64 {
|
| 76 |
+
self.as_inner().as_inner().st_atime_nsec as i64
|
| 77 |
+
}
|
| 78 |
+
fn st_mtime(&self) -> i64 {
|
| 79 |
+
self.as_inner().as_inner().st_mtime as i64
|
| 80 |
+
}
|
| 81 |
+
fn st_mtime_nsec(&self) -> i64 {
|
| 82 |
+
self.as_inner().as_inner().st_mtime_nsec as i64
|
| 83 |
+
}
|
| 84 |
+
fn st_ctime(&self) -> i64 {
|
| 85 |
+
self.as_inner().as_inner().st_ctime as i64
|
| 86 |
+
}
|
| 87 |
+
fn st_ctime_nsec(&self) -> i64 {
|
| 88 |
+
self.as_inner().as_inner().st_ctime_nsec as i64
|
| 89 |
+
}
|
| 90 |
+
fn st_blksize(&self) -> u64 {
|
| 91 |
+
self.as_inner().as_inner().st_blksize as u64
|
| 92 |
+
}
|
| 93 |
+
fn st_blocks(&self) -> u64 {
|
| 94 |
+
self.as_inner().as_inner().st_blocks as u64
|
| 95 |
+
}
|
| 96 |
+
fn st_birthtime(&self) -> i64 {
|
| 97 |
+
self.as_inner().as_inner().st_birthtime as i64
|
| 98 |
+
}
|
| 99 |
+
fn st_birthtime_nsec(&self) -> i64 {
|
| 100 |
+
self.as_inner().as_inner().st_birthtime_nsec as i64
|
| 101 |
+
}
|
| 102 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/cygwin/mod.rs
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Cygwin-specific definitions
|
| 2 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 3 |
+
pub mod fs;
|
| 4 |
+
pub mod net;
|
| 5 |
+
pub(crate) mod raw;
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/cygwin/net.rs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Cygwin-specific networking functionality.
|
| 2 |
+
//!
|
| 3 |
+
//! There are some limitations of Unix domain sockets on Cygwin:
|
| 4 |
+
//! * The syscalls `accept` and `connect` need
|
| 5 |
+
//! [handshake](https://inbox.sourceware.org/cygwin/Z_UERXFI1g-1v3p2@calimero.vinschen.de/T/#t).
|
| 6 |
+
//! * Cannot bind to abstract addr.
|
| 7 |
+
//! * Unbounded unix socket has an abstract local addr.
|
| 8 |
+
//! * Doesn't support recvmsg with control data.
|
| 9 |
+
|
| 10 |
+
#![stable(feature = "unix_socket_abstract", since = "1.70.0")]
|
| 11 |
+
|
| 12 |
+
#[stable(feature = "unix_socket_abstract", since = "1.70.0")]
|
| 13 |
+
pub use crate::os::net::linux_ext::addr::SocketAddrExt;
|
| 14 |
+
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
|
| 15 |
+
pub use crate::os::net::linux_ext::socket::UnixSocketExt;
|
| 16 |
+
#[stable(feature = "tcp_quickack", since = "1.89.0")]
|
| 17 |
+
pub use crate::os::net::linux_ext::tcp::TcpStreamExt;
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/cygwin/raw.rs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Cygwin-specific raw type definitions.
|
| 2 |
+
|
| 3 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 4 |
+
pub use libc::{blkcnt_t, blksize_t, dev_t, ino_t, mode_t, nlink_t, off_t, pthread_t, time_t};
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/darwin/fs.rs
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Darwin-specific extension traits to [`fs`].
|
| 2 |
+
//!
|
| 3 |
+
//! [`fs`]: crate::fs
|
| 4 |
+
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
| 5 |
+
|
| 6 |
+
use crate::fs::{self, Metadata};
|
| 7 |
+
use crate::sealed::Sealed;
|
| 8 |
+
use crate::sys::{AsInner, AsInnerMut, IntoInner};
|
| 9 |
+
use crate::time::SystemTime;
|
| 10 |
+
|
| 11 |
+
/// OS-specific extensions to [`fs::Metadata`].
|
| 12 |
+
///
|
| 13 |
+
/// [`fs::Metadata`]: crate::fs::Metadata
|
| 14 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 15 |
+
pub trait MetadataExt {
|
| 16 |
+
/// Gain a reference to the underlying `stat` structure which contains
|
| 17 |
+
/// the raw information returned by the OS.
|
| 18 |
+
///
|
| 19 |
+
/// The contents of the returned `stat` are **not** consistent across
|
| 20 |
+
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
| 21 |
+
/// cross-Unix abstractions contained within the raw stat.
|
| 22 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 23 |
+
#[deprecated(
|
| 24 |
+
since = "1.8.0",
|
| 25 |
+
note = "deprecated in favor of the accessor \
|
| 26 |
+
methods of this trait"
|
| 27 |
+
)]
|
| 28 |
+
#[allow(deprecated)]
|
| 29 |
+
// Only available on macOS and iOS, since they were stably exposed there.
|
| 30 |
+
#[cfg(any(doc, target_os = "macos", target_os = "ios"))]
|
| 31 |
+
#[doc(cfg(any(target_os = "macos", target_os = "ios")))]
|
| 32 |
+
fn as_raw_stat(&self) -> &super::raw::stat;
|
| 33 |
+
|
| 34 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 35 |
+
fn st_dev(&self) -> u64;
|
| 36 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 37 |
+
fn st_ino(&self) -> u64;
|
| 38 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 39 |
+
fn st_mode(&self) -> u32;
|
| 40 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 41 |
+
fn st_nlink(&self) -> u64;
|
| 42 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 43 |
+
fn st_uid(&self) -> u32;
|
| 44 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 45 |
+
fn st_gid(&self) -> u32;
|
| 46 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 47 |
+
fn st_rdev(&self) -> u64;
|
| 48 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 49 |
+
fn st_size(&self) -> u64;
|
| 50 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 51 |
+
fn st_atime(&self) -> i64;
|
| 52 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 53 |
+
fn st_atime_nsec(&self) -> i64;
|
| 54 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 55 |
+
fn st_mtime(&self) -> i64;
|
| 56 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 57 |
+
fn st_mtime_nsec(&self) -> i64;
|
| 58 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 59 |
+
fn st_ctime(&self) -> i64;
|
| 60 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 61 |
+
fn st_ctime_nsec(&self) -> i64;
|
| 62 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 63 |
+
fn st_birthtime(&self) -> i64;
|
| 64 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 65 |
+
fn st_birthtime_nsec(&self) -> i64;
|
| 66 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 67 |
+
fn st_blksize(&self) -> u64;
|
| 68 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 69 |
+
fn st_blocks(&self) -> u64;
|
| 70 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 71 |
+
fn st_flags(&self) -> u32;
|
| 72 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 73 |
+
fn st_gen(&self) -> u32;
|
| 74 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 75 |
+
fn st_lspare(&self) -> u32;
|
| 76 |
+
#[cfg(target_os = "macos")]
|
| 77 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 78 |
+
fn st_qspare(&self) -> [u64; 2];
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 82 |
+
impl MetadataExt for Metadata {
|
| 83 |
+
#[allow(deprecated)]
|
| 84 |
+
#[cfg(any(doc, target_os = "macos", target_os = "ios"))]
|
| 85 |
+
fn as_raw_stat(&self) -> &super::raw::stat {
|
| 86 |
+
unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const super::raw::stat) }
|
| 87 |
+
}
|
| 88 |
+
fn st_dev(&self) -> u64 {
|
| 89 |
+
self.as_inner().as_inner().st_dev as u64
|
| 90 |
+
}
|
| 91 |
+
fn st_ino(&self) -> u64 {
|
| 92 |
+
self.as_inner().as_inner().st_ino as u64
|
| 93 |
+
}
|
| 94 |
+
fn st_mode(&self) -> u32 {
|
| 95 |
+
self.as_inner().as_inner().st_mode as u32
|
| 96 |
+
}
|
| 97 |
+
fn st_nlink(&self) -> u64 {
|
| 98 |
+
self.as_inner().as_inner().st_nlink as u64
|
| 99 |
+
}
|
| 100 |
+
fn st_uid(&self) -> u32 {
|
| 101 |
+
self.as_inner().as_inner().st_uid as u32
|
| 102 |
+
}
|
| 103 |
+
fn st_gid(&self) -> u32 {
|
| 104 |
+
self.as_inner().as_inner().st_gid as u32
|
| 105 |
+
}
|
| 106 |
+
fn st_rdev(&self) -> u64 {
|
| 107 |
+
self.as_inner().as_inner().st_rdev as u64
|
| 108 |
+
}
|
| 109 |
+
fn st_size(&self) -> u64 {
|
| 110 |
+
self.as_inner().as_inner().st_size as u64
|
| 111 |
+
}
|
| 112 |
+
fn st_atime(&self) -> i64 {
|
| 113 |
+
self.as_inner().as_inner().st_atime as i64
|
| 114 |
+
}
|
| 115 |
+
fn st_atime_nsec(&self) -> i64 {
|
| 116 |
+
self.as_inner().as_inner().st_atime_nsec as i64
|
| 117 |
+
}
|
| 118 |
+
fn st_mtime(&self) -> i64 {
|
| 119 |
+
self.as_inner().as_inner().st_mtime as i64
|
| 120 |
+
}
|
| 121 |
+
fn st_mtime_nsec(&self) -> i64 {
|
| 122 |
+
self.as_inner().as_inner().st_mtime_nsec as i64
|
| 123 |
+
}
|
| 124 |
+
fn st_ctime(&self) -> i64 {
|
| 125 |
+
self.as_inner().as_inner().st_ctime as i64
|
| 126 |
+
}
|
| 127 |
+
fn st_ctime_nsec(&self) -> i64 {
|
| 128 |
+
self.as_inner().as_inner().st_ctime_nsec as i64
|
| 129 |
+
}
|
| 130 |
+
fn st_birthtime(&self) -> i64 {
|
| 131 |
+
self.as_inner().as_inner().st_birthtime as i64
|
| 132 |
+
}
|
| 133 |
+
fn st_birthtime_nsec(&self) -> i64 {
|
| 134 |
+
self.as_inner().as_inner().st_birthtime_nsec as i64
|
| 135 |
+
}
|
| 136 |
+
fn st_blksize(&self) -> u64 {
|
| 137 |
+
self.as_inner().as_inner().st_blksize as u64
|
| 138 |
+
}
|
| 139 |
+
fn st_blocks(&self) -> u64 {
|
| 140 |
+
self.as_inner().as_inner().st_blocks as u64
|
| 141 |
+
}
|
| 142 |
+
fn st_gen(&self) -> u32 {
|
| 143 |
+
self.as_inner().as_inner().st_gen as u32
|
| 144 |
+
}
|
| 145 |
+
fn st_flags(&self) -> u32 {
|
| 146 |
+
self.as_inner().as_inner().st_flags as u32
|
| 147 |
+
}
|
| 148 |
+
fn st_lspare(&self) -> u32 {
|
| 149 |
+
self.as_inner().as_inner().st_lspare as u32
|
| 150 |
+
}
|
| 151 |
+
#[cfg(target_os = "macos")]
|
| 152 |
+
fn st_qspare(&self) -> [u64; 2] {
|
| 153 |
+
let qspare = self.as_inner().as_inner().st_qspare;
|
| 154 |
+
[qspare[0] as u64, qspare[1] as u64]
|
| 155 |
+
}
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
/// OS-specific extensions to [`fs::FileTimes`].
|
| 159 |
+
#[stable(feature = "file_set_times", since = "1.75.0")]
|
| 160 |
+
pub trait FileTimesExt: Sealed {
|
| 161 |
+
/// Set the creation time of a file.
|
| 162 |
+
#[stable(feature = "file_set_times", since = "1.75.0")]
|
| 163 |
+
fn set_created(self, t: SystemTime) -> Self;
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
#[stable(feature = "file_set_times", since = "1.75.0")]
|
| 167 |
+
impl FileTimesExt for fs::FileTimes {
|
| 168 |
+
fn set_created(mut self, t: SystemTime) -> Self {
|
| 169 |
+
self.as_inner_mut().set_created(t.into_inner());
|
| 170 |
+
self
|
| 171 |
+
}
|
| 172 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/darwin/mod.rs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Platform-specific extensions to `std` for Darwin / Apple platforms.
|
| 2 |
+
//!
|
| 3 |
+
//! This is available on the following operating systems:
|
| 4 |
+
//! - macOS
|
| 5 |
+
//! - iOS
|
| 6 |
+
//! - tvOS
|
| 7 |
+
//! - watchOS
|
| 8 |
+
//! - visionOS
|
| 9 |
+
//!
|
| 10 |
+
//! Note: This module is called "Darwin" as that's the name of the underlying
|
| 11 |
+
//! core OS of the above operating systems, but it should not be confused with
|
| 12 |
+
//! the `-darwin` suffix in the `x86_64-apple-darwin` and
|
| 13 |
+
//! `aarch64-apple-darwin` target names, which are mostly named that way for
|
| 14 |
+
//! legacy reasons.
|
| 15 |
+
|
| 16 |
+
#![stable(feature = "os_darwin", since = "1.84.0")]
|
| 17 |
+
#![doc(cfg(target_vendor = "apple"))]
|
| 18 |
+
|
| 19 |
+
pub mod fs;
|
| 20 |
+
pub mod objc;
|
| 21 |
+
|
| 22 |
+
// deprecated, but used for public reexport under `std::os::unix::raw`, as
|
| 23 |
+
// well as `std::os::macos`/`std::os::ios`, because those modules precede the
|
| 24 |
+
// decision to remove these.
|
| 25 |
+
pub(super) mod raw;
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/darwin/objc.rs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Defines types and macros for Objective-C interoperability.
|
| 2 |
+
//!
|
| 3 |
+
//! This module re-exports all the items in [`core::os::darwin::objc`].
|
| 4 |
+
//!
|
| 5 |
+
//! [`core::os::darwin::objc`]: ../../../../core/os/darwin/objc/index.html "mod core::os::darwin::objc"
|
| 6 |
+
|
| 7 |
+
#![unstable(feature = "darwin_objc", issue = "145496")]
|
| 8 |
+
|
| 9 |
+
// We can't generate an intra-doc link for this automatically since `core::os::darwin` isn't
|
| 10 |
+
// compiled into `core` on every platform even though it's documented on every platform.
|
| 11 |
+
// We just link to it directly in the module documentation above instead.
|
| 12 |
+
#[cfg(not(doc))]
|
| 13 |
+
pub use core::os::darwin::objc::*;
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/darwin/raw.rs
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Apple-specific raw type definitions
|
| 2 |
+
use crate::os::raw::c_long;
|
| 3 |
+
|
| 4 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 5 |
+
pub type blkcnt_t = u64;
|
| 6 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 7 |
+
pub type blksize_t = u64;
|
| 8 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 9 |
+
pub type dev_t = u64;
|
| 10 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 11 |
+
pub type ino_t = u64;
|
| 12 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 13 |
+
pub type mode_t = u32;
|
| 14 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 15 |
+
pub type nlink_t = u64;
|
| 16 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 17 |
+
pub type off_t = u64;
|
| 18 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 19 |
+
pub type time_t = i64;
|
| 20 |
+
|
| 21 |
+
#[stable(feature = "pthread_t", since = "1.8.0")]
|
| 22 |
+
pub type pthread_t = usize;
|
| 23 |
+
|
| 24 |
+
#[repr(C)]
|
| 25 |
+
#[derive(Clone)]
|
| 26 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 27 |
+
#[allow(dead_code)]
|
| 28 |
+
pub struct stat {
|
| 29 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 30 |
+
pub st_dev: i32,
|
| 31 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 32 |
+
pub st_mode: u16,
|
| 33 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 34 |
+
pub st_nlink: u16,
|
| 35 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 36 |
+
pub st_ino: u64,
|
| 37 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 38 |
+
pub st_uid: u32,
|
| 39 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 40 |
+
pub st_gid: u32,
|
| 41 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 42 |
+
pub st_rdev: i32,
|
| 43 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 44 |
+
pub st_atime: c_long,
|
| 45 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 46 |
+
pub st_atime_nsec: c_long,
|
| 47 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 48 |
+
pub st_mtime: c_long,
|
| 49 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 50 |
+
pub st_mtime_nsec: c_long,
|
| 51 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 52 |
+
pub st_ctime: c_long,
|
| 53 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 54 |
+
pub st_ctime_nsec: c_long,
|
| 55 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 56 |
+
pub st_birthtime: c_long,
|
| 57 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 58 |
+
pub st_birthtime_nsec: c_long,
|
| 59 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 60 |
+
pub st_size: i64,
|
| 61 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 62 |
+
pub st_blocks: i64,
|
| 63 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 64 |
+
pub st_blksize: i32,
|
| 65 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 66 |
+
pub st_flags: u32,
|
| 67 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 68 |
+
pub st_gen: u32,
|
| 69 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 70 |
+
pub st_lspare: i32,
|
| 71 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 72 |
+
pub st_qspare: [i64; 2],
|
| 73 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/dragonfly/fs.rs
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
| 2 |
+
|
| 3 |
+
use crate::fs::Metadata;
|
| 4 |
+
#[allow(deprecated)]
|
| 5 |
+
use crate::os::dragonfly::raw;
|
| 6 |
+
use crate::sys::AsInner;
|
| 7 |
+
|
| 8 |
+
/// OS-specific extensions to [`fs::Metadata`].
|
| 9 |
+
///
|
| 10 |
+
/// [`fs::Metadata`]: crate::fs::Metadata
|
| 11 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 12 |
+
pub trait MetadataExt {
|
| 13 |
+
/// Gain a reference to the underlying `stat` structure which contains
|
| 14 |
+
/// the raw information returned by the OS.
|
| 15 |
+
///
|
| 16 |
+
/// The contents of the returned `stat` are **not** consistent across
|
| 17 |
+
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
| 18 |
+
/// cross-Unix abstractions contained within the raw stat.
|
| 19 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 20 |
+
#[deprecated(
|
| 21 |
+
since = "1.8.0",
|
| 22 |
+
note = "deprecated in favor of the accessor \
|
| 23 |
+
methods of this trait"
|
| 24 |
+
)]
|
| 25 |
+
#[allow(deprecated)]
|
| 26 |
+
fn as_raw_stat(&self) -> &raw::stat;
|
| 27 |
+
|
| 28 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 29 |
+
fn st_dev(&self) -> u64;
|
| 30 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 31 |
+
fn st_ino(&self) -> u64;
|
| 32 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 33 |
+
fn st_mode(&self) -> u32;
|
| 34 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 35 |
+
fn st_nlink(&self) -> u64;
|
| 36 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 37 |
+
fn st_uid(&self) -> u32;
|
| 38 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 39 |
+
fn st_gid(&self) -> u32;
|
| 40 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 41 |
+
fn st_rdev(&self) -> u64;
|
| 42 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 43 |
+
fn st_size(&self) -> u64;
|
| 44 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 45 |
+
fn st_atime(&self) -> i64;
|
| 46 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 47 |
+
fn st_atime_nsec(&self) -> i64;
|
| 48 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 49 |
+
fn st_mtime(&self) -> i64;
|
| 50 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 51 |
+
fn st_mtime_nsec(&self) -> i64;
|
| 52 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 53 |
+
fn st_ctime(&self) -> i64;
|
| 54 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 55 |
+
fn st_ctime_nsec(&self) -> i64;
|
| 56 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 57 |
+
fn st_blksize(&self) -> u64;
|
| 58 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 59 |
+
fn st_blocks(&self) -> u64;
|
| 60 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 61 |
+
fn st_flags(&self) -> u32;
|
| 62 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 63 |
+
fn st_gen(&self) -> u32;
|
| 64 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 65 |
+
fn st_lspare(&self) -> u32;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 69 |
+
impl MetadataExt for Metadata {
|
| 70 |
+
#[allow(deprecated)]
|
| 71 |
+
fn as_raw_stat(&self) -> &raw::stat {
|
| 72 |
+
unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) }
|
| 73 |
+
}
|
| 74 |
+
fn st_dev(&self) -> u64 {
|
| 75 |
+
self.as_inner().as_inner().st_dev as u64
|
| 76 |
+
}
|
| 77 |
+
fn st_ino(&self) -> u64 {
|
| 78 |
+
self.as_inner().as_inner().st_ino as u64
|
| 79 |
+
}
|
| 80 |
+
fn st_mode(&self) -> u32 {
|
| 81 |
+
self.as_inner().as_inner().st_mode as u32
|
| 82 |
+
}
|
| 83 |
+
fn st_nlink(&self) -> u64 {
|
| 84 |
+
self.as_inner().as_inner().st_nlink as u64
|
| 85 |
+
}
|
| 86 |
+
fn st_uid(&self) -> u32 {
|
| 87 |
+
self.as_inner().as_inner().st_uid as u32
|
| 88 |
+
}
|
| 89 |
+
fn st_gid(&self) -> u32 {
|
| 90 |
+
self.as_inner().as_inner().st_gid as u32
|
| 91 |
+
}
|
| 92 |
+
fn st_rdev(&self) -> u64 {
|
| 93 |
+
self.as_inner().as_inner().st_rdev as u64
|
| 94 |
+
}
|
| 95 |
+
fn st_size(&self) -> u64 {
|
| 96 |
+
self.as_inner().as_inner().st_size as u64
|
| 97 |
+
}
|
| 98 |
+
fn st_atime(&self) -> i64 {
|
| 99 |
+
self.as_inner().as_inner().st_atime as i64
|
| 100 |
+
}
|
| 101 |
+
fn st_atime_nsec(&self) -> i64 {
|
| 102 |
+
self.as_inner().as_inner().st_atime_nsec as i64
|
| 103 |
+
}
|
| 104 |
+
fn st_mtime(&self) -> i64 {
|
| 105 |
+
self.as_inner().as_inner().st_mtime as i64
|
| 106 |
+
}
|
| 107 |
+
fn st_mtime_nsec(&self) -> i64 {
|
| 108 |
+
self.as_inner().as_inner().st_mtime_nsec as i64
|
| 109 |
+
}
|
| 110 |
+
fn st_ctime(&self) -> i64 {
|
| 111 |
+
self.as_inner().as_inner().st_ctime as i64
|
| 112 |
+
}
|
| 113 |
+
fn st_ctime_nsec(&self) -> i64 {
|
| 114 |
+
self.as_inner().as_inner().st_ctime_nsec as i64
|
| 115 |
+
}
|
| 116 |
+
fn st_blksize(&self) -> u64 {
|
| 117 |
+
self.as_inner().as_inner().st_blksize as u64
|
| 118 |
+
}
|
| 119 |
+
fn st_blocks(&self) -> u64 {
|
| 120 |
+
self.as_inner().as_inner().st_blocks as u64
|
| 121 |
+
}
|
| 122 |
+
fn st_gen(&self) -> u32 {
|
| 123 |
+
self.as_inner().as_inner().st_gen as u32
|
| 124 |
+
}
|
| 125 |
+
fn st_flags(&self) -> u32 {
|
| 126 |
+
self.as_inner().as_inner().st_flags as u32
|
| 127 |
+
}
|
| 128 |
+
fn st_lspare(&self) -> u32 {
|
| 129 |
+
self.as_inner().as_inner().st_lspare as u32
|
| 130 |
+
}
|
| 131 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/dragonfly/mod.rs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Dragonfly-specific definitions
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 4 |
+
|
| 5 |
+
pub mod fs;
|
| 6 |
+
pub mod raw;
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/dragonfly/raw.rs
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Dragonfly-specific raw type definitions
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 4 |
+
#![deprecated(
|
| 5 |
+
since = "1.8.0",
|
| 6 |
+
note = "these type aliases are no longer supported by \
|
| 7 |
+
the standard library, the `libc` crate on \
|
| 8 |
+
crates.io should be used instead for the correct \
|
| 9 |
+
definitions"
|
| 10 |
+
)]
|
| 11 |
+
#![allow(deprecated)]
|
| 12 |
+
|
| 13 |
+
use crate::os::raw::c_long;
|
| 14 |
+
|
| 15 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 16 |
+
pub type blkcnt_t = u64;
|
| 17 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 18 |
+
pub type blksize_t = u64;
|
| 19 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 20 |
+
pub type dev_t = u64;
|
| 21 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 22 |
+
pub type fflags_t = u32;
|
| 23 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 24 |
+
pub type ino_t = u64;
|
| 25 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 26 |
+
pub type mode_t = u32;
|
| 27 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 28 |
+
pub type nlink_t = u64;
|
| 29 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 30 |
+
pub type off_t = u64;
|
| 31 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 32 |
+
pub type time_t = i64;
|
| 33 |
+
|
| 34 |
+
#[stable(feature = "pthread_t", since = "1.8.0")]
|
| 35 |
+
pub type pthread_t = usize;
|
| 36 |
+
|
| 37 |
+
#[repr(C)]
|
| 38 |
+
#[derive(Clone)]
|
| 39 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 40 |
+
pub struct stat {
|
| 41 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 42 |
+
pub st_dev: u32,
|
| 43 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 44 |
+
pub st_ino: u32,
|
| 45 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 46 |
+
pub st_mode: u16,
|
| 47 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 48 |
+
pub st_nlink: u16,
|
| 49 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 50 |
+
pub st_uid: u32,
|
| 51 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 52 |
+
pub st_gid: u32,
|
| 53 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 54 |
+
pub st_rdev: u32,
|
| 55 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 56 |
+
pub st_atime: c_long,
|
| 57 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 58 |
+
pub st_atime_nsec: c_long,
|
| 59 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 60 |
+
pub st_mtime: c_long,
|
| 61 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 62 |
+
pub st_mtime_nsec: c_long,
|
| 63 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 64 |
+
pub st_ctime: c_long,
|
| 65 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 66 |
+
pub st_ctime_nsec: c_long,
|
| 67 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 68 |
+
pub st_size: i64,
|
| 69 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 70 |
+
pub st_blocks: i64,
|
| 71 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 72 |
+
pub st_blksize: u32,
|
| 73 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 74 |
+
pub st_flags: u32,
|
| 75 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 76 |
+
pub st_gen: u32,
|
| 77 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 78 |
+
pub st_lspare: i32,
|
| 79 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 80 |
+
pub st_birthtime: c_long,
|
| 81 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 82 |
+
pub st_birthtime_nsec: c_long,
|
| 83 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/emscripten/fs.rs
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
| 2 |
+
|
| 3 |
+
use crate::fs::Metadata;
|
| 4 |
+
#[allow(deprecated)]
|
| 5 |
+
use crate::os::emscripten::raw;
|
| 6 |
+
use crate::sys::AsInner;
|
| 7 |
+
|
| 8 |
+
/// OS-specific extensions to [`fs::Metadata`].
|
| 9 |
+
///
|
| 10 |
+
/// [`fs::Metadata`]: crate::fs::Metadata
|
| 11 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 12 |
+
pub trait MetadataExt {
|
| 13 |
+
/// Gain a reference to the underlying `stat` structure which contains
|
| 14 |
+
/// the raw information returned by the OS.
|
| 15 |
+
///
|
| 16 |
+
/// The contents of the returned `stat` are **not** consistent across
|
| 17 |
+
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
| 18 |
+
/// cross-Unix abstractions contained within the raw stat.
|
| 19 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 20 |
+
#[deprecated(
|
| 21 |
+
since = "1.8.0",
|
| 22 |
+
note = "deprecated in favor of the accessor \
|
| 23 |
+
methods of this trait"
|
| 24 |
+
)]
|
| 25 |
+
#[allow(deprecated)]
|
| 26 |
+
fn as_raw_stat(&self) -> &raw::stat;
|
| 27 |
+
|
| 28 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 29 |
+
fn st_dev(&self) -> u64;
|
| 30 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 31 |
+
fn st_ino(&self) -> u64;
|
| 32 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 33 |
+
fn st_mode(&self) -> u32;
|
| 34 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 35 |
+
fn st_nlink(&self) -> u64;
|
| 36 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 37 |
+
fn st_uid(&self) -> u32;
|
| 38 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 39 |
+
fn st_gid(&self) -> u32;
|
| 40 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 41 |
+
fn st_rdev(&self) -> u64;
|
| 42 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 43 |
+
fn st_size(&self) -> u64;
|
| 44 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 45 |
+
fn st_atime(&self) -> i64;
|
| 46 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 47 |
+
fn st_atime_nsec(&self) -> i64;
|
| 48 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 49 |
+
fn st_mtime(&self) -> i64;
|
| 50 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 51 |
+
fn st_mtime_nsec(&self) -> i64;
|
| 52 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 53 |
+
fn st_ctime(&self) -> i64;
|
| 54 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 55 |
+
fn st_ctime_nsec(&self) -> i64;
|
| 56 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 57 |
+
fn st_blksize(&self) -> u64;
|
| 58 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 59 |
+
fn st_blocks(&self) -> u64;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 63 |
+
impl MetadataExt for Metadata {
|
| 64 |
+
#[allow(deprecated)]
|
| 65 |
+
fn as_raw_stat(&self) -> &raw::stat {
|
| 66 |
+
unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) }
|
| 67 |
+
}
|
| 68 |
+
fn st_dev(&self) -> u64 {
|
| 69 |
+
self.as_inner().as_inner().st_dev as u64
|
| 70 |
+
}
|
| 71 |
+
fn st_ino(&self) -> u64 {
|
| 72 |
+
self.as_inner().as_inner().st_ino as u64
|
| 73 |
+
}
|
| 74 |
+
fn st_mode(&self) -> u32 {
|
| 75 |
+
self.as_inner().as_inner().st_mode as u32
|
| 76 |
+
}
|
| 77 |
+
fn st_nlink(&self) -> u64 {
|
| 78 |
+
self.as_inner().as_inner().st_nlink as u64
|
| 79 |
+
}
|
| 80 |
+
fn st_uid(&self) -> u32 {
|
| 81 |
+
self.as_inner().as_inner().st_uid as u32
|
| 82 |
+
}
|
| 83 |
+
fn st_gid(&self) -> u32 {
|
| 84 |
+
self.as_inner().as_inner().st_gid as u32
|
| 85 |
+
}
|
| 86 |
+
fn st_rdev(&self) -> u64 {
|
| 87 |
+
self.as_inner().as_inner().st_rdev as u64
|
| 88 |
+
}
|
| 89 |
+
fn st_size(&self) -> u64 {
|
| 90 |
+
self.as_inner().as_inner().st_size as u64
|
| 91 |
+
}
|
| 92 |
+
fn st_atime(&self) -> i64 {
|
| 93 |
+
self.as_inner().as_inner().st_atime as i64
|
| 94 |
+
}
|
| 95 |
+
fn st_atime_nsec(&self) -> i64 {
|
| 96 |
+
self.as_inner().as_inner().st_atime_nsec as i64
|
| 97 |
+
}
|
| 98 |
+
fn st_mtime(&self) -> i64 {
|
| 99 |
+
self.as_inner().as_inner().st_mtime as i64
|
| 100 |
+
}
|
| 101 |
+
fn st_mtime_nsec(&self) -> i64 {
|
| 102 |
+
self.as_inner().as_inner().st_mtime_nsec as i64
|
| 103 |
+
}
|
| 104 |
+
fn st_ctime(&self) -> i64 {
|
| 105 |
+
self.as_inner().as_inner().st_ctime as i64
|
| 106 |
+
}
|
| 107 |
+
fn st_ctime_nsec(&self) -> i64 {
|
| 108 |
+
self.as_inner().as_inner().st_ctime_nsec as i64
|
| 109 |
+
}
|
| 110 |
+
fn st_blksize(&self) -> u64 {
|
| 111 |
+
self.as_inner().as_inner().st_blksize as u64
|
| 112 |
+
}
|
| 113 |
+
fn st_blocks(&self) -> u64 {
|
| 114 |
+
self.as_inner().as_inner().st_blocks as u64
|
| 115 |
+
}
|
| 116 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/emscripten/mod.rs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Linux-specific definitions
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 4 |
+
|
| 5 |
+
pub mod fs;
|
| 6 |
+
pub mod raw;
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/emscripten/raw.rs
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Emscripten-specific raw type definitions
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 4 |
+
#![deprecated(
|
| 5 |
+
since = "1.8.0",
|
| 6 |
+
note = "these type aliases are no longer supported by \
|
| 7 |
+
the standard library, the `libc` crate on \
|
| 8 |
+
crates.io should be used instead for the correct \
|
| 9 |
+
definitions"
|
| 10 |
+
)]
|
| 11 |
+
#![allow(deprecated)]
|
| 12 |
+
|
| 13 |
+
use crate::os::raw::{c_long, c_short, c_uint, c_ulong};
|
| 14 |
+
|
| 15 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 16 |
+
pub type dev_t = u64;
|
| 17 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 18 |
+
pub type mode_t = u32;
|
| 19 |
+
|
| 20 |
+
#[stable(feature = "pthread_t", since = "1.8.0")]
|
| 21 |
+
pub type pthread_t = c_ulong;
|
| 22 |
+
|
| 23 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 24 |
+
pub type blkcnt_t = u64;
|
| 25 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 26 |
+
pub type blksize_t = u64;
|
| 27 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 28 |
+
pub type ino_t = u64;
|
| 29 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 30 |
+
pub type nlink_t = u64;
|
| 31 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 32 |
+
pub type off_t = u64;
|
| 33 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 34 |
+
pub type time_t = c_long;
|
| 35 |
+
|
| 36 |
+
#[repr(C)]
|
| 37 |
+
#[derive(Clone)]
|
| 38 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 39 |
+
pub struct stat {
|
| 40 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 41 |
+
pub st_dev: u64,
|
| 42 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 43 |
+
pub __pad1: c_short,
|
| 44 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 45 |
+
pub __st_ino: u32,
|
| 46 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 47 |
+
pub st_mode: u32,
|
| 48 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 49 |
+
pub st_nlink: u32,
|
| 50 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 51 |
+
pub st_uid: u32,
|
| 52 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 53 |
+
pub st_gid: u32,
|
| 54 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 55 |
+
pub st_rdev: u64,
|
| 56 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 57 |
+
pub __pad2: c_uint,
|
| 58 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 59 |
+
pub st_size: i64,
|
| 60 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 61 |
+
pub st_blksize: i32,
|
| 62 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 63 |
+
pub st_blocks: i64,
|
| 64 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 65 |
+
pub st_atime: time_t,
|
| 66 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 67 |
+
pub st_atime_nsec: c_long,
|
| 68 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 69 |
+
pub st_mtime: time_t,
|
| 70 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 71 |
+
pub st_mtime_nsec: c_long,
|
| 72 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 73 |
+
pub st_ctime: time_t,
|
| 74 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 75 |
+
pub st_ctime_nsec: c_long,
|
| 76 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 77 |
+
pub st_ino: u64,
|
| 78 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/espidf/fs.rs
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
| 2 |
+
|
| 3 |
+
use crate::fs::Metadata;
|
| 4 |
+
#[allow(deprecated)]
|
| 5 |
+
use crate::os::espidf::raw;
|
| 6 |
+
use crate::sys::AsInner;
|
| 7 |
+
|
| 8 |
+
/// OS-specific extensions to [`fs::Metadata`].
|
| 9 |
+
///
|
| 10 |
+
/// [`fs::Metadata`]: crate::fs::Metadata
|
| 11 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 12 |
+
pub trait MetadataExt {
|
| 13 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 14 |
+
#[deprecated(
|
| 15 |
+
since = "1.8.0",
|
| 16 |
+
note = "deprecated in favor of the accessor \
|
| 17 |
+
methods of this trait"
|
| 18 |
+
)]
|
| 19 |
+
#[allow(deprecated)]
|
| 20 |
+
fn as_raw_stat(&self) -> &raw::stat;
|
| 21 |
+
|
| 22 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 23 |
+
fn st_dev(&self) -> u64;
|
| 24 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 25 |
+
fn st_ino(&self) -> u64;
|
| 26 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 27 |
+
fn st_mode(&self) -> u32;
|
| 28 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 29 |
+
fn st_nlink(&self) -> u64;
|
| 30 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 31 |
+
fn st_uid(&self) -> u32;
|
| 32 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 33 |
+
fn st_gid(&self) -> u32;
|
| 34 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 35 |
+
fn st_rdev(&self) -> u64;
|
| 36 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 37 |
+
fn st_size(&self) -> u64;
|
| 38 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 39 |
+
fn st_atime(&self) -> i64;
|
| 40 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 41 |
+
fn st_atime_nsec(&self) -> i64;
|
| 42 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 43 |
+
fn st_mtime(&self) -> i64;
|
| 44 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 45 |
+
fn st_mtime_nsec(&self) -> i64;
|
| 46 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 47 |
+
fn st_ctime(&self) -> i64;
|
| 48 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 49 |
+
fn st_ctime_nsec(&self) -> i64;
|
| 50 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 51 |
+
fn st_blksize(&self) -> u64;
|
| 52 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 53 |
+
fn st_blocks(&self) -> u64;
|
| 54 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 55 |
+
fn st_spare4(&self) -> [u32; 2];
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 59 |
+
impl MetadataExt for Metadata {
|
| 60 |
+
#[allow(deprecated)]
|
| 61 |
+
fn as_raw_stat(&self) -> &raw::stat {
|
| 62 |
+
unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) }
|
| 63 |
+
}
|
| 64 |
+
fn st_dev(&self) -> u64 {
|
| 65 |
+
self.as_inner().as_inner().st_dev as u64
|
| 66 |
+
}
|
| 67 |
+
fn st_ino(&self) -> u64 {
|
| 68 |
+
self.as_inner().as_inner().st_ino as u64
|
| 69 |
+
}
|
| 70 |
+
fn st_mode(&self) -> u32 {
|
| 71 |
+
self.as_inner().as_inner().st_mode as u32
|
| 72 |
+
}
|
| 73 |
+
fn st_nlink(&self) -> u64 {
|
| 74 |
+
self.as_inner().as_inner().st_nlink as u64
|
| 75 |
+
}
|
| 76 |
+
fn st_uid(&self) -> u32 {
|
| 77 |
+
self.as_inner().as_inner().st_uid as u32
|
| 78 |
+
}
|
| 79 |
+
fn st_gid(&self) -> u32 {
|
| 80 |
+
self.as_inner().as_inner().st_gid as u32
|
| 81 |
+
}
|
| 82 |
+
fn st_rdev(&self) -> u64 {
|
| 83 |
+
self.as_inner().as_inner().st_rdev as u64
|
| 84 |
+
}
|
| 85 |
+
fn st_size(&self) -> u64 {
|
| 86 |
+
self.as_inner().as_inner().st_size as u64
|
| 87 |
+
}
|
| 88 |
+
fn st_atime(&self) -> i64 {
|
| 89 |
+
self.as_inner().as_inner().st_atime as i64
|
| 90 |
+
}
|
| 91 |
+
fn st_atime_nsec(&self) -> i64 {
|
| 92 |
+
0
|
| 93 |
+
}
|
| 94 |
+
fn st_mtime(&self) -> i64 {
|
| 95 |
+
self.as_inner().as_inner().st_mtime as i64
|
| 96 |
+
}
|
| 97 |
+
fn st_mtime_nsec(&self) -> i64 {
|
| 98 |
+
0
|
| 99 |
+
}
|
| 100 |
+
fn st_ctime(&self) -> i64 {
|
| 101 |
+
self.as_inner().as_inner().st_ctime as i64
|
| 102 |
+
}
|
| 103 |
+
fn st_ctime_nsec(&self) -> i64 {
|
| 104 |
+
0
|
| 105 |
+
}
|
| 106 |
+
fn st_blksize(&self) -> u64 {
|
| 107 |
+
self.as_inner().as_inner().st_blksize as u64
|
| 108 |
+
}
|
| 109 |
+
fn st_blocks(&self) -> u64 {
|
| 110 |
+
self.as_inner().as_inner().st_blocks as u64
|
| 111 |
+
}
|
| 112 |
+
fn st_spare4(&self) -> [u32; 2] {
|
| 113 |
+
let spare4 = self.as_inner().as_inner().st_spare4;
|
| 114 |
+
[spare4[0] as u32, spare4[1] as u32]
|
| 115 |
+
}
|
| 116 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/espidf/mod.rs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Definitions for the ESP-IDF framework.
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 4 |
+
|
| 5 |
+
pub mod fs;
|
| 6 |
+
pub mod raw;
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/espidf/raw.rs
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Raw type definitions for the ESP-IDF framework.
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 4 |
+
#![deprecated(
|
| 5 |
+
since = "1.8.0",
|
| 6 |
+
note = "these type aliases are no longer supported by \
|
| 7 |
+
the standard library, the `libc` crate on \
|
| 8 |
+
crates.io should be used instead for the correct \
|
| 9 |
+
definitions"
|
| 10 |
+
)]
|
| 11 |
+
|
| 12 |
+
use crate::os::raw::c_long;
|
| 13 |
+
use crate::os::unix::raw::{gid_t, uid_t};
|
| 14 |
+
|
| 15 |
+
#[stable(feature = "pthread_t", since = "1.8.0")]
|
| 16 |
+
pub type pthread_t = libc::pthread_t;
|
| 17 |
+
|
| 18 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 19 |
+
pub type blkcnt_t = libc::blkcnt_t;
|
| 20 |
+
|
| 21 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 22 |
+
pub type blksize_t = libc::blksize_t;
|
| 23 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 24 |
+
pub type dev_t = libc::dev_t;
|
| 25 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 26 |
+
pub type ino_t = libc::ino_t;
|
| 27 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 28 |
+
pub type mode_t = libc::mode_t;
|
| 29 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 30 |
+
pub type nlink_t = libc::nlink_t;
|
| 31 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 32 |
+
pub type off_t = libc::off_t;
|
| 33 |
+
|
| 34 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 35 |
+
pub type time_t = libc::time_t;
|
| 36 |
+
|
| 37 |
+
#[repr(C)]
|
| 38 |
+
#[derive(Clone)]
|
| 39 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 40 |
+
pub struct stat {
|
| 41 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 42 |
+
pub st_dev: dev_t,
|
| 43 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 44 |
+
pub st_ino: ino_t,
|
| 45 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 46 |
+
pub st_mode: mode_t,
|
| 47 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 48 |
+
pub st_nlink: nlink_t,
|
| 49 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 50 |
+
pub st_uid: uid_t,
|
| 51 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 52 |
+
pub st_gid: gid_t,
|
| 53 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 54 |
+
pub st_rdev: dev_t,
|
| 55 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 56 |
+
pub st_size: off_t,
|
| 57 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 58 |
+
pub st_atime: time_t,
|
| 59 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 60 |
+
pub st_mtime: time_t,
|
| 61 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 62 |
+
pub st_ctime: time_t,
|
| 63 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 64 |
+
pub st_blksize: blksize_t,
|
| 65 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 66 |
+
pub st_blocks: blkcnt_t,
|
| 67 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 68 |
+
pub st_spare4: [c_long; 2usize],
|
| 69 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fd/mod.rs
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Owned and borrowed Unix-like file descriptors.
|
| 2 |
+
//!
|
| 3 |
+
//! This module is supported on Unix platforms and WASI, which both use a
|
| 4 |
+
//! similar file descriptor system for referencing OS resources.
|
| 5 |
+
|
| 6 |
+
#![stable(feature = "os_fd", since = "1.66.0")]
|
| 7 |
+
#![deny(unsafe_op_in_unsafe_fn)]
|
| 8 |
+
|
| 9 |
+
// `RawFd`, `AsRawFd`, etc.
|
| 10 |
+
mod raw;
|
| 11 |
+
|
| 12 |
+
// `OwnedFd`, `AsFd`, etc.
|
| 13 |
+
mod owned;
|
| 14 |
+
|
| 15 |
+
// Implementations for `AsRawFd` etc. for network types.
|
| 16 |
+
#[cfg(not(target_os = "trusty"))]
|
| 17 |
+
mod net;
|
| 18 |
+
|
| 19 |
+
// Implementation of stdio file descriptor constants.
|
| 20 |
+
mod stdio;
|
| 21 |
+
|
| 22 |
+
#[cfg(test)]
|
| 23 |
+
mod tests;
|
| 24 |
+
|
| 25 |
+
// Export the types and traits for the public API.
|
| 26 |
+
#[stable(feature = "os_fd", since = "1.66.0")]
|
| 27 |
+
pub use owned::*;
|
| 28 |
+
#[stable(feature = "os_fd", since = "1.66.0")]
|
| 29 |
+
pub use raw::*;
|
| 30 |
+
#[unstable(feature = "stdio_fd_consts", issue = "150836")]
|
| 31 |
+
pub use stdio::*;
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fd/net.rs
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
use crate::os::fd::owned::OwnedFd;
|
| 2 |
+
use crate::os::fd::raw::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
|
| 3 |
+
use crate::sys::{AsInner, FromInner, IntoInner};
|
| 4 |
+
use crate::{net, sys};
|
| 5 |
+
|
| 6 |
+
macro_rules! impl_as_raw_fd {
|
| 7 |
+
($($t:ident)*) => {$(
|
| 8 |
+
#[stable(feature = "rust1", since = "1.0.0")]
|
| 9 |
+
impl AsRawFd for net::$t {
|
| 10 |
+
#[inline]
|
| 11 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 12 |
+
self.as_inner().socket().as_raw_fd()
|
| 13 |
+
}
|
| 14 |
+
}
|
| 15 |
+
)*};
|
| 16 |
+
}
|
| 17 |
+
impl_as_raw_fd! { TcpStream TcpListener UdpSocket }
|
| 18 |
+
|
| 19 |
+
macro_rules! impl_from_raw_fd {
|
| 20 |
+
($($t:ident)*) => {$(
|
| 21 |
+
#[stable(feature = "from_raw_os", since = "1.1.0")]
|
| 22 |
+
impl FromRawFd for net::$t {
|
| 23 |
+
#[inline]
|
| 24 |
+
unsafe fn from_raw_fd(fd: RawFd) -> net::$t {
|
| 25 |
+
unsafe {
|
| 26 |
+
let socket = sys::net::Socket::from_inner(FromInner::from_inner(OwnedFd::from_raw_fd(fd)));
|
| 27 |
+
net::$t::from_inner(sys::net::$t::from_inner(socket))
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
)*};
|
| 32 |
+
}
|
| 33 |
+
impl_from_raw_fd! { TcpStream TcpListener UdpSocket }
|
| 34 |
+
|
| 35 |
+
macro_rules! impl_into_raw_fd {
|
| 36 |
+
($($t:ident)*) => {$(
|
| 37 |
+
#[stable(feature = "into_raw_os", since = "1.4.0")]
|
| 38 |
+
impl IntoRawFd for net::$t {
|
| 39 |
+
#[inline]
|
| 40 |
+
fn into_raw_fd(self) -> RawFd {
|
| 41 |
+
self.into_inner().into_socket().into_inner().into_inner().into_raw_fd()
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
)*};
|
| 45 |
+
}
|
| 46 |
+
impl_into_raw_fd! { TcpStream TcpListener UdpSocket }
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fd/owned.rs
ADDED
|
@@ -0,0 +1,580 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Owned and borrowed Unix-like file descriptors.
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "io_safety", since = "1.63.0")]
|
| 4 |
+
#![deny(unsafe_op_in_unsafe_fn)]
|
| 5 |
+
|
| 6 |
+
#[cfg(target_os = "motor")]
|
| 7 |
+
use moto_rt::libc;
|
| 8 |
+
|
| 9 |
+
use super::raw::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
|
| 10 |
+
#[cfg(not(target_os = "trusty"))]
|
| 11 |
+
use crate::fs;
|
| 12 |
+
use crate::marker::PhantomData;
|
| 13 |
+
use crate::mem::ManuallyDrop;
|
| 14 |
+
#[cfg(not(any(
|
| 15 |
+
target_arch = "wasm32",
|
| 16 |
+
target_env = "sgx",
|
| 17 |
+
target_os = "hermit",
|
| 18 |
+
target_os = "trusty",
|
| 19 |
+
target_os = "motor"
|
| 20 |
+
)))]
|
| 21 |
+
use crate::sys::cvt;
|
| 22 |
+
#[cfg(not(target_os = "trusty"))]
|
| 23 |
+
use crate::sys::{AsInner, FromInner, IntoInner};
|
| 24 |
+
use crate::{fmt, io};
|
| 25 |
+
|
| 26 |
+
type ValidRawFd = core::num::niche_types::NotAllOnes<RawFd>;
|
| 27 |
+
|
| 28 |
+
/// A borrowed file descriptor.
|
| 29 |
+
///
|
| 30 |
+
/// This has a lifetime parameter to tie it to the lifetime of something that owns the file
|
| 31 |
+
/// descriptor. For the duration of that lifetime, it is guaranteed that nobody will close the file
|
| 32 |
+
/// descriptor.
|
| 33 |
+
///
|
| 34 |
+
/// This uses `repr(transparent)` and has the representation of a host file
|
| 35 |
+
/// descriptor, so it can be used in FFI in places where a file descriptor is
|
| 36 |
+
/// passed as an argument, it is not captured or consumed, and it never has the
|
| 37 |
+
/// value `-1`.
|
| 38 |
+
///
|
| 39 |
+
/// This type does not have a [`ToOwned`][crate::borrow::ToOwned]
|
| 40 |
+
/// implementation. Calling `.to_owned()` on a variable of this type will call
|
| 41 |
+
/// it on `&BorrowedFd` and use `Clone::clone()` like `ToOwned` does for all
|
| 42 |
+
/// types implementing `Clone`. The result will be descriptor borrowed under
|
| 43 |
+
/// the same lifetime.
|
| 44 |
+
///
|
| 45 |
+
/// To obtain an [`OwnedFd`], you can use [`BorrowedFd::try_clone_to_owned`]
|
| 46 |
+
/// instead, but this is not supported on all platforms.
|
| 47 |
+
#[derive(Copy, Clone)]
|
| 48 |
+
#[repr(transparent)]
|
| 49 |
+
#[rustc_nonnull_optimization_guaranteed]
|
| 50 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 51 |
+
pub struct BorrowedFd<'fd> {
|
| 52 |
+
fd: ValidRawFd,
|
| 53 |
+
_phantom: PhantomData<&'fd OwnedFd>,
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
/// An owned file descriptor.
|
| 57 |
+
///
|
| 58 |
+
/// This closes the file descriptor on drop. It is guaranteed that nobody else will close the file
|
| 59 |
+
/// descriptor.
|
| 60 |
+
///
|
| 61 |
+
/// This uses `repr(transparent)` and has the representation of a host file
|
| 62 |
+
/// descriptor, so it can be used in FFI in places where a file descriptor is
|
| 63 |
+
/// passed as a consumed argument or returned as an owned value, and it never
|
| 64 |
+
/// has the value `-1`.
|
| 65 |
+
///
|
| 66 |
+
/// You can use [`AsFd::as_fd`] to obtain a [`BorrowedFd`].
|
| 67 |
+
#[repr(transparent)]
|
| 68 |
+
#[rustc_nonnull_optimization_guaranteed]
|
| 69 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 70 |
+
pub struct OwnedFd {
|
| 71 |
+
fd: ValidRawFd,
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
impl BorrowedFd<'_> {
|
| 75 |
+
/// Returns a `BorrowedFd` holding the given raw file descriptor.
|
| 76 |
+
///
|
| 77 |
+
/// # Safety
|
| 78 |
+
///
|
| 79 |
+
/// The resource pointed to by `fd` must remain open for the duration of
|
| 80 |
+
/// the returned `BorrowedFd`.
|
| 81 |
+
///
|
| 82 |
+
/// # Panics
|
| 83 |
+
///
|
| 84 |
+
/// Panics if the raw file descriptor has the value `-1`.
|
| 85 |
+
#[inline]
|
| 86 |
+
#[track_caller]
|
| 87 |
+
#[rustc_const_stable(feature = "io_safety", since = "1.63.0")]
|
| 88 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 89 |
+
pub const unsafe fn borrow_raw(fd: RawFd) -> Self {
|
| 90 |
+
Self { fd: ValidRawFd::new(fd).expect("fd != -1"), _phantom: PhantomData }
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
impl OwnedFd {
|
| 95 |
+
/// Creates a new `OwnedFd` instance that shares the same underlying file
|
| 96 |
+
/// description as the existing `OwnedFd` instance.
|
| 97 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 98 |
+
pub fn try_clone(&self) -> io::Result<Self> {
|
| 99 |
+
self.as_fd().try_clone_to_owned()
|
| 100 |
+
}
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
impl BorrowedFd<'_> {
|
| 104 |
+
/// Creates a new `OwnedFd` instance that shares the same underlying file
|
| 105 |
+
/// description as the existing `BorrowedFd` instance.
|
| 106 |
+
#[cfg(not(any(
|
| 107 |
+
target_arch = "wasm32",
|
| 108 |
+
target_os = "hermit",
|
| 109 |
+
target_os = "trusty",
|
| 110 |
+
target_os = "motor"
|
| 111 |
+
)))]
|
| 112 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 113 |
+
pub fn try_clone_to_owned(&self) -> io::Result<OwnedFd> {
|
| 114 |
+
// We want to atomically duplicate this file descriptor and set the
|
| 115 |
+
// CLOEXEC flag, and currently that's done via F_DUPFD_CLOEXEC. This
|
| 116 |
+
// is a POSIX flag that was added to Linux in 2.6.24.
|
| 117 |
+
#[cfg(not(any(target_os = "espidf", target_os = "vita")))]
|
| 118 |
+
let cmd = libc::F_DUPFD_CLOEXEC;
|
| 119 |
+
|
| 120 |
+
// For ESP-IDF, F_DUPFD is used instead, because the CLOEXEC semantics
|
| 121 |
+
// will never be supported, as this is a bare metal framework with
|
| 122 |
+
// no capabilities for multi-process execution. While F_DUPFD is also
|
| 123 |
+
// not supported yet, it might be (currently it returns ENOSYS).
|
| 124 |
+
#[cfg(any(target_os = "espidf", target_os = "vita"))]
|
| 125 |
+
let cmd = libc::F_DUPFD;
|
| 126 |
+
|
| 127 |
+
// Avoid using file descriptors below 3 as they are used for stdio
|
| 128 |
+
let fd = cvt(unsafe { libc::fcntl(self.as_raw_fd(), cmd, 3) })?;
|
| 129 |
+
Ok(unsafe { OwnedFd::from_raw_fd(fd) })
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
/// Creates a new `OwnedFd` instance that shares the same underlying file
|
| 133 |
+
/// description as the existing `BorrowedFd` instance.
|
| 134 |
+
#[cfg(any(target_arch = "wasm32", target_os = "hermit", target_os = "trusty"))]
|
| 135 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 136 |
+
pub fn try_clone_to_owned(&self) -> io::Result<OwnedFd> {
|
| 137 |
+
Err(io::Error::UNSUPPORTED_PLATFORM)
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
/// Creates a new `OwnedFd` instance that shares the same underlying file
|
| 141 |
+
/// description as the existing `BorrowedFd` instance.
|
| 142 |
+
#[cfg(target_os = "motor")]
|
| 143 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 144 |
+
pub fn try_clone_to_owned(&self) -> io::Result<OwnedFd> {
|
| 145 |
+
let fd = moto_rt::fs::duplicate(self.as_raw_fd()).map_err(crate::sys::map_motor_error)?;
|
| 146 |
+
Ok(unsafe { OwnedFd::from_raw_fd(fd) })
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 151 |
+
impl AsRawFd for BorrowedFd<'_> {
|
| 152 |
+
#[inline]
|
| 153 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 154 |
+
self.fd.as_inner()
|
| 155 |
+
}
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 159 |
+
impl AsRawFd for OwnedFd {
|
| 160 |
+
#[inline]
|
| 161 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 162 |
+
self.fd.as_inner()
|
| 163 |
+
}
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 167 |
+
impl IntoRawFd for OwnedFd {
|
| 168 |
+
#[inline]
|
| 169 |
+
fn into_raw_fd(self) -> RawFd {
|
| 170 |
+
ManuallyDrop::new(self).fd.as_inner()
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 175 |
+
impl FromRawFd for OwnedFd {
|
| 176 |
+
/// Constructs a new instance of `Self` from the given raw file descriptor.
|
| 177 |
+
///
|
| 178 |
+
/// # Safety
|
| 179 |
+
///
|
| 180 |
+
/// The resource pointed to by `fd` must be open and suitable for assuming
|
| 181 |
+
/// [ownership][io-safety]. The resource must not require any cleanup other than `close`.
|
| 182 |
+
///
|
| 183 |
+
/// [io-safety]: io#io-safety
|
| 184 |
+
///
|
| 185 |
+
/// # Panics
|
| 186 |
+
///
|
| 187 |
+
/// Panics if the raw file descriptor has the value `-1`.
|
| 188 |
+
#[inline]
|
| 189 |
+
#[track_caller]
|
| 190 |
+
unsafe fn from_raw_fd(fd: RawFd) -> Self {
|
| 191 |
+
Self { fd: ValidRawFd::new(fd).expect("fd != -1") }
|
| 192 |
+
}
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 196 |
+
impl Drop for OwnedFd {
|
| 197 |
+
#[inline]
|
| 198 |
+
fn drop(&mut self) {
|
| 199 |
+
unsafe {
|
| 200 |
+
// Note that errors are ignored when closing a file descriptor. According to POSIX 2024,
|
| 201 |
+
// we can and indeed should retry `close` on `EINTR`
|
| 202 |
+
// (https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/functions/close.html),
|
| 203 |
+
// but it is not clear yet how well widely-used implementations are conforming with this
|
| 204 |
+
// mandate since older versions of POSIX left the state of the FD after an `EINTR`
|
| 205 |
+
// unspecified. Ignoring errors is "fine" because some of the major Unices (in
|
| 206 |
+
// particular, Linux) do make sure to always close the FD, even when `close()` is
|
| 207 |
+
// interrupted, and the scenario is rare to begin with. If we retried on a
|
| 208 |
+
// not-POSIX-compliant implementation, the consequences could be really bad since we may
|
| 209 |
+
// close the wrong FD. Helpful link to an epic discussion by POSIX workgroup that led to
|
| 210 |
+
// the latest POSIX wording: http://austingroupbugs.net/view.php?id=529
|
| 211 |
+
#[cfg(not(target_os = "hermit"))]
|
| 212 |
+
{
|
| 213 |
+
#[cfg(unix)]
|
| 214 |
+
crate::sys::fs::debug_assert_fd_is_open(self.fd.as_inner());
|
| 215 |
+
|
| 216 |
+
let _ = libc::close(self.fd.as_inner());
|
| 217 |
+
}
|
| 218 |
+
#[cfg(target_os = "hermit")]
|
| 219 |
+
let _ = hermit_abi::close(self.fd.as_inner());
|
| 220 |
+
}
|
| 221 |
+
}
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 225 |
+
impl fmt::Debug for BorrowedFd<'_> {
|
| 226 |
+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
| 227 |
+
f.debug_struct("BorrowedFd").field("fd", &self.fd).finish()
|
| 228 |
+
}
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 232 |
+
impl fmt::Debug for OwnedFd {
|
| 233 |
+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
| 234 |
+
f.debug_struct("OwnedFd").field("fd", &self.fd).finish()
|
| 235 |
+
}
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
macro_rules! impl_is_terminal {
|
| 239 |
+
($($t:ty),*$(,)?) => {$(
|
| 240 |
+
#[unstable(feature = "sealed", issue = "none")]
|
| 241 |
+
impl crate::sealed::Sealed for $t {}
|
| 242 |
+
|
| 243 |
+
#[stable(feature = "is_terminal", since = "1.70.0")]
|
| 244 |
+
impl io::IsTerminal for $t {
|
| 245 |
+
#[inline]
|
| 246 |
+
fn is_terminal(&self) -> bool {
|
| 247 |
+
crate::sys::io::is_terminal(self)
|
| 248 |
+
}
|
| 249 |
+
}
|
| 250 |
+
)*}
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
impl_is_terminal!(BorrowedFd<'_>, OwnedFd);
|
| 254 |
+
|
| 255 |
+
/// A trait to borrow the file descriptor from an underlying object.
|
| 256 |
+
///
|
| 257 |
+
/// This is only available on unix platforms and must be imported in order to
|
| 258 |
+
/// call the method. Windows platforms have a corresponding `AsHandle` and
|
| 259 |
+
/// `AsSocket` set of traits.
|
| 260 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 261 |
+
pub trait AsFd {
|
| 262 |
+
/// Borrows the file descriptor.
|
| 263 |
+
///
|
| 264 |
+
/// # Example
|
| 265 |
+
///
|
| 266 |
+
/// ```rust,no_run
|
| 267 |
+
/// use std::fs::File;
|
| 268 |
+
/// # use std::io;
|
| 269 |
+
/// # #[cfg(any(unix, target_os = "wasi"))]
|
| 270 |
+
/// # use std::os::fd::{AsFd, BorrowedFd};
|
| 271 |
+
///
|
| 272 |
+
/// let mut f = File::open("foo.txt")?;
|
| 273 |
+
/// # #[cfg(any(unix, target_os = "wasi"))]
|
| 274 |
+
/// let borrowed_fd: BorrowedFd<'_> = f.as_fd();
|
| 275 |
+
/// # Ok::<(), io::Error>(())
|
| 276 |
+
/// ```
|
| 277 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 278 |
+
fn as_fd(&self) -> BorrowedFd<'_>;
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 282 |
+
impl<T: AsFd + ?Sized> AsFd for &T {
|
| 283 |
+
#[inline]
|
| 284 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 285 |
+
T::as_fd(self)
|
| 286 |
+
}
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 290 |
+
impl<T: AsFd + ?Sized> AsFd for &mut T {
|
| 291 |
+
#[inline]
|
| 292 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 293 |
+
T::as_fd(self)
|
| 294 |
+
}
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 298 |
+
impl AsFd for BorrowedFd<'_> {
|
| 299 |
+
#[inline]
|
| 300 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 301 |
+
*self
|
| 302 |
+
}
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 306 |
+
impl AsFd for OwnedFd {
|
| 307 |
+
#[inline]
|
| 308 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 309 |
+
// Safety: `OwnedFd` and `BorrowedFd` have the same validity
|
| 310 |
+
// invariants, and the `BorrowedFd` is bounded by the lifetime
|
| 311 |
+
// of `&self`.
|
| 312 |
+
unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) }
|
| 313 |
+
}
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 317 |
+
#[cfg(not(target_os = "trusty"))]
|
| 318 |
+
impl AsFd for fs::File {
|
| 319 |
+
#[inline]
|
| 320 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 321 |
+
self.as_inner().as_fd()
|
| 322 |
+
}
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 326 |
+
#[cfg(not(target_os = "trusty"))]
|
| 327 |
+
impl From<fs::File> for OwnedFd {
|
| 328 |
+
/// Takes ownership of a [`File`](fs::File)'s underlying file descriptor.
|
| 329 |
+
#[inline]
|
| 330 |
+
fn from(file: fs::File) -> OwnedFd {
|
| 331 |
+
file.into_inner().into_inner().into_inner()
|
| 332 |
+
}
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 336 |
+
#[cfg(not(target_os = "trusty"))]
|
| 337 |
+
impl From<OwnedFd> for fs::File {
|
| 338 |
+
/// Returns a [`File`](fs::File) that takes ownership of the given
|
| 339 |
+
/// file descriptor.
|
| 340 |
+
#[inline]
|
| 341 |
+
fn from(owned_fd: OwnedFd) -> Self {
|
| 342 |
+
Self::from_inner(FromInner::from_inner(FromInner::from_inner(owned_fd)))
|
| 343 |
+
}
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 347 |
+
#[cfg(not(target_os = "trusty"))]
|
| 348 |
+
impl AsFd for crate::net::TcpStream {
|
| 349 |
+
#[inline]
|
| 350 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 351 |
+
self.as_inner().socket().as_fd()
|
| 352 |
+
}
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 356 |
+
#[cfg(not(target_os = "trusty"))]
|
| 357 |
+
impl From<crate::net::TcpStream> for OwnedFd {
|
| 358 |
+
/// Takes ownership of a [`TcpStream`](crate::net::TcpStream)'s socket file descriptor.
|
| 359 |
+
#[inline]
|
| 360 |
+
fn from(tcp_stream: crate::net::TcpStream) -> OwnedFd {
|
| 361 |
+
tcp_stream.into_inner().into_socket().into_inner().into_inner().into()
|
| 362 |
+
}
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 366 |
+
#[cfg(not(target_os = "trusty"))]
|
| 367 |
+
impl From<OwnedFd> for crate::net::TcpStream {
|
| 368 |
+
#[inline]
|
| 369 |
+
fn from(owned_fd: OwnedFd) -> Self {
|
| 370 |
+
Self::from_inner(FromInner::from_inner(FromInner::from_inner(FromInner::from_inner(
|
| 371 |
+
owned_fd,
|
| 372 |
+
))))
|
| 373 |
+
}
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 377 |
+
#[cfg(not(target_os = "trusty"))]
|
| 378 |
+
impl AsFd for crate::net::TcpListener {
|
| 379 |
+
#[inline]
|
| 380 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 381 |
+
self.as_inner().socket().as_fd()
|
| 382 |
+
}
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 386 |
+
#[cfg(not(target_os = "trusty"))]
|
| 387 |
+
impl From<crate::net::TcpListener> for OwnedFd {
|
| 388 |
+
/// Takes ownership of a [`TcpListener`](crate::net::TcpListener)'s socket file descriptor.
|
| 389 |
+
#[inline]
|
| 390 |
+
fn from(tcp_listener: crate::net::TcpListener) -> OwnedFd {
|
| 391 |
+
tcp_listener.into_inner().into_socket().into_inner().into_inner().into()
|
| 392 |
+
}
|
| 393 |
+
}
|
| 394 |
+
|
| 395 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 396 |
+
#[cfg(not(target_os = "trusty"))]
|
| 397 |
+
impl From<OwnedFd> for crate::net::TcpListener {
|
| 398 |
+
#[inline]
|
| 399 |
+
fn from(owned_fd: OwnedFd) -> Self {
|
| 400 |
+
Self::from_inner(FromInner::from_inner(FromInner::from_inner(FromInner::from_inner(
|
| 401 |
+
owned_fd,
|
| 402 |
+
))))
|
| 403 |
+
}
|
| 404 |
+
}
|
| 405 |
+
|
| 406 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 407 |
+
#[cfg(not(target_os = "trusty"))]
|
| 408 |
+
impl AsFd for crate::net::UdpSocket {
|
| 409 |
+
#[inline]
|
| 410 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 411 |
+
self.as_inner().socket().as_fd()
|
| 412 |
+
}
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 416 |
+
#[cfg(not(target_os = "trusty"))]
|
| 417 |
+
impl From<crate::net::UdpSocket> for OwnedFd {
|
| 418 |
+
/// Takes ownership of a [`UdpSocket`](crate::net::UdpSocket)'s file descriptor.
|
| 419 |
+
#[inline]
|
| 420 |
+
fn from(udp_socket: crate::net::UdpSocket) -> OwnedFd {
|
| 421 |
+
udp_socket.into_inner().into_socket().into_inner().into_inner().into()
|
| 422 |
+
}
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 426 |
+
#[cfg(not(target_os = "trusty"))]
|
| 427 |
+
impl From<OwnedFd> for crate::net::UdpSocket {
|
| 428 |
+
#[inline]
|
| 429 |
+
fn from(owned_fd: OwnedFd) -> Self {
|
| 430 |
+
Self::from_inner(FromInner::from_inner(FromInner::from_inner(FromInner::from_inner(
|
| 431 |
+
owned_fd,
|
| 432 |
+
))))
|
| 433 |
+
}
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
#[stable(feature = "asfd_ptrs", since = "1.64.0")]
|
| 437 |
+
/// This impl allows implementing traits that require `AsFd` on Arc.
|
| 438 |
+
/// ```
|
| 439 |
+
/// # #[cfg(any(unix, target_os = "wasi"))] mod group_cfg {
|
| 440 |
+
/// # #[cfg(target_os = "wasi")]
|
| 441 |
+
/// # use std::os::wasi::io::AsFd;
|
| 442 |
+
/// # #[cfg(unix)]
|
| 443 |
+
/// # use std::os::unix::io::AsFd;
|
| 444 |
+
/// use std::net::UdpSocket;
|
| 445 |
+
/// use std::sync::Arc;
|
| 446 |
+
///
|
| 447 |
+
/// trait MyTrait: AsFd {}
|
| 448 |
+
/// impl MyTrait for Arc<UdpSocket> {}
|
| 449 |
+
/// impl MyTrait for Box<UdpSocket> {}
|
| 450 |
+
/// # }
|
| 451 |
+
/// ```
|
| 452 |
+
impl<T: AsFd + ?Sized> AsFd for crate::sync::Arc<T> {
|
| 453 |
+
#[inline]
|
| 454 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 455 |
+
(**self).as_fd()
|
| 456 |
+
}
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
#[stable(feature = "asfd_rc", since = "1.69.0")]
|
| 460 |
+
impl<T: AsFd + ?Sized> AsFd for crate::rc::Rc<T> {
|
| 461 |
+
#[inline]
|
| 462 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 463 |
+
(**self).as_fd()
|
| 464 |
+
}
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
#[unstable(feature = "unique_rc_arc", issue = "112566")]
|
| 468 |
+
impl<T: AsFd + ?Sized> AsFd for crate::rc::UniqueRc<T> {
|
| 469 |
+
#[inline]
|
| 470 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 471 |
+
(**self).as_fd()
|
| 472 |
+
}
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
#[stable(feature = "asfd_ptrs", since = "1.64.0")]
|
| 476 |
+
impl<T: AsFd + ?Sized> AsFd for Box<T> {
|
| 477 |
+
#[inline]
|
| 478 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 479 |
+
(**self).as_fd()
|
| 480 |
+
}
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 484 |
+
impl AsFd for io::Stdin {
|
| 485 |
+
#[inline]
|
| 486 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 487 |
+
unsafe { BorrowedFd::borrow_raw(0) }
|
| 488 |
+
}
|
| 489 |
+
}
|
| 490 |
+
|
| 491 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 492 |
+
impl<'a> AsFd for io::StdinLock<'a> {
|
| 493 |
+
#[inline]
|
| 494 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 495 |
+
// SAFETY: user code should not close stdin out from under the standard library
|
| 496 |
+
unsafe { BorrowedFd::borrow_raw(0) }
|
| 497 |
+
}
|
| 498 |
+
}
|
| 499 |
+
|
| 500 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 501 |
+
impl AsFd for io::Stdout {
|
| 502 |
+
#[inline]
|
| 503 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 504 |
+
unsafe { BorrowedFd::borrow_raw(1) }
|
| 505 |
+
}
|
| 506 |
+
}
|
| 507 |
+
|
| 508 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 509 |
+
impl<'a> AsFd for io::StdoutLock<'a> {
|
| 510 |
+
#[inline]
|
| 511 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 512 |
+
// SAFETY: user code should not close stdout out from under the standard library
|
| 513 |
+
unsafe { BorrowedFd::borrow_raw(1) }
|
| 514 |
+
}
|
| 515 |
+
}
|
| 516 |
+
|
| 517 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 518 |
+
impl AsFd for io::Stderr {
|
| 519 |
+
#[inline]
|
| 520 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 521 |
+
unsafe { BorrowedFd::borrow_raw(2) }
|
| 522 |
+
}
|
| 523 |
+
}
|
| 524 |
+
|
| 525 |
+
#[stable(feature = "io_safety", since = "1.63.0")]
|
| 526 |
+
impl<'a> AsFd for io::StderrLock<'a> {
|
| 527 |
+
#[inline]
|
| 528 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 529 |
+
// SAFETY: user code should not close stderr out from under the standard library
|
| 530 |
+
unsafe { BorrowedFd::borrow_raw(2) }
|
| 531 |
+
}
|
| 532 |
+
}
|
| 533 |
+
|
| 534 |
+
#[stable(feature = "anonymous_pipe", since = "1.87.0")]
|
| 535 |
+
#[cfg(not(target_os = "trusty"))]
|
| 536 |
+
impl AsFd for io::PipeReader {
|
| 537 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 538 |
+
self.0.as_fd()
|
| 539 |
+
}
|
| 540 |
+
}
|
| 541 |
+
|
| 542 |
+
#[stable(feature = "anonymous_pipe", since = "1.87.0")]
|
| 543 |
+
#[cfg(not(target_os = "trusty"))]
|
| 544 |
+
impl From<io::PipeReader> for OwnedFd {
|
| 545 |
+
fn from(pipe: io::PipeReader) -> Self {
|
| 546 |
+
pipe.0.into_inner()
|
| 547 |
+
}
|
| 548 |
+
}
|
| 549 |
+
|
| 550 |
+
#[stable(feature = "anonymous_pipe", since = "1.87.0")]
|
| 551 |
+
#[cfg(not(target_os = "trusty"))]
|
| 552 |
+
impl AsFd for io::PipeWriter {
|
| 553 |
+
fn as_fd(&self) -> BorrowedFd<'_> {
|
| 554 |
+
self.0.as_fd()
|
| 555 |
+
}
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
#[stable(feature = "anonymous_pipe", since = "1.87.0")]
|
| 559 |
+
#[cfg(not(target_os = "trusty"))]
|
| 560 |
+
impl From<io::PipeWriter> for OwnedFd {
|
| 561 |
+
fn from(pipe: io::PipeWriter) -> Self {
|
| 562 |
+
pipe.0.into_inner()
|
| 563 |
+
}
|
| 564 |
+
}
|
| 565 |
+
|
| 566 |
+
#[stable(feature = "anonymous_pipe", since = "1.87.0")]
|
| 567 |
+
#[cfg(not(target_os = "trusty"))]
|
| 568 |
+
impl From<OwnedFd> for io::PipeReader {
|
| 569 |
+
fn from(owned_fd: OwnedFd) -> Self {
|
| 570 |
+
Self(FromInner::from_inner(owned_fd))
|
| 571 |
+
}
|
| 572 |
+
}
|
| 573 |
+
|
| 574 |
+
#[stable(feature = "anonymous_pipe", since = "1.87.0")]
|
| 575 |
+
#[cfg(not(target_os = "trusty"))]
|
| 576 |
+
impl From<OwnedFd> for io::PipeWriter {
|
| 577 |
+
fn from(owned_fd: OwnedFd) -> Self {
|
| 578 |
+
Self(FromInner::from_inner(owned_fd))
|
| 579 |
+
}
|
| 580 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fd/raw.rs
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Raw Unix-like file descriptors.
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "rust1", since = "1.0.0")]
|
| 4 |
+
|
| 5 |
+
#[cfg(target_os = "hermit")]
|
| 6 |
+
use hermit_abi as libc;
|
| 7 |
+
#[cfg(target_os = "motor")]
|
| 8 |
+
use moto_rt::libc;
|
| 9 |
+
|
| 10 |
+
#[cfg(target_os = "motor")]
|
| 11 |
+
use super::owned::OwnedFd;
|
| 12 |
+
#[cfg(not(target_os = "trusty"))]
|
| 13 |
+
use crate::fs;
|
| 14 |
+
use crate::io;
|
| 15 |
+
#[cfg(target_os = "hermit")]
|
| 16 |
+
use crate::os::hermit::io::OwnedFd;
|
| 17 |
+
#[cfg(all(not(target_os = "hermit"), not(target_os = "motor")))]
|
| 18 |
+
use crate::os::raw;
|
| 19 |
+
#[cfg(all(doc, not(target_arch = "wasm32")))]
|
| 20 |
+
use crate::os::unix::io::AsFd;
|
| 21 |
+
#[cfg(unix)]
|
| 22 |
+
use crate::os::unix::io::OwnedFd;
|
| 23 |
+
#[cfg(target_os = "wasi")]
|
| 24 |
+
use crate::os::wasi::io::OwnedFd;
|
| 25 |
+
#[cfg(not(target_os = "trusty"))]
|
| 26 |
+
use crate::sys::{AsInner, FromInner, IntoInner};
|
| 27 |
+
|
| 28 |
+
/// Raw file descriptors.
|
| 29 |
+
#[stable(feature = "rust1", since = "1.0.0")]
|
| 30 |
+
#[cfg(all(not(target_os = "hermit"), not(target_os = "motor")))]
|
| 31 |
+
pub type RawFd = raw::c_int;
|
| 32 |
+
#[stable(feature = "rust1", since = "1.0.0")]
|
| 33 |
+
#[cfg(any(target_os = "hermit", target_os = "motor"))]
|
| 34 |
+
pub type RawFd = i32;
|
| 35 |
+
|
| 36 |
+
/// A trait to extract the raw file descriptor from an underlying object.
|
| 37 |
+
///
|
| 38 |
+
/// This is only available on unix and WASI platforms and must be imported in
|
| 39 |
+
/// order to call the method. Windows platforms have a corresponding
|
| 40 |
+
/// `AsRawHandle` and `AsRawSocket` set of traits.
|
| 41 |
+
#[stable(feature = "rust1", since = "1.0.0")]
|
| 42 |
+
pub trait AsRawFd {
|
| 43 |
+
/// Extracts the raw file descriptor.
|
| 44 |
+
///
|
| 45 |
+
/// This function is typically used to **borrow** an owned file descriptor.
|
| 46 |
+
/// When used in this way, this method does **not** pass ownership of the
|
| 47 |
+
/// raw file descriptor to the caller, and the file descriptor is only
|
| 48 |
+
/// guaranteed to be valid while the original object has not yet been
|
| 49 |
+
/// destroyed.
|
| 50 |
+
///
|
| 51 |
+
/// However, borrowing is not strictly required. See [`AsFd::as_fd`]
|
| 52 |
+
/// for an API which strictly borrows a file descriptor.
|
| 53 |
+
///
|
| 54 |
+
/// # Example
|
| 55 |
+
///
|
| 56 |
+
/// ```no_run
|
| 57 |
+
/// use std::fs::File;
|
| 58 |
+
/// # use std::io;
|
| 59 |
+
/// #[cfg(any(unix, target_os = "wasi"))]
|
| 60 |
+
/// use std::os::fd::{AsRawFd, RawFd};
|
| 61 |
+
///
|
| 62 |
+
/// let mut f = File::open("foo.txt")?;
|
| 63 |
+
/// // Note that `raw_fd` is only valid as long as `f` exists.
|
| 64 |
+
/// #[cfg(any(unix, target_os = "wasi"))]
|
| 65 |
+
/// let raw_fd: RawFd = f.as_raw_fd();
|
| 66 |
+
/// # Ok::<(), io::Error>(())
|
| 67 |
+
/// ```
|
| 68 |
+
#[stable(feature = "rust1", since = "1.0.0")]
|
| 69 |
+
fn as_raw_fd(&self) -> RawFd;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
/// A trait to express the ability to construct an object from a raw file
|
| 73 |
+
/// descriptor.
|
| 74 |
+
#[stable(feature = "from_raw_os", since = "1.1.0")]
|
| 75 |
+
pub trait FromRawFd {
|
| 76 |
+
/// Constructs a new instance of `Self` from the given raw file
|
| 77 |
+
/// descriptor.
|
| 78 |
+
///
|
| 79 |
+
/// This function is typically used to **consume ownership** of the
|
| 80 |
+
/// specified file descriptor. When used in this way, the returned object
|
| 81 |
+
/// will take responsibility for closing it when the object goes out of
|
| 82 |
+
/// scope.
|
| 83 |
+
///
|
| 84 |
+
/// However, consuming ownership is not strictly required. Use a
|
| 85 |
+
/// [`From<OwnedFd>::from`] implementation for an API which strictly
|
| 86 |
+
/// consumes ownership.
|
| 87 |
+
///
|
| 88 |
+
/// # Safety
|
| 89 |
+
///
|
| 90 |
+
/// The `fd` passed in must be an [owned file descriptor][io-safety];
|
| 91 |
+
/// in particular, it must be open.
|
| 92 |
+
///
|
| 93 |
+
/// [io-safety]: io#io-safety
|
| 94 |
+
///
|
| 95 |
+
/// # Example
|
| 96 |
+
///
|
| 97 |
+
/// ```no_run
|
| 98 |
+
/// use std::fs::File;
|
| 99 |
+
/// # use std::io;
|
| 100 |
+
/// #[cfg(any(unix, target_os = "wasi"))]
|
| 101 |
+
/// use std::os::fd::{FromRawFd, IntoRawFd, RawFd};
|
| 102 |
+
///
|
| 103 |
+
/// let f = File::open("foo.txt")?;
|
| 104 |
+
/// # #[cfg(any(unix, target_os = "wasi"))]
|
| 105 |
+
/// let raw_fd: RawFd = f.into_raw_fd();
|
| 106 |
+
/// // SAFETY: no other functions should call `from_raw_fd`, so there
|
| 107 |
+
/// // is only one owner for the file descriptor.
|
| 108 |
+
/// # #[cfg(any(unix, target_os = "wasi"))]
|
| 109 |
+
/// let f = unsafe { File::from_raw_fd(raw_fd) };
|
| 110 |
+
/// # Ok::<(), io::Error>(())
|
| 111 |
+
/// ```
|
| 112 |
+
#[stable(feature = "from_raw_os", since = "1.1.0")]
|
| 113 |
+
unsafe fn from_raw_fd(fd: RawFd) -> Self;
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
/// A trait to express the ability to consume an object and acquire ownership of
|
| 117 |
+
/// its raw file descriptor.
|
| 118 |
+
#[stable(feature = "into_raw_os", since = "1.4.0")]
|
| 119 |
+
pub trait IntoRawFd {
|
| 120 |
+
/// Consumes this object, returning the raw underlying file descriptor.
|
| 121 |
+
///
|
| 122 |
+
/// This function is typically used to **transfer ownership** of the underlying
|
| 123 |
+
/// file descriptor to the caller. When used in this way, callers are then the unique
|
| 124 |
+
/// owners of the file descriptor and must close it once it's no longer needed.
|
| 125 |
+
///
|
| 126 |
+
/// However, transferring ownership is not strictly required. Use a
|
| 127 |
+
/// [`Into<OwnedFd>::into`] implementation for an API which strictly
|
| 128 |
+
/// transfers ownership.
|
| 129 |
+
///
|
| 130 |
+
/// # Example
|
| 131 |
+
///
|
| 132 |
+
/// ```no_run
|
| 133 |
+
/// use std::fs::File;
|
| 134 |
+
/// # use std::io;
|
| 135 |
+
/// #[cfg(any(unix, target_os = "wasi"))]
|
| 136 |
+
/// use std::os::fd::{IntoRawFd, RawFd};
|
| 137 |
+
///
|
| 138 |
+
/// let f = File::open("foo.txt")?;
|
| 139 |
+
/// #[cfg(any(unix, target_os = "wasi"))]
|
| 140 |
+
/// let raw_fd: RawFd = f.into_raw_fd();
|
| 141 |
+
/// # Ok::<(), io::Error>(())
|
| 142 |
+
/// ```
|
| 143 |
+
#[must_use = "losing the raw file descriptor may leak resources"]
|
| 144 |
+
#[stable(feature = "into_raw_os", since = "1.4.0")]
|
| 145 |
+
fn into_raw_fd(self) -> RawFd;
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
#[stable(feature = "raw_fd_reflexive_traits", since = "1.48.0")]
|
| 149 |
+
impl AsRawFd for RawFd {
|
| 150 |
+
#[inline]
|
| 151 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 152 |
+
*self
|
| 153 |
+
}
|
| 154 |
+
}
|
| 155 |
+
#[stable(feature = "raw_fd_reflexive_traits", since = "1.48.0")]
|
| 156 |
+
impl IntoRawFd for RawFd {
|
| 157 |
+
#[inline]
|
| 158 |
+
fn into_raw_fd(self) -> RawFd {
|
| 159 |
+
self
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
#[stable(feature = "raw_fd_reflexive_traits", since = "1.48.0")]
|
| 163 |
+
impl FromRawFd for RawFd {
|
| 164 |
+
#[inline]
|
| 165 |
+
unsafe fn from_raw_fd(fd: RawFd) -> RawFd {
|
| 166 |
+
fd
|
| 167 |
+
}
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
#[stable(feature = "rust1", since = "1.0.0")]
|
| 171 |
+
#[cfg(not(target_os = "trusty"))]
|
| 172 |
+
impl AsRawFd for fs::File {
|
| 173 |
+
#[inline]
|
| 174 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 175 |
+
self.as_inner().as_raw_fd()
|
| 176 |
+
}
|
| 177 |
+
}
|
| 178 |
+
#[stable(feature = "from_raw_os", since = "1.1.0")]
|
| 179 |
+
#[cfg(not(target_os = "trusty"))]
|
| 180 |
+
impl FromRawFd for fs::File {
|
| 181 |
+
#[inline]
|
| 182 |
+
unsafe fn from_raw_fd(fd: RawFd) -> fs::File {
|
| 183 |
+
unsafe { fs::File::from(OwnedFd::from_raw_fd(fd)) }
|
| 184 |
+
}
|
| 185 |
+
}
|
| 186 |
+
#[stable(feature = "into_raw_os", since = "1.4.0")]
|
| 187 |
+
#[cfg(not(target_os = "trusty"))]
|
| 188 |
+
impl IntoRawFd for fs::File {
|
| 189 |
+
#[inline]
|
| 190 |
+
fn into_raw_fd(self) -> RawFd {
|
| 191 |
+
self.into_inner().into_inner().into_raw_fd()
|
| 192 |
+
}
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
#[stable(feature = "asraw_stdio", since = "1.21.0")]
|
| 196 |
+
#[cfg(not(target_os = "trusty"))]
|
| 197 |
+
impl AsRawFd for io::Stdin {
|
| 198 |
+
#[inline]
|
| 199 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 200 |
+
libc::STDIN_FILENO
|
| 201 |
+
}
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
#[stable(feature = "asraw_stdio", since = "1.21.0")]
|
| 205 |
+
impl AsRawFd for io::Stdout {
|
| 206 |
+
#[inline]
|
| 207 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 208 |
+
libc::STDOUT_FILENO
|
| 209 |
+
}
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
#[stable(feature = "asraw_stdio", since = "1.21.0")]
|
| 213 |
+
impl AsRawFd for io::Stderr {
|
| 214 |
+
#[inline]
|
| 215 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 216 |
+
libc::STDERR_FILENO
|
| 217 |
+
}
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
#[stable(feature = "asraw_stdio_locks", since = "1.35.0")]
|
| 221 |
+
#[cfg(not(target_os = "trusty"))]
|
| 222 |
+
impl<'a> AsRawFd for io::StdinLock<'a> {
|
| 223 |
+
#[inline]
|
| 224 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 225 |
+
libc::STDIN_FILENO
|
| 226 |
+
}
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
#[stable(feature = "asraw_stdio_locks", since = "1.35.0")]
|
| 230 |
+
impl<'a> AsRawFd for io::StdoutLock<'a> {
|
| 231 |
+
#[inline]
|
| 232 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 233 |
+
libc::STDOUT_FILENO
|
| 234 |
+
}
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
#[stable(feature = "asraw_stdio_locks", since = "1.35.0")]
|
| 238 |
+
impl<'a> AsRawFd for io::StderrLock<'a> {
|
| 239 |
+
#[inline]
|
| 240 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 241 |
+
libc::STDERR_FILENO
|
| 242 |
+
}
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
/// This impl allows implementing traits that require `AsRawFd` on Arc.
|
| 246 |
+
/// ```
|
| 247 |
+
/// # #[cfg(any(unix, target_os = "wasi"))] mod group_cfg {
|
| 248 |
+
/// # #[cfg(target_os = "wasi")]
|
| 249 |
+
/// # use std::os::wasi::io::AsRawFd;
|
| 250 |
+
/// # #[cfg(unix)]
|
| 251 |
+
/// # use std::os::unix::io::AsRawFd;
|
| 252 |
+
/// use std::net::UdpSocket;
|
| 253 |
+
/// use std::sync::Arc;
|
| 254 |
+
/// trait MyTrait: AsRawFd {
|
| 255 |
+
/// }
|
| 256 |
+
/// impl MyTrait for Arc<UdpSocket> {}
|
| 257 |
+
/// impl MyTrait for Box<UdpSocket> {}
|
| 258 |
+
/// # }
|
| 259 |
+
/// ```
|
| 260 |
+
#[stable(feature = "asrawfd_ptrs", since = "1.63.0")]
|
| 261 |
+
impl<T: AsRawFd> AsRawFd for crate::sync::Arc<T> {
|
| 262 |
+
#[inline]
|
| 263 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 264 |
+
(**self).as_raw_fd()
|
| 265 |
+
}
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
#[stable(feature = "asfd_rc", since = "1.69.0")]
|
| 269 |
+
impl<T: AsRawFd> AsRawFd for crate::rc::Rc<T> {
|
| 270 |
+
#[inline]
|
| 271 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 272 |
+
(**self).as_raw_fd()
|
| 273 |
+
}
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
#[unstable(feature = "unique_rc_arc", issue = "112566")]
|
| 277 |
+
impl<T: AsRawFd + ?Sized> AsRawFd for crate::rc::UniqueRc<T> {
|
| 278 |
+
#[inline]
|
| 279 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 280 |
+
(**self).as_raw_fd()
|
| 281 |
+
}
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
#[stable(feature = "asrawfd_ptrs", since = "1.63.0")]
|
| 285 |
+
impl<T: AsRawFd> AsRawFd for Box<T> {
|
| 286 |
+
#[inline]
|
| 287 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 288 |
+
(**self).as_raw_fd()
|
| 289 |
+
}
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
#[stable(feature = "anonymous_pipe", since = "1.87.0")]
|
| 293 |
+
#[cfg(not(target_os = "trusty"))]
|
| 294 |
+
impl AsRawFd for io::PipeReader {
|
| 295 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 296 |
+
self.0.as_raw_fd()
|
| 297 |
+
}
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
+
#[stable(feature = "anonymous_pipe", since = "1.87.0")]
|
| 301 |
+
#[cfg(not(target_os = "trusty"))]
|
| 302 |
+
impl FromRawFd for io::PipeReader {
|
| 303 |
+
unsafe fn from_raw_fd(raw_fd: RawFd) -> Self {
|
| 304 |
+
Self::from_inner(unsafe { FromRawFd::from_raw_fd(raw_fd) })
|
| 305 |
+
}
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
#[stable(feature = "anonymous_pipe", since = "1.87.0")]
|
| 309 |
+
#[cfg(not(target_os = "trusty"))]
|
| 310 |
+
impl IntoRawFd for io::PipeReader {
|
| 311 |
+
fn into_raw_fd(self) -> RawFd {
|
| 312 |
+
self.0.into_raw_fd()
|
| 313 |
+
}
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
#[stable(feature = "anonymous_pipe", since = "1.87.0")]
|
| 317 |
+
#[cfg(not(target_os = "trusty"))]
|
| 318 |
+
impl AsRawFd for io::PipeWriter {
|
| 319 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 320 |
+
self.0.as_raw_fd()
|
| 321 |
+
}
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
#[stable(feature = "anonymous_pipe", since = "1.87.0")]
|
| 325 |
+
#[cfg(not(target_os = "trusty"))]
|
| 326 |
+
impl FromRawFd for io::PipeWriter {
|
| 327 |
+
unsafe fn from_raw_fd(raw_fd: RawFd) -> Self {
|
| 328 |
+
Self::from_inner(unsafe { FromRawFd::from_raw_fd(raw_fd) })
|
| 329 |
+
}
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
#[stable(feature = "anonymous_pipe", since = "1.87.0")]
|
| 333 |
+
#[cfg(not(target_os = "trusty"))]
|
| 334 |
+
impl IntoRawFd for io::PipeWriter {
|
| 335 |
+
fn into_raw_fd(self) -> RawFd {
|
| 336 |
+
self.0.into_raw_fd()
|
| 337 |
+
}
|
| 338 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fd/stdio.rs
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
use super::BorrowedFd;
|
| 2 |
+
|
| 3 |
+
/// The file descriptor for the standard input stream of the current process.
|
| 4 |
+
///
|
| 5 |
+
/// See [`io::stdin()`][`crate::io::stdin`] for the higher level handle, which should be preferred
|
| 6 |
+
/// whenever possible. See [`STDERR`] for why the file descriptor might be required and caveats.
|
| 7 |
+
#[unstable(feature = "stdio_fd_consts", issue = "150836")]
|
| 8 |
+
pub const STDIN: BorrowedFd<'static> = unsafe { BorrowedFd::borrow_raw(0) };
|
| 9 |
+
|
| 10 |
+
/// The file descriptor for the standard output stream of the current process.
|
| 11 |
+
///
|
| 12 |
+
/// See [`io::stdout()`][`crate::io::stdout`] for the higher level handle, which should be preferred
|
| 13 |
+
/// whenever possible. See [`STDERR`] for why the file descriptor might be required and caveats. In
|
| 14 |
+
/// addition to the issues discussed there, note that [`Stdout`][`crate::io::Stdout`] is buffered by
|
| 15 |
+
/// default, and writing to the file descriptor will bypass this buffer.
|
| 16 |
+
#[unstable(feature = "stdio_fd_consts", issue = "150836")]
|
| 17 |
+
pub const STDOUT: BorrowedFd<'static> = unsafe { BorrowedFd::borrow_raw(1) };
|
| 18 |
+
|
| 19 |
+
/// The file descriptor for the standard error stream of the current process.
|
| 20 |
+
///
|
| 21 |
+
/// See [`io::stderr()`][`crate::io::stderr`] for the higher level handle, which should be preferred
|
| 22 |
+
/// whenever possible. However, there are situations where touching the `std::io` handles (or most
|
| 23 |
+
/// other parts of the standard library) risks deadlocks or other subtle bugs. For example:
|
| 24 |
+
///
|
| 25 |
+
/// - Global allocators must be careful to [avoid reentrancy][global-alloc-reentrancy], and the
|
| 26 |
+
/// `std::io` handles may allocate memory on (some) accesses.
|
| 27 |
+
/// - Signal handlers must be *async-signal-safe*, which rules out panicking, taking locks (may
|
| 28 |
+
/// deadlock if the signal handler interrupted a thread holding that lock), allocating memory, or
|
| 29 |
+
/// anything else that is not explicitly declared async-signal-safe.
|
| 30 |
+
/// - `CommandExt::pre_exec` callbacks can safely panic (with some limitations), but otherwise must
|
| 31 |
+
/// abide by similar limitations as signal handlers. In particular, at the time these callbacks
|
| 32 |
+
/// run, the stdio file descriptors have already been replaced, but the locks protecting the
|
| 33 |
+
/// `std::io` handles may be permanently locked if another thread held the lock at `fork()` time.
|
| 34 |
+
///
|
| 35 |
+
/// In these and similar cases, direct access to the file descriptor may be required. However, in
|
| 36 |
+
/// most cases, using the `std::io` handles and accessing the file descriptor via the `AsFd`
|
| 37 |
+
/// implementations is preferable, as it enables cooperation with the standard library's locking and
|
| 38 |
+
/// buffering.
|
| 39 |
+
///
|
| 40 |
+
/// # I/O safety
|
| 41 |
+
///
|
| 42 |
+
/// This is a `BorrowedFd<'static>` because the standard input/output/error streams are shared
|
| 43 |
+
/// resources that must remain available for the lifetime of the process. This is only true when
|
| 44 |
+
/// linking `std`, and may not always hold for [code running before `main()`][before-after-main] or
|
| 45 |
+
/// in `no_std` environments. It is [unsound][io-safety] to close these file descriptors. Safe
|
| 46 |
+
/// patterns for changing these file descriptors are available on Unix via the `StdioExt` extension
|
| 47 |
+
/// trait.
|
| 48 |
+
///
|
| 49 |
+
/// [before-after-main]: ../../../std/index.html#use-before-and-after-main
|
| 50 |
+
/// [io-safety]: ../../../std/io/index.html#io-safety
|
| 51 |
+
/// [global-alloc-reentrancy]: ../../../std/alloc/trait.GlobalAlloc.html#re-entrance
|
| 52 |
+
#[unstable(feature = "stdio_fd_consts", issue = "150836")]
|
| 53 |
+
pub const STDERR: BorrowedFd<'static> = unsafe { BorrowedFd::borrow_raw(2) };
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fd/tests.rs
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#[cfg(any(unix, target_os = "wasi"))]
|
| 2 |
+
#[test]
|
| 3 |
+
fn test_raw_fd() {
|
| 4 |
+
#[cfg(unix)]
|
| 5 |
+
use crate::os::unix::io::{AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
|
| 6 |
+
#[cfg(target_os = "wasi")]
|
| 7 |
+
use crate::os::wasi::io::{AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
|
| 8 |
+
|
| 9 |
+
let raw_fd: RawFd = crate::io::stdin().as_raw_fd();
|
| 10 |
+
|
| 11 |
+
let stdin_as_file = unsafe { crate::fs::File::from_raw_fd(raw_fd) };
|
| 12 |
+
assert_eq!(stdin_as_file.as_raw_fd(), raw_fd);
|
| 13 |
+
assert_eq!(unsafe { BorrowedFd::borrow_raw(raw_fd).as_raw_fd() }, raw_fd);
|
| 14 |
+
assert_eq!(stdin_as_file.into_raw_fd(), 0);
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
#[cfg(any(unix, target_os = "wasi"))]
|
| 18 |
+
#[test]
|
| 19 |
+
fn test_fd() {
|
| 20 |
+
#[cfg(unix)]
|
| 21 |
+
use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
|
| 22 |
+
#[cfg(target_os = "wasi")]
|
| 23 |
+
use crate::os::wasi::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
|
| 24 |
+
|
| 25 |
+
let stdin = crate::io::stdin();
|
| 26 |
+
let fd: BorrowedFd<'_> = stdin.as_fd();
|
| 27 |
+
let raw_fd: RawFd = fd.as_raw_fd();
|
| 28 |
+
let owned_fd: OwnedFd = unsafe { OwnedFd::from_raw_fd(raw_fd) };
|
| 29 |
+
|
| 30 |
+
let stdin_as_file = crate::fs::File::from(owned_fd);
|
| 31 |
+
|
| 32 |
+
assert_eq!(stdin_as_file.as_fd().as_raw_fd(), raw_fd);
|
| 33 |
+
assert_eq!(Into::<OwnedFd>::into(stdin_as_file).into_raw_fd(), raw_fd);
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
#[cfg(any(unix, target_os = "wasi"))]
|
| 37 |
+
#[test]
|
| 38 |
+
fn test_niche_optimizations() {
|
| 39 |
+
#[cfg(unix)]
|
| 40 |
+
use crate::os::unix::io::{BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
|
| 41 |
+
#[cfg(target_os = "wasi")]
|
| 42 |
+
use crate::os::wasi::io::{BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
|
| 43 |
+
|
| 44 |
+
assert_eq!(size_of::<Option<OwnedFd>>(), size_of::<RawFd>());
|
| 45 |
+
assert_eq!(size_of::<Option<BorrowedFd<'static>>>(), size_of::<RawFd>());
|
| 46 |
+
unsafe {
|
| 47 |
+
assert_eq!(OwnedFd::from_raw_fd(RawFd::MIN).into_raw_fd(), RawFd::MIN);
|
| 48 |
+
assert_eq!(OwnedFd::from_raw_fd(RawFd::MAX).into_raw_fd(), RawFd::MAX);
|
| 49 |
+
assert_eq!(Some(OwnedFd::from_raw_fd(RawFd::MIN)).unwrap().into_raw_fd(), RawFd::MIN);
|
| 50 |
+
assert_eq!(Some(OwnedFd::from_raw_fd(RawFd::MAX)).unwrap().into_raw_fd(), RawFd::MAX);
|
| 51 |
+
}
|
| 52 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fortanix_sgx/arch.rs
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! SGX-specific access to architectural features.
|
| 2 |
+
//!
|
| 3 |
+
//! The functionality in this module is further documented in the Intel
|
| 4 |
+
//! Software Developer's Manual, Volume 3, Chapter 40.
|
| 5 |
+
#![unstable(feature = "sgx_platform", issue = "56975")]
|
| 6 |
+
|
| 7 |
+
use core::arch::asm;
|
| 8 |
+
|
| 9 |
+
use crate::mem::MaybeUninit;
|
| 10 |
+
|
| 11 |
+
/// Wrapper struct to force 16-byte alignment.
|
| 12 |
+
#[repr(align(16))]
|
| 13 |
+
#[unstable(feature = "sgx_platform", issue = "56975")]
|
| 14 |
+
pub struct Align16<T>(pub T);
|
| 15 |
+
|
| 16 |
+
/// Wrapper struct to force 128-byte alignment.
|
| 17 |
+
#[repr(align(128))]
|
| 18 |
+
#[unstable(feature = "sgx_platform", issue = "56975")]
|
| 19 |
+
pub struct Align128<T>(pub T);
|
| 20 |
+
|
| 21 |
+
/// Wrapper struct to force 512-byte alignment.
|
| 22 |
+
#[repr(align(512))]
|
| 23 |
+
#[unstable(feature = "sgx_platform", issue = "56975")]
|
| 24 |
+
pub struct Align512<T>(pub T);
|
| 25 |
+
|
| 26 |
+
const ENCLU_EREPORT: u32 = 0;
|
| 27 |
+
const ENCLU_EGETKEY: u32 = 1;
|
| 28 |
+
|
| 29 |
+
/// Call the `EGETKEY` instruction to obtain a 128-bit secret key.
|
| 30 |
+
#[unstable(feature = "sgx_platform", issue = "56975")]
|
| 31 |
+
pub fn egetkey(request: &Align512<[u8; 512]>) -> Result<Align16<[u8; 16]>, u32> {
|
| 32 |
+
unsafe {
|
| 33 |
+
let mut out = MaybeUninit::uninit();
|
| 34 |
+
let error;
|
| 35 |
+
|
| 36 |
+
asm!(
|
| 37 |
+
// rbx is reserved by LLVM
|
| 38 |
+
"xchg %rbx, {0}",
|
| 39 |
+
"enclu",
|
| 40 |
+
"mov {0}, %rbx",
|
| 41 |
+
inout(reg) request => _,
|
| 42 |
+
inlateout("eax") ENCLU_EGETKEY => error,
|
| 43 |
+
in("rcx") out.as_mut_ptr(),
|
| 44 |
+
options(att_syntax, nostack),
|
| 45 |
+
);
|
| 46 |
+
|
| 47 |
+
match error {
|
| 48 |
+
0 => Ok(out.assume_init()),
|
| 49 |
+
err => Err(err),
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
/// Call the `EREPORT` instruction.
|
| 55 |
+
///
|
| 56 |
+
/// This creates a cryptographic report describing the contents of the current
|
| 57 |
+
/// enclave. The report may be verified by the enclave described in
|
| 58 |
+
/// `targetinfo`.
|
| 59 |
+
#[unstable(feature = "sgx_platform", issue = "56975")]
|
| 60 |
+
pub fn ereport(
|
| 61 |
+
targetinfo: &Align512<[u8; 512]>,
|
| 62 |
+
reportdata: &Align128<[u8; 64]>,
|
| 63 |
+
) -> Align512<[u8; 432]> {
|
| 64 |
+
unsafe {
|
| 65 |
+
let mut report = MaybeUninit::uninit();
|
| 66 |
+
|
| 67 |
+
asm!(
|
| 68 |
+
// rbx is reserved by LLVM
|
| 69 |
+
"xchg %rbx, {0}",
|
| 70 |
+
"enclu",
|
| 71 |
+
"mov {0}, %rbx",
|
| 72 |
+
inout(reg) targetinfo => _,
|
| 73 |
+
in("eax") ENCLU_EREPORT,
|
| 74 |
+
in("rcx") reportdata,
|
| 75 |
+
in("rdx") report.as_mut_ptr(),
|
| 76 |
+
options(att_syntax, preserves_flags, nostack),
|
| 77 |
+
);
|
| 78 |
+
|
| 79 |
+
report.assume_init()
|
| 80 |
+
}
|
| 81 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fortanix_sgx/ffi.rs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! SGX-specific extension to the primitives in the `std::ffi` module
|
| 2 |
+
//!
|
| 3 |
+
//! # Examples
|
| 4 |
+
//!
|
| 5 |
+
//! ```
|
| 6 |
+
//! use std::ffi::OsString;
|
| 7 |
+
//! use std::os::fortanix_sgx::ffi::OsStringExt;
|
| 8 |
+
//!
|
| 9 |
+
//! let bytes = b"foo".to_vec();
|
| 10 |
+
//!
|
| 11 |
+
//! // OsStringExt::from_vec
|
| 12 |
+
//! let os_string = OsString::from_vec(bytes);
|
| 13 |
+
//! assert_eq!(os_string.to_str(), Some("foo"));
|
| 14 |
+
//!
|
| 15 |
+
//! // OsStringExt::into_vec
|
| 16 |
+
//! let bytes = os_string.into_vec();
|
| 17 |
+
//! assert_eq!(bytes, b"foo");
|
| 18 |
+
//! ```
|
| 19 |
+
//!
|
| 20 |
+
//! ```
|
| 21 |
+
//! use std::ffi::OsStr;
|
| 22 |
+
//! use std::os::fortanix_sgx::ffi::OsStrExt;
|
| 23 |
+
//!
|
| 24 |
+
//! let bytes = b"foo";
|
| 25 |
+
//!
|
| 26 |
+
//! // OsStrExt::from_bytes
|
| 27 |
+
//! let os_str = OsStr::from_bytes(bytes);
|
| 28 |
+
//! assert_eq!(os_str.to_str(), Some("foo"));
|
| 29 |
+
//!
|
| 30 |
+
//! // OsStrExt::as_bytes
|
| 31 |
+
//! let bytes = os_str.as_bytes();
|
| 32 |
+
//! assert_eq!(bytes, b"foo");
|
| 33 |
+
//! ```
|
| 34 |
+
|
| 35 |
+
#![unstable(feature = "sgx_platform", issue = "56975")]
|
| 36 |
+
|
| 37 |
+
#[path = "../unix/ffi/os_str.rs"]
|
| 38 |
+
mod os_str;
|
| 39 |
+
|
| 40 |
+
#[unstable(feature = "sgx_platform", issue = "56975")]
|
| 41 |
+
pub use self::os_str::{OsStrExt, OsStringExt};
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fortanix_sgx/io.rs
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! SGX-specific extensions to general I/O primitives
|
| 2 |
+
//!
|
| 3 |
+
//! SGX file descriptors behave differently from Unix file descriptors. See the
|
| 4 |
+
//! description of [`TryIntoRawFd`] for more details.
|
| 5 |
+
#![unstable(feature = "sgx_platform", issue = "56975")]
|
| 6 |
+
|
| 7 |
+
use crate::net;
|
| 8 |
+
pub use crate::sys::abi::usercalls::raw::Fd as RawFd;
|
| 9 |
+
use crate::sys::{self, AsInner, FromInner, IntoInner, TryIntoInner};
|
| 10 |
+
|
| 11 |
+
/// A trait to extract the raw SGX file descriptor from an underlying
|
| 12 |
+
/// object.
|
| 13 |
+
#[unstable(feature = "sgx_platform", issue = "56975")]
|
| 14 |
+
pub trait AsRawFd {
|
| 15 |
+
/// Extracts the raw file descriptor.
|
| 16 |
+
///
|
| 17 |
+
/// This method does **not** pass ownership of the raw file descriptor
|
| 18 |
+
/// to the caller. The descriptor is only guaranteed to be valid while
|
| 19 |
+
/// the original object has not yet been destroyed.
|
| 20 |
+
#[unstable(feature = "sgx_platform", issue = "56975")]
|
| 21 |
+
fn as_raw_fd(&self) -> RawFd;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
/// A trait to express the ability to construct an object from a raw file
|
| 25 |
+
/// descriptor.
|
| 26 |
+
#[unstable(feature = "sgx_platform", issue = "56975")]
|
| 27 |
+
pub trait FromRawFd {
|
| 28 |
+
/// An associated type that contains relevant metadata for `Self`.
|
| 29 |
+
type Metadata: Default;
|
| 30 |
+
|
| 31 |
+
/// Constructs a new instance of `Self` from the given raw file
|
| 32 |
+
/// descriptor and metadata.
|
| 33 |
+
///
|
| 34 |
+
/// This function is typically used to **consume ownership** of the
|
| 35 |
+
/// specified file descriptor. When used in this way, the returned object
|
| 36 |
+
/// will take responsibility for closing it when the object goes out of
|
| 37 |
+
/// scope.
|
| 38 |
+
///
|
| 39 |
+
/// However, consuming ownership is not strictly required. Use a
|
| 40 |
+
/// [`From<OwnedFd>::from`] implementation for an API which strictly
|
| 41 |
+
/// consumes ownership.
|
| 42 |
+
///
|
| 43 |
+
/// # Safety
|
| 44 |
+
///
|
| 45 |
+
/// The `fd` passed in must be an [owned file descriptor][io-safety];
|
| 46 |
+
/// in particular, it must be open.
|
| 47 |
+
// FIXME: say something about `metadata`.
|
| 48 |
+
///
|
| 49 |
+
/// [io-safety]: io#io-safety
|
| 50 |
+
#[unstable(feature = "sgx_platform", issue = "56975")]
|
| 51 |
+
unsafe fn from_raw_fd(fd: RawFd, metadata: Self::Metadata) -> Self;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
/// A trait to express the ability to consume an object and acquire ownership of
|
| 55 |
+
/// its raw file descriptor.
|
| 56 |
+
#[unstable(feature = "sgx_platform", issue = "56975")]
|
| 57 |
+
pub trait TryIntoRawFd: Sized {
|
| 58 |
+
/// Consumes this object, returning the raw underlying file descriptor, if
|
| 59 |
+
/// this object is not cloned.
|
| 60 |
+
///
|
| 61 |
+
/// This function **transfers ownership** of the underlying file descriptor
|
| 62 |
+
/// to the caller. Callers are then the unique owners of the file descriptor
|
| 63 |
+
/// and must close the descriptor once it's no longer needed.
|
| 64 |
+
///
|
| 65 |
+
/// Unlike other platforms, on SGX, the file descriptor is shared between
|
| 66 |
+
/// all clones of an object. To avoid race conditions, this function will
|
| 67 |
+
/// only return `Ok` when called on the final clone.
|
| 68 |
+
#[unstable(feature = "sgx_platform", issue = "56975")]
|
| 69 |
+
fn try_into_raw_fd(self) -> Result<RawFd, Self>;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
impl AsRawFd for net::TcpStream {
|
| 73 |
+
#[inline]
|
| 74 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 75 |
+
*self.as_inner().as_inner().as_inner().as_inner()
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
impl AsRawFd for net::TcpListener {
|
| 80 |
+
#[inline]
|
| 81 |
+
fn as_raw_fd(&self) -> RawFd {
|
| 82 |
+
*self.as_inner().as_inner().as_inner().as_inner()
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
/// Metadata for `TcpStream`.
|
| 87 |
+
#[derive(Debug, Clone, Default)]
|
| 88 |
+
#[unstable(feature = "sgx_platform", issue = "56975")]
|
| 89 |
+
pub struct TcpStreamMetadata {
|
| 90 |
+
/// Local address of the TCP stream
|
| 91 |
+
pub local_addr: Option<String>,
|
| 92 |
+
/// Peer address of the TCP stream
|
| 93 |
+
pub peer_addr: Option<String>,
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
impl FromRawFd for net::TcpStream {
|
| 97 |
+
type Metadata = TcpStreamMetadata;
|
| 98 |
+
|
| 99 |
+
#[inline]
|
| 100 |
+
unsafe fn from_raw_fd(fd: RawFd, metadata: Self::Metadata) -> net::TcpStream {
|
| 101 |
+
let fd = sys::fd::FileDesc::from_inner(fd);
|
| 102 |
+
let socket = sys::net::Socket::from_inner((fd, metadata.local_addr));
|
| 103 |
+
net::TcpStream::from_inner(sys::net::TcpStream::from_inner((socket, metadata.peer_addr)))
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
/// Metadata for `TcpListener`.
|
| 108 |
+
#[derive(Debug, Clone, Default)]
|
| 109 |
+
#[unstable(feature = "sgx_platform", issue = "56975")]
|
| 110 |
+
pub struct TcpListenerMetadata {
|
| 111 |
+
/// Local address of the TCP listener
|
| 112 |
+
pub local_addr: Option<String>,
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
impl FromRawFd for net::TcpListener {
|
| 116 |
+
type Metadata = TcpListenerMetadata;
|
| 117 |
+
|
| 118 |
+
#[inline]
|
| 119 |
+
unsafe fn from_raw_fd(fd: RawFd, metadata: Self::Metadata) -> net::TcpListener {
|
| 120 |
+
let fd = sys::fd::FileDesc::from_inner(fd);
|
| 121 |
+
let socket = sys::net::Socket::from_inner((fd, metadata.local_addr));
|
| 122 |
+
net::TcpListener::from_inner(sys::net::TcpListener::from_inner(socket))
|
| 123 |
+
}
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
impl TryIntoRawFd for net::TcpStream {
|
| 127 |
+
#[inline]
|
| 128 |
+
fn try_into_raw_fd(self) -> Result<RawFd, Self> {
|
| 129 |
+
let (socket, peer_addr) = self.into_inner().into_inner();
|
| 130 |
+
match socket.try_into_inner() {
|
| 131 |
+
Ok(fd) => Ok(fd.into_inner()),
|
| 132 |
+
Err(socket) => {
|
| 133 |
+
let sys = sys::net::TcpStream::from_inner((socket, peer_addr));
|
| 134 |
+
Err(net::TcpStream::from_inner(sys))
|
| 135 |
+
}
|
| 136 |
+
}
|
| 137 |
+
}
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
impl TryIntoRawFd for net::TcpListener {
|
| 141 |
+
#[inline]
|
| 142 |
+
fn try_into_raw_fd(self) -> Result<RawFd, Self> {
|
| 143 |
+
match self.into_inner().into_inner().try_into_inner() {
|
| 144 |
+
Ok(fd) => Ok(fd.into_inner()),
|
| 145 |
+
Err(socket) => {
|
| 146 |
+
let sys = sys::net::TcpListener::from_inner(socket);
|
| 147 |
+
Err(net::TcpListener::from_inner(sys))
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fortanix_sgx/mod.rs
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Functionality specific to the `x86_64-fortanix-unknown-sgx` target.
|
| 2 |
+
//!
|
| 3 |
+
//! This includes functions to deal with memory isolation, usercalls, and the
|
| 4 |
+
//! SGX instruction set.
|
| 5 |
+
|
| 6 |
+
#![deny(missing_docs)]
|
| 7 |
+
#![unstable(feature = "sgx_platform", issue = "56975")]
|
| 8 |
+
|
| 9 |
+
/// Low-level interfaces to usercalls. See the [ABI documentation] for more
|
| 10 |
+
/// information.
|
| 11 |
+
///
|
| 12 |
+
/// [ABI documentation]: https://docs.rs/fortanix-sgx-abi/
|
| 13 |
+
pub mod usercalls {
|
| 14 |
+
pub use crate::sys::abi::usercalls::*;
|
| 15 |
+
|
| 16 |
+
/// Primitives for allocating memory in userspace as well as copying data
|
| 17 |
+
/// to and from user memory.
|
| 18 |
+
pub mod alloc {
|
| 19 |
+
pub use crate::sys::abi::usercalls::alloc::*;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
/// Lowest-level interfaces to usercalls and usercall ABI type definitions.
|
| 23 |
+
pub mod raw {
|
| 24 |
+
pub use crate::sys::abi::usercalls::raw::{
|
| 25 |
+
ByteBuffer, Cancel, EV_RETURNQ_NOT_EMPTY, EV_UNPARK, EV_USERCALLQ_NOT_FULL, Error,
|
| 26 |
+
FD_STDERR, FD_STDIN, FD_STDOUT, Fd, FifoDescriptor, RESULT_SUCCESS, Register,
|
| 27 |
+
RegisterArgument, Result, Return, ReturnValue, Tcs, USERCALL_USER_DEFINED, Usercall,
|
| 28 |
+
Usercalls as UsercallNrs, WAIT_INDEFINITE, WAIT_NO, accept_stream, alloc, async_queues,
|
| 29 |
+
bind_stream, close, connect_stream, do_usercall, exit, flush, free, insecure_time,
|
| 30 |
+
launch_thread, read, read_alloc, send, wait, write,
|
| 31 |
+
};
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
/// Functions for querying mapping information for pointers.
|
| 36 |
+
pub mod mem {
|
| 37 |
+
pub use crate::sys::abi::mem::*;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
pub mod arch;
|
| 41 |
+
pub mod ffi;
|
| 42 |
+
pub mod io;
|
| 43 |
+
|
| 44 |
+
/// Functions for querying thread-related information.
|
| 45 |
+
pub mod thread {
|
| 46 |
+
pub use crate::sys::abi::thread::current;
|
| 47 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/freebsd/fs.rs
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
| 2 |
+
|
| 3 |
+
use crate::fs::Metadata;
|
| 4 |
+
#[allow(deprecated)]
|
| 5 |
+
use crate::os::freebsd::raw;
|
| 6 |
+
use crate::sys::AsInner;
|
| 7 |
+
|
| 8 |
+
/// OS-specific extensions to [`fs::Metadata`].
|
| 9 |
+
///
|
| 10 |
+
/// [`fs::Metadata`]: crate::fs::Metadata
|
| 11 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 12 |
+
pub trait MetadataExt {
|
| 13 |
+
/// Gain a reference to the underlying `stat` structure which contains
|
| 14 |
+
/// the raw information returned by the OS.
|
| 15 |
+
///
|
| 16 |
+
/// The contents of the returned `stat` are **not** consistent across
|
| 17 |
+
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
| 18 |
+
/// cross-Unix abstractions contained within the raw stat.
|
| 19 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 20 |
+
#[deprecated(
|
| 21 |
+
since = "1.8.0",
|
| 22 |
+
note = "deprecated in favor of the accessor \
|
| 23 |
+
methods of this trait"
|
| 24 |
+
)]
|
| 25 |
+
#[allow(deprecated)]
|
| 26 |
+
fn as_raw_stat(&self) -> &raw::stat;
|
| 27 |
+
|
| 28 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 29 |
+
fn st_dev(&self) -> u64;
|
| 30 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 31 |
+
fn st_ino(&self) -> u64;
|
| 32 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 33 |
+
fn st_mode(&self) -> u32;
|
| 34 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 35 |
+
fn st_nlink(&self) -> u64;
|
| 36 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 37 |
+
fn st_uid(&self) -> u32;
|
| 38 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 39 |
+
fn st_gid(&self) -> u32;
|
| 40 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 41 |
+
fn st_rdev(&self) -> u64;
|
| 42 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 43 |
+
fn st_size(&self) -> u64;
|
| 44 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 45 |
+
fn st_atime(&self) -> i64;
|
| 46 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 47 |
+
fn st_atime_nsec(&self) -> i64;
|
| 48 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 49 |
+
fn st_mtime(&self) -> i64;
|
| 50 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 51 |
+
fn st_mtime_nsec(&self) -> i64;
|
| 52 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 53 |
+
fn st_ctime(&self) -> i64;
|
| 54 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 55 |
+
fn st_ctime_nsec(&self) -> i64;
|
| 56 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 57 |
+
fn st_birthtime(&self) -> i64;
|
| 58 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 59 |
+
fn st_birthtime_nsec(&self) -> i64;
|
| 60 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 61 |
+
fn st_blksize(&self) -> u64;
|
| 62 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 63 |
+
fn st_blocks(&self) -> u64;
|
| 64 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 65 |
+
fn st_flags(&self) -> u32;
|
| 66 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 67 |
+
fn st_gen(&self) -> u32;
|
| 68 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 69 |
+
fn st_lspare(&self) -> u32;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 73 |
+
impl MetadataExt for Metadata {
|
| 74 |
+
#[allow(deprecated)]
|
| 75 |
+
fn as_raw_stat(&self) -> &raw::stat {
|
| 76 |
+
// The methods below use libc::stat, so they work fine when libc is built with FreeBSD 12 ABI.
|
| 77 |
+
// This method would just return nonsense.
|
| 78 |
+
panic!("as_raw_stat not supported with FreeBSD 12 ABI");
|
| 79 |
+
}
|
| 80 |
+
fn st_dev(&self) -> u64 {
|
| 81 |
+
self.as_inner().as_inner().st_dev as u64
|
| 82 |
+
}
|
| 83 |
+
fn st_ino(&self) -> u64 {
|
| 84 |
+
self.as_inner().as_inner().st_ino as u64
|
| 85 |
+
}
|
| 86 |
+
fn st_mode(&self) -> u32 {
|
| 87 |
+
self.as_inner().as_inner().st_mode as u32
|
| 88 |
+
}
|
| 89 |
+
fn st_nlink(&self) -> u64 {
|
| 90 |
+
self.as_inner().as_inner().st_nlink as u64
|
| 91 |
+
}
|
| 92 |
+
fn st_uid(&self) -> u32 {
|
| 93 |
+
self.as_inner().as_inner().st_uid as u32
|
| 94 |
+
}
|
| 95 |
+
fn st_gid(&self) -> u32 {
|
| 96 |
+
self.as_inner().as_inner().st_gid as u32
|
| 97 |
+
}
|
| 98 |
+
fn st_rdev(&self) -> u64 {
|
| 99 |
+
self.as_inner().as_inner().st_rdev as u64
|
| 100 |
+
}
|
| 101 |
+
fn st_size(&self) -> u64 {
|
| 102 |
+
self.as_inner().as_inner().st_size as u64
|
| 103 |
+
}
|
| 104 |
+
fn st_atime(&self) -> i64 {
|
| 105 |
+
self.as_inner().as_inner().st_atime as i64
|
| 106 |
+
}
|
| 107 |
+
fn st_atime_nsec(&self) -> i64 {
|
| 108 |
+
self.as_inner().as_inner().st_atime_nsec as i64
|
| 109 |
+
}
|
| 110 |
+
fn st_mtime(&self) -> i64 {
|
| 111 |
+
self.as_inner().as_inner().st_mtime as i64
|
| 112 |
+
}
|
| 113 |
+
fn st_mtime_nsec(&self) -> i64 {
|
| 114 |
+
self.as_inner().as_inner().st_mtime_nsec as i64
|
| 115 |
+
}
|
| 116 |
+
fn st_ctime(&self) -> i64 {
|
| 117 |
+
self.as_inner().as_inner().st_ctime as i64
|
| 118 |
+
}
|
| 119 |
+
fn st_ctime_nsec(&self) -> i64 {
|
| 120 |
+
self.as_inner().as_inner().st_ctime_nsec as i64
|
| 121 |
+
}
|
| 122 |
+
fn st_birthtime(&self) -> i64 {
|
| 123 |
+
self.as_inner().as_inner().st_birthtime as i64
|
| 124 |
+
}
|
| 125 |
+
fn st_birthtime_nsec(&self) -> i64 {
|
| 126 |
+
self.as_inner().as_inner().st_birthtime_nsec as i64
|
| 127 |
+
}
|
| 128 |
+
fn st_blksize(&self) -> u64 {
|
| 129 |
+
self.as_inner().as_inner().st_blksize as u64
|
| 130 |
+
}
|
| 131 |
+
fn st_blocks(&self) -> u64 {
|
| 132 |
+
self.as_inner().as_inner().st_blocks as u64
|
| 133 |
+
}
|
| 134 |
+
fn st_gen(&self) -> u32 {
|
| 135 |
+
self.as_inner().as_inner().st_gen as u32
|
| 136 |
+
}
|
| 137 |
+
fn st_flags(&self) -> u32 {
|
| 138 |
+
self.as_inner().as_inner().st_flags as u32
|
| 139 |
+
}
|
| 140 |
+
fn st_lspare(&self) -> u32 {
|
| 141 |
+
panic!("st_lspare not supported with FreeBSD 12 ABI");
|
| 142 |
+
}
|
| 143 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/freebsd/mod.rs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! FreeBSD-specific definitions
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 4 |
+
|
| 5 |
+
pub mod fs;
|
| 6 |
+
pub mod net;
|
| 7 |
+
pub mod raw;
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/freebsd/net.rs
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! FreeBSD-specific networking functionality.
|
| 2 |
+
|
| 3 |
+
#![unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
|
| 4 |
+
|
| 5 |
+
use crate::ffi::CStr;
|
| 6 |
+
use crate::io;
|
| 7 |
+
use crate::os::unix::net;
|
| 8 |
+
use crate::sealed::Sealed;
|
| 9 |
+
use crate::sys::AsInner;
|
| 10 |
+
|
| 11 |
+
/// FreeBSD-specific functionality for `AF_UNIX` sockets [`UnixDatagram`]
|
| 12 |
+
/// and [`UnixStream`].
|
| 13 |
+
///
|
| 14 |
+
/// [`UnixDatagram`]: net::UnixDatagram
|
| 15 |
+
/// [`UnixStream`]: net::UnixStream
|
| 16 |
+
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
|
| 17 |
+
pub trait UnixSocketExt: Sealed {
|
| 18 |
+
/// Query the current setting of socket option `LOCAL_CREDS_PERSISTENT`.
|
| 19 |
+
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
|
| 20 |
+
fn local_creds_persistent(&self) -> io::Result<bool>;
|
| 21 |
+
|
| 22 |
+
/// Enable or disable socket option `LOCAL_CREDS_PERSISTENT`.
|
| 23 |
+
///
|
| 24 |
+
/// This option enables the credentials of the sending process to be
|
| 25 |
+
/// received as a control message in [`AncillaryData`].
|
| 26 |
+
///
|
| 27 |
+
/// [`AncillaryData`]: net::AncillaryData
|
| 28 |
+
///
|
| 29 |
+
/// # Examples
|
| 30 |
+
///
|
| 31 |
+
/// ```no_run
|
| 32 |
+
/// #![feature(unix_socket_ancillary_data)]
|
| 33 |
+
/// use std::os::freebsd::net::UnixSocketExt;
|
| 34 |
+
/// use std::os::unix::net::UnixDatagram;
|
| 35 |
+
///
|
| 36 |
+
/// fn main() -> std::io::Result<()> {
|
| 37 |
+
/// let sock = UnixDatagram::unbound()?;
|
| 38 |
+
/// sock.set_local_creds_persistent(true).expect("set_local_creds_persistent failed");
|
| 39 |
+
/// Ok(())
|
| 40 |
+
/// }
|
| 41 |
+
/// ```
|
| 42 |
+
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
|
| 43 |
+
fn set_local_creds_persistent(&self, local_creds_persistent: bool) -> io::Result<()>;
|
| 44 |
+
|
| 45 |
+
/// Gets a filter name if one had been set previously on the socket.
|
| 46 |
+
#[unstable(feature = "acceptfilter", issue = "121891")]
|
| 47 |
+
fn acceptfilter(&self) -> io::Result<&CStr>;
|
| 48 |
+
|
| 49 |
+
/// Set or disable a filter on the socket to filter incoming connections
|
| 50 |
+
/// to defer it before accept(2)
|
| 51 |
+
#[unstable(feature = "acceptfilter", issue = "121891")]
|
| 52 |
+
fn set_acceptfilter(&self, name: &CStr) -> io::Result<()>;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
|
| 56 |
+
impl UnixSocketExt for net::UnixDatagram {
|
| 57 |
+
fn local_creds_persistent(&self) -> io::Result<bool> {
|
| 58 |
+
self.as_inner().local_creds_persistent()
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
fn set_local_creds_persistent(&self, local_creds_persistent: bool) -> io::Result<()> {
|
| 62 |
+
self.as_inner().set_local_creds_persistent(local_creds_persistent)
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
fn acceptfilter(&self) -> io::Result<&CStr> {
|
| 66 |
+
self.as_inner().acceptfilter()
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
fn set_acceptfilter(&self, name: &CStr) -> io::Result<()> {
|
| 70 |
+
self.as_inner().set_acceptfilter(name)
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
|
| 75 |
+
impl UnixSocketExt for net::UnixStream {
|
| 76 |
+
fn local_creds_persistent(&self) -> io::Result<bool> {
|
| 77 |
+
self.as_inner().local_creds_persistent()
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
fn set_local_creds_persistent(&self, local_creds_persistent: bool) -> io::Result<()> {
|
| 81 |
+
self.as_inner().set_local_creds_persistent(local_creds_persistent)
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
fn acceptfilter(&self) -> io::Result<&CStr> {
|
| 85 |
+
self.as_inner().acceptfilter()
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
fn set_acceptfilter(&self, name: &CStr) -> io::Result<()> {
|
| 89 |
+
self.as_inner().set_acceptfilter(name)
|
| 90 |
+
}
|
| 91 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/freebsd/raw.rs
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! FreeBSD-specific raw type definitions
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 4 |
+
#![deprecated(
|
| 5 |
+
since = "1.8.0",
|
| 6 |
+
note = "these type aliases are no longer supported by \
|
| 7 |
+
the standard library, the `libc` crate on \
|
| 8 |
+
crates.io should be used instead for the correct \
|
| 9 |
+
definitions"
|
| 10 |
+
)]
|
| 11 |
+
#![allow(deprecated)]
|
| 12 |
+
|
| 13 |
+
use crate::os::raw::c_long;
|
| 14 |
+
|
| 15 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 16 |
+
pub type blkcnt_t = u64;
|
| 17 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 18 |
+
pub type blksize_t = u64;
|
| 19 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 20 |
+
pub type dev_t = u64;
|
| 21 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 22 |
+
pub type fflags_t = u32;
|
| 23 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 24 |
+
pub type ino_t = u64;
|
| 25 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 26 |
+
pub type mode_t = u32;
|
| 27 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 28 |
+
pub type nlink_t = u64;
|
| 29 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 30 |
+
pub type off_t = u64;
|
| 31 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 32 |
+
pub type time_t = i64;
|
| 33 |
+
|
| 34 |
+
#[stable(feature = "pthread_t", since = "1.8.0")]
|
| 35 |
+
pub type pthread_t = usize;
|
| 36 |
+
|
| 37 |
+
#[repr(C)]
|
| 38 |
+
#[derive(Clone)]
|
| 39 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 40 |
+
pub struct stat {
|
| 41 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 42 |
+
pub st_dev: u32,
|
| 43 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 44 |
+
pub st_ino: u32,
|
| 45 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 46 |
+
pub st_mode: u16,
|
| 47 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 48 |
+
pub st_nlink: u16,
|
| 49 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 50 |
+
pub st_uid: u32,
|
| 51 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 52 |
+
pub st_gid: u32,
|
| 53 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 54 |
+
pub st_rdev: u32,
|
| 55 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 56 |
+
pub st_atime: c_long,
|
| 57 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 58 |
+
pub st_atime_nsec: c_long,
|
| 59 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 60 |
+
pub st_mtime: c_long,
|
| 61 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 62 |
+
pub st_mtime_nsec: c_long,
|
| 63 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 64 |
+
pub st_ctime: c_long,
|
| 65 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 66 |
+
pub st_ctime_nsec: c_long,
|
| 67 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 68 |
+
pub st_size: i64,
|
| 69 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 70 |
+
pub st_blocks: i64,
|
| 71 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 72 |
+
pub st_blksize: u32,
|
| 73 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 74 |
+
pub st_flags: u32,
|
| 75 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 76 |
+
pub st_gen: u32,
|
| 77 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 78 |
+
pub st_lspare: i32,
|
| 79 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 80 |
+
pub st_birthtime: c_long,
|
| 81 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 82 |
+
pub st_birthtime_nsec: c_long,
|
| 83 |
+
#[cfg(target_arch = "x86")]
|
| 84 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 85 |
+
pub __unused: [u8; 8],
|
| 86 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fuchsia/fs.rs
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
| 2 |
+
|
| 3 |
+
use crate::fs::Metadata;
|
| 4 |
+
use crate::sys::AsInner;
|
| 5 |
+
|
| 6 |
+
/// OS-specific extensions to [`fs::Metadata`].
|
| 7 |
+
///
|
| 8 |
+
/// [`fs::Metadata`]: crate::fs::Metadata
|
| 9 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 10 |
+
pub trait MetadataExt {
|
| 11 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 12 |
+
fn st_dev(&self) -> u64;
|
| 13 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 14 |
+
fn st_ino(&self) -> u64;
|
| 15 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 16 |
+
fn st_mode(&self) -> u32;
|
| 17 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 18 |
+
fn st_nlink(&self) -> u64;
|
| 19 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 20 |
+
fn st_uid(&self) -> u32;
|
| 21 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 22 |
+
fn st_gid(&self) -> u32;
|
| 23 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 24 |
+
fn st_rdev(&self) -> u64;
|
| 25 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 26 |
+
fn st_size(&self) -> u64;
|
| 27 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 28 |
+
fn st_atime(&self) -> i64;
|
| 29 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 30 |
+
fn st_atime_nsec(&self) -> i64;
|
| 31 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 32 |
+
fn st_mtime(&self) -> i64;
|
| 33 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 34 |
+
fn st_mtime_nsec(&self) -> i64;
|
| 35 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 36 |
+
fn st_ctime(&self) -> i64;
|
| 37 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 38 |
+
fn st_ctime_nsec(&self) -> i64;
|
| 39 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 40 |
+
fn st_blksize(&self) -> u64;
|
| 41 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 42 |
+
fn st_blocks(&self) -> u64;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 46 |
+
impl MetadataExt for Metadata {
|
| 47 |
+
fn st_dev(&self) -> u64 {
|
| 48 |
+
self.as_inner().as_inner().st_dev as u64
|
| 49 |
+
}
|
| 50 |
+
fn st_ino(&self) -> u64 {
|
| 51 |
+
self.as_inner().as_inner().st_ino as u64
|
| 52 |
+
}
|
| 53 |
+
fn st_mode(&self) -> u32 {
|
| 54 |
+
self.as_inner().as_inner().st_mode as u32
|
| 55 |
+
}
|
| 56 |
+
fn st_nlink(&self) -> u64 {
|
| 57 |
+
self.as_inner().as_inner().st_nlink as u64
|
| 58 |
+
}
|
| 59 |
+
fn st_uid(&self) -> u32 {
|
| 60 |
+
self.as_inner().as_inner().st_uid as u32
|
| 61 |
+
}
|
| 62 |
+
fn st_gid(&self) -> u32 {
|
| 63 |
+
self.as_inner().as_inner().st_gid as u32
|
| 64 |
+
}
|
| 65 |
+
fn st_rdev(&self) -> u64 {
|
| 66 |
+
self.as_inner().as_inner().st_rdev as u64
|
| 67 |
+
}
|
| 68 |
+
fn st_size(&self) -> u64 {
|
| 69 |
+
self.as_inner().as_inner().st_size as u64
|
| 70 |
+
}
|
| 71 |
+
fn st_atime(&self) -> i64 {
|
| 72 |
+
self.as_inner().as_inner().st_atime as i64
|
| 73 |
+
}
|
| 74 |
+
fn st_atime_nsec(&self) -> i64 {
|
| 75 |
+
self.as_inner().as_inner().st_atime_nsec as i64
|
| 76 |
+
}
|
| 77 |
+
fn st_mtime(&self) -> i64 {
|
| 78 |
+
self.as_inner().as_inner().st_mtime as i64
|
| 79 |
+
}
|
| 80 |
+
fn st_mtime_nsec(&self) -> i64 {
|
| 81 |
+
self.as_inner().as_inner().st_mtime_nsec as i64
|
| 82 |
+
}
|
| 83 |
+
fn st_ctime(&self) -> i64 {
|
| 84 |
+
self.as_inner().as_inner().st_ctime as i64
|
| 85 |
+
}
|
| 86 |
+
fn st_ctime_nsec(&self) -> i64 {
|
| 87 |
+
self.as_inner().as_inner().st_ctime_nsec as i64
|
| 88 |
+
}
|
| 89 |
+
fn st_blksize(&self) -> u64 {
|
| 90 |
+
self.as_inner().as_inner().st_blksize as u64
|
| 91 |
+
}
|
| 92 |
+
fn st_blocks(&self) -> u64 {
|
| 93 |
+
self.as_inner().as_inner().st_blocks as u64
|
| 94 |
+
}
|
| 95 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fuchsia/mod.rs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Fuchsia-specific definitions
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 4 |
+
|
| 5 |
+
pub mod fs;
|
| 6 |
+
pub mod raw;
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/fuchsia/raw.rs
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Fuchsia-specific raw type definitions
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 4 |
+
#![deprecated(
|
| 5 |
+
since = "1.8.0",
|
| 6 |
+
note = "these type aliases are no longer supported by \
|
| 7 |
+
the standard library, the `libc` crate on \
|
| 8 |
+
crates.io should be used instead for the correct \
|
| 9 |
+
definitions"
|
| 10 |
+
)]
|
| 11 |
+
#![allow(deprecated)]
|
| 12 |
+
|
| 13 |
+
use crate::os::raw::c_ulong;
|
| 14 |
+
|
| 15 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 16 |
+
pub type dev_t = u64;
|
| 17 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 18 |
+
pub type mode_t = u32;
|
| 19 |
+
|
| 20 |
+
#[stable(feature = "pthread_t", since = "1.8.0")]
|
| 21 |
+
pub type pthread_t = c_ulong;
|
| 22 |
+
|
| 23 |
+
#[doc(inline)]
|
| 24 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 25 |
+
pub use self::arch::{blkcnt_t, blksize_t, ino_t, nlink_t, off_t, stat, time_t};
|
| 26 |
+
|
| 27 |
+
#[cfg(any(target_arch = "x86", target_arch = "powerpc", target_arch = "arm"))]
|
| 28 |
+
mod arch {
|
| 29 |
+
use crate::os::raw::{c_long, c_short, c_uint};
|
| 30 |
+
|
| 31 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 32 |
+
pub type blkcnt_t = u64;
|
| 33 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 34 |
+
pub type blksize_t = u64;
|
| 35 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 36 |
+
pub type ino_t = u64;
|
| 37 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 38 |
+
pub type nlink_t = u64;
|
| 39 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 40 |
+
pub type off_t = u64;
|
| 41 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 42 |
+
pub type time_t = i64;
|
| 43 |
+
|
| 44 |
+
#[repr(C)]
|
| 45 |
+
#[derive(Clone)]
|
| 46 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 47 |
+
pub struct stat {
|
| 48 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 49 |
+
pub st_dev: u64,
|
| 50 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 51 |
+
pub __pad1: c_short,
|
| 52 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 53 |
+
pub __st_ino: u32,
|
| 54 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 55 |
+
pub st_mode: u32,
|
| 56 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 57 |
+
pub st_nlink: u32,
|
| 58 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 59 |
+
pub st_uid: u32,
|
| 60 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 61 |
+
pub st_gid: u32,
|
| 62 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 63 |
+
pub st_rdev: u64,
|
| 64 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 65 |
+
pub __pad2: c_uint,
|
| 66 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 67 |
+
pub st_size: i64,
|
| 68 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 69 |
+
pub st_blksize: i32,
|
| 70 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 71 |
+
pub st_blocks: i64,
|
| 72 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 73 |
+
pub st_atime: i32,
|
| 74 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 75 |
+
pub st_atime_nsec: c_long,
|
| 76 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 77 |
+
pub st_mtime: i32,
|
| 78 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 79 |
+
pub st_mtime_nsec: c_long,
|
| 80 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 81 |
+
pub st_ctime: i32,
|
| 82 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 83 |
+
pub st_ctime_nsec: c_long,
|
| 84 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 85 |
+
pub st_ino: u64,
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
#[cfg(target_arch = "mips")]
|
| 90 |
+
mod arch {
|
| 91 |
+
use crate::os::raw::{c_long, c_ulong};
|
| 92 |
+
|
| 93 |
+
#[cfg(target_env = "musl")]
|
| 94 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 95 |
+
pub type blkcnt_t = i64;
|
| 96 |
+
#[cfg(not(target_env = "musl"))]
|
| 97 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 98 |
+
pub type blkcnt_t = u64;
|
| 99 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 100 |
+
pub type blksize_t = u64;
|
| 101 |
+
#[cfg(target_env = "musl")]
|
| 102 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 103 |
+
pub type ino_t = u64;
|
| 104 |
+
#[cfg(not(target_env = "musl"))]
|
| 105 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 106 |
+
pub type ino_t = u64;
|
| 107 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 108 |
+
pub type nlink_t = u64;
|
| 109 |
+
#[cfg(target_env = "musl")]
|
| 110 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 111 |
+
pub type off_t = u64;
|
| 112 |
+
#[cfg(not(target_env = "musl"))]
|
| 113 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 114 |
+
pub type off_t = u64;
|
| 115 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 116 |
+
pub type time_t = i64;
|
| 117 |
+
|
| 118 |
+
#[repr(C)]
|
| 119 |
+
#[derive(Clone)]
|
| 120 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 121 |
+
pub struct stat {
|
| 122 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 123 |
+
pub st_dev: c_ulong,
|
| 124 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 125 |
+
pub st_pad1: [c_long; 3],
|
| 126 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 127 |
+
pub st_ino: u64,
|
| 128 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 129 |
+
pub st_mode: u32,
|
| 130 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 131 |
+
pub st_nlink: u32,
|
| 132 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 133 |
+
pub st_uid: u32,
|
| 134 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 135 |
+
pub st_gid: u32,
|
| 136 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 137 |
+
pub st_rdev: c_ulong,
|
| 138 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 139 |
+
pub st_pad2: [c_long; 2],
|
| 140 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 141 |
+
pub st_size: i64,
|
| 142 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 143 |
+
pub st_atime: i32,
|
| 144 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 145 |
+
pub st_atime_nsec: c_long,
|
| 146 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 147 |
+
pub st_mtime: i32,
|
| 148 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 149 |
+
pub st_mtime_nsec: c_long,
|
| 150 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 151 |
+
pub st_ctime: i32,
|
| 152 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 153 |
+
pub st_ctime_nsec: c_long,
|
| 154 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 155 |
+
pub st_blksize: i32,
|
| 156 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 157 |
+
pub st_blocks: i64,
|
| 158 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 159 |
+
pub st_pad5: [c_long; 14],
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
#[cfg(target_arch = "mips64")]
|
| 164 |
+
mod arch {
|
| 165 |
+
pub use libc::{blkcnt_t, blksize_t, ino_t, nlink_t, off_t, stat, time_t};
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
#[cfg(target_arch = "aarch64")]
|
| 169 |
+
mod arch {
|
| 170 |
+
use crate::os::raw::{c_int, c_long};
|
| 171 |
+
|
| 172 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 173 |
+
pub type blkcnt_t = u64;
|
| 174 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 175 |
+
pub type blksize_t = u64;
|
| 176 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 177 |
+
pub type ino_t = u64;
|
| 178 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 179 |
+
pub type nlink_t = u64;
|
| 180 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 181 |
+
pub type off_t = u64;
|
| 182 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 183 |
+
pub type time_t = i64;
|
| 184 |
+
|
| 185 |
+
#[repr(C)]
|
| 186 |
+
#[derive(Clone)]
|
| 187 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 188 |
+
pub struct stat {
|
| 189 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 190 |
+
pub st_dev: u64,
|
| 191 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 192 |
+
pub st_ino: u64,
|
| 193 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 194 |
+
pub st_mode: u32,
|
| 195 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 196 |
+
pub st_nlink: u32,
|
| 197 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 198 |
+
pub st_uid: u32,
|
| 199 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 200 |
+
pub st_gid: u32,
|
| 201 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 202 |
+
pub st_rdev: u64,
|
| 203 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 204 |
+
pub __pad1: u64,
|
| 205 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 206 |
+
pub st_size: i64,
|
| 207 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 208 |
+
pub st_blksize: i32,
|
| 209 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 210 |
+
pub __pad2: c_int,
|
| 211 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 212 |
+
pub st_blocks: i64,
|
| 213 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 214 |
+
pub st_atime: i64,
|
| 215 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 216 |
+
pub st_atime_nsec: c_long,
|
| 217 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 218 |
+
pub st_mtime: i64,
|
| 219 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 220 |
+
pub st_mtime_nsec: c_long,
|
| 221 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 222 |
+
pub st_ctime: i64,
|
| 223 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 224 |
+
pub st_ctime_nsec: c_long,
|
| 225 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 226 |
+
pub __unused: [c_int; 2],
|
| 227 |
+
}
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
#[cfg(target_arch = "x86_64")]
|
| 231 |
+
mod arch {
|
| 232 |
+
use crate::os::raw::{c_int, c_long};
|
| 233 |
+
|
| 234 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 235 |
+
pub type blkcnt_t = u64;
|
| 236 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 237 |
+
pub type blksize_t = u64;
|
| 238 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 239 |
+
pub type ino_t = u64;
|
| 240 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 241 |
+
pub type nlink_t = u64;
|
| 242 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 243 |
+
pub type off_t = u64;
|
| 244 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 245 |
+
pub type time_t = i64;
|
| 246 |
+
|
| 247 |
+
#[repr(C)]
|
| 248 |
+
#[derive(Clone)]
|
| 249 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 250 |
+
pub struct stat {
|
| 251 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 252 |
+
pub st_dev: u64,
|
| 253 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 254 |
+
pub st_ino: u64,
|
| 255 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 256 |
+
pub st_nlink: u64,
|
| 257 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 258 |
+
pub st_mode: u32,
|
| 259 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 260 |
+
pub st_uid: u32,
|
| 261 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 262 |
+
pub st_gid: u32,
|
| 263 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 264 |
+
pub __pad0: c_int,
|
| 265 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 266 |
+
pub st_rdev: u64,
|
| 267 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 268 |
+
pub st_size: i64,
|
| 269 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 270 |
+
pub st_blksize: i64,
|
| 271 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 272 |
+
pub st_blocks: i64,
|
| 273 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 274 |
+
pub st_atime: i64,
|
| 275 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 276 |
+
pub st_atime_nsec: c_long,
|
| 277 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 278 |
+
pub st_mtime: i64,
|
| 279 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 280 |
+
pub st_mtime_nsec: c_long,
|
| 281 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 282 |
+
pub st_ctime: i64,
|
| 283 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 284 |
+
pub st_ctime_nsec: c_long,
|
| 285 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 286 |
+
pub __unused: [c_long; 3],
|
| 287 |
+
}
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
#[cfg(target_arch = "riscv64")]
|
| 291 |
+
mod arch {
|
| 292 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 293 |
+
pub use libc::{blkcnt_t, blksize_t, ino_t, nlink_t, off_t, stat, time_t};
|
| 294 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/haiku/fs.rs
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
| 2 |
+
|
| 3 |
+
use crate::fs::Metadata;
|
| 4 |
+
#[allow(deprecated)]
|
| 5 |
+
use crate::os::haiku::raw;
|
| 6 |
+
use crate::sys::AsInner;
|
| 7 |
+
|
| 8 |
+
/// OS-specific extensions to [`fs::Metadata`].
|
| 9 |
+
///
|
| 10 |
+
/// [`fs::Metadata`]: crate::fs::Metadata
|
| 11 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 12 |
+
pub trait MetadataExt {
|
| 13 |
+
/// Gain a reference to the underlying `stat` structure which contains
|
| 14 |
+
/// the raw information returned by the OS.
|
| 15 |
+
///
|
| 16 |
+
/// The contents of the returned `stat` are **not** consistent across
|
| 17 |
+
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
| 18 |
+
/// cross-Unix abstractions contained within the raw stat.
|
| 19 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 20 |
+
#[deprecated(
|
| 21 |
+
since = "1.8.0",
|
| 22 |
+
note = "deprecated in favor of the accessor \
|
| 23 |
+
methods of this trait"
|
| 24 |
+
)]
|
| 25 |
+
#[allow(deprecated)]
|
| 26 |
+
fn as_raw_stat(&self) -> &raw::stat;
|
| 27 |
+
|
| 28 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 29 |
+
fn st_dev(&self) -> u64;
|
| 30 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 31 |
+
fn st_ino(&self) -> u64;
|
| 32 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 33 |
+
fn st_mode(&self) -> u32;
|
| 34 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 35 |
+
fn st_nlink(&self) -> u64;
|
| 36 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 37 |
+
fn st_uid(&self) -> u32;
|
| 38 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 39 |
+
fn st_gid(&self) -> u32;
|
| 40 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 41 |
+
fn st_rdev(&self) -> u64;
|
| 42 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 43 |
+
fn st_size(&self) -> u64;
|
| 44 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 45 |
+
fn st_atime(&self) -> i64;
|
| 46 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 47 |
+
fn st_atime_nsec(&self) -> i64;
|
| 48 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 49 |
+
fn st_mtime(&self) -> i64;
|
| 50 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 51 |
+
fn st_mtime_nsec(&self) -> i64;
|
| 52 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 53 |
+
fn st_ctime(&self) -> i64;
|
| 54 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 55 |
+
fn st_ctime_nsec(&self) -> i64;
|
| 56 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 57 |
+
fn st_crtime(&self) -> i64;
|
| 58 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 59 |
+
fn st_crtime_nsec(&self) -> i64;
|
| 60 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 61 |
+
fn st_blksize(&self) -> u64;
|
| 62 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 63 |
+
fn st_blocks(&self) -> u64;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 67 |
+
impl MetadataExt for Metadata {
|
| 68 |
+
#[allow(deprecated)]
|
| 69 |
+
fn as_raw_stat(&self) -> &raw::stat {
|
| 70 |
+
unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) }
|
| 71 |
+
}
|
| 72 |
+
fn st_dev(&self) -> u64 {
|
| 73 |
+
self.as_inner().as_inner().st_dev as u64
|
| 74 |
+
}
|
| 75 |
+
fn st_ino(&self) -> u64 {
|
| 76 |
+
self.as_inner().as_inner().st_ino as u64
|
| 77 |
+
}
|
| 78 |
+
fn st_mode(&self) -> u32 {
|
| 79 |
+
self.as_inner().as_inner().st_mode as u32
|
| 80 |
+
}
|
| 81 |
+
fn st_nlink(&self) -> u64 {
|
| 82 |
+
self.as_inner().as_inner().st_nlink as u64
|
| 83 |
+
}
|
| 84 |
+
fn st_uid(&self) -> u32 {
|
| 85 |
+
self.as_inner().as_inner().st_uid as u32
|
| 86 |
+
}
|
| 87 |
+
fn st_gid(&self) -> u32 {
|
| 88 |
+
self.as_inner().as_inner().st_gid as u32
|
| 89 |
+
}
|
| 90 |
+
fn st_rdev(&self) -> u64 {
|
| 91 |
+
self.as_inner().as_inner().st_rdev as u64
|
| 92 |
+
}
|
| 93 |
+
fn st_size(&self) -> u64 {
|
| 94 |
+
self.as_inner().as_inner().st_size as u64
|
| 95 |
+
}
|
| 96 |
+
fn st_atime(&self) -> i64 {
|
| 97 |
+
self.as_inner().as_inner().st_atime as i64
|
| 98 |
+
}
|
| 99 |
+
fn st_atime_nsec(&self) -> i64 {
|
| 100 |
+
self.as_inner().as_inner().st_atime_nsec as i64
|
| 101 |
+
}
|
| 102 |
+
fn st_mtime(&self) -> i64 {
|
| 103 |
+
self.as_inner().as_inner().st_mtime as i64
|
| 104 |
+
}
|
| 105 |
+
fn st_mtime_nsec(&self) -> i64 {
|
| 106 |
+
self.as_inner().as_inner().st_mtime_nsec as i64
|
| 107 |
+
}
|
| 108 |
+
fn st_ctime(&self) -> i64 {
|
| 109 |
+
self.as_inner().as_inner().st_ctime as i64
|
| 110 |
+
}
|
| 111 |
+
fn st_ctime_nsec(&self) -> i64 {
|
| 112 |
+
self.as_inner().as_inner().st_ctime_nsec as i64
|
| 113 |
+
}
|
| 114 |
+
fn st_crtime(&self) -> i64 {
|
| 115 |
+
self.as_inner().as_inner().st_crtime as i64
|
| 116 |
+
}
|
| 117 |
+
fn st_crtime_nsec(&self) -> i64 {
|
| 118 |
+
self.as_inner().as_inner().st_crtime_nsec as i64
|
| 119 |
+
}
|
| 120 |
+
fn st_blksize(&self) -> u64 {
|
| 121 |
+
self.as_inner().as_inner().st_blksize as u64
|
| 122 |
+
}
|
| 123 |
+
fn st_blocks(&self) -> u64 {
|
| 124 |
+
self.as_inner().as_inner().st_blocks as u64
|
| 125 |
+
}
|
| 126 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/haiku/mod.rs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Haiku-specific definitions
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 4 |
+
|
| 5 |
+
pub mod fs;
|
| 6 |
+
pub mod raw;
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/haiku/raw.rs
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Haiku-specific raw type definitions
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 4 |
+
#![deprecated(
|
| 5 |
+
since = "1.53.0",
|
| 6 |
+
note = "these type aliases are no longer supported by \
|
| 7 |
+
the standard library, the `libc` crate on \
|
| 8 |
+
crates.io should be used instead for the correct \
|
| 9 |
+
definitions"
|
| 10 |
+
)]
|
| 11 |
+
#![allow(deprecated)]
|
| 12 |
+
|
| 13 |
+
use crate::os::raw::c_long;
|
| 14 |
+
use crate::os::unix::raw::{gid_t, uid_t};
|
| 15 |
+
|
| 16 |
+
// Use the direct definition of usize, instead of uintptr_t like in libc
|
| 17 |
+
#[stable(feature = "pthread_t", since = "1.8.0")]
|
| 18 |
+
pub type pthread_t = usize;
|
| 19 |
+
|
| 20 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 21 |
+
pub type blkcnt_t = i64;
|
| 22 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 23 |
+
pub type blksize_t = i32;
|
| 24 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 25 |
+
pub type dev_t = i32;
|
| 26 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 27 |
+
pub type ino_t = i64;
|
| 28 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 29 |
+
pub type mode_t = u32;
|
| 30 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 31 |
+
pub type nlink_t = i32;
|
| 32 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 33 |
+
pub type off_t = i64;
|
| 34 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 35 |
+
pub type time_t = i32;
|
| 36 |
+
|
| 37 |
+
#[repr(C)]
|
| 38 |
+
#[derive(Clone)]
|
| 39 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 40 |
+
pub struct stat {
|
| 41 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 42 |
+
pub st_dev: dev_t,
|
| 43 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 44 |
+
pub st_ino: ino_t,
|
| 45 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 46 |
+
pub st_mode: mode_t,
|
| 47 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 48 |
+
pub st_nlink: nlink_t,
|
| 49 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 50 |
+
pub st_uid: uid_t,
|
| 51 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 52 |
+
pub st_gid: gid_t,
|
| 53 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 54 |
+
pub st_size: off_t,
|
| 55 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 56 |
+
pub st_rdev: dev_t,
|
| 57 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 58 |
+
pub st_blksize: blksize_t,
|
| 59 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 60 |
+
pub st_atime: time_t,
|
| 61 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 62 |
+
pub st_atime_nsec: c_long,
|
| 63 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 64 |
+
pub st_mtime: time_t,
|
| 65 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 66 |
+
pub st_mtime_nsec: c_long,
|
| 67 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 68 |
+
pub st_ctime: time_t,
|
| 69 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 70 |
+
pub st_ctime_nsec: c_long,
|
| 71 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 72 |
+
pub st_crtime: time_t,
|
| 73 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 74 |
+
pub st_crtime_nsec: c_long,
|
| 75 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 76 |
+
pub st_type: u32,
|
| 77 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 78 |
+
pub st_blocks: blkcnt_t,
|
| 79 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/hermit/ffi.rs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! HermitCore-specific extension to the primitives in the `std::ffi` module
|
| 2 |
+
//!
|
| 3 |
+
//! # Examples
|
| 4 |
+
//!
|
| 5 |
+
//! ```
|
| 6 |
+
//! use std::ffi::OsString;
|
| 7 |
+
//! use std::os::hermit::ffi::OsStringExt;
|
| 8 |
+
//!
|
| 9 |
+
//! let bytes = b"foo".to_vec();
|
| 10 |
+
//!
|
| 11 |
+
//! // OsStringExt::from_vec
|
| 12 |
+
//! let os_string = OsString::from_vec(bytes);
|
| 13 |
+
//! assert_eq!(os_string.to_str(), Some("foo"));
|
| 14 |
+
//!
|
| 15 |
+
//! // OsStringExt::into_vec
|
| 16 |
+
//! let bytes = os_string.into_vec();
|
| 17 |
+
//! assert_eq!(bytes, b"foo");
|
| 18 |
+
//! ```
|
| 19 |
+
//!
|
| 20 |
+
//! ```
|
| 21 |
+
//! use std::ffi::OsStr;
|
| 22 |
+
//! use std::os::hermit::ffi::OsStrExt;
|
| 23 |
+
//!
|
| 24 |
+
//! let bytes = b"foo";
|
| 25 |
+
//!
|
| 26 |
+
//! // OsStrExt::from_bytes
|
| 27 |
+
//! let os_str = OsStr::from_bytes(bytes);
|
| 28 |
+
//! assert_eq!(os_str.to_str(), Some("foo"));
|
| 29 |
+
//!
|
| 30 |
+
//! // OsStrExt::as_bytes
|
| 31 |
+
//! let bytes = os_str.as_bytes();
|
| 32 |
+
//! assert_eq!(bytes, b"foo");
|
| 33 |
+
//! ```
|
| 34 |
+
|
| 35 |
+
#![stable(feature = "rust1", since = "1.0.0")]
|
| 36 |
+
|
| 37 |
+
#[path = "../unix/ffi/os_str.rs"]
|
| 38 |
+
mod os_str;
|
| 39 |
+
|
| 40 |
+
#[stable(feature = "rust1", since = "1.0.0")]
|
| 41 |
+
pub use self::os_str::{OsStrExt, OsStringExt};
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/hermit/mod.rs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#![stable(feature = "rust1", since = "1.0.0")]
|
| 2 |
+
#![deny(unsafe_op_in_unsafe_fn)]
|
| 3 |
+
|
| 4 |
+
#[allow(unused_extern_crates)]
|
| 5 |
+
#[stable(feature = "rust1", since = "1.0.0")]
|
| 6 |
+
pub extern crate hermit_abi;
|
| 7 |
+
|
| 8 |
+
pub mod ffi;
|
| 9 |
+
pub mod io;
|
| 10 |
+
|
| 11 |
+
/// A prelude for conveniently writing platform-specific code.
|
| 12 |
+
///
|
| 13 |
+
/// Includes all extension traits, and some important type definitions.
|
| 14 |
+
#[stable(feature = "rust1", since = "1.0.0")]
|
| 15 |
+
pub mod prelude {
|
| 16 |
+
#[doc(no_inline)]
|
| 17 |
+
#[stable(feature = "rust1", since = "1.0.0")]
|
| 18 |
+
pub use super::ffi::{OsStrExt, OsStringExt};
|
| 19 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/horizon/fs.rs
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
| 2 |
+
|
| 3 |
+
use crate::fs::Metadata;
|
| 4 |
+
use crate::sys::AsInner;
|
| 5 |
+
|
| 6 |
+
/// OS-specific extensions to [`fs::Metadata`].
|
| 7 |
+
///
|
| 8 |
+
/// [`fs::Metadata`]: crate::fs::Metadata
|
| 9 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 10 |
+
pub trait MetadataExt {
|
| 11 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 12 |
+
fn st_dev(&self) -> u64;
|
| 13 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 14 |
+
fn st_ino(&self) -> u64;
|
| 15 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 16 |
+
fn st_mode(&self) -> u32;
|
| 17 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 18 |
+
fn st_nlink(&self) -> u64;
|
| 19 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 20 |
+
fn st_uid(&self) -> u32;
|
| 21 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 22 |
+
fn st_gid(&self) -> u32;
|
| 23 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 24 |
+
fn st_rdev(&self) -> u64;
|
| 25 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 26 |
+
fn st_size(&self) -> u64;
|
| 27 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 28 |
+
fn st_atime(&self) -> i64;
|
| 29 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 30 |
+
fn st_atime_nsec(&self) -> i64;
|
| 31 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 32 |
+
fn st_mtime(&self) -> i64;
|
| 33 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 34 |
+
fn st_mtime_nsec(&self) -> i64;
|
| 35 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 36 |
+
fn st_ctime(&self) -> i64;
|
| 37 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 38 |
+
fn st_ctime_nsec(&self) -> i64;
|
| 39 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 40 |
+
fn st_blksize(&self) -> u64;
|
| 41 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 42 |
+
fn st_blocks(&self) -> u64;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 46 |
+
impl MetadataExt for Metadata {
|
| 47 |
+
fn st_dev(&self) -> u64 {
|
| 48 |
+
self.as_inner().as_inner().st_dev as u64
|
| 49 |
+
}
|
| 50 |
+
fn st_ino(&self) -> u64 {
|
| 51 |
+
self.as_inner().as_inner().st_ino as u64
|
| 52 |
+
}
|
| 53 |
+
fn st_mode(&self) -> u32 {
|
| 54 |
+
self.as_inner().as_inner().st_mode as u32
|
| 55 |
+
}
|
| 56 |
+
fn st_nlink(&self) -> u64 {
|
| 57 |
+
self.as_inner().as_inner().st_nlink as u64
|
| 58 |
+
}
|
| 59 |
+
fn st_uid(&self) -> u32 {
|
| 60 |
+
self.as_inner().as_inner().st_uid as u32
|
| 61 |
+
}
|
| 62 |
+
fn st_gid(&self) -> u32 {
|
| 63 |
+
self.as_inner().as_inner().st_gid as u32
|
| 64 |
+
}
|
| 65 |
+
fn st_rdev(&self) -> u64 {
|
| 66 |
+
self.as_inner().as_inner().st_rdev as u64
|
| 67 |
+
}
|
| 68 |
+
fn st_size(&self) -> u64 {
|
| 69 |
+
self.as_inner().as_inner().st_size as u64
|
| 70 |
+
}
|
| 71 |
+
fn st_atime(&self) -> i64 {
|
| 72 |
+
self.as_inner().as_inner().st_atim.tv_sec
|
| 73 |
+
}
|
| 74 |
+
fn st_atime_nsec(&self) -> i64 {
|
| 75 |
+
self.as_inner().as_inner().st_atim.tv_nsec as i64
|
| 76 |
+
}
|
| 77 |
+
fn st_mtime(&self) -> i64 {
|
| 78 |
+
self.as_inner().as_inner().st_mtim.tv_sec
|
| 79 |
+
}
|
| 80 |
+
fn st_mtime_nsec(&self) -> i64 {
|
| 81 |
+
self.as_inner().as_inner().st_mtim.tv_nsec as i64
|
| 82 |
+
}
|
| 83 |
+
fn st_ctime(&self) -> i64 {
|
| 84 |
+
self.as_inner().as_inner().st_ctim.tv_sec
|
| 85 |
+
}
|
| 86 |
+
fn st_ctime_nsec(&self) -> i64 {
|
| 87 |
+
self.as_inner().as_inner().st_ctim.tv_nsec as i64
|
| 88 |
+
}
|
| 89 |
+
fn st_blksize(&self) -> u64 {
|
| 90 |
+
self.as_inner().as_inner().st_blksize as u64
|
| 91 |
+
}
|
| 92 |
+
fn st_blocks(&self) -> u64 {
|
| 93 |
+
self.as_inner().as_inner().st_blocks as u64
|
| 94 |
+
}
|
| 95 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/horizon/mod.rs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Definitions for Horizon OS
|
| 2 |
+
|
| 3 |
+
#![forbid(unsafe_op_in_unsafe_fn)]
|
| 4 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 5 |
+
|
| 6 |
+
pub mod fs;
|
| 7 |
+
pub(crate) mod raw;
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/horizon/raw.rs
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Horizon OS raw type definitions
|
| 2 |
+
|
| 3 |
+
#![stable(feature = "raw_ext", since = "1.1.0")]
|
| 4 |
+
#![deprecated(
|
| 5 |
+
since = "1.8.0",
|
| 6 |
+
note = "these type aliases are no longer supported by \
|
| 7 |
+
the standard library, the `libc` crate on \
|
| 8 |
+
crates.io should be used instead for the correct \
|
| 9 |
+
definitions"
|
| 10 |
+
)]
|
| 11 |
+
#![allow(deprecated)]
|
| 12 |
+
|
| 13 |
+
use crate::os::raw::c_long;
|
| 14 |
+
use crate::os::unix::raw::{gid_t, uid_t};
|
| 15 |
+
|
| 16 |
+
#[stable(feature = "pthread_t", since = "1.8.0")]
|
| 17 |
+
pub type pthread_t = libc::pthread_t;
|
| 18 |
+
|
| 19 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 20 |
+
pub type blkcnt_t = libc::blkcnt_t;
|
| 21 |
+
|
| 22 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 23 |
+
pub type blksize_t = libc::blksize_t;
|
| 24 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 25 |
+
pub type dev_t = libc::dev_t;
|
| 26 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 27 |
+
pub type ino_t = libc::ino_t;
|
| 28 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 29 |
+
pub type mode_t = libc::mode_t;
|
| 30 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 31 |
+
pub type nlink_t = libc::nlink_t;
|
| 32 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 33 |
+
pub type off_t = libc::off_t;
|
| 34 |
+
|
| 35 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 36 |
+
pub type time_t = libc::time_t;
|
| 37 |
+
|
| 38 |
+
#[repr(C)]
|
| 39 |
+
#[derive(Clone)]
|
| 40 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 41 |
+
#[allow(dead_code)] // This exists for parity with other `raw` modules, but isn't actually used.
|
| 42 |
+
pub struct stat {
|
| 43 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 44 |
+
pub st_dev: dev_t,
|
| 45 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 46 |
+
pub st_ino: ino_t,
|
| 47 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 48 |
+
pub st_mode: mode_t,
|
| 49 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 50 |
+
pub st_nlink: nlink_t,
|
| 51 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 52 |
+
pub st_uid: uid_t,
|
| 53 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 54 |
+
pub st_gid: gid_t,
|
| 55 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 56 |
+
pub st_rdev: dev_t,
|
| 57 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 58 |
+
pub st_size: off_t,
|
| 59 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 60 |
+
pub st_atime: time_t,
|
| 61 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 62 |
+
pub st_mtime: time_t,
|
| 63 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 64 |
+
pub st_ctime: time_t,
|
| 65 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 66 |
+
pub st_blksize: blksize_t,
|
| 67 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 68 |
+
pub st_blocks: blkcnt_t,
|
| 69 |
+
#[stable(feature = "raw_ext", since = "1.1.0")]
|
| 70 |
+
pub st_spare4: [c_long; 2usize],
|
| 71 |
+
}
|
rust/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library/std/src/os/hurd/fs.rs
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//! Hurd-specific extensions to primitives in the [`std::fs`] module.
|
| 2 |
+
//!
|
| 3 |
+
//! [`std::fs`]: crate::fs
|
| 4 |
+
|
| 5 |
+
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
| 6 |
+
|
| 7 |
+
use crate::fs::Metadata;
|
| 8 |
+
use crate::sys::AsInner;
|
| 9 |
+
|
| 10 |
+
/// OS-specific extensions to [`fs::Metadata`].
|
| 11 |
+
///
|
| 12 |
+
/// [`fs::Metadata`]: crate::fs::Metadata
|
| 13 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 14 |
+
pub trait MetadataExt {
|
| 15 |
+
/// Returns the device ID on which this file resides.
|
| 16 |
+
///
|
| 17 |
+
/// # Examples
|
| 18 |
+
///
|
| 19 |
+
/// ```no_run
|
| 20 |
+
/// use std::fs;
|
| 21 |
+
/// use std::io;
|
| 22 |
+
/// use std::os::hurd::fs::MetadataExt;
|
| 23 |
+
///
|
| 24 |
+
/// fn main() -> io::Result<()> {
|
| 25 |
+
/// let meta = fs::metadata("some_file")?;
|
| 26 |
+
/// println!("{}", meta.st_dev());
|
| 27 |
+
/// Ok(())
|
| 28 |
+
/// }
|
| 29 |
+
/// ```
|
| 30 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 31 |
+
fn st_dev(&self) -> u64;
|
| 32 |
+
/// Returns the inode number.
|
| 33 |
+
///
|
| 34 |
+
/// # Examples
|
| 35 |
+
///
|
| 36 |
+
/// ```no_run
|
| 37 |
+
/// use std::fs;
|
| 38 |
+
/// use std::io;
|
| 39 |
+
/// use std::os::hurd::fs::MetadataExt;
|
| 40 |
+
///
|
| 41 |
+
/// fn main() -> io::Result<()> {
|
| 42 |
+
/// let meta = fs::metadata("some_file")?;
|
| 43 |
+
/// println!("{}", meta.st_ino());
|
| 44 |
+
/// Ok(())
|
| 45 |
+
/// }
|
| 46 |
+
/// ```
|
| 47 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 48 |
+
fn st_ino(&self) -> u64;
|
| 49 |
+
/// Returns the file type and mode.
|
| 50 |
+
///
|
| 51 |
+
/// # Examples
|
| 52 |
+
///
|
| 53 |
+
/// ```no_run
|
| 54 |
+
/// use std::fs;
|
| 55 |
+
/// use std::io;
|
| 56 |
+
/// use std::os::hurd::fs::MetadataExt;
|
| 57 |
+
///
|
| 58 |
+
/// fn main() -> io::Result<()> {
|
| 59 |
+
/// let meta = fs::metadata("some_file")?;
|
| 60 |
+
/// println!("{}", meta.st_mode());
|
| 61 |
+
/// Ok(())
|
| 62 |
+
/// }
|
| 63 |
+
/// ```
|
| 64 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 65 |
+
fn st_mode(&self) -> u32;
|
| 66 |
+
/// Returns the number of hard links to file.
|
| 67 |
+
///
|
| 68 |
+
/// # Examples
|
| 69 |
+
///
|
| 70 |
+
/// ```no_run
|
| 71 |
+
/// use std::fs;
|
| 72 |
+
/// use std::io;
|
| 73 |
+
/// use std::os::hurd::fs::MetadataExt;
|
| 74 |
+
///
|
| 75 |
+
/// fn main() -> io::Result<()> {
|
| 76 |
+
/// let meta = fs::metadata("some_file")?;
|
| 77 |
+
/// println!("{}", meta.st_nlink());
|
| 78 |
+
/// Ok(())
|
| 79 |
+
/// }
|
| 80 |
+
/// ```
|
| 81 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 82 |
+
fn st_nlink(&self) -> u64;
|
| 83 |
+
/// Returns the user ID of the file owner.
|
| 84 |
+
///
|
| 85 |
+
/// # Examples
|
| 86 |
+
///
|
| 87 |
+
/// ```no_run
|
| 88 |
+
/// use std::fs;
|
| 89 |
+
/// use std::io;
|
| 90 |
+
/// use std::os::hurd::fs::MetadataExt;
|
| 91 |
+
///
|
| 92 |
+
/// fn main() -> io::Result<()> {
|
| 93 |
+
/// let meta = fs::metadata("some_file")?;
|
| 94 |
+
/// println!("{}", meta.st_uid());
|
| 95 |
+
/// Ok(())
|
| 96 |
+
/// }
|
| 97 |
+
/// ```
|
| 98 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 99 |
+
fn st_uid(&self) -> u32;
|
| 100 |
+
/// Returns the group ID of the file owner.
|
| 101 |
+
///
|
| 102 |
+
/// # Examples
|
| 103 |
+
///
|
| 104 |
+
/// ```no_run
|
| 105 |
+
/// use std::fs;
|
| 106 |
+
/// use std::io;
|
| 107 |
+
/// use std::os::hurd::fs::MetadataExt;
|
| 108 |
+
///
|
| 109 |
+
/// fn main() -> io::Result<()> {
|
| 110 |
+
/// let meta = fs::metadata("some_file")?;
|
| 111 |
+
/// println!("{}", meta.st_gid());
|
| 112 |
+
/// Ok(())
|
| 113 |
+
/// }
|
| 114 |
+
/// ```
|
| 115 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 116 |
+
fn st_gid(&self) -> u32;
|
| 117 |
+
/// Returns the device ID that this file represents. Only relevant for special file.
|
| 118 |
+
///
|
| 119 |
+
/// # Examples
|
| 120 |
+
///
|
| 121 |
+
/// ```no_run
|
| 122 |
+
/// use std::fs;
|
| 123 |
+
/// use std::io;
|
| 124 |
+
/// use std::os::hurd::fs::MetadataExt;
|
| 125 |
+
///
|
| 126 |
+
/// fn main() -> io::Result<()> {
|
| 127 |
+
/// let meta = fs::metadata("some_file")?;
|
| 128 |
+
/// println!("{}", meta.st_rdev());
|
| 129 |
+
/// Ok(())
|
| 130 |
+
/// }
|
| 131 |
+
/// ```
|
| 132 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 133 |
+
fn st_rdev(&self) -> u64;
|
| 134 |
+
/// Returns the size of the file (if it is a regular file or a symbolic link) in bytes.
|
| 135 |
+
///
|
| 136 |
+
/// The size of a symbolic link is the length of the pathname it contains,
|
| 137 |
+
/// without a terminating null byte.
|
| 138 |
+
///
|
| 139 |
+
/// # Examples
|
| 140 |
+
///
|
| 141 |
+
/// ```no_run
|
| 142 |
+
/// use std::fs;
|
| 143 |
+
/// use std::io;
|
| 144 |
+
/// use std::os::hurd::fs::MetadataExt;
|
| 145 |
+
///
|
| 146 |
+
/// fn main() -> io::Result<()> {
|
| 147 |
+
/// let meta = fs::metadata("some_file")?;
|
| 148 |
+
/// println!("{}", meta.st_size());
|
| 149 |
+
/// Ok(())
|
| 150 |
+
/// }
|
| 151 |
+
/// ```
|
| 152 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 153 |
+
fn st_size(&self) -> u64;
|
| 154 |
+
/// Returns the last access time of the file, in seconds since Unix Epoch.
|
| 155 |
+
///
|
| 156 |
+
/// # Examples
|
| 157 |
+
///
|
| 158 |
+
/// ```no_run
|
| 159 |
+
/// use std::fs;
|
| 160 |
+
/// use std::io;
|
| 161 |
+
/// use std::os::hurd::fs::MetadataExt;
|
| 162 |
+
///
|
| 163 |
+
/// fn main() -> io::Result<()> {
|
| 164 |
+
/// let meta = fs::metadata("some_file")?;
|
| 165 |
+
/// println!("{}", meta.st_atime());
|
| 166 |
+
/// Ok(())
|
| 167 |
+
/// }
|
| 168 |
+
/// ```
|
| 169 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 170 |
+
fn st_atime(&self) -> i64;
|
| 171 |
+
/// Returns the last access time of the file, in nanoseconds since [`st_atime`].
|
| 172 |
+
///
|
| 173 |
+
/// [`st_atime`]: Self::st_atime
|
| 174 |
+
///
|
| 175 |
+
/// # Examples
|
| 176 |
+
///
|
| 177 |
+
/// ```no_run
|
| 178 |
+
/// use std::fs;
|
| 179 |
+
/// use std::io;
|
| 180 |
+
/// use std::os::hurd::fs::MetadataExt;
|
| 181 |
+
///
|
| 182 |
+
/// fn main() -> io::Result<()> {
|
| 183 |
+
/// let meta = fs::metadata("some_file")?;
|
| 184 |
+
/// println!("{}", meta.st_atime_nsec());
|
| 185 |
+
/// Ok(())
|
| 186 |
+
/// }
|
| 187 |
+
/// ```
|
| 188 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 189 |
+
fn st_atime_nsec(&self) -> i64;
|
| 190 |
+
/// Returns the last modification time of the file, in seconds since Unix Epoch.
|
| 191 |
+
///
|
| 192 |
+
/// # Examples
|
| 193 |
+
///
|
| 194 |
+
/// ```no_run
|
| 195 |
+
/// use std::fs;
|
| 196 |
+
/// use std::io;
|
| 197 |
+
/// use std::os::hurd::fs::MetadataExt;
|
| 198 |
+
///
|
| 199 |
+
/// fn main() -> io::Result<()> {
|
| 200 |
+
/// let meta = fs::metadata("some_file")?;
|
| 201 |
+
/// println!("{}", meta.st_mtime());
|
| 202 |
+
/// Ok(())
|
| 203 |
+
/// }
|
| 204 |
+
/// ```
|
| 205 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 206 |
+
fn st_mtime(&self) -> i64;
|
| 207 |
+
/// Returns the last modification time of the file, in nanoseconds since [`st_mtime`].
|
| 208 |
+
///
|
| 209 |
+
/// [`st_mtime`]: Self::st_mtime
|
| 210 |
+
///
|
| 211 |
+
/// # Examples
|
| 212 |
+
///
|
| 213 |
+
/// ```no_run
|
| 214 |
+
/// use std::fs;
|
| 215 |
+
/// use std::io;
|
| 216 |
+
/// use std::os::hurd::fs::MetadataExt;
|
| 217 |
+
///
|
| 218 |
+
/// fn main() -> io::Result<()> {
|
| 219 |
+
/// let meta = fs::metadata("some_file")?;
|
| 220 |
+
/// println!("{}", meta.st_mtime_nsec());
|
| 221 |
+
/// Ok(())
|
| 222 |
+
/// }
|
| 223 |
+
/// ```
|
| 224 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 225 |
+
fn st_mtime_nsec(&self) -> i64;
|
| 226 |
+
/// Returns the last status change time of the file, in seconds since Unix Epoch.
|
| 227 |
+
///
|
| 228 |
+
/// # Examples
|
| 229 |
+
///
|
| 230 |
+
/// ```no_run
|
| 231 |
+
/// use std::fs;
|
| 232 |
+
/// use std::io;
|
| 233 |
+
/// use std::os::hurd::fs::MetadataExt;
|
| 234 |
+
///
|
| 235 |
+
/// fn main() -> io::Result<()> {
|
| 236 |
+
/// let meta = fs::metadata("some_file")?;
|
| 237 |
+
/// println!("{}", meta.st_ctime());
|
| 238 |
+
/// Ok(())
|
| 239 |
+
/// }
|
| 240 |
+
/// ```
|
| 241 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 242 |
+
fn st_ctime(&self) -> i64;
|
| 243 |
+
/// Returns the last status change time of the file, in nanoseconds since [`st_ctime`].
|
| 244 |
+
///
|
| 245 |
+
/// [`st_ctime`]: Self::st_ctime
|
| 246 |
+
///
|
| 247 |
+
/// # Examples
|
| 248 |
+
///
|
| 249 |
+
/// ```no_run
|
| 250 |
+
/// use std::fs;
|
| 251 |
+
/// use std::io;
|
| 252 |
+
/// use std::os::hurd::fs::MetadataExt;
|
| 253 |
+
///
|
| 254 |
+
/// fn main() -> io::Result<()> {
|
| 255 |
+
/// let meta = fs::metadata("some_file")?;
|
| 256 |
+
/// println!("{}", meta.st_ctime_nsec());
|
| 257 |
+
/// Ok(())
|
| 258 |
+
/// }
|
| 259 |
+
/// ```
|
| 260 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 261 |
+
fn st_ctime_nsec(&self) -> i64;
|
| 262 |
+
/// Returns the "preferred" block size for efficient filesystem I/O.
|
| 263 |
+
///
|
| 264 |
+
/// # Examples
|
| 265 |
+
///
|
| 266 |
+
/// ```no_run
|
| 267 |
+
/// use std::fs;
|
| 268 |
+
/// use std::io;
|
| 269 |
+
/// use std::os::hurd::fs::MetadataExt;
|
| 270 |
+
///
|
| 271 |
+
/// fn main() -> io::Result<()> {
|
| 272 |
+
/// let meta = fs::metadata("some_file")?;
|
| 273 |
+
/// println!("{}", meta.st_blksize());
|
| 274 |
+
/// Ok(())
|
| 275 |
+
/// }
|
| 276 |
+
/// ```
|
| 277 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 278 |
+
fn st_blksize(&self) -> u64;
|
| 279 |
+
/// Returns the number of blocks allocated to the file, 512-byte units.
|
| 280 |
+
///
|
| 281 |
+
/// # Examples
|
| 282 |
+
///
|
| 283 |
+
/// ```no_run
|
| 284 |
+
/// use std::fs;
|
| 285 |
+
/// use std::io;
|
| 286 |
+
/// use std::os::hurd::fs::MetadataExt;
|
| 287 |
+
///
|
| 288 |
+
/// fn main() -> io::Result<()> {
|
| 289 |
+
/// let meta = fs::metadata("some_file")?;
|
| 290 |
+
/// println!("{}", meta.st_blocks());
|
| 291 |
+
/// Ok(())
|
| 292 |
+
/// }
|
| 293 |
+
/// ```
|
| 294 |
+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
| 295 |
+
fn st_blocks(&self) -> u64;
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
| 299 |
+
impl MetadataExt for Metadata {
|
| 300 |
+
fn st_dev(&self) -> u64 {
|
| 301 |
+
self.as_inner().as_inner().st_dev as u64
|
| 302 |
+
}
|
| 303 |
+
fn st_ino(&self) -> u64 {
|
| 304 |
+
self.as_inner().as_inner().st_ino as u64
|
| 305 |
+
}
|
| 306 |
+
fn st_mode(&self) -> u32 {
|
| 307 |
+
self.as_inner().as_inner().st_mode as u32
|
| 308 |
+
}
|
| 309 |
+
fn st_nlink(&self) -> u64 {
|
| 310 |
+
self.as_inner().as_inner().st_nlink as u64
|
| 311 |
+
}
|
| 312 |
+
fn st_uid(&self) -> u32 {
|
| 313 |
+
self.as_inner().as_inner().st_uid as u32
|
| 314 |
+
}
|
| 315 |
+
fn st_gid(&self) -> u32 {
|
| 316 |
+
self.as_inner().as_inner().st_gid as u32
|
| 317 |
+
}
|
| 318 |
+
fn st_rdev(&self) -> u64 {
|
| 319 |
+
self.as_inner().as_inner().st_rdev as u64
|
| 320 |
+
}
|
| 321 |
+
fn st_size(&self) -> u64 {
|
| 322 |
+
self.as_inner().as_inner().st_size as u64
|
| 323 |
+
}
|
| 324 |
+
fn st_atime(&self) -> i64 {
|
| 325 |
+
self.as_inner().as_inner().st_atim.tv_sec as i64
|
| 326 |
+
}
|
| 327 |
+
fn st_atime_nsec(&self) -> i64 {
|
| 328 |
+
self.as_inner().as_inner().st_atim.tv_nsec as i64
|
| 329 |
+
}
|
| 330 |
+
fn st_mtime(&self) -> i64 {
|
| 331 |
+
self.as_inner().as_inner().st_mtim.tv_sec as i64
|
| 332 |
+
}
|
| 333 |
+
fn st_mtime_nsec(&self) -> i64 {
|
| 334 |
+
self.as_inner().as_inner().st_mtim.tv_nsec as i64
|
| 335 |
+
}
|
| 336 |
+
fn st_ctime(&self) -> i64 {
|
| 337 |
+
self.as_inner().as_inner().st_ctim.tv_sec as i64
|
| 338 |
+
}
|
| 339 |
+
fn st_ctime_nsec(&self) -> i64 {
|
| 340 |
+
self.as_inner().as_inner().st_ctim.tv_nsec as i64
|
| 341 |
+
}
|
| 342 |
+
fn st_blksize(&self) -> u64 {
|
| 343 |
+
self.as_inner().as_inner().st_blksize as u64
|
| 344 |
+
}
|
| 345 |
+
fn st_blocks(&self) -> u64 {
|
| 346 |
+
self.as_inner().as_inner().st_blocks as u64
|
| 347 |
+
}
|
| 348 |
+
}
|