syscall: add wrapper functions for destroy_server and disconnect

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2021-04-02 17:33:36 +08:00
parent 0230ccb252
commit 461d6f23ee

View file

@ -1529,6 +1529,26 @@ pub fn current_tid() -> core::result::Result<TID, Error> {
})
}
pub fn destroy_server(sid: SID) -> core::result::Result<(), Error> {
rsyscall(SysCall::DestroyServer(sid)).and_then(|result| {
if let Result::Ok = result {
Ok(())
} else {
Err(Error::InternalError)
}
})
}
pub unsafe fn disconnect(cid: CID) -> core::result::Result<(), Error> {
rsyscall(SysCall::Disconnect(cid)).and_then(|result| {
if let Result::Ok = result {
Ok(())
} else {
Err(Error::InternalError)
}
})
}
pub fn rsyscall(call: SysCall) -> SysCallResult {
let mut ret = Result::Ok;
let args = call.as_args();