unix: move linux feature detection macros to internal.h

This commit is contained in:
Ben Noordhuis 2011-09-05 16:05:28 +02:00
parent a9ba756bfd
commit bb0c6e6d53
5 changed files with 29 additions and 25 deletions

View File

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

View File

@ -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 <limits.h> /* PATH_MAX */
#include <sys/uio.h> /* writev */
#if defined(__linux__)
#include <linux/version.h>
#include <features.h>
#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 <sys/types.h>
# include <sys/wait.h>

View File

@ -32,6 +32,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <utime.h>
#include <sys/time.h>
#define ARGS1(a) (a)

View File

@ -25,6 +25,32 @@
#include "uv-common.h"
#include "uv-eio.h"
#if defined(__linux__)
#include <linux/version.h>
#include <features.h>
#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. */

View File

@ -26,6 +26,7 @@
#include <assert.h>
#include <errno.h>
#include <sys/wait.h>
#include <fcntl.h> /* O_CLOEXEC, O_NONBLOCK */
#include <poll.h>
#include <unistd.h>
#include <stdio.h>