diff --git a/include/uv-errno.h b/include/uv-errno.h index c3413279..53f30296 100644 --- a/include/uv-errno.h +++ b/include/uv-errno.h @@ -399,4 +399,20 @@ # define UV__EMLINK (-4032) #endif +/* EHOSTDOWN is not visible on BSD-like systems when _POSIX_C_SOURCE is + * defined. Fortunately, its value is always 64 so it's possible albeit + * icky to hard-code it. + */ +#if defined(EHOSTDOWN) && !defined(_WIN32) +# define UV__EHOSTDOWN (-EHOSTDOWN) +#elif defined(__APPLE__) || \ + defined(__DragonFly__) || \ + defined(__FreeBSD__) || \ + defined(__NetBSD__) || \ + defined(__OpenBSD__) +# define UV__EHOSTDOWN (-64) +#else +# define UV__EHOSTDOWN (-4031) +#endif + #endif /* UV_ERRNO_H_ */ diff --git a/include/uv.h b/include/uv.h index 191eecac..55f75218 100644 --- a/include/uv.h +++ b/include/uv.h @@ -138,6 +138,7 @@ extern "C" { XX(EOF, "end of file") \ XX(ENXIO, "no such device or address") \ XX(EMLINK, "too many links") \ + XX(EHOSTDOWN, "host is down") \ #define UV_HANDLE_TYPE_MAP(XX) \ XX(ASYNC, async) \