use proc_connector::ProcConnector;
use std::time::Duration;
fn main() {
let conn = ProcConnector::new().expect("failed to create proc connector (try as root)");
let mut buf = vec![0u8; 4096];
println!("polling for events with 2s timeout... (Ctrl+C to stop)");
loop {
match conn.recv_timeout(&mut buf, Duration::from_secs(2)) {
Ok(Some(event)) => println!("{event}"),
Ok(None) => {
print!(".");
std::io::Write::flush(&mut std::io::stdout()).ok();
}
Err(e) => {
eprintln!("error: {e}");
break;
}
}
}
let _raw_fd = conn.as_raw_fd();
}