Vendor things
This commit is contained in:
parent
5deceec006
commit
977e3c17e5
19434 changed files with 10682014 additions and 0 deletions
33
third-party/vendor/kqueue/examples/file.rs
vendored
Normal file
33
third-party/vendor/kqueue/examples/file.rs
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
use std::env;
|
||||
use std::io::Result;
|
||||
|
||||
fn watch_file(filename: &str) -> Result<()> {
|
||||
let mut watcher = kqueue::Watcher::new()?;
|
||||
|
||||
watcher.add_filename(
|
||||
filename,
|
||||
kqueue::EventFilter::EVFILT_VNODE,
|
||||
kqueue::FilterFlag::NOTE_DELETE
|
||||
| kqueue::FilterFlag::NOTE_WRITE
|
||||
| kqueue::FilterFlag::NOTE_RENAME,
|
||||
)?;
|
||||
|
||||
watcher.watch()?;
|
||||
|
||||
println!("Watching for events, press Ctrl+C to stop...");
|
||||
for ev in watcher.iter() {
|
||||
println!("{:?}", ev);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn main() {
|
||||
if let Some(filename) = env::args().nth(1) {
|
||||
if let Err(err) = watch_file(&filename) {
|
||||
println!("{:?}", err);
|
||||
}
|
||||
} else {
|
||||
println!("Usage: cargo run --example file <filename>");
|
||||
}
|
||||
}
|
||||
33
third-party/vendor/kqueue/examples/pid.rs
vendored
Normal file
33
third-party/vendor/kqueue/examples/pid.rs
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
use std::env;
|
||||
use std::io::Result;
|
||||
|
||||
fn watch_pid(pid: libc::pid_t) -> Result<()> {
|
||||
let mut watcher = kqueue::Watcher::new()?;
|
||||
|
||||
watcher.add_pid(
|
||||
pid,
|
||||
kqueue::EventFilter::EVFILT_PROC,
|
||||
kqueue::FilterFlag::NOTE_EXIT,
|
||||
)?;
|
||||
|
||||
watcher.watch()?;
|
||||
|
||||
println!("Watching for events, press Ctrl+C to stop...");
|
||||
for ev in watcher.iter() {
|
||||
println!("{:?}", ev);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn main() {
|
||||
if let Some(pid) = env::args().nth(1) {
|
||||
if let Ok(npid) = pid.parse::<libc::pid_t>() {
|
||||
if let Err(err) = watch_pid(npid) {
|
||||
println!("{:?}", err);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
println!("Usage: cargo run --example pid <pid>");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue