From: Thomas Karpiniec Date: Sat, 8 Jun 2024 07:39:30 +0000 (+1000) Subject: Fix up deps for Linux X-Git-Tag: v0.1.0~20 X-Git-Url: https://code.octet-stream.net/netwatcher/commitdiff_plain/5dd5aea6e6c70688ad4288df1eaafd97ac05720a?ds=sidebyside Fix up deps for Linux --- diff --git a/Cargo.toml b/Cargo.toml index a1feb3c..45cff20 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,10 @@ edition = "2021" [dependencies] -[target.'cfg(target_vendor = "apple")'.dependencies] +[target.'cfg(any(target_vendor = "apple", target_os = "linux"))'.dependencies] nix = { version = "0.29.0", features = ["net"] } + +[target.'cfg(target_vendor = "apple")'.dependencies] block2 = "0.5.1" [target.'cfg(windows)'.dependencies.windows] diff --git a/src/lib.rs b/src/lib.rs index 46218d2..e7bf152 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,6 +10,7 @@ mod list; #[cfg_attr(windows, path = "watch_win.rs")] #[cfg_attr(target_vendor = "apple", path = "watch_mac.rs")] +#[cfg_attr(target_os = "linux", path = "watch_linux.rs")] mod watch; #[cfg(unix)] diff --git a/src/watch_linux.rs b/src/watch_linux.rs new file mode 100644 index 0000000..74c1465 --- /dev/null +++ b/src/watch_linux.rs @@ -0,0 +1,13 @@ +use crate::Update; +use crate::Error; + +pub(crate) struct WatchHandle; + +pub(crate) fn watch_interfaces( + callback: F, +) -> Result { + // stop current worker thread + // post this into a thread that will use it + drop(callback); + Ok(WatchHandle) +}