systematic 0.0.2

Rusty bindings to libsystemd
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::{ffi::CStr, io};

use crate::sys;

pub fn session_is_active(session: &CStr) -> io::Result<bool> {
    let ret = unsafe { sys::sd_session_is_active(session.as_ptr()) };

    if ret < 0 {
        return Err(io::Error::from_raw_os_error(ret.wrapping_neg()));
    }

    Ok(ret != 0)
}