use std::os::raw::c_int;
pub struct SyscallReturnCode(pub c_int);
impl SyscallReturnCode {
pub fn into_result(self) -> std::io::Result<c_int> {
if self.0 == -1 {
Err(std::io::Error::last_os_error())
} else {
Ok(self.0)
}
}
pub fn into_empty_result(self) -> std::io::Result<()> {
self.into_result().map(|_| ())
}
}