library: os: Add initial squiid target layer
This will eventually use relibc as a libc. Signed-off-by: Christoph Heiss <contact@christoph-heiss.at>
This commit is contained in:
parent
31f1b59264
commit
9270463e45
|
@ -31,6 +31,7 @@ fn main() {
|
||||||
|| target.contains("espidf")
|
|| target.contains("espidf")
|
||||||
|| target.contains("solid")
|
|| target.contains("solid")
|
||||||
|| target.contains("nintendo-3ds")
|
|| target.contains("nintendo-3ds")
|
||||||
|
|| target.contains("squiid")
|
||||||
{
|
{
|
||||||
// These platforms don't have any special requirements.
|
// These platforms don't have any special requirements.
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -141,6 +141,8 @@ pub mod openbsd;
|
||||||
pub mod redox;
|
pub mod redox;
|
||||||
#[cfg(target_os = "solaris")]
|
#[cfg(target_os = "solaris")]
|
||||||
pub mod solaris;
|
pub mod solaris;
|
||||||
|
#[cfg(target_os = "squiid")]
|
||||||
|
pub mod squiid;
|
||||||
#[cfg(target_os = "solid_asp3")]
|
#[cfg(target_os = "solid_asp3")]
|
||||||
pub mod solid;
|
pub mod solid;
|
||||||
#[cfg(target_os = "vxworks")]
|
#[cfg(target_os = "vxworks")]
|
||||||
|
|
382
library/std/src/os/squiid/fs.rs
Normal file
382
library/std/src/os/squiid/fs.rs
Normal file
|
@ -0,0 +1,382 @@
|
||||||
|
#![stable(feature = "metadata_ext", since = "1.1.0")]
|
||||||
|
|
||||||
|
use crate::fs::Metadata;
|
||||||
|
use crate::sys_common::AsInner;
|
||||||
|
|
||||||
|
#[allow(deprecated)]
|
||||||
|
use crate::os::squiid::raw;
|
||||||
|
|
||||||
|
/// OS-specific extensions to [`fs::Metadata`].
|
||||||
|
///
|
||||||
|
/// [`fs::Metadata`]: crate::fs::Metadata
|
||||||
|
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
||||||
|
pub trait MetadataExt {
|
||||||
|
/// Gain a reference to the underlying `stat` structure which contains
|
||||||
|
/// the raw information returned by the OS.
|
||||||
|
///
|
||||||
|
/// The contents of the returned [`stat`] are **not** consistent across
|
||||||
|
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
||||||
|
/// cross-Unix abstractions contained within the raw stat.
|
||||||
|
///
|
||||||
|
/// [`stat`]: crate::os::squiid::raw::stat
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```no_run
|
||||||
|
/// use std::fs;
|
||||||
|
/// use std::io;
|
||||||
|
/// use std::os::squiid::fs::MetadataExt;
|
||||||
|
///
|
||||||
|
/// fn main() -> io::Result<()> {
|
||||||
|
/// let meta = fs::metadata("some_file")?;
|
||||||
|
/// let stat = meta.as_raw_stat();
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
||||||
|
#[deprecated(
|
||||||
|
since = "1.8.0",
|
||||||
|
note = "deprecated in favor of the accessor \
|
||||||
|
methods of this trait"
|
||||||
|
)]
|
||||||
|
#[allow(deprecated)]
|
||||||
|
fn as_raw_stat(&self) -> &raw::stat;
|
||||||
|
|
||||||
|
/// Returns the device ID on which this file resides.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```no_run
|
||||||
|
/// use std::fs;
|
||||||
|
/// use std::io;
|
||||||
|
/// use std::os::squiid::fs::MetadataExt;
|
||||||
|
///
|
||||||
|
/// fn main() -> io::Result<()> {
|
||||||
|
/// let meta = fs::metadata("some_file")?;
|
||||||
|
/// println!("{}", meta.st_dev());
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||||
|
fn st_dev(&self) -> u64;
|
||||||
|
/// Returns the inode number.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```no_run
|
||||||
|
/// use std::fs;
|
||||||
|
/// use std::io;
|
||||||
|
/// use std::os::squiid::fs::MetadataExt;
|
||||||
|
///
|
||||||
|
/// fn main() -> io::Result<()> {
|
||||||
|
/// let meta = fs::metadata("some_file")?;
|
||||||
|
/// println!("{}", meta.st_ino());
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||||
|
fn st_ino(&self) -> u64;
|
||||||
|
/// Returns the file type and mode.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```no_run
|
||||||
|
/// use std::fs;
|
||||||
|
/// use std::io;
|
||||||
|
/// use std::os::squiid::fs::MetadataExt;
|
||||||
|
///
|
||||||
|
/// fn main() -> io::Result<()> {
|
||||||
|
/// let meta = fs::metadata("some_file")?;
|
||||||
|
/// println!("{}", meta.st_mode());
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||||
|
fn st_mode(&self) -> u32;
|
||||||
|
/// Returns the number of hard links to file.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```no_run
|
||||||
|
/// use std::fs;
|
||||||
|
/// use std::io;
|
||||||
|
/// use std::os::squiid::fs::MetadataExt;
|
||||||
|
///
|
||||||
|
/// fn main() -> io::Result<()> {
|
||||||
|
/// let meta = fs::metadata("some_file")?;
|
||||||
|
/// println!("{}", meta.st_nlink());
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||||
|
fn st_nlink(&self) -> u64;
|
||||||
|
/// Returns the user ID of the file owner.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```no_run
|
||||||
|
/// use std::fs;
|
||||||
|
/// use std::io;
|
||||||
|
/// use std::os::squiid::fs::MetadataExt;
|
||||||
|
///
|
||||||
|
/// fn main() -> io::Result<()> {
|
||||||
|
/// let meta = fs::metadata("some_file")?;
|
||||||
|
/// println!("{}", meta.st_uid());
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||||
|
fn st_uid(&self) -> u32;
|
||||||
|
/// Returns the group ID of the file owner.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```no_run
|
||||||
|
/// use std::fs;
|
||||||
|
/// use std::io;
|
||||||
|
/// use std::os::squiid::fs::MetadataExt;
|
||||||
|
///
|
||||||
|
/// fn main() -> io::Result<()> {
|
||||||
|
/// let meta = fs::metadata("some_file")?;
|
||||||
|
/// println!("{}", meta.st_gid());
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||||
|
fn st_gid(&self) -> u32;
|
||||||
|
/// Returns the device ID that this file represents. Only relevant for special file.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```no_run
|
||||||
|
/// use std::fs;
|
||||||
|
/// use std::io;
|
||||||
|
/// use std::os::squiid::fs::MetadataExt;
|
||||||
|
///
|
||||||
|
/// fn main() -> io::Result<()> {
|
||||||
|
/// let meta = fs::metadata("some_file")?;
|
||||||
|
/// println!("{}", meta.st_rdev());
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||||
|
fn st_rdev(&self) -> u64;
|
||||||
|
/// Returns the size of the file (if it is a regular file or a symbolic link) in bytes.
|
||||||
|
///
|
||||||
|
/// The size of a symbolic link is the length of the pathname it contains,
|
||||||
|
/// without a terminating null byte.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```no_run
|
||||||
|
/// use std::fs;
|
||||||
|
/// use std::io;
|
||||||
|
/// use std::os::squiid::fs::MetadataExt;
|
||||||
|
///
|
||||||
|
/// fn main() -> io::Result<()> {
|
||||||
|
/// let meta = fs::metadata("some_file")?;
|
||||||
|
/// println!("{}", meta.st_size());
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||||
|
fn st_size(&self) -> u64;
|
||||||
|
/// Returns the last access time of the file, in seconds since Unix Epoch.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```no_run
|
||||||
|
/// use std::fs;
|
||||||
|
/// use std::io;
|
||||||
|
/// use std::os::squiid::fs::MetadataExt;
|
||||||
|
///
|
||||||
|
/// fn main() -> io::Result<()> {
|
||||||
|
/// let meta = fs::metadata("some_file")?;
|
||||||
|
/// println!("{}", meta.st_atime());
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||||
|
fn st_atime(&self) -> i64;
|
||||||
|
/// Returns the last access time of the file, in nanoseconds since [`st_atime`].
|
||||||
|
///
|
||||||
|
/// [`st_atime`]: Self::st_atime
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```no_run
|
||||||
|
/// use std::fs;
|
||||||
|
/// use std::io;
|
||||||
|
/// use std::os::squiid::fs::MetadataExt;
|
||||||
|
///
|
||||||
|
/// fn main() -> io::Result<()> {
|
||||||
|
/// let meta = fs::metadata("some_file")?;
|
||||||
|
/// println!("{}", meta.st_atime_nsec());
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||||
|
fn st_atime_nsec(&self) -> i64;
|
||||||
|
/// Returns the last modification time of the file, in seconds since Unix Epoch.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```no_run
|
||||||
|
/// use std::fs;
|
||||||
|
/// use std::io;
|
||||||
|
/// use std::os::squiid::fs::MetadataExt;
|
||||||
|
///
|
||||||
|
/// fn main() -> io::Result<()> {
|
||||||
|
/// let meta = fs::metadata("some_file")?;
|
||||||
|
/// println!("{}", meta.st_mtime());
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||||
|
fn st_mtime(&self) -> i64;
|
||||||
|
/// Returns the last modification time of the file, in nanoseconds since [`st_mtime`].
|
||||||
|
///
|
||||||
|
/// [`st_mtime`]: Self::st_mtime
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```no_run
|
||||||
|
/// use std::fs;
|
||||||
|
/// use std::io;
|
||||||
|
/// use std::os::squiid::fs::MetadataExt;
|
||||||
|
///
|
||||||
|
/// fn main() -> io::Result<()> {
|
||||||
|
/// let meta = fs::metadata("some_file")?;
|
||||||
|
/// println!("{}", meta.st_mtime_nsec());
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||||
|
fn st_mtime_nsec(&self) -> i64;
|
||||||
|
/// Returns the last status change time of the file, in seconds since Unix Epoch.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```no_run
|
||||||
|
/// use std::fs;
|
||||||
|
/// use std::io;
|
||||||
|
/// use std::os::squiid::fs::MetadataExt;
|
||||||
|
///
|
||||||
|
/// fn main() -> io::Result<()> {
|
||||||
|
/// let meta = fs::metadata("some_file")?;
|
||||||
|
/// println!("{}", meta.st_ctime());
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||||
|
fn st_ctime(&self) -> i64;
|
||||||
|
/// Returns the last status change time of the file, in nanoseconds since [`st_ctime`].
|
||||||
|
///
|
||||||
|
/// [`st_ctime`]: Self::st_ctime
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```no_run
|
||||||
|
/// use std::fs;
|
||||||
|
/// use std::io;
|
||||||
|
/// use std::os::squiid::fs::MetadataExt;
|
||||||
|
///
|
||||||
|
/// fn main() -> io::Result<()> {
|
||||||
|
/// let meta = fs::metadata("some_file")?;
|
||||||
|
/// println!("{}", meta.st_ctime_nsec());
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||||
|
fn st_ctime_nsec(&self) -> i64;
|
||||||
|
/// Returns the "preferred" block size for efficient filesystem I/O.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```no_run
|
||||||
|
/// use std::fs;
|
||||||
|
/// use std::io;
|
||||||
|
/// use std::os::squiid::fs::MetadataExt;
|
||||||
|
///
|
||||||
|
/// fn main() -> io::Result<()> {
|
||||||
|
/// let meta = fs::metadata("some_file")?;
|
||||||
|
/// println!("{}", meta.st_blksize());
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||||
|
fn st_blksize(&self) -> u64;
|
||||||
|
/// Returns the number of blocks allocated to the file, 512-byte units.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```no_run
|
||||||
|
/// use std::fs;
|
||||||
|
/// use std::io;
|
||||||
|
/// use std::os::squiid::fs::MetadataExt;
|
||||||
|
///
|
||||||
|
/// fn main() -> io::Result<()> {
|
||||||
|
/// let meta = fs::metadata("some_file")?;
|
||||||
|
/// println!("{}", meta.st_blocks());
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||||
|
fn st_blocks(&self) -> u64;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
||||||
|
impl MetadataExt for Metadata {
|
||||||
|
#[allow(deprecated)]
|
||||||
|
fn as_raw_stat(&self) -> &raw::stat {
|
||||||
|
unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) }
|
||||||
|
}
|
||||||
|
fn st_dev(&self) -> u64 {
|
||||||
|
self.as_inner().as_inner().st_dev as u64
|
||||||
|
}
|
||||||
|
fn st_ino(&self) -> u64 {
|
||||||
|
self.as_inner().as_inner().st_ino as u64
|
||||||
|
}
|
||||||
|
fn st_mode(&self) -> u32 {
|
||||||
|
self.as_inner().as_inner().st_mode as u32
|
||||||
|
}
|
||||||
|
fn st_nlink(&self) -> u64 {
|
||||||
|
self.as_inner().as_inner().st_nlink as u64
|
||||||
|
}
|
||||||
|
fn st_uid(&self) -> u32 {
|
||||||
|
self.as_inner().as_inner().st_uid as u32
|
||||||
|
}
|
||||||
|
fn st_gid(&self) -> u32 {
|
||||||
|
self.as_inner().as_inner().st_gid as u32
|
||||||
|
}
|
||||||
|
fn st_rdev(&self) -> u64 {
|
||||||
|
self.as_inner().as_inner().st_rdev as u64
|
||||||
|
}
|
||||||
|
fn st_size(&self) -> u64 {
|
||||||
|
self.as_inner().as_inner().st_size as u64
|
||||||
|
}
|
||||||
|
fn st_atime(&self) -> i64 {
|
||||||
|
self.as_inner().as_inner().st_atime as i64
|
||||||
|
}
|
||||||
|
fn st_atime_nsec(&self) -> i64 {
|
||||||
|
self.as_inner().as_inner().st_atime_nsec as i64
|
||||||
|
}
|
||||||
|
fn st_mtime(&self) -> i64 {
|
||||||
|
self.as_inner().as_inner().st_mtime as i64
|
||||||
|
}
|
||||||
|
fn st_mtime_nsec(&self) -> i64 {
|
||||||
|
self.as_inner().as_inner().st_mtime_nsec as i64
|
||||||
|
}
|
||||||
|
fn st_ctime(&self) -> i64 {
|
||||||
|
self.as_inner().as_inner().st_ctime as i64
|
||||||
|
}
|
||||||
|
fn st_ctime_nsec(&self) -> i64 {
|
||||||
|
self.as_inner().as_inner().st_ctime_nsec as i64
|
||||||
|
}
|
||||||
|
fn st_blksize(&self) -> u64 {
|
||||||
|
self.as_inner().as_inner().st_blksize as u64
|
||||||
|
}
|
||||||
|
fn st_blocks(&self) -> u64 {
|
||||||
|
self.as_inner().as_inner().st_blocks as u64
|
||||||
|
}
|
||||||
|
}
|
6
library/std/src/os/squiid/mod.rs
Normal file
6
library/std/src/os/squiid/mod.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
//! Redox-specific definitions
|
||||||
|
|
||||||
|
#![stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
|
||||||
|
pub mod fs;
|
||||||
|
pub mod raw;
|
78
library/std/src/os/squiid/raw.rs
Normal file
78
library/std/src/os/squiid/raw.rs
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
//! Redox-specific raw type definitions
|
||||||
|
|
||||||
|
#![stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
#![deprecated(
|
||||||
|
since = "1.8.0",
|
||||||
|
note = "these type aliases are no longer supported by \
|
||||||
|
the standard library, the `libc` crate on \
|
||||||
|
crates.io should be used instead for the correct \
|
||||||
|
definitions"
|
||||||
|
)]
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
|
use crate::os::raw::{c_char, c_int, c_long, c_ulong, c_void};
|
||||||
|
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub type dev_t = c_long;
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub type gid_t = c_int;
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub type mode_t = c_int;
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub type uid_t = c_int;
|
||||||
|
|
||||||
|
#[stable(feature = "pthread_t", since = "1.8.0")]
|
||||||
|
pub type pthread_t = *mut c_void;
|
||||||
|
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub type blkcnt_t = c_ulong;
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub type blksize_t = c_ulong;
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub type ino_t = c_ulong;
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub type nlink_t = c_ulong;
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub type off_t = c_long;
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub type time_t = c_long;
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Clone)]
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub struct stat {
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub st_dev: dev_t,
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub st_ino: ino_t,
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub st_nlink: nlink_t,
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub st_mode: mode_t,
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub st_uid: uid_t,
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub st_gid: gid_t,
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub st_rdev: dev_t,
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub st_size: off_t,
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub st_blksize: blksize_t,
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub st_blocks: blkcnt_t,
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub st_atime: time_t,
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub st_atime_nsec: c_long,
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub st_mtime: time_t,
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub st_mtime_nsec: c_long,
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub st_ctime: time_t,
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub st_ctime_nsec: c_long,
|
||||||
|
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
pub _pad: [c_char; 24],
|
||||||
|
}
|
|
@ -69,6 +69,8 @@ mod platform {
|
||||||
pub use crate::os::openbsd::*;
|
pub use crate::os::openbsd::*;
|
||||||
#[cfg(target_os = "redox")]
|
#[cfg(target_os = "redox")]
|
||||||
pub use crate::os::redox::*;
|
pub use crate::os::redox::*;
|
||||||
|
#[cfg(target_os = "squiid")]
|
||||||
|
pub use crate::os::squiid::*;
|
||||||
#[cfg(target_os = "solaris")]
|
#[cfg(target_os = "solaris")]
|
||||||
pub use crate::os::solaris::*;
|
pub use crate::os::solaris::*;
|
||||||
#[cfg(target_os = "vxworks")]
|
#[cfg(target_os = "vxworks")]
|
||||||
|
|
|
@ -68,6 +68,7 @@ impl DoubleEndedIterator for Args {
|
||||||
target_os = "l4re",
|
target_os = "l4re",
|
||||||
target_os = "fuchsia",
|
target_os = "fuchsia",
|
||||||
target_os = "redox",
|
target_os = "redox",
|
||||||
|
target_os = "squiid",
|
||||||
target_os = "vxworks",
|
target_os = "vxworks",
|
||||||
target_os = "horizon"
|
target_os = "horizon"
|
||||||
))]
|
))]
|
||||||
|
|
|
@ -196,6 +196,17 @@ pub mod os {
|
||||||
pub const EXE_EXTENSION: &str = "";
|
pub const EXE_EXTENSION: &str = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "squiid")]
|
||||||
|
pub mod os {
|
||||||
|
pub const FAMILY: &str = "unix";
|
||||||
|
pub const OS: &str = "squiid";
|
||||||
|
pub const DLL_PREFIX: &str = "lib";
|
||||||
|
pub const DLL_SUFFIX: &str = ".so";
|
||||||
|
pub const DLL_EXTENSION: &str = "so";
|
||||||
|
pub const EXE_SUFFIX: &str = "";
|
||||||
|
pub const EXE_EXTENSION: &str = "";
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "vxworks")]
|
#[cfg(target_os = "vxworks")]
|
||||||
pub mod os {
|
pub mod os {
|
||||||
pub const FAMILY: &str = "unix";
|
pub const FAMILY: &str = "unix";
|
||||||
|
|
|
@ -13,7 +13,8 @@ use crate::mem;
|
||||||
target_os = "solaris",
|
target_os = "solaris",
|
||||||
target_os = "fuchsia",
|
target_os = "fuchsia",
|
||||||
target_os = "redox",
|
target_os = "redox",
|
||||||
target_os = "illumos"
|
target_os = "illumos",
|
||||||
|
target_os = "squiid",
|
||||||
))]
|
))]
|
||||||
use crate::mem::MaybeUninit;
|
use crate::mem::MaybeUninit;
|
||||||
use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd};
|
use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd};
|
||||||
|
@ -54,7 +55,8 @@ use libc::fstatat64;
|
||||||
target_os = "solaris",
|
target_os = "solaris",
|
||||||
target_os = "fuchsia",
|
target_os = "fuchsia",
|
||||||
target_os = "redox",
|
target_os = "redox",
|
||||||
target_os = "illumos"
|
target_os = "illumos",
|
||||||
|
target_os = "squiid",
|
||||||
))]
|
))]
|
||||||
use libc::readdir as readdir64;
|
use libc::readdir as readdir64;
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
|
@ -69,7 +71,8 @@ use libc::readdir64_r;
|
||||||
target_os = "illumos",
|
target_os = "illumos",
|
||||||
target_os = "l4re",
|
target_os = "l4re",
|
||||||
target_os = "fuchsia",
|
target_os = "fuchsia",
|
||||||
target_os = "redox"
|
target_os = "redox",
|
||||||
|
target_os = "squiid",
|
||||||
)))]
|
)))]
|
||||||
use libc::readdir_r as readdir64_r;
|
use libc::readdir_r as readdir64_r;
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
|
@ -277,7 +280,8 @@ unsafe impl Sync for Dir {}
|
||||||
target_os = "solaris",
|
target_os = "solaris",
|
||||||
target_os = "illumos",
|
target_os = "illumos",
|
||||||
target_os = "fuchsia",
|
target_os = "fuchsia",
|
||||||
target_os = "redox"
|
target_os = "redox",
|
||||||
|
target_os = "squiid",
|
||||||
))]
|
))]
|
||||||
pub struct DirEntry {
|
pub struct DirEntry {
|
||||||
dir: Arc<InnerReadDir>,
|
dir: Arc<InnerReadDir>,
|
||||||
|
@ -297,7 +301,8 @@ pub struct DirEntry {
|
||||||
target_os = "solaris",
|
target_os = "solaris",
|
||||||
target_os = "illumos",
|
target_os = "illumos",
|
||||||
target_os = "fuchsia",
|
target_os = "fuchsia",
|
||||||
target_os = "redox"
|
target_os = "redox",
|
||||||
|
target_os = "squiid",
|
||||||
))]
|
))]
|
||||||
struct dirent64_min {
|
struct dirent64_min {
|
||||||
d_ino: u64,
|
d_ino: u64,
|
||||||
|
@ -311,7 +316,8 @@ struct dirent64_min {
|
||||||
target_os = "solaris",
|
target_os = "solaris",
|
||||||
target_os = "illumos",
|
target_os = "illumos",
|
||||||
target_os = "fuchsia",
|
target_os = "fuchsia",
|
||||||
target_os = "redox"
|
target_os = "redox",
|
||||||
|
target_os = "squiid",
|
||||||
)))]
|
)))]
|
||||||
pub struct DirEntry {
|
pub struct DirEntry {
|
||||||
dir: Arc<InnerReadDir>,
|
dir: Arc<InnerReadDir>,
|
||||||
|
@ -603,7 +609,8 @@ impl Iterator for ReadDir {
|
||||||
target_os = "solaris",
|
target_os = "solaris",
|
||||||
target_os = "fuchsia",
|
target_os = "fuchsia",
|
||||||
target_os = "redox",
|
target_os = "redox",
|
||||||
target_os = "illumos"
|
target_os = "illumos",
|
||||||
|
target_os = "squiid",
|
||||||
))]
|
))]
|
||||||
fn next(&mut self) -> Option<io::Result<DirEntry>> {
|
fn next(&mut self) -> Option<io::Result<DirEntry>> {
|
||||||
if self.end_of_stream {
|
if self.end_of_stream {
|
||||||
|
@ -705,6 +712,7 @@ impl Iterator for ReadDir {
|
||||||
target_os = "solaris",
|
target_os = "solaris",
|
||||||
target_os = "fuchsia",
|
target_os = "fuchsia",
|
||||||
target_os = "redox",
|
target_os = "redox",
|
||||||
|
target_os = "squiid",
|
||||||
target_os = "illumos"
|
target_os = "illumos"
|
||||||
)))]
|
)))]
|
||||||
fn next(&mut self) -> Option<io::Result<DirEntry>> {
|
fn next(&mut self) -> Option<io::Result<DirEntry>> {
|
||||||
|
@ -832,6 +840,7 @@ impl DirEntry {
|
||||||
target_os = "l4re",
|
target_os = "l4re",
|
||||||
target_os = "fuchsia",
|
target_os = "fuchsia",
|
||||||
target_os = "redox",
|
target_os = "redox",
|
||||||
|
target_os = "squiid",
|
||||||
target_os = "vxworks",
|
target_os = "vxworks",
|
||||||
target_os = "espidf",
|
target_os = "espidf",
|
||||||
target_os = "horizon"
|
target_os = "horizon"
|
||||||
|
@ -887,7 +896,8 @@ impl DirEntry {
|
||||||
target_os = "solaris",
|
target_os = "solaris",
|
||||||
target_os = "illumos",
|
target_os = "illumos",
|
||||||
target_os = "fuchsia",
|
target_os = "fuchsia",
|
||||||
target_os = "redox"
|
target_os = "redox",
|
||||||
|
target_os = "squiid",
|
||||||
)))]
|
)))]
|
||||||
fn name_cstr(&self) -> &CStr {
|
fn name_cstr(&self) -> &CStr {
|
||||||
unsafe { CStr::from_ptr(self.entry.d_name.as_ptr()) }
|
unsafe { CStr::from_ptr(self.entry.d_name.as_ptr()) }
|
||||||
|
@ -898,7 +908,8 @@ impl DirEntry {
|
||||||
target_os = "solaris",
|
target_os = "solaris",
|
||||||
target_os = "illumos",
|
target_os = "illumos",
|
||||||
target_os = "fuchsia",
|
target_os = "fuchsia",
|
||||||
target_os = "redox"
|
target_os = "redox",
|
||||||
|
target_os = "squiid",
|
||||||
))]
|
))]
|
||||||
fn name_cstr(&self) -> &CStr {
|
fn name_cstr(&self) -> &CStr {
|
||||||
&self.name
|
&self.name
|
||||||
|
|
|
@ -90,6 +90,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
|
||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
target_os = "redox",
|
target_os = "redox",
|
||||||
|
target_os = "squiid",
|
||||||
target_os = "l4re",
|
target_os = "l4re",
|
||||||
target_os = "horizon",
|
target_os = "horizon",
|
||||||
)))]
|
)))]
|
||||||
|
|
|
@ -47,6 +47,7 @@ extern "C" {
|
||||||
target_os = "linux",
|
target_os = "linux",
|
||||||
target_os = "emscripten",
|
target_os = "emscripten",
|
||||||
target_os = "fuchsia",
|
target_os = "fuchsia",
|
||||||
|
target_os = "squiid",
|
||||||
target_os = "l4re"
|
target_os = "l4re"
|
||||||
),
|
),
|
||||||
link_name = "__errno_location"
|
link_name = "__errno_location"
|
||||||
|
@ -350,7 +351,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "linux", target_os = "android", target_os = "emscripten"))]
|
#[cfg(any(target_os = "linux", target_os = "android", target_os = "emscripten", target_os = "squiid"))]
|
||||||
pub fn current_exe() -> io::Result<PathBuf> {
|
pub fn current_exe() -> io::Result<PathBuf> {
|
||||||
match crate::fs::read_link("/proc/self/exe") {
|
match crate::fs::read_link("/proc/self/exe") {
|
||||||
Err(ref e) if e.kind() == io::ErrorKind::NotFound => Err(io::const_io_error!(
|
Err(ref e) if e.kind() == io::ErrorKind::NotFound => Err(io::const_io_error!(
|
||||||
|
@ -598,6 +599,7 @@ pub fn home_dir() -> Option<PathBuf> {
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
target_os = "emscripten",
|
target_os = "emscripten",
|
||||||
target_os = "redox",
|
target_os = "redox",
|
||||||
|
target_os = "squiid",
|
||||||
target_os = "vxworks",
|
target_os = "vxworks",
|
||||||
target_os = "espidf",
|
target_os = "espidf",
|
||||||
target_os = "horizon"
|
target_os = "horizon"
|
||||||
|
@ -611,6 +613,7 @@ pub fn home_dir() -> Option<PathBuf> {
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
target_os = "emscripten",
|
target_os = "emscripten",
|
||||||
target_os = "redox",
|
target_os = "redox",
|
||||||
|
target_os = "squiid",
|
||||||
target_os = "vxworks",
|
target_os = "vxworks",
|
||||||
target_os = "espidf",
|
target_os = "espidf",
|
||||||
target_os = "horizon"
|
target_os = "horizon"
|
||||||
|
|
|
@ -299,7 +299,7 @@ impl Command {
|
||||||
{
|
{
|
||||||
if let Some(_g) = self.get_groups() {
|
if let Some(_g) = self.get_groups() {
|
||||||
//FIXME: Redox kernel does not support setgroups yet
|
//FIXME: Redox kernel does not support setgroups yet
|
||||||
#[cfg(not(target_os = "redox"))]
|
#[cfg(not(any(target_os = "redox", target_os = "squiid")))]
|
||||||
cvt(libc::setgroups(_g.len().try_into().unwrap(), _g.as_ptr()))?;
|
cvt(libc::setgroups(_g.len().try_into().unwrap(), _g.as_ptr()))?;
|
||||||
}
|
}
|
||||||
if let Some(u) = self.get_gid() {
|
if let Some(u) = self.get_gid() {
|
||||||
|
@ -313,7 +313,7 @@ impl Command {
|
||||||
// uid has dropped, we may still have groups that enable us to
|
// uid has dropped, we may still have groups that enable us to
|
||||||
// do super-user things.
|
// do super-user things.
|
||||||
//FIXME: Redox kernel does not support setgroups yet
|
//FIXME: Redox kernel does not support setgroups yet
|
||||||
#[cfg(not(target_os = "redox"))]
|
#[cfg(not(any(target_os = "redox", target_os = "squiid")))]
|
||||||
if libc::getuid() == 0 && self.get_groups().is_none() {
|
if libc::getuid() == 0 && self.get_groups().is_none() {
|
||||||
cvt(libc::setgroups(0, crate::ptr::null()))?;
|
cvt(libc::setgroups(0, crate::ptr::null()))?;
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,6 +213,7 @@ impl Thread {
|
||||||
target_os = "l4re",
|
target_os = "l4re",
|
||||||
target_os = "emscripten",
|
target_os = "emscripten",
|
||||||
target_os = "redox",
|
target_os = "redox",
|
||||||
|
target_os = "squiid",
|
||||||
target_os = "vxworks"
|
target_os = "vxworks"
|
||||||
))]
|
))]
|
||||||
pub fn set_name(_name: &CStr) {
|
pub fn set_name(_name: &CStr) {
|
||||||
|
|
|
@ -11,7 +11,12 @@
|
||||||
// Note, however, that we run on lots older linuxes, as well as cross
|
// Note, however, that we run on lots older linuxes, as well as cross
|
||||||
// compiling from a newer linux to an older linux, so we also have a
|
// compiling from a newer linux to an older linux, so we also have a
|
||||||
// fallback implementation to use as well.
|
// fallback implementation to use as well.
|
||||||
#[cfg(any(target_os = "linux", target_os = "fuchsia", target_os = "redox"))]
|
#[cfg(any(
|
||||||
|
target_os = "linux",
|
||||||
|
target_os = "fuchsia",
|
||||||
|
target_os = "redox",
|
||||||
|
target_os = "squiid",
|
||||||
|
))]
|
||||||
pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
|
pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
|
||||||
use crate::mem;
|
use crate::mem;
|
||||||
use crate::sys_common::thread_local_dtor::register_dtor_fallback;
|
use crate::sys_common::thread_local_dtor::register_dtor_fallback;
|
||||||
|
|
|
@ -114,7 +114,8 @@ impl Parker {
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
target_os = "l4re",
|
target_os = "l4re",
|
||||||
target_os = "android",
|
target_os = "android",
|
||||||
target_os = "redox"
|
target_os = "redox",
|
||||||
|
target_os = "squiid"
|
||||||
))] {
|
))] {
|
||||||
addr_of_mut!((*parker).cvar).write(UnsafeCell::new(libc::PTHREAD_COND_INITIALIZER));
|
addr_of_mut!((*parker).cvar).write(UnsafeCell::new(libc::PTHREAD_COND_INITIALIZER));
|
||||||
} else if #[cfg(any(target_os = "espidf", target_os = "horizon"))] {
|
} else if #[cfg(any(target_os = "espidf", target_os = "horizon"))] {
|
||||||
|
|
|
@ -100,6 +100,10 @@ extern "C" {}
|
||||||
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
|
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
|
||||||
extern "C" {}
|
extern "C" {}
|
||||||
|
|
||||||
|
#[cfg(all(target_os = "squiid"))]
|
||||||
|
#[link(name = "gcc", kind = "static", modifiers = "-bundle")]
|
||||||
|
extern "C" {}
|
||||||
|
|
||||||
#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
|
#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
|
||||||
#[link(name = "unwind", kind = "static", modifiers = "-bundle")]
|
#[link(name = "unwind", kind = "static", modifiers = "-bundle")]
|
||||||
extern "C" {}
|
extern "C" {}
|
||||||
|
|
|
@ -507,6 +507,7 @@ impl<'a> fmt::Display for Display<'a> {
|
||||||
"openbsd" => "OpenBSD",
|
"openbsd" => "OpenBSD",
|
||||||
"redox" => "Redox",
|
"redox" => "Redox",
|
||||||
"solaris" => "Solaris",
|
"solaris" => "Solaris",
|
||||||
|
"squiid" => "squiid",
|
||||||
"tvos" => "tvOS",
|
"tvos" => "tvOS",
|
||||||
"wasi" => "WASI",
|
"wasi" => "WASI",
|
||||||
"watchos" => "watchOS",
|
"watchos" => "watchOS",
|
||||||
|
|
Loading…
Reference in a new issue