Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit f6a02fbe763aec5d290aa9d9509aeec5348c7792 1 parent 27cd5f0
@bnoordhuis bnoordhuis authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/unix/core.c
View
8 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);
Please sign in to comment.
Something went wrong with that request. Please try again.