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

unix: move linux feature detection macros to internal.h

  • Loading branch information...
bnoordhuis committed Sep 5, 2011
1 parent a9ba756 commit bb0c6e6d53a6618f48de54bc174fdb9f2816bd3f
Showing with 29 additions and 25 deletions.
  1. +1 −1 config-unix.mk
  2. +0 −24 src/unix/core.c
  3. +1 −0 src/unix/fs.c
  4. +26 −0 src/unix/internal.h
  5. +1 −0 src/unix/process.c
@@ -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
@@ -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>
@@ -32,6 +32,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <utime.h>
#include <sys/time.h>


#define ARGS1(a) (a)
@@ -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. */
@@ -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>

0 comments on commit bb0c6e6

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