linux: don't use accept4() syscall after ENOSYS

Repeatedly calling the syscall when it's not supported has a small but
measurable performance impact.

Besides, it's a silly thing to do.
This commit is contained in:
Ben Noordhuis 2012-06-29 02:23:39 +02:00
parent 27cd5f03ef
commit f6a02fbe76

View File

@ -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);