Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

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 75ab1ba77467cab272ee8302ca4e9d1be306d2f6
Showing with 14 additions and 1 deletion.
  1. +14 −1 src/unix/linux.c
@@ -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

@@ -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
}


0 comments on commit 75ab1ba

Please sign in to comment.
You can’t perform that action at this time.