|
@ -152,13 +152,25 @@ |
|
|
|
|
|
|
|
|
int uv__accept4(int fd, struct sockaddr* addr, socklen_t* addrlen, int flags) { |
|
|
int uv__accept4(int fd, struct sockaddr* addr, socklen_t* addrlen, int flags) { |
|
|
#if __i386__ |
|
|
#if __i386__ |
|
|
unsigned long args[] = { |
|
|
unsigned long args[4]; |
|
|
(unsigned long) fd, |
|
|
int r; |
|
|
(unsigned long) addr, |
|
|
|
|
|
(unsigned long) addrlen, |
|
|
args[0] = (unsigned long) fd; |
|
|
(unsigned long) flags |
|
|
args[1] = (unsigned long) addr; |
|
|
}; |
|
|
args[2] = (unsigned long) addrlen; |
|
|
return syscall(__NR_socketcall, 18 /* SYS_ACCEPT4 */, args); |
|
|
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 |
|
|
#elif __NR_accept4 |
|
|
return syscall(__NR_accept4, fd, addr, addrlen, flags); |
|
|
return syscall(__NR_accept4, fd, addr, addrlen, flags); |
|
|
#else |
|
|
#else |
|
|