Convert exit into a kernel called RPC function
This commit is contained in:
parent
83d19db638
commit
03a8c6229a
@ -66,13 +66,6 @@ impl Client {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn exit(&self, code: u8) {
|
|
||||||
postcard::from_bytes(
|
|
||||||
&rpc::send_call(self.0, PROTO, 4, &postcard::to_stdvec(&code).unwrap()).get_return(),
|
|
||||||
)
|
|
||||||
.unwrap()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn wait(&self, pid: u64, block: bool) -> Result<WaitResult, Errno> {
|
pub fn wait(&self, pid: u64, block: bool) -> Result<WaitResult, Errno> {
|
||||||
postcard::from_bytes(
|
postcard::from_bytes(
|
||||||
&rpc::send_call(self.0, PROTO, 5, &postcard::to_stdvec(&(pid, block)).unwrap()).get_return(),
|
&rpc::send_call(self.0, PROTO, 5, &postcard::to_stdvec(&(pid, block)).unwrap()).get_return(),
|
||||||
@ -109,9 +102,9 @@ fn callback(call: IncomingCall) {
|
|||||||
let ret = postcard::to_stdvec(&server.get_cli_args(call.from)).unwrap();
|
let ret = postcard::to_stdvec(&server.get_cli_args(call.from)).unwrap();
|
||||||
call.send_return(&ret);
|
call.send_return(&ret);
|
||||||
} else if call.func == 4 {
|
} else if call.func == 4 {
|
||||||
let code = postcard::from_bytes(call.args()).unwrap();
|
let (pid, code) = postcard::from_bytes(call.args()).unwrap();
|
||||||
let ret = postcard::to_stdvec(&server.exit(call.from, code)).unwrap();
|
let _ = server.exit(pid, code);
|
||||||
call.send_return(&ret);
|
//call.send_return(&ret);
|
||||||
} else if call.func == 5 {
|
} else if call.func == 5 {
|
||||||
let (pid, block) = postcard::from_bytes(call.args()).unwrap();
|
let (pid, block) = postcard::from_bytes(call.args()).unwrap();
|
||||||
let ret = postcard::to_stdvec(&server.wait(call.from, pid, block)).unwrap();
|
let ret = postcard::to_stdvec(&server.wait(call.from, pid, block)).unwrap();
|
||||||
|
@ -78,8 +78,8 @@ impl proc_man_rpc::Server for Serv {
|
|||||||
.map_or(Vec::new(), |proc| proc.cli_args.clone())
|
.map_or(Vec::new(), |proc| proc.cli_args.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exit(&self, from: u64, code: u8) {
|
fn exit(&self, pid: u64, code: u8) {
|
||||||
if let Some(proc) = self.processes.write().get_mut(&from) {
|
if let Some(proc) = self.processes.write().get_mut(&pid) {
|
||||||
proc.status = ProcessStatus::Exited(code);
|
proc.status = ProcessStatus::Exited(code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user