Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
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()
  • Loading branch information
jedisct1 authored and bnoordhuis committed Feb 17, 2012
1 parent 372ed18 commit 75ab1ba
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/unix/linux.c
Expand Up @@ -28,14 +28,23 @@
#include <assert.h>
#include <errno.h>

#include <ifaddrs.h>
#include <net/if.h>
#include <sys/param.h>
#include <sys/sysinfo.h>
#include <unistd.h>
#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

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -520,6 +532,7 @@ uv_err_t uv_interface_addresses(uv_interface_address_t** addresses,
freeifaddrs(addrs);

return uv_ok_;
#endif
}


Expand Down

0 comments on commit 75ab1ba

Please sign in to comment.