systemd_rs/lib.rs
1use std::os::raw::c_int;
2
3pub use std::io::{Error, Result};
4
5pub fn to_result(result: c_int) -> Result<c_int> {
6 if result < 0 {
7 return Err(Error::from_raw_os_error(-result));
8 }
9
10 Ok(result)
11}
12
13#[macro_export]
14macro_rules! ffi_try {
15 ($e:expr) => {{
16 $crate::to_result(unsafe { $e })
17 }};
18}
19
20pub mod login;