Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-lang/rust
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d96ab6ec8a71fde4799dc61a95c3dccf2b547435
Choose a base ref
..
head repository: rust-lang/rust
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3414c99e8dfb122a60f73cb131dc203b779616f9
Choose a head ref
Showing with 9 additions and 15 deletions.
  1. +6 −14 library/std/src/sys/pal/hermit/fs.rs
  2. +3 −1 library/std/src/sys/pal/hermit/stdio.rs
20 changes: 6 additions & 14 deletions library/std/src/sys/pal/hermit/fs.rs
Original file line number Diff line number Diff line change
@@ -112,24 +112,15 @@ pub struct DirBuilder {

impl FileAttr {
pub fn modified(&self) -> io::Result<SystemTime> {
Ok(SystemTime::new(
self.stat_val.st_mtim.tv_sec,
self.stat_val.st_mtim.tv_nsec,
))
Ok(SystemTime::new(self.stat_val.st_mtim.tv_sec, self.stat_val.st_mtim.tv_nsec))
}

pub fn accessed(&self) -> io::Result<SystemTime> {
Ok(SystemTime::new(
self.stat_val.st_atim.tv_sec,
self.stat_val.st_atim.tv_nsec,
))
Ok(SystemTime::new(self.stat_val.st_atim.tv_sec, self.stat_val.st_atim.tv_nsec))
}

pub fn created(&self) -> io::Result<SystemTime> {
Ok(SystemTime::new(
self.stat_val.st_ctim.tv_sec,
self.stat_val.st_ctim.tv_nsec,
))
Ok(SystemTime::new(self.stat_val.st_ctim.tv_sec, self.stat_val.st_ctim.tv_nsec))
}

pub fn size(&self) -> u64 {
@@ -502,8 +493,9 @@ impl FromRawFd for File {
}

pub fn readdir(path: &Path) -> io::Result<ReadDir> {
let fd_raw =
run_path_with_cstr(path, &|path| cvt(unsafe { hermit_abi::open(path.as_ptr(), O_RDONLY | O_DIRECTORY, 0) }))?;
let fd_raw = run_path_with_cstr(path, &|path| {
cvt(unsafe { hermit_abi::open(path.as_ptr(), O_RDONLY | O_DIRECTORY, 0) })
})?;
let fd = unsafe { FileDesc::from_raw_fd(fd_raw as i32) };
let root = path.to_path_buf();

4 changes: 3 additions & 1 deletion library/std/src/sys/pal/hermit/stdio.rs
Original file line number Diff line number Diff line change
@@ -21,7 +21,9 @@ impl io::Read for Stdin {
}

fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
unsafe { ManuallyDrop::new(FileDesc::from_raw_fd(hermit_abi::STDIN_FILENO)).read_vectored(bufs) }
unsafe {
ManuallyDrop::new(FileDesc::from_raw_fd(hermit_abi::STDIN_FILENO)).read_vectored(bufs)
}
}

#[inline]