diff --git a/config-unix.mk b/config-unix.mk index e77ad2fee..7aa3a1654 100644 --- a/config-unix.mk +++ b/config-unix.mk @@ -58,7 +58,7 @@ endif ifeq (Linux,$(uname_S)) EV_CONFIG=config_linux.h EIO_CONFIG=config_linux.h -CSTDFLAG += -D_XOPEN_SOURCE=600 +CSTDFLAG += -D_GNU_SOURCE CPPFLAGS += -Isrc/ares/config_linux LINKFLAGS+=-lrt OBJS += src/unix/linux.o diff --git a/src/unix/core.c b/src/unix/core.c index a016d1b36..4d713c295 100644 --- a/src/unix/core.c +++ b/src/unix/core.c @@ -18,10 +18,6 @@ * IN THE SOFTWARE. */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE /* O_CLOEXEC, accept4(), etc. */ -#endif - #include "uv.h" #include "unix/internal.h" @@ -42,26 +38,6 @@ #include /* PATH_MAX */ #include /* writev */ -#if defined(__linux__) - -#include -#include - -#undef HAVE_PIPE2 -#undef HAVE_ACCEPT4 - -/* pipe2() requires linux >= 2.6.27 and glibc >= 2.9 */ -#if LINUX_VERSION_CODE >= 0x2061B && __GLIBC_PREREQ(2, 9) -#define HAVE_PIPE2 -#endif - -/* accept4() requires linux >= 2.6.28 and glib >= 2.10 */ -#if LINUX_VERSION_CODE >= 0x2061C && __GLIBC_PREREQ(2, 10) -#define HAVE_ACCEPT4 -#endif - -#endif /* __linux__ */ - #ifdef __sun # include # include diff --git a/src/unix/fs.c b/src/unix/fs.c index 26e7afbcc..a2e765218 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c @@ -32,6 +32,7 @@ #include #include #include +#include #define ARGS1(a) (a) diff --git a/src/unix/internal.h b/src/unix/internal.h index 6e5be7da0..c5c458485 100644 --- a/src/unix/internal.h +++ b/src/unix/internal.h @@ -25,6 +25,32 @@ #include "uv-common.h" #include "uv-eio.h" +#if defined(__linux__) + +#include +#include + +#undef HAVE_FUTIMES +#undef HAVE_PIPE2 +#undef HAVE_ACCEPT4 + +/* futimes() requires linux >= 2.6.22 and glib >= 2.6 */ +#if LINUX_VERSION_CODE >= 0x20616 && __GLIBC_PREREQ(2, 6) +#define HAVE_FUTIMES +#endif + +/* pipe2() requires linux >= 2.6.27 and glibc >= 2.9 */ +#if LINUX_VERSION_CODE >= 0x2061B && __GLIBC_PREREQ(2, 9) +#define HAVE_PIPE2 +#endif + +/* accept4() requires linux >= 2.6.28 and glib >= 2.10 */ +#if LINUX_VERSION_CODE >= 0x2061C && __GLIBC_PREREQ(2, 10) +#define HAVE_ACCEPT4 +#endif + +#endif /* __linux__ */ + /* flags */ enum { UV_CLOSING = 0x00000001, /* uv_close() called but not finished. */ diff --git a/src/unix/process.c b/src/unix/process.c index 349e0da6f..bbd24f450 100644 --- a/src/unix/process.c +++ b/src/unix/process.c @@ -26,6 +26,7 @@ #include #include #include +#include /* O_CLOEXEC, O_NONBLOCK */ #include #include #include