Skip to content
Browse files

uv: upgrade to 5b8a112

  • Loading branch information...
1 parent c721604 commit 3644b0bc9637fbb17ec74b41fe2dcb1dd978699e @isaacs isaacs committed Jun 28, 2012
Showing with 30 additions and 7 deletions.
  1. +3 −0 deps/uv/common.gypi
  2. +8 −0 deps/uv/src/unix/core.c
  3. +19 −7 deps/uv/src/unix/linux/syscalls.c
View
3 deps/uv/common.gypi
@@ -32,6 +32,9 @@
'LinkIncremental': 2, # enable incremental linking
},
},
+ 'xcode_settings': {
+ 'GCC_OPTIMIZATION_LEVEL': '0',
+ },
'conditions': [
['OS != "win"', {
'defines': [ 'EV_VERIFY=2' ],
View
8 deps/uv/src/unix/core.c
@@ -426,6 +426,11 @@ int uv__accept(int sockfd) {
while (1) {
#if __linux__
+ static int no_accept4;
+
+ if (no_accept4)
+ goto skip;
+
peerfd = uv__accept4(sockfd,
NULL,
NULL,
@@ -439,6 +444,9 @@ int uv__accept(int sockfd) {
if (errno != ENOSYS)
break;
+
+ no_accept4 = 1;
+skip:
#endif
peerfd = accept(sockfd, NULL, NULL);
View
26 deps/uv/src/unix/linux/syscalls.c
@@ -152,13 +152,25 @@
int uv__accept4(int fd, struct sockaddr* addr, socklen_t* addrlen, int flags) {
#if __i386__
- unsigned long args[] = {
- (unsigned long) fd,
- (unsigned long) addr,
- (unsigned long) addrlen,
- (unsigned long) flags
- };
- return syscall(__NR_socketcall, 18 /* SYS_ACCEPT4 */, args);
+ unsigned long args[4];
+ int r;
+
+ args[0] = (unsigned long) fd;
+ args[1] = (unsigned long) addr;
+ args[2] = (unsigned long) addrlen;
+ args[3] = (unsigned long) flags;
+
+ r = syscall(__NR_socketcall, 18 /* SYS_ACCEPT4 */, args);
+
+ /* socketcall() raises EINVAL when SYS_ACCEPT4 is not supported but so does
+ * a bad flags argument. Try to distinguish between the two cases.
+ */
+ if (r == -1)
+ if (errno == EINVAL)
+ if ((flags & ~(UV__SOCK_CLOEXEC|UV__SOCK_NONBLOCK)) == 0)
+ errno = ENOSYS;
+
+ return r;
#elif __NR_accept4
return syscall(__NR_accept4, fd, addr, addrlen, flags);
#else

0 comments on commit 3644b0b

Please sign in to comment.
Something went wrong with that request. Please try again.