devela::_dep::nc::call

Function syslog

pub unsafe fn syslog(action: i32, buf: &mut [u8]) -> Result<isize, i32> 
Available on crate feature dep_nc only.
Expand description

Read and/or clear kernel message ring buffer.

§Examples

let mut buf = vec![0_u8; 4096];
let ret = unsafe { nc::syslog(nc::SYSLOG_ACTION_READ_ALL, &mut buf) };
if let Ok(nread) = ret {
    if let Ok(msg) = std::str::from_utf8(&buf[..nread as usize]) {
        println!("msg: {msg}");
    }
} else {
    assert_eq!(ret, Err(nc::EPERM));
}