mikros: Change to using proc_man for stdio
This commit is contained in:
parent
b4bdead6e9
commit
ead8f274c6
@ -134,15 +134,13 @@ pub fn spawn(
|
||||
.map(|arg| (0, arg.clone().into_encoded_bytes()))
|
||||
.collect::<Vec<(u32, Vec<u8>)>>();
|
||||
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(
|
||||
&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(),
|
||||
)
|
||||
.unwrap();
|
||||
res?;
|
||||
};
|
||||
if let Some(proc_man_pid) = syscalls::try_get_registered(3) {
|
||||
let res: Result<(), Errno> = postcard::from_bytes(
|
||||
&rpc::send_call(proc_man_pid, 8, 2, &postcard::to_allocvec(&(pid, args)).unwrap())
|
||||
.get_return(),
|
||||
|
@ -98,14 +98,14 @@ pub fn panic_output() -> Option<impl io::Write> {
|
||||
}
|
||||
|
||||
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);
|
||||
STDOUT_FD.get_or_init(|| None);
|
||||
STDERR_FD.get_or_init(|| None);
|
||||
return;
|
||||
};
|
||||
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]);
|
||||
STDOUT_FD.get_or_init(|| stdio[1]);
|
||||
STDERR_FD.get_or_init(|| stdio[2]);
|
||||
|
Loading…
Reference in New Issue
Block a user