Add basic support for running programs off disk for mikros
This commit is contained in:
parent
4d7329b9f4
commit
dd38365992
@ -104,7 +104,20 @@ pub fn spawn(
|
||||
_default: Stdio,
|
||||
_needs_stdin: bool,
|
||||
) -> io::Result<(Process, StdioPipes)> {
|
||||
unsupported()
|
||||
let path = Path::new(&self.program);
|
||||
let binary = crate::fs::read(path).unwrap();
|
||||
let (space, entry) = crate::os::mikros::loader::Loader::load(&binary);
|
||||
super::syscalls::new_process(entry as _, space).unwrap();
|
||||
Ok((
|
||||
Process {
|
||||
dummy: ()
|
||||
},
|
||||
StdioPipes {
|
||||
stdin: None,
|
||||
stdout: None,
|
||||
stderr: None,
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
pub fn output(&mut self) -> io::Result<(ExitStatus, Vec<u8>, Vec<u8>)> {
|
||||
@ -277,23 +290,25 @@ fn from(code: u8) -> Self {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Process(!);
|
||||
pub struct Process {
|
||||
dummy: ()
|
||||
}
|
||||
|
||||
impl Process {
|
||||
pub fn id(&self) -> u32 {
|
||||
self.0
|
||||
todo!()
|
||||
}
|
||||
|
||||
pub fn kill(&mut self) -> io::Result<()> {
|
||||
self.0
|
||||
todo!()
|
||||
}
|
||||
|
||||
pub fn wait(&mut self) -> io::Result<ExitStatus> {
|
||||
self.0
|
||||
todo!()
|
||||
}
|
||||
|
||||
pub fn try_wait(&mut self) -> io::Result<Option<ExitStatus>> {
|
||||
self.0
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user