Skip to content

Commit 3644b0b

Browse files
committed
uv: upgrade to 5b8a112
1 parent c721604 commit 3644b0b

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed

deps/uv/common.gypi

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
'LinkIncremental': 2, # enable incremental linking
3333
},
3434
},
35+
'xcode_settings': {
36+
'GCC_OPTIMIZATION_LEVEL': '0',
37+
},
3538
'conditions': [
3639
['OS != "win"', {
3740
'defines': [ 'EV_VERIFY=2' ],

deps/uv/src/unix/core.c

+8
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,11 @@ int uv__accept(int sockfd) {
426426

427427
while (1) {
428428
#if __linux__
429+
static int no_accept4;
430+
431+
if (no_accept4)
432+
goto skip;
433+
429434
peerfd = uv__accept4(sockfd,
430435
NULL,
431436
NULL,
@@ -439,6 +444,9 @@ int uv__accept(int sockfd) {
439444

440445
if (errno != ENOSYS)
441446
break;
447+
448+
no_accept4 = 1;
449+
skip:
442450
#endif
443451

444452
peerfd = accept(sockfd, NULL, NULL);

deps/uv/src/unix/linux/syscalls.c

+19-7
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,25 @@
152152

153153
int uv__accept4(int fd, struct sockaddr* addr, socklen_t* addrlen, int flags) {
154154
#if __i386__
155-
unsigned long args[] = {
156-
(unsigned long) fd,
157-
(unsigned long) addr,
158-
(unsigned long) addrlen,
159-
(unsigned long) flags
160-
};
161-
return syscall(__NR_socketcall, 18 /* SYS_ACCEPT4 */, args);
155+
unsigned long args[4];
156+
int r;
157+
158+
args[0] = (unsigned long) fd;
159+
args[1] = (unsigned long) addr;
160+
args[2] = (unsigned long) addrlen;
161+
args[3] = (unsigned long) flags;
162+
163+
r = syscall(__NR_socketcall, 18 /* SYS_ACCEPT4 */, args);
164+
165+
/* socketcall() raises EINVAL when SYS_ACCEPT4 is not supported but so does
166+
* a bad flags argument. Try to distinguish between the two cases.
167+
*/
168+
if (r == -1)
169+
if (errno == EINVAL)
170+
if ((flags & ~(UV__SOCK_CLOEXEC|UV__SOCK_NONBLOCK)) == 0)
171+
errno = ENOSYS;
172+
173+
return r;
162174
#elif __NR_accept4
163175
return syscall(__NR_accept4, fd, addr, addrlen, flags);
164176
#else

0 commit comments

Comments
 (0)