linux: uclibc <0.9.32 doesn't have <ifaddrs.h>
uclibc didn't provide ifaddrs.h before version 0.9.32 It explicitly didn't install it because (quoting) "the corresponding functionality is disabled". So, fix libuv on uclibc < 0.9.32 by returning ENOSYS for uv_interface_addresses()
This commit is contained in:
parent
372ed18986
commit
75ab1ba774
@ -28,7 +28,6 @@
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <ifaddrs.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysinfo.h>
|
||||
@ -36,6 +35,16 @@
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
|
||||
#define HAVE_IFADDRS_H 1
|
||||
#ifdef __UCLIBC__
|
||||
# if __UCLIBC_MAJOR__ < 0 || __UCLIBC_MINOR__ < 9 || __UCLIBC_SUBLEVEL__ < 32
|
||||
# undef HAVE_IFADDRS_H
|
||||
# endif
|
||||
#endif
|
||||
#ifdef HAVE_IFADDRS_H
|
||||
# include <ifaddrs.h>
|
||||
#endif
|
||||
|
||||
#undef NANOSEC
|
||||
#define NANOSEC 1000000000
|
||||
|
||||
@ -457,6 +466,9 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
|
||||
|
||||
uv_err_t uv_interface_addresses(uv_interface_address_t** addresses,
|
||||
int* count) {
|
||||
#ifndef HAVE_IFADDRS_H
|
||||
return uv__new_artificial_error(UV_ENOSYS);
|
||||
#else
|
||||
struct ifaddrs *addrs, *ent;
|
||||
char ip[INET6_ADDRSTRLEN];
|
||||
uv_interface_address_t* address;
|
||||
@ -520,6 +532,7 @@ uv_err_t uv_interface_addresses(uv_interface_address_t** addresses,
|
||||
freeifaddrs(addrs);
|
||||
|
||||
return uv_ok_;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user