Skip to content

Unhandled `kevent` in `Event::from_error`

If I build the following program:

use std::time::Duration;
use std::io::Error;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};

const TIMEOUT: Duration = Duration::from_millis(500);

fn main() -> Result<(), Error> {
    let mut watcher = kqueue::Watcher::new()?;
    watcher.add_filename("/bin", 
                         kqueue::EventFilter::EVFILT_VNODE,
                         kqueue::FilterFlag::NOTE_WRITE)?;
    watcher.watch()?;
    let sigterm = Arc::new(AtomicBool::new(false));
    signal_hook::flag::register(signal_hook::consts::SIGTERM, Arc::clone(&sigterm))?;

    loop {
        if sigterm.load(Ordering::Relaxed) {
            break;
        }
        if let Some(ev) = watcher.poll(Some(TIMEOUT)) {
            println!("{:?}", ev);
        }
    }

    Ok(())
}

(that depends on signal-hook), run it and kill it with pkill -TERM name-of-example, the program panics:

thread 'main' panicked at 'not supported', /Users/ice/tmp/rust-kqueue/src/lib.rs:620:18

The unhandled filter is EVFILT_SYSCOUNT, and the corresponding last OS error is Os { code: 4, kind: Interrupted, message: "Interrupted system call" }.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information