From: Thomas Karpiniec Date: Tue, 18 Jun 2024 10:51:46 +0000 (+1000) Subject: Fix Android compile X-Git-Tag: v0.1.0~9 X-Git-Url: https://code.octet-stream.net/netwatcher/commitdiff_plain/addb589bf51bdc5b5e253c0b5cbd47394e293ba7 Fix Android compile --- diff --git a/Cargo.toml b/Cargo.toml index 78a17e6..f6e3125 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] -[target.'cfg(any(target_vendor = "apple", target_os = "linux"))'.dependencies] +[target.'cfg(any(target_vendor = "apple", target_os = "linux", target_os = "android"))'.dependencies] nix = { version = "0.29.0", features = ["net"] } [target.'cfg(target_vendor = "apple")'.dependencies] diff --git a/src/watch_linux.rs b/src/watch_linux.rs index 95ef106..c1f08a2 100644 --- a/src/watch_linux.rs +++ b/src/watch_linux.rs @@ -4,9 +4,6 @@ use std::os::fd::OwnedFd; use nix::libc::poll; use nix::libc::pollfd; use nix::libc::POLLIN; -use nix::libc::RTMGRP_IPV4_IFADDR; -use nix::libc::RTMGRP_IPV6_IFADDR; -use nix::libc::RTMGRP_LINK; use nix::sys::socket::bind; use nix::sys::socket::recv; use nix::sys::socket::socket; @@ -22,6 +19,10 @@ use crate::Error; use crate::List; use crate::Update; +const RTMGRP_IPV4_IFADDR: u32 = 0x10; +const RTMGRP_IPV6_IFADDR: u32 = 0x20; +const RTMGRP_LINK: u32 = 0x01; + pub(crate) struct WatchHandle { // Dropping will close the fd which will be detected by poll _pipefd: OwnedFd,