Created
November 22, 2025 23:56
-
-
Save mekanix/12f5d4a54e08146c49a0c9e0d31dad37 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use kqueue; | |
| use std::{fs::File, os::fd::AsRawFd}; | |
| fn main() { | |
| let f = File::open("/bin/sh").expect("Opening file failed"); | |
| let mut watcher = kqueue::Watcher::new().expect("Failed to create kqueue watcher"); | |
| watcher.add_fd(f.as_raw_fd(), kqueue::EventFilter::EVFILT_READ, kqueue::FilterFlag::NOTE_READ).expect("Failed to add file to watcher"); | |
| watcher.watch().expect("Failed to watch for events"); | |
| for i in watcher.iter() { | |
| println!("Hello, world! {:?}!", i); | |
| break; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment