fix: libuv patches to address child_process.spawn slowness (#33337)

* fix: libuv patches to address child_process.spawn slowness

* chore: backport additional patches

Co-authored-by: deepak1556 <hop2deep@gmail.com>
This commit is contained in:
Jeremy Rose 2022-03-23 06:30:54 -07:00 committed by GitHub
parent a5ab10f3d2
commit f912130be6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 1805 additions and 0 deletions

View file

@ -0,0 +1,36 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ben Noordhuis <info@bnoordhuis.nl>
Date: Sat, 5 Mar 2022 18:55:49 +0100
Subject: unix: simplify uv__cloexec_fcntl() (#3492)
FD_CLOEXEC is the only defined flag for fcntl(F_SETFD) so don't bother
getting the status of that flag first with fcntl(F_GETFD), just set it.
diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c
index a6425294086ff2f1435fdd6866380d3aaaf68200..6cd519ad5b3e7af8f5c71b18a59b88458a233f15 100644
--- a/deps/uv/src/unix/core.c
+++ b/deps/uv/src/unix/core.c
@@ -649,21 +649,9 @@ int uv__cloexec_fcntl(int fd, int set) {
int flags;
int r;
- do
- r = fcntl(fd, F_GETFD);
- while (r == -1 && errno == EINTR);
-
- if (r == -1)
- return UV__ERR(errno);
-
- /* Bail out now if already set/clear. */
- if (!!(r & FD_CLOEXEC) == !!set)
- return 0;
-
+ flags = 0;
if (set)
- flags = r | FD_CLOEXEC;
- else
- flags = r & ~FD_CLOEXEC;
+ flags = FD_CLOEXEC;
do
r = fcntl(fd, F_SETFD, flags);