Implement exec cache from ld_so cache

This commit is contained in:
Wildan M
2026-03-29 13:11:36 +07:00
parent a78c1f5cfd
commit b2de3d6e2e
2 changed files with 48 additions and 8 deletions
+7
View File
@@ -9,6 +9,7 @@ use crate::{
platform::{Pal, Sys, types::*},
};
use core::ops::Deref;
use syscall::Stat;
pub struct File {
pub fd: c_int,
@@ -57,6 +58,12 @@ impl File {
Sys::ftruncate(self.fd, size as off_t).map_err(Errno::sync)
}
pub fn fstat(&self) -> Result<Stat, syscall::Error> {
let mut stat = Stat::default();
redox_rt::sys::fstat(self.fd as usize, &mut stat)?;
Ok(stat)
}
pub fn try_clone(&self) -> io::Result<Self> {
Ok(Self::new(Sys::dup(self.fd)?))
}