Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
linux: don't use accept4() syscall after ENOSYS
Browse files Browse the repository at this point in the history
Repeatedly calling the syscall when it's not supported has a small but
measurable performance impact.

Besides, it's a silly thing to do.
  • Loading branch information
bnoordhuis committed Jun 29, 2012
1 parent 27cd5f0 commit f6a02fb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/unix/core.c
Expand Up @@ -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,
Expand All @@ -439,6 +444,9 @@ int uv__accept(int sockfd) {

if (errno != ENOSYS)
break;

no_accept4 = 1;
skip:
#endif

peerfd = accept(sockfd, NULL, NULL);
Expand Down

0 comments on commit f6a02fb

Please sign in to comment.