From 5672bbd68a8ac47644a7e17b71b2d88234795f08 Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Tue, 25 Nov 2014 17:06:22 +0100 Subject: [PATCH] linux: handle O_NONBLOCK != SOCK_NONBLOCK case linux-syscalls.h assumes that on all Linux platforms the value of O_NONBLOCK is the same as SOCK_NONBLOCK. This commit fixes it, as it is at least not true for hppa, and resolves #1442. Signed-off-by: Luca Bruno --- src/unix/linux-syscalls.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/unix/linux-syscalls.h b/src/unix/linux-syscalls.h index ba44974a..62eb5c5a 100644 --- a/src/unix/linux-syscalls.h +++ b/src/unix/linux-syscalls.h @@ -43,7 +43,7 @@ #if defined(__alpha__) # define UV__O_NONBLOCK 0x4 #elif defined(__hppa__) -# define UV__O_NONBLOCK 0x10004 +# define UV__O_NONBLOCK O_NONBLOCK #elif defined(__mips__) # define UV__O_NONBLOCK 0x80 #elif defined(__sparc__) @@ -59,7 +59,11 @@ #define UV__IN_NONBLOCK UV__O_NONBLOCK #define UV__SOCK_CLOEXEC UV__O_CLOEXEC -#define UV__SOCK_NONBLOCK UV__O_NONBLOCK +#if defined(SOCK_NONBLOCK) +# define UV__SOCK_NONBLOCK SOCK_NONBLOCK +#else +# define UV__SOCK_NONBLOCK UV__O_NONBLOCK +#endif /* epoll flags */ #define UV__EPOLL_CLOEXEC UV__O_CLOEXEC