target_os = "solaris",
target_os = "fuchsia",
target_os = "redox",
- target_os = "illumos"
+ target_os = "illumos",
+ target_os = "nto",
))]
use crate::mem::MaybeUninit;
use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd};
target_os = "solaris",
target_os = "fuchsia",
target_os = "redox",
- target_os = "illumos"
+ target_os = "illumos",
+ target_os = "nto",
))]
use libc::readdir as readdir64;
#[cfg(target_os = "linux")]
target_os = "illumos",
target_os = "l4re",
target_os = "fuchsia",
- target_os = "redox"
+ target_os = "redox",
+ target_os = "nto",
)))]
use libc::readdir_r as readdir64_r;
#[cfg(target_os = "android")]
target_os = "solaris",
target_os = "illumos",
target_os = "fuchsia",
- target_os = "redox"
+ target_os = "redox",
+ target_os = "nto",
))]
pub struct DirEntry {
dir: Arc<InnerReadDir>,
target_os = "solaris",
target_os = "illumos",
target_os = "fuchsia",
- target_os = "redox"
+ target_os = "redox",
+ target_os = "nto",
))]
struct dirent64_min {
d_ino: u64,
- #[cfg(not(any(target_os = "solaris", target_os = "illumos")))]
+ #[cfg(not(any(target_os = "solaris", target_os = "illumos", target_os = "nto")))]
d_type: u8,
}
target_os = "solaris",
target_os = "illumos",
target_os = "fuchsia",
- target_os = "redox"
+ target_os = "redox",
+ target_os = "nto",
)))]
pub struct DirEntry {
dir: Arc<InnerReadDir>,
}
}
-#[cfg(not(target_os = "netbsd"))]
+#[cfg(not(any(target_os = "netbsd", target_os = "nto")))]
impl FileAttr {
#[cfg(not(any(target_os = "vxworks", target_os = "espidf", target_os = "horizon")))]
pub fn modified(&self) -> io::Result<SystemTime> {
}
}
+#[cfg(target_os = "nto")]
+impl FileAttr {
+ pub fn modified(&self) -> io::Result<SystemTime> {
+ Ok(SystemTime::new(self.stat.st_mtim.tv_sec, self.stat.st_mtim.tv_nsec))
+ }
+
+ pub fn accessed(&self) -> io::Result<SystemTime> {
+ Ok(SystemTime::new(self.stat.st_atim.tv_sec, self.stat.st_atim.tv_nsec))
+ }
+
+ pub fn created(&self) -> io::Result<SystemTime> {
+ Ok(SystemTime::new(self.stat.st_ctim.tv_sec, self.stat.st_ctim.tv_nsec))
+ }
+}
+
impl AsInner<stat64> for FileAttr {
fn as_inner(&self) -> &stat64 {
&self.stat
target_os = "solaris",
target_os = "fuchsia",
target_os = "redox",
- target_os = "illumos"
+ target_os = "illumos",
+ target_os = "nto",
))]
fn next(&mut self) -> Option<io::Result<DirEntry>> {
if self.end_of_stream {
let entry = dirent64_min {
d_ino: *offset_ptr!(entry_ptr, d_ino) as u64,
- #[cfg(not(any(target_os = "solaris", target_os = "illumos")))]
+ #[cfg(not(any(
+ target_os = "solaris",
+ target_os = "illumos",
+ target_os = "nto",
+ )))]
d_type: *offset_ptr!(entry_ptr, d_type) as u8,
};
target_os = "solaris",
target_os = "fuchsia",
target_os = "redox",
- target_os = "illumos"
+ target_os = "illumos",
+ target_os = "nto",
)))]
fn next(&mut self) -> Option<io::Result<DirEntry>> {
if self.end_of_stream {
target_os = "solaris",
target_os = "illumos",
target_os = "haiku",
- target_os = "vxworks"
+ target_os = "vxworks",
+ target_os = "nto",
))]
pub fn file_type(&self) -> io::Result<FileType> {
self.metadata().map(|m| m.file_type())
target_os = "solaris",
target_os = "illumos",
target_os = "haiku",
- target_os = "vxworks"
+ target_os = "vxworks",
+ target_os = "nto",
)))]
pub fn file_type(&self) -> io::Result<FileType> {
match self.entry.d_type {
target_os = "redox",
target_os = "vxworks",
target_os = "espidf",
- target_os = "horizon"
+ target_os = "horizon",
+ target_os = "nto",
))]
pub fn ino(&self) -> u64 {
self.entry.d_ino as u64
target_os = "solaris",
target_os = "illumos",
target_os = "fuchsia",
- target_os = "redox"
+ target_os = "redox",
+ target_os = "nto",
)))]
fn name_cstr(&self) -> &CStr {
unsafe { CStr::from_ptr(self.entry.d_name.as_ptr()) }
target_os = "solaris",
target_os = "illumos",
target_os = "fuchsia",
- target_os = "redox"
+ target_os = "redox",
+ target_os = "nto",
))]
fn name_cstr(&self) -> &CStr {
&self.name
target_os = "linux",
target_os = "android",
target_os = "netbsd",
- target_os = "openbsd"
+ target_os = "openbsd",
+ target_os = "nto",
))]
unsafe fn os_datasync(fd: c_int) -> c_int {
libc::fdatasync(fd)
target_os = "netbsd",
target_os = "openbsd",
target_os = "watchos",
+ target_os = "nto",
)))]
unsafe fn os_datasync(fd: c_int) -> c_int {
libc::fsync(fd)
self.0.read_buf(cursor)
}
+ pub fn read_vectored_at(&self, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io::Result<usize> {
+ self.0.read_vectored_at(bufs, offset)
+ }
+
pub fn write(&self, buf: &[u8]) -> io::Result<usize> {
self.0.write(buf)
}
self.0.write_at(buf, offset)
}
+ pub fn write_vectored_at(&self, bufs: &[IoSlice<'_>], offset: u64) -> io::Result<usize> {
+ self.0.write_vectored_at(bufs, offset)
+ }
+
pub fn flush(&self) -> io::Result<()> {
Ok(())
}
pub use remove_dir_impl::remove_dir_all;
// Fallback for REDOX, ESP-ID, Horizon, and Miri
-#[cfg(any(target_os = "redox", target_os = "espidf", target_os = "horizon", miri))]
+#[cfg(any(
+ target_os = "redox",
+ target_os = "espidf",
+ target_os = "horizon",
+ target_os = "nto",
+ miri
+))]
mod remove_dir_impl {
pub use crate::sys_common::fs::remove_dir_all;
}
// Modern implementation using openat(), unlinkat() and fdopendir()
-#[cfg(not(any(target_os = "redox", target_os = "espidf", target_os = "horizon", miri)))]
+#[cfg(not(any(
+ target_os = "redox",
+ target_os = "espidf",
+ target_os = "horizon",
+ target_os = "nto",
+ miri
+)))]
mod remove_dir_impl {
use super::{lstat, Dir, DirEntry, InnerReadDir, ReadDir};
use crate::ffi::CStr;