From a7d5255122ebdf60fd209e1f7201c5dac175677b Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 12 Dec 2023 21:13:31 +0100 Subject: [PATCH] linux: remove HAVE_IFADDRS_H macro (#4243) Introduced long ago for old Linux/libc flavors libuv no longer supports. We include unconditionally elsewhere so there is no point in special-casing it here. Fixes: https://github.com/libuv/libuv/issues/4242 --- src/unix/linux.c | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/src/unix/linux.c b/src/unix/linux.c index 91409bb5..7402a6fa 100644 --- a/src/unix/linux.c +++ b/src/unix/linux.c @@ -37,12 +37,16 @@ #include #include +#include +#include #include +#include #include #include #include #include #include +#include #include #include #include @@ -120,25 +124,6 @@ # endif #endif /* __NR_getrandom */ -#define HAVE_IFADDRS_H 1 - -# if defined(__ANDROID_API__) && __ANDROID_API__ < 24 -# undef HAVE_IFADDRS_H -#endif - -#ifdef __UCLIBC__ -# if __UCLIBC_MAJOR__ < 0 && __UCLIBC_MINOR__ < 9 && __UCLIBC_SUBLEVEL__ < 32 -# undef HAVE_IFADDRS_H -# endif -#endif - -#ifdef HAVE_IFADDRS_H -# include -# include -# include -# include -#endif /* HAVE_IFADDRS_H */ - enum { UV__IORING_SETUP_SQPOLL = 2u, }; @@ -1916,7 +1901,6 @@ nocpuinfo: } -#ifdef HAVE_IFADDRS_H static int uv__ifaddr_exclude(struct ifaddrs *ent, int exclude_type) { if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING))) return 1; @@ -1930,14 +1914,8 @@ static int uv__ifaddr_exclude(struct ifaddrs *ent, int exclude_type) { return exclude_type; return !exclude_type; } -#endif int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { -#ifndef HAVE_IFADDRS_H - *count = 0; - *addresses = NULL; - return UV_ENOSYS; -#else struct ifaddrs *addrs, *ent; uv_interface_address_t* address; int i; @@ -2016,7 +1994,6 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { freeifaddrs(addrs); return 0; -#endif }