From addb589bf51bdc5b5e253c0b5cbd47394e293ba7 Mon Sep 17 00:00:00 2001
From: Thomas Karpiniec <tom.karpiniec@outlook.com>
Date: Tue, 18 Jun 2024 20:51:46 +1000
Subject: [PATCH 1/1] Fix Android compile

---
 Cargo.toml         | 2 +-
 src/watch_linux.rs | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

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,
-- 
2.39.5