Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
unix: move linux feature detection macros to internal.h
  • Loading branch information
bnoordhuis committed Sep 5, 2011
1 parent a9ba756 commit bb0c6e6
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion config-unix.mk
Expand Up @@ -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
Expand Down
24 changes: 0 additions & 24 deletions src/unix/core.c
Expand Up @@ -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"

Expand All @@ -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>
Expand Down
1 change: 1 addition & 0 deletions src/unix/fs.c
Expand Up @@ -32,6 +32,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <utime.h>
#include <sys/time.h>


#define ARGS1(a) (a)
Expand Down
26 changes: 26 additions & 0 deletions src/unix/internal.h
Expand Up @@ -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. */
Expand Down
1 change: 1 addition & 0 deletions src/unix/process.c
Expand Up @@ -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>
Expand Down

0 comments on commit bb0c6e6

Please sign in to comment.