mikros: Change to using proc_man for stdio

This commit is contained in:
pjht 2024-11-09 22:14:37 -06:00
parent b4bdead6e9
commit ead8f274c6
Signed by: pjht
GPG Key ID: 7B5F6AFBEC7EE78E
2 changed files with 4 additions and 6 deletions

View File

@ -134,15 +134,13 @@ pub fn spawn(
.map(|arg| (0, arg.clone().into_encoded_bytes())) .map(|arg| (0, arg.clone().into_encoded_bytes()))
.collect::<Vec<(u32, Vec<u8>)>>(); .collect::<Vec<(u32, Vec<u8>)>>();
let pid = super::syscalls::new_process(entry as _, space).unwrap(); let pid = super::syscalls::new_process(entry as _, space).unwrap();
if let Some(vfs_pid) = syscalls::try_get_registered(0) { if let Some(proc_man_pid) = syscalls::try_get_registered(3) {
let res: Result<(), Errno> = postcard::from_bytes( let res: Result<(), Errno> = postcard::from_bytes(
&rpc::send_call(vfs_pid, 2, 4, &postcard::to_allocvec(&(pid, stdio)).unwrap()) &rpc::send_call(proc_man_pid, 8, 0, &postcard::to_allocvec(&(pid, stdio)).unwrap())
.get_return(), .get_return(),
) )
.unwrap(); .unwrap();
res?; res?;
};
if let Some(proc_man_pid) = syscalls::try_get_registered(3) {
let res: Result<(), Errno> = postcard::from_bytes( let res: Result<(), Errno> = postcard::from_bytes(
&rpc::send_call(proc_man_pid, 8, 2, &postcard::to_allocvec(&(pid, args)).unwrap()) &rpc::send_call(proc_man_pid, 8, 2, &postcard::to_allocvec(&(pid, args)).unwrap())
.get_return(), .get_return(),

View File

@ -98,14 +98,14 @@ pub fn panic_output() -> Option<impl io::Write> {
} }
pub fn init() { pub fn init() {
let Some(vfs_pid) = syscalls::try_get_registered(0) else { let Some(proc_man_pid) = syscalls::try_get_registered(3) else {
STDIN_FD.get_or_init(|| None); STDIN_FD.get_or_init(|| None);
STDOUT_FD.get_or_init(|| None); STDOUT_FD.get_or_init(|| None);
STDERR_FD.get_or_init(|| None); STDERR_FD.get_or_init(|| None);
return; return;
}; };
let stdio: [Option<(u64, u64)>; 3] = let stdio: [Option<(u64, u64)>; 3] =
postcard::from_bytes(&rpc::send_call(vfs_pid, 2, 5, &[]).get_return()).unwrap(); postcard::from_bytes(&rpc::send_call(proc_man_pid, 8, 1, &[]).get_return()).unwrap();
STDIN_FD.get_or_init(|| stdio[0]); STDIN_FD.get_or_init(|| stdio[0]);
STDOUT_FD.get_or_init(|| stdio[1]); STDOUT_FD.get_or_init(|| stdio[1]);
STDERR_FD.get_or_init(|| stdio[2]); STDERR_FD.get_or_init(|| stdio[2]);