diff --git a/upstream_utils/libuv_patches/0001-Revert-win-process-write-minidumps-when-sending-SIGQ.patch b/upstream_utils/libuv_patches/0001-Revert-win-process-write-minidumps-when-sending-SIGQ.patch index e09186acd1..8db5c3cd0c 100644 --- a/upstream_utils/libuv_patches/0001-Revert-win-process-write-minidumps-when-sending-SIGQ.patch +++ b/upstream_utils/libuv_patches/0001-Revert-win-process-write-minidumps-when-sending-SIGQ.patch @@ -6,44 +6,43 @@ Subject: [PATCH 01/10] Revert "win,process: write minidumps when sending This reverts commit 748d894e82abcdfff7429cf745003e182c47f163. --- - CMakeLists.txt | 6 +-- + CMakeLists.txt | 5 +- configure.ac | 2 +- include/uv/win.h | 1 - - src/win/process.c | 116 ---------------------------------------------- - 4 files changed, 2 insertions(+), 123 deletions(-) + src/win/process.c | 125 ---------------------------------------------- + 4 files changed, 2 insertions(+), 131 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index 72377851b69f74c5285fd34ae206ad6bed3745c1..3ec6bd00542f5aacfc6245b1f82e365eb1cff02c 100644 +index 5e8e0166d743bc23f446b180fdbe6843492c754b..4b6ff2477e494dde7a876d8b5bd3e8985c93f0e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -183,11 +183,7 @@ if(WIN32) +@@ -188,10 +188,7 @@ if(WIN32) advapi32 iphlpapi userenv - ws2_32 - dbghelp - ole32 -- uuid - shell32) + ws2_32) list(APPEND uv_sources src/win/async.c src/win/core.c diff --git a/configure.ac b/configure.ac -index 0a1042ce3d384f6a4392a100275c14cb31ba2816..6c87c36039446e04f6c30c23b8fdb9b957dd610d 100644 +index d4cc003e34388de77fe1cfe2ebf12ab25b00b9b8..b215638506223e1c9edb1847bbcfccb7404be33f 100644 --- a/configure.ac +++ b/configure.ac @@ -74,7 +74,7 @@ AM_CONDITIONAL([OS400], [AS_CASE([$host_os],[os400], [true], [false]) AM_CONDITIONAL([SUNOS], [AS_CASE([$host_os],[solaris*], [true], [false])]) AM_CONDITIONAL([WINNT], [AS_CASE([$host_os],[mingw*], [true], [false])]) AS_CASE([$host_os],[mingw*], [ -- LIBS="$LIBS -lws2_32 -lpsapi -liphlpapi -lshell32 -luserenv -luser32 -ldbghelp -lole32 -luuid -lshell32" -+ LIBS="$LIBS -lws2_32 -lpsapi -liphlpapi -lshell32 -luserenv -luser32" +- LIBS="$LIBS -lws2_32 -lpsapi -liphlpapi -luserenv -luser32 -ldbghelp -lole32 -lshell32" ++ LIBS="$LIBS -lws2_32 -lpsapi -liphlpapi -luserenv -luser32 -lshell32" ]) AS_CASE([$host_os], [solaris2.10], [ CFLAGS="$CFLAGS -DSUNOS_NO_IFADDRS" diff --git a/include/uv/win.h b/include/uv/win.h -index 6f8c47298e407bcb0151cf383a8370b71074f03e..eb74776978340a4910194bae35a9da6493e8c0a6 100644 +index f4adaa216c6f0c17437ed42ca594acbf1b8c2c56..518b17606c3b0c114845594e6be9c3c4d95f1776 100644 --- a/include/uv/win.h +++ b/include/uv/win.h @@ -91,7 +91,6 @@ typedef struct pollfd { @@ -55,7 +54,7 @@ index 6f8c47298e407bcb0151cf383a8370b71074f03e..eb74776978340a4910194bae35a9da64 #define SIGWINCH 28 diff --git a/src/win/process.c b/src/win/process.c -index 43059858f3112e7e7185796525697629b72988df..119b46cb3f37122395c172c6e9700d472a2173ed 100644 +index 4e94dee90e13eede63d8e97ddc9992726f874ea9..4f0af83e83442bb905762361775abe05ab6beb4e 100644 --- a/src/win/process.c +++ b/src/win/process.c @@ -32,9 +32,6 @@ @@ -68,7 +67,7 @@ index 43059858f3112e7e7185796525697629b72988df..119b46cb3f37122395c172c6e9700d47 #define SIGKILL 9 -@@ -1173,120 +1170,7 @@ static int uv__kill(HANDLE process_handle, int signum) { +@@ -1179,129 +1176,7 @@ static int uv__kill(HANDLE process_handle, int signum) { return UV_EINVAL; } @@ -109,9 +108,18 @@ index 43059858f3112e7e7185796525697629b72988df..119b46cb3f37122395c172c6e9700d47 - (PVOID) dump_folder, - &dump_folder_len); - if (ret != ERROR_SUCCESS) { +- /* Workaround for missing uuid.dll on MinGW. */ +- static const GUID FOLDERID_LocalAppData_libuv = { +- 0xf1b32785, 0x6fba, 0x4fcf, +- {0x9d, 0x55, 0x7b, 0x8e, 0x7f, 0x15, 0x70, 0x91} +- }; +- - /* Default value for `dump_folder` is `%LOCALAPPDATA%\CrashDumps`. */ - WCHAR* localappdata; -- SHGetKnownFolderPath(&FOLDERID_LocalAppData, 0, NULL, &localappdata); +- SHGetKnownFolderPath(&FOLDERID_LocalAppData_libuv, +- 0, +- NULL, +- &localappdata); - _snwprintf_s(dump_folder, - sizeof(dump_folder), - _TRUNCATE, diff --git a/upstream_utils/libuv_patches/0002-Fix-missing-casts.patch b/upstream_utils/libuv_patches/0002-Fix-missing-casts.patch index de3bebd093..2c9355b440 100644 --- a/upstream_utils/libuv_patches/0002-Fix-missing-casts.patch +++ b/upstream_utils/libuv_patches/0002-Fix-missing-casts.patch @@ -24,7 +24,7 @@ Subject: [PATCH 02/10] Fix missing casts src/unix/loop.c | 2 +- src/unix/netbsd.c | 4 +-- src/unix/openbsd.c | 4 +-- - src/unix/pipe.c | 4 +-- + src/unix/pipe.c | 6 ++--- src/unix/poll.c | 4 +-- src/unix/posix-poll.c | 2 +- src/unix/process.c | 4 +-- @@ -41,13 +41,13 @@ Subject: [PATCH 02/10] Fix missing casts src/win/fs-fd-hash-inl.h | 2 +- src/win/fs.c | 38 ++++++++++++++-------------- src/win/getaddrinfo.c | 12 ++++----- - src/win/pipe.c | 8 +++--- + src/win/pipe.c | 12 ++++----- src/win/process.c | 22 ++++++++-------- src/win/tcp.c | 2 +- src/win/thread.c | 4 +-- src/win/tty.c | 6 ++--- src/win/util.c | 35 +++++++++++++------------- - 43 files changed, 207 insertions(+), 202 deletions(-) + 43 files changed, 210 insertions(+), 205 deletions(-) diff --git a/src/fs-poll.c b/src/fs-poll.c index 1bac1c568e36cadd0b68451926c6f045f88342d2..5a39daed095502b2db34f23fcaf0ab04f31f96ff 100644 @@ -99,10 +99,10 @@ index 1bac1c568e36cadd0b68451926c6f045f88342d2..5a39daed095502b2db34f23fcaf0ab04 last = it, it = it->previous) { assert(last->previous != NULL); diff --git a/src/idna.c b/src/idna.c -index 1c0a60cf3e3becc1badafa394e7c422af7f56833..0c952cf605a88136ed9035f9385f9b1080c30c28 100644 +index efc5f283ce2ef98c80be023eb2ba5cb9a9a7e8b9..765e12e8f2e030cffa9d498f381c0640aa43a647 100644 --- a/src/idna.c +++ b/src/idna.c -@@ -477,7 +477,7 @@ int uv_utf16_to_wtf8(const uint16_t* w_source_ptr, +@@ -482,7 +482,7 @@ int uv_utf16_to_wtf8(const uint16_t* w_source_ptr, return 0; if (*target_ptr == NULL) { @@ -203,10 +203,10 @@ index 11ca95591fc38244e931fecd9dd4038d3968af7a..c3dd71a1889bfae08cfdf95acda61e6c if (*addresses == NULL) { freeifaddrs(addrs); diff --git a/src/unix/core.c b/src/unix/core.c -index 25c5181f370e94983e8a5f797f02f7a8dc207e00..28c036f94f3e76717afa651451969f128c5a573c 100644 +index 965e7f775250cf9899266bc3aaf62eda69367264..8c08d607884335a2da5cb49f35e3108cb833da32 100644 --- a/src/unix/core.c +++ b/src/unix/core.c -@@ -855,7 +855,7 @@ static unsigned int next_power_of_two(unsigned int val) { +@@ -856,7 +856,7 @@ static unsigned int next_power_of_two(unsigned int val) { } static void maybe_resize(uv_loop_t* loop, unsigned int len) { @@ -215,7 +215,7 @@ index 25c5181f370e94983e8a5f797f02f7a8dc207e00..28c036f94f3e76717afa651451969f12 void* fake_watcher_list; void* fake_watcher_count; unsigned int nwatchers; -@@ -874,8 +874,8 @@ static void maybe_resize(uv_loop_t* loop, unsigned int len) { +@@ -875,8 +875,8 @@ static void maybe_resize(uv_loop_t* loop, unsigned int len) { } nwatchers = next_power_of_two(len + 2) - 2; @@ -226,7 +226,7 @@ index 25c5181f370e94983e8a5f797f02f7a8dc207e00..28c036f94f3e76717afa651451969f12 if (watchers == NULL) abort(); -@@ -884,7 +884,7 @@ static void maybe_resize(uv_loop_t* loop, unsigned int len) { +@@ -885,7 +885,7 @@ static void maybe_resize(uv_loop_t* loop, unsigned int len) { watchers[nwatchers] = fake_watcher_list; watchers[nwatchers + 1] = fake_watcher_count; @@ -235,7 +235,7 @@ index 25c5181f370e94983e8a5f797f02f7a8dc207e00..28c036f94f3e76717afa651451969f12 loop->nwatchers = nwatchers; } -@@ -1216,7 +1216,7 @@ static int uv__getpwuid_r(uv_passwd_t *pwd, uid_t uid) { +@@ -1217,7 +1217,7 @@ static int uv__getpwuid_r(uv_passwd_t *pwd, uid_t uid) { * is frequently 1024 or 4096, so we can just use that directly. The pwent * will not usually be large. */ for (bufsize = 2000;; bufsize *= 2) { @@ -244,7 +244,7 @@ index 25c5181f370e94983e8a5f797f02f7a8dc207e00..28c036f94f3e76717afa651451969f12 if (buf == NULL) return UV_ENOMEM; -@@ -1242,7 +1242,7 @@ static int uv__getpwuid_r(uv_passwd_t *pwd, uid_t uid) { +@@ -1243,7 +1243,7 @@ static int uv__getpwuid_r(uv_passwd_t *pwd, uid_t uid) { name_size = strlen(pw.pw_name) + 1; homedir_size = strlen(pw.pw_dir) + 1; shell_size = strlen(pw.pw_shell) + 1; @@ -253,7 +253,7 @@ index 25c5181f370e94983e8a5f797f02f7a8dc207e00..28c036f94f3e76717afa651451969f12 if (pwd->username == NULL) { uv__free(buf); -@@ -1292,7 +1292,7 @@ int uv_os_get_group(uv_group_t* grp, uv_uid_t gid) { +@@ -1293,7 +1293,7 @@ int uv_os_get_group(uv_group_t* grp, uv_uid_t gid) { * is frequently 1024 or 4096, so we can just use that directly. The pwent * will not usually be large. */ for (bufsize = 2000;; bufsize *= 2) { @@ -262,7 +262,7 @@ index 25c5181f370e94983e8a5f797f02f7a8dc207e00..28c036f94f3e76717afa651451969f12 if (buf == NULL) return UV_ENOMEM; -@@ -1323,7 +1323,7 @@ int uv_os_get_group(uv_group_t* grp, uv_uid_t gid) { +@@ -1324,7 +1324,7 @@ int uv_os_get_group(uv_group_t* grp, uv_uid_t gid) { members++; } @@ -271,7 +271,7 @@ index 25c5181f370e94983e8a5f797f02f7a8dc207e00..28c036f94f3e76717afa651451969f12 if (gr_mem == NULL) { uv__free(buf); return UV_ENOMEM; -@@ -1380,7 +1380,7 @@ int uv_os_environ(uv_env_item_t** envitems, int* count) { +@@ -1381,7 +1381,7 @@ int uv_os_environ(uv_env_item_t** envitems, int* count) { for (i = 0; environ[i] != NULL; i++); @@ -332,10 +332,10 @@ index 191bc8bc213ffddb15c5e04baa66e2a0a8d69a3d..1bd63886b823be6451ac013d94e29885 uv__free(*cpu_infos); return UV_ENOMEM; diff --git a/src/unix/fs.c b/src/unix/fs.c -index 891306daedcc6a9b493bdfefcdb7d43c7efbb622..bc00c90b07a32a823412b216df6f2d758dbc423b 100644 +index 3a74350f0e5ab6b268b9fb72eda2a4da909f3f5d..22f31f7285c995c981aca0fa5125bc70aeedc151 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c -@@ -134,7 +134,7 @@ extern char *mkdtemp(char *template); /* See issue #740 on AIX < 7 */ +@@ -136,7 +136,7 @@ extern char *mkdtemp(char *template); /* See issue #740 on AIX < 7 */ size_t new_path_len; \ path_len = strlen(path) + 1; \ new_path_len = strlen(new_path) + 1; \ @@ -344,7 +344,7 @@ index 891306daedcc6a9b493bdfefcdb7d43c7efbb622..bc00c90b07a32a823412b216df6f2d75 if (req->path == NULL) \ return UV_ENOMEM; \ req->new_path = req->path + path_len; \ -@@ -496,7 +496,7 @@ static ssize_t uv__fs_scandir(uv_fs_t* req) { +@@ -498,7 +498,7 @@ static ssize_t uv__fs_scandir(uv_fs_t* req) { static int uv__fs_opendir(uv_fs_t* req) { uv_dir_t* dir; @@ -353,7 +353,7 @@ index 891306daedcc6a9b493bdfefcdb7d43c7efbb622..bc00c90b07a32a823412b216df6f2d75 if (dir == NULL) goto error; -@@ -520,7 +520,7 @@ static int uv__fs_readdir(uv_fs_t* req) { +@@ -522,7 +522,7 @@ static int uv__fs_readdir(uv_fs_t* req) { unsigned int dirent_idx; unsigned int i; @@ -362,7 +362,7 @@ index 891306daedcc6a9b493bdfefcdb7d43c7efbb622..bc00c90b07a32a823412b216df6f2d75 dirent_idx = 0; while (dirent_idx < dir->nentries) { -@@ -562,7 +562,7 @@ error: +@@ -564,7 +564,7 @@ error: static int uv__fs_closedir(uv_fs_t* req) { uv_dir_t* dir; @@ -371,7 +371,7 @@ index 891306daedcc6a9b493bdfefcdb7d43c7efbb622..bc00c90b07a32a823412b216df6f2d75 if (dir->dir != NULL) { closedir(dir->dir); -@@ -591,7 +591,7 @@ static int uv__fs_statfs(uv_fs_t* req) { +@@ -593,7 +593,7 @@ static int uv__fs_statfs(uv_fs_t* req) { #endif /* defined(__sun) */ return -1; @@ -380,7 +380,7 @@ index 891306daedcc6a9b493bdfefcdb7d43c7efbb622..bc00c90b07a32a823412b216df6f2d75 if (stat_fs == NULL) { errno = ENOMEM; return -1; -@@ -655,7 +655,7 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) { +@@ -657,7 +657,7 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) { maxlen = uv__fs_pathmax_size(req->path); #endif @@ -389,7 +389,7 @@ index 891306daedcc6a9b493bdfefcdb7d43c7efbb622..bc00c90b07a32a823412b216df6f2d75 if (buf == NULL) { errno = ENOMEM; -@@ -675,7 +675,7 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) { +@@ -677,7 +677,7 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) { /* Uncommon case: resize to make room for the trailing nul byte. */ if (len == maxlen) { @@ -398,7 +398,7 @@ index 891306daedcc6a9b493bdfefcdb7d43c7efbb622..bc00c90b07a32a823412b216df6f2d75 if (buf == NULL) return -1; -@@ -698,7 +698,7 @@ static ssize_t uv__fs_realpath(uv_fs_t* req) { +@@ -700,7 +700,7 @@ static ssize_t uv__fs_realpath(uv_fs_t* req) { ssize_t len; len = uv__fs_pathmax_size(req->path); @@ -407,7 +407,7 @@ index 891306daedcc6a9b493bdfefcdb7d43c7efbb622..bc00c90b07a32a823412b216df6f2d75 if (buf == NULL) { errno = ENOMEM; -@@ -1886,7 +1886,7 @@ int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, +@@ -1898,7 +1898,7 @@ int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, req->bufs = req->bufsml; if (nbufs > ARRAY_SIZE(req->bufsml)) @@ -416,7 +416,7 @@ index 891306daedcc6a9b493bdfefcdb7d43c7efbb622..bc00c90b07a32a823412b216df6f2d75 if (req->bufs == NULL) return UV_ENOMEM; -@@ -2071,7 +2071,7 @@ int uv_fs_write(uv_loop_t* loop, +@@ -2083,7 +2083,7 @@ int uv_fs_write(uv_loop_t* loop, req->nbufs = nbufs; req->bufs = req->bufsml; if (nbufs > ARRAY_SIZE(req->bufsml)) @@ -603,7 +603,7 @@ index 837bba6e2fef7b834a8d104d263bef47eaed0950..5e0fa98d104428534e5264a1c6358e3f return UV_ENOMEM; } diff --git a/src/unix/kqueue.c b/src/unix/kqueue.c -index 94ace58680cf391707f68357d7927173cb1db08e..06fbdb24b4adc4adb781d32150d40836fa745531 100644 +index 4d09edc06a0972a32ef66a91100404d95e006e60..c307e6631eefb1effb0e0c304eb400e0cb8d984e 100644 --- a/src/unix/kqueue.c +++ b/src/unix/kqueue.c @@ -303,8 +303,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { @@ -627,10 +627,10 @@ index 94ace58680cf391707f68357d7927173cb1db08e..06fbdb24b4adc4adb781d32150d40836 if (w == NULL) { /* File descriptor that we've stopped watching, disarm it. */ diff --git a/src/unix/linux.c b/src/unix/linux.c -index 8eeb352e6238a9e9557ec4dfc71f192105135cd7..2b8e1d8fe593a181d049aa50ff9edaf6da258a24 100644 +index 4164e90dbb0a39457d565a35be2d7890f66a7d71..09b02cd5df6c32a954cbed817111cf3c1874c3db 100644 --- a/src/unix/linux.c +++ b/src/unix/linux.c -@@ -518,8 +518,8 @@ static void uv__iou_init(int epollfd, +@@ -514,8 +514,8 @@ static void uv__iou_init(int epollfd, char* sqe; int ringfd; @@ -641,7 +641,7 @@ index 8eeb352e6238a9e9557ec4dfc71f192105135cd7..2b8e1d8fe593a181d049aa50ff9edaf6 if (!uv__use_io_uring()) return; -@@ -558,14 +558,14 @@ static void uv__iou_init(int epollfd, +@@ -554,14 +554,14 @@ static void uv__iou_init(int epollfd, maxlen = sqlen < cqlen ? cqlen : sqlen; sqelen = params.sq_entries * sizeof(struct uv__io_uring_sqe); @@ -658,7 +658,7 @@ index 8eeb352e6238a9e9557ec4dfc71f192105135cd7..2b8e1d8fe593a181d049aa50ff9edaf6 sqelen, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, -@@ -705,7 +705,7 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) { +@@ -701,7 +701,7 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) { int i; lfields = uv__get_internal_fields(loop); @@ -667,7 +667,7 @@ index 8eeb352e6238a9e9557ec4dfc71f192105135cd7..2b8e1d8fe593a181d049aa50ff9edaf6 /* Invalidate events with same file descriptor */ if (inv != NULL) -@@ -780,7 +780,7 @@ static struct uv__io_uring_sqe* uv__iou_get_sqe(struct uv__iou* iou, +@@ -776,7 +776,7 @@ static struct uv__io_uring_sqe* uv__iou_get_sqe(struct uv__iou* iou, return NULL; /* No room in ring buffer. TODO(bnoordhuis) maybe flush it? */ slot = tail & mask; @@ -676,7 +676,7 @@ index 8eeb352e6238a9e9557ec4dfc71f192105135cd7..2b8e1d8fe593a181d049aa50ff9edaf6 sqe = &sqe[slot]; memset(sqe, 0, sizeof(*sqe)); sqe->user_data = (uintptr_t) req; -@@ -1057,7 +1057,7 @@ int uv__iou_fs_statx(uv_loop_t* loop, +@@ -1053,7 +1053,7 @@ int uv__iou_fs_statx(uv_loop_t* loop, struct uv__statx* statxbuf; struct uv__iou* iou; @@ -685,7 +685,7 @@ index 8eeb352e6238a9e9557ec4dfc71f192105135cd7..2b8e1d8fe593a181d049aa50ff9edaf6 if (statxbuf == NULL) return 0; -@@ -1121,7 +1121,7 @@ static void uv__iou_fs_statx_post(uv_fs_t* req) { +@@ -1117,7 +1117,7 @@ static void uv__iou_fs_statx_post(uv_fs_t* req) { uv_stat_t* buf; buf = &req->statbuf; @@ -694,7 +694,7 @@ index 8eeb352e6238a9e9557ec4dfc71f192105135cd7..2b8e1d8fe593a181d049aa50ff9edaf6 req->ptr = NULL; if (req->result == 0) { -@@ -1150,7 +1150,7 @@ static void uv__poll_io_uring(uv_loop_t* loop, struct uv__iou* iou) { +@@ -1146,7 +1146,7 @@ static void uv__poll_io_uring(uv_loop_t* loop, struct uv__iou* iou) { tail = atomic_load_explicit((_Atomic uint32_t*) iou->cqtail, memory_order_acquire); mask = iou->cqmask; @@ -703,7 +703,7 @@ index 8eeb352e6238a9e9557ec4dfc71f192105135cd7..2b8e1d8fe593a181d049aa50ff9edaf6 nevents = 0; for (i = head; i != tail; i++) { -@@ -1241,7 +1241,7 @@ static void uv__epoll_ctl_prep(int epollfd, +@@ -1243,7 +1243,7 @@ static void uv__epoll_ctl_prep(int epollfd, pe = &(*events)[slot]; *pe = *e; @@ -712,7 +712,7 @@ index 8eeb352e6238a9e9557ec4dfc71f192105135cd7..2b8e1d8fe593a181d049aa50ff9edaf6 sqe = &sqe[slot]; memset(sqe, 0, sizeof(*sqe)); -@@ -1297,7 +1297,7 @@ static void uv__epoll_ctl_flush(int epollfd, +@@ -1299,7 +1299,7 @@ static void uv__epoll_ctl_flush(int epollfd, while (*ctl->cqhead != *ctl->cqtail) { slot = (*ctl->cqhead)++ & ctl->cqmask; @@ -721,7 +721,7 @@ index 8eeb352e6238a9e9557ec4dfc71f192105135cd7..2b8e1d8fe593a181d049aa50ff9edaf6 cqe = &cqe[slot]; if (cqe->res == 0) -@@ -1758,7 +1758,7 @@ int uv_cpu_info(uv_cpu_info_t** ci, int* count) { +@@ -1760,7 +1760,7 @@ int uv_cpu_info(uv_cpu_info_t** ci, int* count) { snprintf(*models, sizeof(*models), "unknown"); maxcpu = 0; @@ -730,7 +730,7 @@ index 8eeb352e6238a9e9557ec4dfc71f192105135cd7..2b8e1d8fe593a181d049aa50ff9edaf6 if (cpus == NULL) return UV_ENOMEM; -@@ -1816,9 +1816,9 @@ int uv_cpu_info(uv_cpu_info_t** ci, int* count) { +@@ -1818,9 +1818,9 @@ int uv_cpu_info(uv_cpu_info_t** ci, int* count) { /* arm64: translate CPU part code to model name. */ if (*parts) { @@ -742,7 +742,7 @@ index 8eeb352e6238a9e9557ec4dfc71f192105135cd7..2b8e1d8fe593a181d049aa50ff9edaf6 else p += n + 1; n = (int) strcspn(p, "\n"); -@@ -1868,7 +1868,7 @@ nocpuinfo: +@@ -1870,7 +1870,7 @@ nocpuinfo: } size = n * sizeof(**ci) + sizeof(models); @@ -751,7 +751,7 @@ index 8eeb352e6238a9e9557ec4dfc71f192105135cd7..2b8e1d8fe593a181d049aa50ff9edaf6 *count = 0; if (*ci == NULL) { -@@ -1877,7 +1877,7 @@ nocpuinfo: +@@ -1879,7 +1879,7 @@ nocpuinfo: } *count = n; @@ -760,7 +760,7 @@ index 8eeb352e6238a9e9557ec4dfc71f192105135cd7..2b8e1d8fe593a181d049aa50ff9edaf6 i = 0; for (cpu = 0; cpu < maxcpu; cpu++) { -@@ -1886,19 +1886,19 @@ nocpuinfo: +@@ -1888,19 +1888,19 @@ nocpuinfo: c = *cpus + cpu; @@ -784,7 +784,7 @@ index 8eeb352e6238a9e9557ec4dfc71f192105135cd7..2b8e1d8fe593a181d049aa50ff9edaf6 }; } -@@ -1955,7 +1955,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { +@@ -1950,7 +1950,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { } /* Make sure the memory is initiallized to zero using calloc() */ @@ -793,7 +793,7 @@ index 8eeb352e6238a9e9557ec4dfc71f192105135cd7..2b8e1d8fe593a181d049aa50ff9edaf6 if (!(*addresses)) { freeifaddrs(addrs); return UV_ENOMEM; -@@ -2523,12 +2523,12 @@ int uv_fs_event_start(uv_fs_event_t* handle, +@@ -2517,12 +2517,12 @@ int uv_fs_event_start(uv_fs_event_t* handle, goto no_insert; len = strlen(path) + 1; @@ -865,10 +865,19 @@ index 9c863b6c90dad9864cb8341c2b6203c1390a9487..2aa61e2ee3321d91ba84887c7ed6dcfa return UV_ENOMEM; diff --git a/src/unix/pipe.c b/src/unix/pipe.c -index d332f3518303d6ef1dee1d835c392bb60b935bad..a60b1a0e442bb3c482575da117f30e9f119f55d3 100644 +index fca364426f809e2085a3e6c4d984cfb88de548d3..ea26ce45c9b4c298528ab45cd4e8a21917f4be0e 100644 --- a/src/unix/pipe.c +++ b/src/unix/pipe.c -@@ -377,7 +377,7 @@ int uv_pipe_pending_count(uv_pipe_t* handle) { +@@ -104,7 +104,7 @@ int uv_pipe_bind2(uv_pipe_t* handle, + if (*name == '\0') { + addrlen = offsetof(struct sockaddr_un, sun_path) + namelen; + } else { +- pipe_fname = uv__malloc(namelen + 1); ++ pipe_fname = (char*)uv__malloc(namelen + 1); + if (pipe_fname == NULL) + return UV_ENOMEM; + memcpy(pipe_fname, name, namelen); +@@ -410,7 +410,7 @@ int uv_pipe_pending_count(uv_pipe_t* handle) { if (handle->queued_fds == NULL) return 1; @@ -877,7 +886,7 @@ index d332f3518303d6ef1dee1d835c392bb60b935bad..a60b1a0e442bb3c482575da117f30e9f return queued_fds->offset + 1; } -@@ -414,7 +414,7 @@ int uv_pipe_chmod(uv_pipe_t* handle, int mode) { +@@ -447,7 +447,7 @@ int uv_pipe_chmod(uv_pipe_t* handle, int mode) { if (r != UV_ENOBUFS) return r; @@ -922,7 +931,7 @@ index 2e016c2fbaed2eeccd78080969a86aff821a4251..b71eee3f01a3f30b3b5efef539194139 abort(); diff --git a/src/unix/process.c b/src/unix/process.c -index dd58c18d9b9359fca1a924698c39bd6390dafbe0..2d622c956de6d7b6f8a04be3ecd311f39602b241 100644 +index 4812a90f2f5047fc18ddb9b6f70e3f380641ddde..8271d513b15588a3a73401cc2df3be160940ab10 100644 --- a/src/unix/process.c +++ b/src/unix/process.c @@ -423,7 +423,7 @@ static int posix_spawn_can_use_setsid; @@ -934,7 +943,7 @@ index dd58c18d9b9359fca1a924698c39bd6390dafbe0..2d622c956de6d7b6f8a04be3ecd311f3 } -@@ -988,7 +988,7 @@ int uv_spawn(uv_loop_t* loop, +@@ -989,7 +989,7 @@ int uv_spawn(uv_loop_t* loop, err = UV_ENOMEM; pipes = pipes_storage; if (stdio_count > (int) ARRAY_SIZE(pipes_storage)) @@ -1077,10 +1086,10 @@ index 28c4d5463c4622725a433b8807e5e7bde580dadd..265ddade7aec129eb9dbf07cde2a16a0 uv__close(queued_fds->fds[i]); uv__free(handle->queued_fds); diff --git a/src/unix/tcp.c b/src/unix/tcp.c -index a6b53e5913271d0c83e1d7f7e4cb8140f5f3936d..4c4213a4241b51d245146f1a37a371448d57b3b8 100644 +index 799fca77aa53920e86c128336f19903f522c3b6a..6fe6361c81e39133b605edfedd88da840ba9ba20 100644 --- a/src/unix/tcp.c +++ b/src/unix/tcp.c -@@ -274,7 +274,7 @@ int uv__tcp_connect(uv_connect_t* req, +@@ -295,7 +295,7 @@ int uv__tcp_connect(uv_connect_t* req, memcpy(&tmp6, addr, sizeof(tmp6)); if (tmp6.sin6_scope_id == 0) { tmp6.sin6_scope_id = uv__ipv6_link_local_scope_id(); @@ -1262,7 +1271,7 @@ index 7880c9595be1f66ea0dcbdbcc4a91ce40577587f..d88400f0e819d74998e13f60f13c67a6 lib->handle = LoadLibraryExW(filename_w, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (lib->handle == NULL) { diff --git a/src/win/fs-event.c b/src/win/fs-event.c -index 4a0ca1f70a22b6342e208124838d6ecf3173f1a8..5a07acfe54efe90cf2ab0bca5b5998a961e72ebd 100644 +index fce411813e937018f636aefd6b8c172eebc7532b..dba981c68821ece88e0beb80422b214b77e84b79 100644 --- a/src/win/fs-event.c +++ b/src/win/fs-event.c @@ -73,7 +73,7 @@ static void uv__relative_path(const WCHAR* filename, @@ -1297,7 +1306,7 @@ index 0b532af12d4371c2311bd50a66913287a0716f43..703a8d8f87de1089ac8b18bd817d416d uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); } diff --git a/src/win/fs.c b/src/win/fs.c -index 99c8a2bf8bf1244f0db7114c1eaa8bff22564996..d9c2a4f728c7fb491995c6153b2a63a835b206b7 100644 +index b73c17d8c1c831c29aef6454cb0525bb0b951071..7e2367e8c1c6ad96af55a2cc370142104cc0de77 100644 --- a/src/win/fs.c +++ b/src/win/fs.c @@ -280,7 +280,7 @@ INLINE static int fs__readlink_handle(HANDLE handle, @@ -1514,10 +1523,28 @@ index 8b8406ada8e7434e291b2e50caf4ed7f36613fa0..5bc63d8e19411b967a2acf5c24b34b9b } else { req->service = NULL; diff --git a/src/win/pipe.c b/src/win/pipe.c -index cec72ff750b5a17e139fd85080ccbdfc3c71d8c0..0f045a873073cf9b07feb457ea199990df521e5f 100644 +index 3c8abe1c28ce369dc9fbc91936f6a97b0c178fdc..27868221455dcbb90c00066fd8b716d2c0a4d371 100644 --- a/src/win/pipe.c +++ b/src/win/pipe.c -@@ -899,7 +899,7 @@ int uv_pipe_connect2(uv_connect_t* req, +@@ -739,7 +739,7 @@ int uv_pipe_bind2(uv_pipe_t* handle, + return UV_EINVAL; + } + +- name_copy = uv__malloc(namelen + 1); ++ name_copy = (char*)uv__malloc(namelen + 1); + if (name_copy == NULL) { + return UV_ENOMEM; + } +@@ -910,7 +910,7 @@ int uv_pipe_connect2(uv_connect_t* req, + return UV_EINVAL; + } + +- name_copy = uv__malloc(namelen + 1); ++ name_copy = (char*)uv__malloc(namelen + 1); + if (name_copy == NULL) { + return UV_ENOMEM; + } +@@ -942,7 +942,7 @@ int uv_pipe_connect2(uv_connect_t* req, if (pipeHandle == INVALID_HANDLE_VALUE) { if (GetLastError() == ERROR_PIPE_BUSY) { nameSize = (wcslen(handle->name) + 1) * sizeof(WCHAR); @@ -1526,7 +1553,7 @@ index cec72ff750b5a17e139fd85080ccbdfc3c71d8c0..0f045a873073cf9b07feb457ea199990 if (!req->u.connect.name) { uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc"); } -@@ -1503,7 +1503,7 @@ static int uv__build_coalesced_write_req(uv_write_t* user_req, +@@ -1548,7 +1548,7 @@ static int uv__build_coalesced_write_req(uv_write_t* user_req, data_length; /* (c) */ /* Allocate buffer. */ @@ -1535,7 +1562,7 @@ index cec72ff750b5a17e139fd85080ccbdfc3c71d8c0..0f045a873073cf9b07feb457ea199990 if (heap_buffer == NULL) return ERROR_NOT_ENOUGH_MEMORY; /* Maps to UV_ENOMEM. */ -@@ -1752,7 +1752,7 @@ int uv__pipe_write_ipc(uv_loop_t* loop, +@@ -1797,7 +1797,7 @@ int uv__pipe_write_ipc(uv_loop_t* loop, bufs = stack_bufs; } else { /* Use heap-allocated buffer array. */ @@ -1544,7 +1571,7 @@ index cec72ff750b5a17e139fd85080ccbdfc3c71d8c0..0f045a873073cf9b07feb457ea199990 if (bufs == NULL) return ERROR_NOT_ENOUGH_MEMORY; /* Maps to UV_ENOMEM. */ } -@@ -2449,7 +2449,7 @@ static int uv__pipe_getname(const uv_pipe_t* handle, char* buffer, size_t* size) +@@ -2494,7 +2494,7 @@ static int uv__pipe_getname(const uv_pipe_t* handle, char* buffer, size_t* size) FileNameInformation); if (nt_status == STATUS_BUFFER_OVERFLOW) { name_size = sizeof(*name_info) + tmp_name_info.FileNameLength; @@ -1554,10 +1581,10 @@ index cec72ff750b5a17e139fd85080ccbdfc3c71d8c0..0f045a873073cf9b07feb457ea199990 *size = 0; return UV_ENOMEM; diff --git a/src/win/process.c b/src/win/process.c -index 119b46cb3f37122395c172c6e9700d472a2173ed..0103004c565bb09b7b9c150e874f9c68486ab26c 100644 +index 4f0af83e83442bb905762361775abe05ab6beb4e..25f1075745267785cdd7d7de83d9c62750305852 100644 --- a/src/win/process.c +++ b/src/win/process.c -@@ -543,14 +543,14 @@ int make_program_args(char** args, int verbatim_arguments, WCHAR** dst_ptr) { +@@ -547,14 +547,14 @@ int make_program_args(char** args, int verbatim_arguments, WCHAR** dst_ptr) { dst_len = dst_len * 2 + arg_count * 2; /* Allocate buffer for the final command line. */ @@ -1574,7 +1601,7 @@ index 119b46cb3f37122395c172c6e9700d472a2173ed..0103004c565bb09b7b9c150e874f9c68 if (temp_buffer == NULL) { err = UV_ENOMEM; goto error; -@@ -564,7 +564,7 @@ int make_program_args(char** args, int verbatim_arguments, WCHAR** dst_ptr) { +@@ -568,7 +568,7 @@ int make_program_args(char** args, int verbatim_arguments, WCHAR** dst_ptr) { arg_len = uv_wtf8_length_as_utf16(*arg); assert(arg_len > 0); assert(temp_buffer_len >= (size_t) arg_len); @@ -1583,7 +1610,7 @@ index 119b46cb3f37122395c172c6e9700d472a2173ed..0103004c565bb09b7b9c150e874f9c68 if (verbatim_arguments) { /* Copy verbatim. */ -@@ -592,8 +592,8 @@ error: +@@ -596,8 +596,8 @@ error: int env_strncmp(const wchar_t* a, int na, const wchar_t* b) { @@ -1594,18 +1621,18 @@ index 119b46cb3f37122395c172c6e9700d472a2173ed..0103004c565bb09b7b9c150e874f9c68 wchar_t* A; wchar_t* B; int nb; -@@ -610,8 +610,8 @@ int env_strncmp(const wchar_t* a, int na, const wchar_t* b) { +@@ -614,8 +614,8 @@ int env_strncmp(const wchar_t* a, int na, const wchar_t* b) { assert(b_eq); nb = b_eq - b; -- A = alloca((na+1) * sizeof(wchar_t)); -- B = alloca((nb+1) * sizeof(wchar_t)); -+ A = (wchar_t*)alloca((na+1) * sizeof(wchar_t)); -+ B = (wchar_t*)alloca((nb+1) * sizeof(wchar_t)); +- A = _alloca((na+1) * sizeof(wchar_t)); +- B = _alloca((nb+1) * sizeof(wchar_t)); ++ A = (wchar_t*)_alloca((na+1) * sizeof(wchar_t)); ++ B = (wchar_t*)_alloca((nb+1) * sizeof(wchar_t)); r = LCMapStringW(LOCALE_INVARIANT, LCMAP_UPPERCASE, a, na, A, na); assert(r==na); -@@ -684,11 +684,11 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) { +@@ -688,11 +688,11 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) { } /* second pass: copy to UTF-16 environment block */ @@ -1614,12 +1641,12 @@ index 119b46cb3f37122395c172c6e9700d472a2173ed..0103004c565bb09b7b9c150e874f9c68 if (dst_copy == NULL && env_len > 0) { return UV_ENOMEM; } -- env_copy = alloca(env_block_count * sizeof(WCHAR*)); -+ env_copy = (WCHAR**)alloca(env_block_count * sizeof(WCHAR*)); +- env_copy = _alloca(env_block_count * sizeof(WCHAR*)); ++ env_copy = (WCHAR**)_alloca(env_block_count * sizeof(WCHAR*)); ptr = dst_copy; ptr_copy = env_copy; -@@ -698,7 +698,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) { +@@ -702,7 +702,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) { len = uv_wtf8_length_as_utf16(*env); assert(len > 0); assert((size_t) len <= env_len - (ptr - dst_copy)); @@ -1628,7 +1655,7 @@ index 119b46cb3f37122395c172c6e9700d472a2173ed..0103004c565bb09b7b9c150e874f9c68 *ptr_copy++ = ptr; ptr += len; } -@@ -736,7 +736,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) { +@@ -740,7 +740,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) { } /* final pass: copy, in sort order, and inserting required variables */ @@ -1673,7 +1700,7 @@ index 57c25e8f5a861c9d8a4c402c260d3ac235200423..57f1698f595e2410a51044f7f228b5a2 return UV_ENOMEM; diff --git a/src/win/tty.c b/src/win/tty.c -index ac836930d6f3a185d57ba59fb42c817496aa0fdf..3aacaaf0b514ba71755dc51f1bd7263de5cbc308 100644 +index 9f8dd698d761248a994e66c4039b35cb216f1d82..0b51b6c82fad711480c28ad6cee7125ddb72ca87 100644 --- a/src/win/tty.c +++ b/src/win/tty.c @@ -528,7 +528,7 @@ static DWORD CALLBACK uv_tty_line_read_thread(void* data) { @@ -1704,7 +1731,7 @@ index ac836930d6f3a185d57ba59fb42c817496aa0fdf..3aacaaf0b514ba71755dc51f1bd7263d &last_key_buf, &char_len)) diff --git a/src/win/util.c b/src/win/util.c -index 91d88a54fb24a613df45d7915c345b6764dd6ffd..5fbc70f52952f90b36fb22ee03ec7f70e6ed5954 100644 +index a96cb915930a30a49ba55fd7d15ea48f0b471f89..924d878e89260c2d3cf9a30b7151abeaf735b8be 100644 --- a/src/win/util.c +++ b/src/win/util.c @@ -124,7 +124,7 @@ int uv_exepath(char* buffer, size_t* size_ptr) { diff --git a/upstream_utils/libuv_patches/0003-Fix-warnings.patch b/upstream_utils/libuv_patches/0003-Fix-warnings.patch index 55cbb9f9ed..03d0127af3 100644 --- a/upstream_utils/libuv_patches/0003-Fix-warnings.patch +++ b/upstream_utils/libuv_patches/0003-Fix-warnings.patch @@ -21,7 +21,7 @@ Subject: [PATCH 03/10] Fix warnings 14 files changed, 47 insertions(+), 14 deletions(-) diff --git a/include/uv/win.h b/include/uv/win.h -index eb74776978340a4910194bae35a9da6493e8c0a6..6d0afe69e7dd4caf4c9459e548fe75cf0c51b501 100644 +index 518b17606c3b0c114845594e6be9c3c4d95f1776..9a8c990c1b182633f23890cb5f4532b6bee2b22c 100644 --- a/include/uv/win.h +++ b/include/uv/win.h @@ -201,11 +201,16 @@ typedef int (WSAAPI* LPFN_WSARECVFROM) @@ -42,7 +42,7 @@ index eb74776978340a4910194bae35a9da6493e8c0a6..6d0afe69e7dd4caf4c9459e548fe75cf typedef PVOID CONDITION_VARIABLE, *PCONDITION_VARIABLE; #endif diff --git a/src/idna.c b/src/idna.c -index 0c952cf605a88136ed9035f9385f9b1080c30c28..fe60fb59bea59986a612cfa1747802b0636482d9 100644 +index 765e12e8f2e030cffa9d498f381c0640aa43a647..17a0e7e74c0204c662594198c1f5b545534ee85e 100644 --- a/src/idna.c +++ b/src/idna.c @@ -153,7 +153,7 @@ static int uv__idna_toascii_label(const char* s, const char* se, @@ -54,7 +54,7 @@ index 0c952cf605a88136ed9035f9385f9b1080c30c28..fe60fb59bea59986a612cfa1747802b0 unsigned h; unsigned k; unsigned n; -@@ -382,7 +382,7 @@ ssize_t uv_wtf8_length_as_utf16(const char* source_ptr) { +@@ -386,7 +386,7 @@ ssize_t uv_wtf8_length_as_utf16(const char* source_ptr) { void uv_wtf8_to_utf16(const char* source_ptr, uint16_t* w_target, @@ -94,10 +94,10 @@ index f572de5aaf1a1b150e58c7b989949441cac279c4..aa282af468935b680140295a175e503c static uv_once_t once = UV_ONCE_INIT; diff --git a/src/unix/core.c b/src/unix/core.c -index 28c036f94f3e76717afa651451969f128c5a573c..268fc9652f437eb0d0cda2a9e0b06b9e91eb9742 100644 +index 8c08d607884335a2da5cb49f35e3108cb833da32..4bc870214afa1e08da2f7b335c031d67d221fdd6 100644 --- a/src/unix/core.c +++ b/src/unix/core.c -@@ -575,6 +575,16 @@ int uv__accept(int sockfd) { +@@ -576,6 +576,16 @@ int uv__accept(int sockfd) { return peerfd; } @@ -114,7 +114,7 @@ index 28c036f94f3e76717afa651451969f128c5a573c..268fc9652f437eb0d0cda2a9e0b06b9e /* close() on macos has the "interesting" quirk that it fails with EINTR * without closing the file descriptor when a thread is in the cancel state. -@@ -589,10 +599,8 @@ int uv__close_nocancel(int fd) { +@@ -590,10 +600,8 @@ int uv__close_nocancel(int fd) { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdollar-in-identifier-extension" #if defined(__LP64__) || TARGET_OS_IPHONE @@ -126,7 +126,7 @@ index 28c036f94f3e76717afa651451969f128c5a573c..268fc9652f437eb0d0cda2a9e0b06b9e #endif #pragma GCC diagnostic pop diff --git a/src/unix/internal.h b/src/unix/internal.h -index fe5885136039d5332623467b86bf52cd4b32ca0f..98c437dcadec5b5106d697e82d5394d459f55e47 100644 +index bcb3be577e584925d4bf4a20d2429ce13aad0584..4c167f5e529cb38a7418fc35dbbafc2a2cea626c 100644 --- a/src/unix/internal.h +++ b/src/unix/internal.h @@ -384,8 +384,8 @@ UV_UNUSED(static void uv__update_time(uv_loop_t* loop)) { @@ -184,7 +184,7 @@ index 69e95801a18104ea910abf86db236d85f62afb66..49126e50f07bac16d198775454b731f4 static uv_loop_t default_loop_struct; static uv_loop_t* default_loop_ptr; diff --git a/src/win/fs-event.c b/src/win/fs-event.c -index 5a07acfe54efe90cf2ab0bca5b5998a961e72ebd..381220bf241d9572ff64576cf25700d9746d2806 100644 +index dba981c68821ece88e0beb80422b214b77e84b79..2f566f796a55c68329d5aed19bd5bb392d0082fa 100644 --- a/src/win/fs-event.c +++ b/src/win/fs-event.c @@ -19,6 +19,8 @@ @@ -197,7 +197,7 @@ index 5a07acfe54efe90cf2ab0bca5b5998a961e72ebd..381220bf241d9572ff64576cf25700d9 #include #include diff --git a/src/win/fs.c b/src/win/fs.c -index d9c2a4f728c7fb491995c6153b2a63a835b206b7..7df1df2b9ba23c0ecb96e82a6cfcaae824826b69 100644 +index 7e2367e8c1c6ad96af55a2cc370142104cc0de77..b812293048e60264f3e849367b7a129c306f8502 100644 --- a/src/win/fs.c +++ b/src/win/fs.c @@ -19,6 +19,8 @@ @@ -210,7 +210,7 @@ index d9c2a4f728c7fb491995c6153b2a63a835b206b7..7df1df2b9ba23c0ecb96e82a6cfcaae8 #include #include diff --git a/src/win/pipe.c b/src/win/pipe.c -index 0f045a873073cf9b07feb457ea199990df521e5f..b2348bd0430aada98ff10313f6f926ea2f1c4491 100644 +index 27868221455dcbb90c00066fd8b716d2c0a4d371..d747dc72362a0b21077fa7b9beb57234ca62baad 100644 --- a/src/win/pipe.c +++ b/src/win/pipe.c @@ -19,6 +19,8 @@ @@ -223,7 +223,7 @@ index 0f045a873073cf9b07feb457ea199990df521e5f..b2348bd0430aada98ff10313f6f926ea #include #include diff --git a/src/win/process.c b/src/win/process.c -index 0103004c565bb09b7b9c150e874f9c68486ab26c..eeb0f6a984bb0f61b956cb4b907fbfdb3b4ac7e2 100644 +index 25f1075745267785cdd7d7de83d9c62750305852..e4bf93d707da3d22b747300775e8c96a34039ddb 100644 --- a/src/win/process.c +++ b/src/win/process.c @@ -19,6 +19,8 @@ @@ -251,7 +251,7 @@ index 57f1698f595e2410a51044f7f228b5a235206819..03b33e9b4de6fe2532095d717a8639e8 return UV_EINVAL; } diff --git a/src/win/tty.c b/src/win/tty.c -index 3aacaaf0b514ba71755dc51f1bd7263de5cbc308..c90995afb6166a7cab0a267f5eb513705ce05148 100644 +index 0b51b6c82fad711480c28ad6cee7125ddb72ca87..67df01396ab50260b986fc9e7aff0368f6ceb308 100644 --- a/src/win/tty.c +++ b/src/win/tty.c @@ -19,6 +19,8 @@ diff --git a/upstream_utils/libuv_patches/0004-Preprocessor-cleanup.patch b/upstream_utils/libuv_patches/0004-Preprocessor-cleanup.patch index d5aa3e2f1b..7d7a6c89e4 100644 --- a/upstream_utils/libuv_patches/0004-Preprocessor-cleanup.patch +++ b/upstream_utils/libuv_patches/0004-Preprocessor-cleanup.patch @@ -14,7 +14,7 @@ Subject: [PATCH 04/10] Preprocessor cleanup 7 files changed, 14 insertions(+), 20 deletions(-) diff --git a/include/uv.h b/include/uv.h -index 5642101c10c351a602a195d3b74027b53bf641d2..aff06cb7f4352eb4fcf93c938f09a789318bddc3 100644 +index a62b3fa69b1087847f37c7093954e19a07959b74..931c96262b33090422cc1f6c519f8eb4bfc4f9b3 100644 --- a/include/uv.h +++ b/include/uv.h @@ -23,9 +23,6 @@ @@ -44,7 +44,7 @@ index 5642101c10c351a602a195d3b74027b53bf641d2..aff06cb7f4352eb4fcf93c938f09a789 UV_EXTERN uv_handle_type uv_guess_handle(uv_file file); enum { -@@ -1918,7 +1909,4 @@ void uv_wtf8_to_utf16(const char* wtf8, +@@ -1936,7 +1927,4 @@ void uv_wtf8_to_utf16(const char* wtf8, #undef UV_LOOP_PRIVATE_PLATFORM_FIELDS #undef UV__ERR @@ -53,7 +53,7 @@ index 5642101c10c351a602a195d3b74027b53bf641d2..aff06cb7f4352eb4fcf93c938f09a789 -#endif #endif /* UV_H */ diff --git a/include/uv/unix.h b/include/uv/unix.h -index 09f88a5674280d762c094d956e5dec6971c6a33e..e334cabe0280ef94bacbb1171049c71f17bf56ff 100644 +index 538f98b6c5d657169e2750a549dd82bf0b948542..2073fe61a569386cc850d733a6c94cbb77a0a369 100644 --- a/include/uv/unix.h +++ b/include/uv/unix.h @@ -47,14 +47,6 @@ @@ -72,7 +72,7 @@ index 09f88a5674280d762c094d956e5dec6971c6a33e..e334cabe0280ef94bacbb1171049c71f # include "uv/darwin.h" #elif defined(__DragonFly__) || \ diff --git a/src/unix/internal.h b/src/unix/internal.h -index 98c437dcadec5b5106d697e82d5394d459f55e47..854d98a16a74c45e0b6cb92b17782de6803f6e28 100644 +index 4c167f5e529cb38a7418fc35dbbafc2a2cea626c..35ac6d1f6da75522d4bd69dcde696a8d0fd42bce 100644 --- a/src/unix/internal.h +++ b/src/unix/internal.h @@ -233,6 +233,8 @@ struct uv__statx { @@ -85,7 +85,7 @@ index 98c437dcadec5b5106d697e82d5394d459f55e47..854d98a16a74c45e0b6cb92b17782de6 /* core */ diff --git a/src/win/fs.c b/src/win/fs.c -index 7df1df2b9ba23c0ecb96e82a6cfcaae824826b69..26ba539936786902af5830c2811594292815d2d7 100644 +index b812293048e60264f3e849367b7a129c306f8502..05488e5d67101adba611f882ded4f6dc5a462d9a 100644 --- a/src/win/fs.c +++ b/src/win/fs.c @@ -43,6 +43,7 @@ @@ -97,7 +97,7 @@ index 7df1df2b9ba23c0ecb96e82a6cfcaae824826b69..26ba539936786902af5830c281159429 #define UV_FS_FREE_PATHS 0x0002 #define UV_FS_FREE_PTR 0x0008 diff --git a/src/win/tty.c b/src/win/tty.c -index c90995afb6166a7cab0a267f5eb513705ce05148..7adf3cd3ba81a9c41064f4ef2af01667092f27d1 100644 +index 67df01396ab50260b986fc9e7aff0368f6ceb308..7294f311e17d5d02e5873e60f8f0cdd551f6d34d 100644 --- a/src/win/tty.c +++ b/src/win/tty.c @@ -37,6 +37,8 @@ @@ -110,7 +110,7 @@ index c90995afb6166a7cab0a267f5eb513705ce05148..7adf3cd3ba81a9c41064f4ef2af01667 # define InterlockedOr _InterlockedOr #endif diff --git a/src/win/util.c b/src/win/util.c -index 5fbc70f52952f90b36fb22ee03ec7f70e6ed5954..f505cfad4987768fa6470ca27612312c2ba0729d 100644 +index 924d878e89260c2d3cf9a30b7151abeaf735b8be..5767c66c988c67edaf17155d5cb299a1936870ee 100644 --- a/src/win/util.c +++ b/src/win/util.c @@ -64,12 +64,20 @@ diff --git a/upstream_utils/libuv_patches/0006-Fix-Win32-warning-suppression-pragma.patch b/upstream_utils/libuv_patches/0006-Fix-Win32-warning-suppression-pragma.patch index eaf0cb3942..90355bb98d 100644 --- a/upstream_utils/libuv_patches/0006-Fix-Win32-warning-suppression-pragma.patch +++ b/upstream_utils/libuv_patches/0006-Fix-Win32-warning-suppression-pragma.patch @@ -8,10 +8,10 @@ Subject: [PATCH 06/10] Fix Win32 warning suppression pragma 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/win/util.c b/src/win/util.c -index f505cfad4987768fa6470ca27612312c2ba0729d..8828857db76a54d6e184c7f5714a091e92eba8ed 100644 +index 5767c66c988c67edaf17155d5cb299a1936870ee..52c31979589e4ed7fe12af200f7e8daab9e02797 100644 --- a/src/win/util.c +++ b/src/win/util.c -@@ -1502,7 +1502,7 @@ int uv_os_uname(uv_utsname_t* buffer) { +@@ -1544,7 +1544,7 @@ int uv_os_uname(uv_utsname_t* buffer) { } else { /* Silence GetVersionEx() deprecation warning. */ #ifdef _MSC_VER diff --git a/upstream_utils/libuv_patches/0007-Use-C-atomics.patch b/upstream_utils/libuv_patches/0007-Use-C-atomics.patch index f8df99a94b..26b488bb68 100644 --- a/upstream_utils/libuv_patches/0007-Use-C-atomics.patch +++ b/upstream_utils/libuv_patches/0007-Use-C-atomics.patch @@ -91,7 +91,7 @@ index 0ff2669e30a628dbb2df9e28ba14b38cf14114e5..fef4ae93343edc0341179a1c4739dcd8 continue; diff --git a/src/unix/core.c b/src/unix/core.c -index 268fc9652f437eb0d0cda2a9e0b06b9e91eb9742..1a52716792d2dbbb71a4ebdd2255173b7447979b 100644 +index 4bc870214afa1e08da2f7b335c031d67d221fdd6..f13ffd1714af26dede3d4d5f6f01efa39fc78959 100644 --- a/src/unix/core.c +++ b/src/unix/core.c @@ -45,6 +45,7 @@ @@ -102,7 +102,7 @@ index 268fc9652f437eb0d0cda2a9e0b06b9e91eb9742..1a52716792d2dbbb71a4ebdd2255173b #ifdef __sun # include -@@ -263,7 +264,7 @@ int uv__getiovmax(void) { +@@ -264,7 +265,7 @@ int uv__getiovmax(void) { #if defined(IOV_MAX) return IOV_MAX; #elif defined(_SC_IOV_MAX) @@ -112,7 +112,7 @@ index 268fc9652f437eb0d0cda2a9e0b06b9e91eb9742..1a52716792d2dbbb71a4ebdd2255173b iovmax = atomic_load_explicit(&iovmax_cached, memory_order_relaxed); diff --git a/src/unix/fs.c b/src/unix/fs.c -index bc00c90b07a32a823412b216df6f2d758dbc423b..afdf0c6e592c69961b1286a87b61e62601331763 100644 +index 22f31f7285c995c981aca0fa5125bc70aeedc151..75c3093cb7cd6998637c31348265e9299404f91f 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c @@ -45,6 +45,8 @@ @@ -124,7 +124,7 @@ index bc00c90b07a32a823412b216df6f2d758dbc423b..afdf0c6e592c69961b1286a87b61e626 #if defined(__linux__) # include #endif -@@ -307,7 +309,7 @@ static int uv__fs_mkstemp(uv_fs_t* req) { +@@ -309,7 +311,7 @@ static int uv__fs_mkstemp(uv_fs_t* req) { static uv_once_t once = UV_ONCE_INIT; int r; #ifdef O_CLOEXEC @@ -133,7 +133,7 @@ index bc00c90b07a32a823412b216df6f2d758dbc423b..afdf0c6e592c69961b1286a87b61e626 #endif static const char pattern[] = "XXXXXX"; static const size_t pattern_size = sizeof(pattern) - 1; -@@ -332,7 +334,7 @@ static int uv__fs_mkstemp(uv_fs_t* req) { +@@ -334,7 +336,7 @@ static int uv__fs_mkstemp(uv_fs_t* req) { uv_once(&once, uv__mkostemp_initonce); #ifdef O_CLOEXEC @@ -142,7 +142,7 @@ index bc00c90b07a32a823412b216df6f2d758dbc423b..afdf0c6e592c69961b1286a87b61e626 uv__mkostemp != NULL) { r = uv__mkostemp(path, O_CLOEXEC); -@@ -346,7 +348,7 @@ static int uv__fs_mkstemp(uv_fs_t* req) { +@@ -348,7 +350,7 @@ static int uv__fs_mkstemp(uv_fs_t* req) { /* We set the static variable so that next calls don't even try to use mkostemp. */ @@ -151,7 +151,7 @@ index bc00c90b07a32a823412b216df6f2d758dbc423b..afdf0c6e592c69961b1286a87b61e626 } #endif /* O_CLOEXEC */ -@@ -867,10 +869,10 @@ static int uv__is_cifs_or_smb(int fd) { +@@ -869,10 +871,10 @@ static int uv__is_cifs_or_smb(int fd) { static ssize_t uv__fs_try_copy_file_range(int in_fd, off_t* off, int out_fd, size_t len) { @@ -164,7 +164,7 @@ index bc00c90b07a32a823412b216df6f2d758dbc423b..afdf0c6e592c69961b1286a87b61e626 errno = ENOSYS; return -1; } -@@ -889,7 +891,7 @@ static ssize_t uv__fs_try_copy_file_range(int in_fd, off_t* off, +@@ -891,7 +893,7 @@ static ssize_t uv__fs_try_copy_file_range(int in_fd, off_t* off, errno = ENOSYS; /* Use fallback. */ break; case ENOSYS: @@ -173,7 +173,7 @@ index bc00c90b07a32a823412b216df6f2d758dbc423b..afdf0c6e592c69961b1286a87b61e626 break; case EPERM: /* It's been reported that CIFS spuriously fails. -@@ -1380,14 +1382,14 @@ static int uv__fs_statx(int fd, +@@ -1382,14 +1384,14 @@ static int uv__fs_statx(int fd, uv_stat_t* buf) { STATIC_ASSERT(UV_ENOSYS != -1); #ifdef __linux__ @@ -190,7 +190,7 @@ index bc00c90b07a32a823412b216df6f2d758dbc423b..afdf0c6e592c69961b1286a87b61e626 return UV_ENOSYS; dirfd = AT_FDCWD; -@@ -1421,7 +1423,7 @@ static int uv__fs_statx(int fd, +@@ -1423,7 +1425,7 @@ static int uv__fs_statx(int fd, * implemented, rc might return 1 with 0 set as the error code in which * case we return ENOSYS. */ @@ -200,7 +200,7 @@ index bc00c90b07a32a823412b216df6f2d758dbc423b..afdf0c6e592c69961b1286a87b61e626 } diff --git a/src/unix/kqueue.c b/src/unix/kqueue.c -index 06fbdb24b4adc4adb781d32150d40836fa745531..939a42696778741f9184be29dcea7c858736d181 100644 +index c307e6631eefb1effb0e0c304eb400e0cb8d984e..bd09ac39dda916dd5a7d664979ce5735586fd7e3 100644 --- a/src/unix/kqueue.c +++ b/src/unix/kqueue.c @@ -37,6 +37,8 @@ @@ -230,7 +230,7 @@ index 06fbdb24b4adc4adb781d32150d40836fa745531..939a42696778741f9184be29dcea7c85 uv__free(loop->cf_state); loop->cf_state = NULL; } -@@ -555,7 +557,7 @@ int uv_fs_event_start(uv_fs_event_t* handle, +@@ -565,7 +567,7 @@ int uv_fs_event_start(uv_fs_event_t* handle, goto fallback; if (0 == atomic_load_explicit(&uv__has_forked_with_cfrunloop, @@ -239,7 +239,7 @@ index 06fbdb24b4adc4adb781d32150d40836fa745531..939a42696778741f9184be29dcea7c85 int r; /* The fallback fd is no longer needed */ uv__close_nocheckstdio(fd); -@@ -591,7 +593,7 @@ int uv_fs_event_stop(uv_fs_event_t* handle) { +@@ -601,7 +603,7 @@ int uv_fs_event_stop(uv_fs_event_t* handle) { #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 if (0 == atomic_load_explicit(&uv__has_forked_with_cfrunloop, @@ -249,7 +249,7 @@ index 06fbdb24b4adc4adb781d32150d40836fa745531..939a42696778741f9184be29dcea7c85 r = uv__fsevents_close(handle); #endif diff --git a/src/unix/linux.c b/src/unix/linux.c -index 2b8e1d8fe593a181d049aa50ff9edaf6da258a24..b23d88bd824843eebc3b439e5a18e6f796a747be 100644 +index 09b02cd5df6c32a954cbed817111cf3c1874c3db..e0c4902385edac10ac31bc5075a85a45025615f9 100644 --- a/src/unix/linux.c +++ b/src/unix/linux.c @@ -27,7 +27,6 @@ @@ -260,16 +260,16 @@ index 2b8e1d8fe593a181d049aa50ff9edaf6da258a24..b23d88bd824843eebc3b439e5a18e6f7 #include /* offsetof */ #include #include -@@ -139,6 +138,8 @@ - # include - #endif /* HAVE_IFADDRS_H */ +@@ -124,6 +123,8 @@ + # endif + #endif /* __NR_getrandom */ +#include + enum { UV__IORING_SETUP_SQPOLL = 2u, }; -@@ -317,7 +318,7 @@ static struct watcher_root* uv__inotify_watchers(uv_loop_t* loop) { +@@ -302,7 +303,7 @@ static struct watcher_root* uv__inotify_watchers(uv_loop_t* loop) { unsigned uv__kernel_version(void) { @@ -278,7 +278,7 @@ index 2b8e1d8fe593a181d049aa50ff9edaf6da258a24..b23d88bd824843eebc3b439e5a18e6f7 struct utsname u; unsigned version; unsigned major; -@@ -326,7 +327,7 @@ unsigned uv__kernel_version(void) { +@@ -311,7 +312,7 @@ unsigned uv__kernel_version(void) { char v_sig[256]; char* needle; @@ -287,7 +287,7 @@ index 2b8e1d8fe593a181d049aa50ff9edaf6da258a24..b23d88bd824843eebc3b439e5a18e6f7 if (version != 0) return version; -@@ -382,7 +383,7 @@ unsigned uv__kernel_version(void) { +@@ -367,7 +368,7 @@ unsigned uv__kernel_version(void) { calculate_version: version = major * 65536 + minor * 256 + patch; @@ -296,8 +296,8 @@ index 2b8e1d8fe593a181d049aa50ff9edaf6da258a24..b23d88bd824843eebc3b439e5a18e6f7 return version; } -@@ -480,11 +481,11 @@ static int uv__use_io_uring(void) { - return 0; /* All 32 bits kernels appear buggy. */ +@@ -468,11 +469,11 @@ static int uv__use_io_uring(void) { + return 0; /* Random SIGSEGV in signal handler. */ #else /* Ternary: unknown=0, yes=1, no=-1 */ - static _Atomic int use_io_uring; @@ -309,8 +309,8 @@ index 2b8e1d8fe593a181d049aa50ff9edaf6da258a24..b23d88bd824843eebc3b439e5a18e6f7 + use = std::atomic_load_explicit(&use_io_uring, std::memory_order_relaxed); if (use == 0) { - /* Older kernels have a bug where the sqpoll thread uses 100% CPU. */ -@@ -495,7 +496,7 @@ static int uv__use_io_uring(void) { + use = uv__kernel_version() >= +@@ -491,7 +492,7 @@ static int uv__use_io_uring(void) { if (val != NULL) use = atoi(val) ? 1 : -1; @@ -319,7 +319,7 @@ index 2b8e1d8fe593a181d049aa50ff9edaf6da258a24..b23d88bd824843eebc3b439e5a18e6f7 } return use > 0; -@@ -771,8 +772,8 @@ static struct uv__io_uring_sqe* uv__iou_get_sqe(struct uv__iou* iou, +@@ -767,8 +768,8 @@ static struct uv__io_uring_sqe* uv__iou_get_sqe(struct uv__iou* iou, if (iou->ringfd == -1) return NULL; @@ -330,7 +330,7 @@ index 2b8e1d8fe593a181d049aa50ff9edaf6da258a24..b23d88bd824843eebc3b439e5a18e6f7 tail = *iou->sqtail; mask = iou->sqmask; -@@ -801,12 +802,12 @@ static struct uv__io_uring_sqe* uv__iou_get_sqe(struct uv__iou* iou, +@@ -797,12 +798,12 @@ static struct uv__io_uring_sqe* uv__iou_get_sqe(struct uv__iou* iou, static void uv__iou_submit(struct uv__iou* iou) { uint32_t flags; @@ -347,7 +347,7 @@ index 2b8e1d8fe593a181d049aa50ff9edaf6da258a24..b23d88bd824843eebc3b439e5a18e6f7 if (flags & UV__IORING_SQ_NEED_WAKEUP) if (uv__io_uring_enter(iou->ringfd, 0, 0, UV__IORING_ENTER_SQ_WAKEUP)) -@@ -1147,8 +1148,8 @@ static void uv__poll_io_uring(uv_loop_t* loop, struct uv__iou* iou) { +@@ -1143,8 +1144,8 @@ static void uv__poll_io_uring(uv_loop_t* loop, struct uv__iou* iou) { int rc; head = *iou->cqhead; @@ -358,7 +358,7 @@ index 2b8e1d8fe593a181d049aa50ff9edaf6da258a24..b23d88bd824843eebc3b439e5a18e6f7 mask = iou->cqmask; cqe = (uv__io_uring_cqe*)iou->cqe; nevents = 0; -@@ -1180,15 +1181,15 @@ static void uv__poll_io_uring(uv_loop_t* loop, struct uv__iou* iou) { +@@ -1182,15 +1183,15 @@ static void uv__poll_io_uring(uv_loop_t* loop, struct uv__iou* iou) { nevents++; } @@ -378,7 +378,7 @@ index 2b8e1d8fe593a181d049aa50ff9edaf6da258a24..b23d88bd824843eebc3b439e5a18e6f7 if (flags & UV__IORING_SQ_CQ_OVERFLOW) { do -@@ -1581,7 +1582,7 @@ update_timeout: +@@ -1583,7 +1584,7 @@ update_timeout: } uint64_t uv__hrtime(uv_clocktype_t type) { @@ -387,7 +387,7 @@ index 2b8e1d8fe593a181d049aa50ff9edaf6da258a24..b23d88bd824843eebc3b439e5a18e6f7 struct timespec t; clock_t clock_id; -@@ -1597,7 +1598,7 @@ uint64_t uv__hrtime(uv_clocktype_t type) { +@@ -1599,7 +1600,7 @@ uint64_t uv__hrtime(uv_clocktype_t type) { if (type != UV_CLOCK_FAST) goto done; @@ -396,7 +396,7 @@ index 2b8e1d8fe593a181d049aa50ff9edaf6da258a24..b23d88bd824843eebc3b439e5a18e6f7 if (clock_id != -1) goto done; -@@ -1606,7 +1607,7 @@ uint64_t uv__hrtime(uv_clocktype_t type) { +@@ -1608,7 +1609,7 @@ uint64_t uv__hrtime(uv_clocktype_t type) { if (t.tv_nsec <= 1 * 1000 * 1000) clock_id = CLOCK_MONOTONIC_COARSE; diff --git a/upstream_utils/libuv_patches/0008-Remove-static-from-array-indices.patch b/upstream_utils/libuv_patches/0008-Remove-static-from-array-indices.patch index fb98018557..7fd97eabcc 100644 --- a/upstream_utils/libuv_patches/0008-Remove-static-from-array-indices.patch +++ b/upstream_utils/libuv_patches/0008-Remove-static-from-array-indices.patch @@ -8,10 +8,10 @@ Subject: [PATCH 08/10] Remove static from array indices 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/unix/linux.c b/src/unix/linux.c -index b23d88bd824843eebc3b439e5a18e6f796a747be..95a2fe2b42895626f207f740bdccfe938915d836 100644 +index e0c4902385edac10ac31bc5075a85a45025615f9..091c0474cfe37de4eb55dbf6c20144aa78e896a5 100644 --- a/src/unix/linux.c +++ b/src/unix/linux.c -@@ -2104,7 +2104,7 @@ static uint64_t uv__read_uint64(const char* filename) { +@@ -2098,7 +2098,7 @@ static uint64_t uv__read_uint64(const char* filename) { * finds the location and length of the memory controller mount path. * This disregards the leading / for easy concatenation of paths. * Returns NULL if the memory controller wasn't found. */ @@ -20,7 +20,7 @@ index b23d88bd824843eebc3b439e5a18e6f796a747be..95a2fe2b42895626f207f740bdccfe93 int* n) { char* p; -@@ -2125,7 +2125,7 @@ static char* uv__cgroup1_find_memory_controller(char buf[static 1024], +@@ -2119,7 +2119,7 @@ static char* uv__cgroup1_find_memory_controller(char buf[static 1024], return p; } @@ -29,7 +29,7 @@ index b23d88bd824843eebc3b439e5a18e6f796a747be..95a2fe2b42895626f207f740bdccfe93 uint64_t* max) { char filename[4097]; char* p; -@@ -2165,7 +2165,7 @@ update_limits: +@@ -2159,7 +2159,7 @@ update_limits: *max = UINT64_MAX; } @@ -38,7 +38,7 @@ index b23d88bd824843eebc3b439e5a18e6f796a747be..95a2fe2b42895626f207f740bdccfe93 uint64_t* max) { char filename[4097]; char* p; -@@ -2182,7 +2182,7 @@ static void uv__get_cgroup2_memory_limits(char buf[static 1024], uint64_t* high, +@@ -2176,7 +2176,7 @@ static void uv__get_cgroup2_memory_limits(char buf[static 1024], uint64_t* high, *high = uv__read_uint64(filename); } @@ -47,7 +47,7 @@ index b23d88bd824843eebc3b439e5a18e6f796a747be..95a2fe2b42895626f207f740bdccfe93 uint64_t high; uint64_t max; -@@ -2208,7 +2208,7 @@ uint64_t uv_get_constrained_memory(void) { +@@ -2202,7 +2202,7 @@ uint64_t uv_get_constrained_memory(void) { } @@ -56,7 +56,7 @@ index b23d88bd824843eebc3b439e5a18e6f796a747be..95a2fe2b42895626f207f740bdccfe93 char filename[4097]; uint64_t current; char* p; -@@ -2232,7 +2232,7 @@ static uint64_t uv__get_cgroup1_current_memory(char buf[static 1024]) { +@@ -2226,7 +2226,7 @@ static uint64_t uv__get_cgroup1_current_memory(char buf[static 1024]) { return uv__read_uint64("/sys/fs/cgroup/memory/memory.usage_in_bytes"); } diff --git a/upstream_utils/libuv_patches/0009-Add-pragmas-for-missing-libraries-and-set-_WIN32_WIN.patch b/upstream_utils/libuv_patches/0009-Add-pragmas-for-missing-libraries-and-set-_WIN32_WIN.patch index c47dfc85ec..4bbcf846cf 100644 --- a/upstream_utils/libuv_patches/0009-Add-pragmas-for-missing-libraries-and-set-_WIN32_WIN.patch +++ b/upstream_utils/libuv_patches/0009-Add-pragmas-for-missing-libraries-and-set-_WIN32_WIN.patch @@ -14,7 +14,7 @@ https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt. 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/uv/win.h b/include/uv/win.h -index 6d0afe69e7dd4caf4c9459e548fe75cf0c51b501..613065df435d813cd517efbc138b13ee46f01f2d 100644 +index 9a8c990c1b182633f23890cb5f4532b6bee2b22c..f17abc1f92681971da8ec603f7a20204fd53e5d1 100644 --- a/include/uv/win.h +++ b/include/uv/win.h @@ -20,7 +20,7 @@ @@ -27,7 +27,7 @@ index 6d0afe69e7dd4caf4c9459e548fe75cf0c51b501..613065df435d813cd517efbc138b13ee #if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED) diff --git a/src/win/util.c b/src/win/util.c -index 8828857db76a54d6e184c7f5714a091e92eba8ed..14295c41342b6dda16f39c5c548a6cc8269bfa0b 100644 +index 52c31979589e4ed7fe12af200f7e8daab9e02797..6529aa36f32eab1114488b7445a6bd872975b97b 100644 --- a/src/win/util.c +++ b/src/win/util.c @@ -73,7 +73,9 @@ static char *process_title; diff --git a/upstream_utils/libuv_patches/0010-Remove-swearing.patch b/upstream_utils/libuv_patches/0010-Remove-swearing.patch index bfbe744f71..fabd4a8c19 100644 --- a/upstream_utils/libuv_patches/0010-Remove-swearing.patch +++ b/upstream_utils/libuv_patches/0010-Remove-swearing.patch @@ -9,7 +9,7 @@ Subject: [PATCH 10/10] Remove swearing 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/win/fs.c b/src/win/fs.c -index 26ba539936786902af5830c2811594292815d2d7..3c73d6294e14e665c1669728495afe6bd91782f2 100644 +index 05488e5d67101adba611f882ded4f6dc5a462d9a..d6b2b3f1d08d846fa941942f4bb33ae2fa30e320 100644 --- a/src/win/fs.c +++ b/src/win/fs.c @@ -1704,7 +1704,7 @@ INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf, @@ -22,7 +22,7 @@ index 26ba539936786902af5830c2811594292815d2d7..3c73d6294e14e665c1669728495afe6b * * And uv_fs_chmod should probably just fail on windows or be a total no-op. diff --git a/src/win/tty.c b/src/win/tty.c -index 7adf3cd3ba81a9c41064f4ef2af01667092f27d1..c0461ae56d16165ce0c1d47fb42b7a85a85d7255 100644 +index 7294f311e17d5d02e5873e60f8f0cdd551f6d34d..f7d5ef6c29f97a979fb1df993b66e31830af55c4 100644 --- a/src/win/tty.c +++ b/src/win/tty.c @@ -1055,7 +1055,7 @@ int uv__tty_read_stop(uv_tty_t* handle) { diff --git a/upstream_utils/update_libuv.py b/upstream_utils/update_libuv.py index 273822c5da..0290c4d73a 100755 --- a/upstream_utils/update_libuv.py +++ b/upstream_utils/update_libuv.py @@ -13,7 +13,7 @@ from upstream_utils import ( def main(): - upstream_root = clone_repo("https://github.com/libuv/libuv", "v1.47.0") + upstream_root = clone_repo("https://github.com/libuv/libuv", "v1.48.0") wpilib_root = get_repo_root() wpinet = os.path.join(wpilib_root, "wpinet") diff --git a/wpinet/src/main/native/thirdparty/libuv/include/uv.h b/wpinet/src/main/native/thirdparty/libuv/include/uv.h index aff06cb7f4..931c96262b 100644 --- a/wpinet/src/main/native/thirdparty/libuv/include/uv.h +++ b/wpinet/src/main/native/thirdparty/libuv/include/uv.h @@ -1097,7 +1097,14 @@ enum uv_process_flags { * option is only meaningful on Windows systems. On Unix it is silently * ignored. */ - UV_PROCESS_WINDOWS_HIDE_GUI = (1 << 6) + UV_PROCESS_WINDOWS_HIDE_GUI = (1 << 6), + /* + * On Windows, if the path to the program to execute, specified in + * uv_process_options_t's file field, has a directory component, + * search for the exact file name before trying variants with + * extensions like '.exe' or '.cmd'. + */ + UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME = (1 << 7) }; /* @@ -1275,6 +1282,17 @@ UV_EXTERN uv_pid_t uv_os_getppid(void); UV_EXTERN int uv_os_getpriority(uv_pid_t pid, int* priority); UV_EXTERN int uv_os_setpriority(uv_pid_t pid, int priority); +enum { + UV_THREAD_PRIORITY_HIGHEST = 2, + UV_THREAD_PRIORITY_ABOVE_NORMAL = 1, + UV_THREAD_PRIORITY_NORMAL = 0, + UV_THREAD_PRIORITY_BELOW_NORMAL = -1, + UV_THREAD_PRIORITY_LOWEST = -2, +}; + +UV_EXTERN int uv_thread_getpriority(uv_thread_t tid, int* priority); +UV_EXTERN int uv_thread_setpriority(uv_thread_t tid, int priority); + UV_EXTERN unsigned int uv_available_parallelism(void); UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count); UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count); diff --git a/wpinet/src/main/native/thirdparty/libuv/include/uv/unix.h b/wpinet/src/main/native/thirdparty/libuv/include/uv/unix.h index e334cabe02..2073fe61a5 100644 --- a/wpinet/src/main/native/thirdparty/libuv/include/uv/unix.h +++ b/wpinet/src/main/native/thirdparty/libuv/include/uv/unix.h @@ -320,7 +320,10 @@ typedef struct { #define UV_TIMER_PRIVATE_FIELDS \ uv_timer_cb timer_cb; \ - void* heap_node[3]; \ + union { \ + void* heap[3]; \ + struct uv__queue queue; \ + } node; \ uint64_t timeout; \ uint64_t repeat; \ uint64_t start_id; diff --git a/wpinet/src/main/native/thirdparty/libuv/include/uv/version.h b/wpinet/src/main/native/thirdparty/libuv/include/uv/version.h index b17220fcf9..d6a61a10f7 100644 --- a/wpinet/src/main/native/thirdparty/libuv/include/uv/version.h +++ b/wpinet/src/main/native/thirdparty/libuv/include/uv/version.h @@ -31,7 +31,7 @@ */ #define UV_VERSION_MAJOR 1 -#define UV_VERSION_MINOR 47 +#define UV_VERSION_MINOR 48 #define UV_VERSION_PATCH 0 #define UV_VERSION_IS_RELEASE 1 #define UV_VERSION_SUFFIX "" diff --git a/wpinet/src/main/native/thirdparty/libuv/include/uv/win.h b/wpinet/src/main/native/thirdparty/libuv/include/uv/win.h index 613065df43..f17abc1f92 100644 --- a/wpinet/src/main/native/thirdparty/libuv/include/uv/win.h +++ b/wpinet/src/main/native/thirdparty/libuv/include/uv/win.h @@ -45,7 +45,7 @@ typedef struct pollfd { #endif #include -// Disable the typedef in mstcpip.h of MinGW. +/* Disable the typedef in mstcpip.h of MinGW. */ #define _TCP_INITIAL_RTO_PARAMETERS _TCP_INITIAL_RTO_PARAMETERS__AVOID #define TCP_INITIAL_RTO_PARAMETERS TCP_INITIAL_RTO_PARAMETERS__AVOID #define PTCP_INITIAL_RTO_PARAMETERS PTCP_INITIAL_RTO_PARAMETERS__AVOID @@ -70,7 +70,7 @@ typedef struct pollfd { # define S_IFLNK 0xA000 #endif -// Define missing in Windows Kit Include\{VERSION}\ucrt\sys\stat.h +/* Define missing in Windows Kit Include\{VERSION}\ucrt\sys\stat.h */ #if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES && !defined(S_IFIFO) # define S_IFIFO _S_IFIFO #endif @@ -554,7 +554,10 @@ typedef struct { unsigned char events; #define UV_TIMER_PRIVATE_FIELDS \ - void* heap_node[3]; \ + union { \ + void* heap[3]; \ + struct uv__queue queue; \ + } node; \ int unused; \ uint64_t timeout; \ uint64_t repeat; \ diff --git a/wpinet/src/main/native/thirdparty/libuv/src/idna.cpp b/wpinet/src/main/native/thirdparty/libuv/src/idna.cpp index fe60fb59be..17a0e7e74c 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/idna.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/idna.cpp @@ -322,6 +322,9 @@ ssize_t uv__idna_toascii(const char* s, const char* se, char* d, char* de) { char* ds; int rc; + if (s == se) + return UV_EINVAL; + ds = d; si = s; @@ -356,9 +359,10 @@ ssize_t uv__idna_toascii(const char* s, const char* se, char* d, char* de) { return rc; } - if (d < de) - *d++ = '\0'; + if (d >= de) + return UV_EINVAL; + *d++ = '\0'; return d - ds; /* Number of bytes written. */ } @@ -400,6 +404,7 @@ void uv_wtf8_to_utf16(const char* source_ptr, } } while (*source_ptr++); + (void)w_target_len; assert(w_target_len == 0); } diff --git a/wpinet/src/main/native/thirdparty/libuv/src/timer.cpp b/wpinet/src/main/native/thirdparty/libuv/src/timer.cpp index bc680e71a9..4525199ddc 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/timer.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/timer.cpp @@ -40,8 +40,8 @@ static int timer_less_than(const struct heap_node* ha, const uv_timer_t* a; const uv_timer_t* b; - a = container_of(ha, uv_timer_t, heap_node); - b = container_of(hb, uv_timer_t, heap_node); + a = container_of(ha, uv_timer_t, node.heap); + b = container_of(hb, uv_timer_t, node.heap); if (a->timeout < b->timeout) return 1; @@ -60,6 +60,7 @@ int uv_timer_init(uv_loop_t* loop, uv_timer_t* handle) { handle->timer_cb = NULL; handle->timeout = 0; handle->repeat = 0; + uv__queue_init(&handle->node.queue); return 0; } @@ -73,8 +74,7 @@ int uv_timer_start(uv_timer_t* handle, if (uv__is_closing(handle) || cb == NULL) return UV_EINVAL; - if (uv__is_active(handle)) - uv_timer_stop(handle); + uv_timer_stop(handle); clamped_timeout = handle->loop->time + timeout; if (clamped_timeout < timeout) @@ -87,7 +87,7 @@ int uv_timer_start(uv_timer_t* handle, handle->start_id = handle->loop->timer_counter++; heap_insert(timer_heap(handle->loop), - (struct heap_node*) &handle->heap_node, + (struct heap_node*) &handle->node.heap, timer_less_than); uv__handle_start(handle); @@ -96,14 +96,16 @@ int uv_timer_start(uv_timer_t* handle, int uv_timer_stop(uv_timer_t* handle) { - if (!uv__is_active(handle)) - return 0; - - heap_remove(timer_heap(handle->loop), - (struct heap_node*) &handle->heap_node, - timer_less_than); - uv__handle_stop(handle); + if (uv__is_active(handle)) { + heap_remove(timer_heap(handle->loop), + (struct heap_node*) &handle->node.heap, + timer_less_than); + uv__handle_stop(handle); + } else { + uv__queue_remove(&handle->node.queue); + } + uv__queue_init(&handle->node.queue); return 0; } @@ -148,7 +150,7 @@ int uv__next_timeout(const uv_loop_t* loop) { if (heap_node == NULL) return -1; /* block indefinitely */ - handle = container_of(heap_node, uv_timer_t, heap_node); + handle = container_of(heap_node, uv_timer_t, node.heap); if (handle->timeout <= loop->time) return 0; @@ -163,17 +165,30 @@ int uv__next_timeout(const uv_loop_t* loop) { void uv__run_timers(uv_loop_t* loop) { struct heap_node* heap_node; uv_timer_t* handle; + struct uv__queue* queue_node; + struct uv__queue ready_queue; + + uv__queue_init(&ready_queue); for (;;) { heap_node = heap_min(timer_heap(loop)); if (heap_node == NULL) break; - handle = container_of(heap_node, uv_timer_t, heap_node); + handle = container_of(heap_node, uv_timer_t, node.heap); if (handle->timeout > loop->time) break; uv_timer_stop(handle); + uv__queue_insert_tail(&ready_queue, &handle->node.queue); + } + + while (!uv__queue_empty(&ready_queue)) { + queue_node = uv__queue_head(&ready_queue); + uv__queue_remove(queue_node); + uv__queue_init(queue_node); + handle = container_of(queue_node, uv_timer_t, node.queue); + uv_timer_again(handle); handle->timer_cb(handle); } diff --git a/wpinet/src/main/native/thirdparty/libuv/src/unix/core.cpp b/wpinet/src/main/native/thirdparty/libuv/src/unix/core.cpp index 1a52716792..f13ffd1714 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/unix/core.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/unix/core.cpp @@ -91,6 +91,7 @@ extern char** environ; #if defined(__linux__) # include # include +# define gettid() syscall(SYS_gettid) # define uv__accept4 accept4 #endif @@ -1566,6 +1567,130 @@ int uv_os_setpriority(uv_pid_t pid, int priority) { return 0; } +/** + * If the function succeeds, the return value is 0. + * If the function fails, the return value is non-zero. + * for Linux, when schedule policy is SCHED_OTHER (default), priority is 0. + * So the output parameter priority is actually the nice value. +*/ +int uv_thread_getpriority(uv_thread_t tid, int* priority) { + int r; + int policy; + struct sched_param param; +#ifdef __linux__ + pid_t pid = gettid(); +#endif + + if (priority == NULL) + return UV_EINVAL; + + r = pthread_getschedparam(tid, &policy, ¶m); + if (r != 0) + return UV__ERR(errno); + +#ifdef __linux__ + if (SCHED_OTHER == policy && pthread_equal(tid, pthread_self())) { + errno = 0; + r = getpriority(PRIO_PROCESS, pid); + if (r == -1 && errno != 0) + return UV__ERR(errno); + *priority = r; + return 0; + } +#endif + + *priority = param.sched_priority; + return 0; +} + +#ifdef __linux__ +static int set_nice_for_calling_thread(int priority) { + int r; + int nice; + + if (priority < UV_THREAD_PRIORITY_LOWEST || priority > UV_THREAD_PRIORITY_HIGHEST) + return UV_EINVAL; + + pid_t pid = gettid(); + nice = 0 - priority * 2; + r = setpriority(PRIO_PROCESS, pid, nice); + if (r != 0) + return UV__ERR(errno); + return 0; +} +#endif + +/** + * If the function succeeds, the return value is 0. + * If the function fails, the return value is non-zero. +*/ +int uv_thread_setpriority(uv_thread_t tid, int priority) { + int r; + int min; + int max; + int range; + int prio; + int policy; + struct sched_param param; + + if (priority < UV_THREAD_PRIORITY_LOWEST || priority > UV_THREAD_PRIORITY_HIGHEST) + return UV_EINVAL; + + r = pthread_getschedparam(tid, &policy, ¶m); + if (r != 0) + return UV__ERR(errno); + +#ifdef __linux__ +/** + * for Linux, when schedule policy is SCHED_OTHER (default), priority must be 0, + * we should set the nice value in this case. +*/ + if (SCHED_OTHER == policy && pthread_equal(tid, pthread_self())) + return set_nice_for_calling_thread(priority); +#endif + +#ifdef __PASE__ + min = 1; + max = 127; +#else + min = sched_get_priority_min(policy); + max = sched_get_priority_max(policy); +#endif + + if (min == -1 || max == -1) + return UV__ERR(errno); + + range = max - min; + + switch (priority) { + case UV_THREAD_PRIORITY_HIGHEST: + prio = max; + break; + case UV_THREAD_PRIORITY_ABOVE_NORMAL: + prio = min + range * 3 / 4; + break; + case UV_THREAD_PRIORITY_NORMAL: + prio = min + range / 2; + break; + case UV_THREAD_PRIORITY_BELOW_NORMAL: + prio = min + range / 4; + break; + case UV_THREAD_PRIORITY_LOWEST: + prio = min; + break; + default: + return 0; + } + + if (param.sched_priority != prio) { + param.sched_priority = prio; + r = pthread_setschedparam(tid, policy, ¶m); + if (r != 0) + return UV__ERR(errno); + } + + return 0; +} int uv_os_uname(uv_utsname_t* buffer) { struct utsname buf; diff --git a/wpinet/src/main/native/thirdparty/libuv/src/unix/fs.cpp b/wpinet/src/main/native/thirdparty/libuv/src/unix/fs.cpp index afdf0c6e59..75c3093cb7 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/unix/fs.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/unix/fs.cpp @@ -86,7 +86,9 @@ #if defined(__CYGWIN__) || \ (defined(__HAIKU__) && B_HAIKU_VERSION < B_HAIKU_VERSION_1_PRE_BETA_5) || \ - (defined(__sun) && !defined(__illumos__)) + (defined(__sun) && !defined(__illumos__)) || \ + (defined(__APPLE__) && !TARGET_OS_IPHONE && \ + MAC_OS_X_VERSION_MIN_REQUIRED < 110000) #define preadv(fd, bufs, nbufs, off) \ pread(fd, (bufs)->iov_base, (bufs)->iov_len, off) #define pwritev(fd, bufs, nbufs, off) \ @@ -1630,6 +1632,16 @@ static void uv__fs_done(struct uv__work* w, int status) { } +void uv__fs_post(uv_loop_t* loop, uv_fs_t* req) { + uv__req_register(loop, req); + uv__work_submit(loop, + &req->work_req, + UV__WORK_FAST_IO, + uv__fs_work, + uv__fs_done); +} + + int uv_fs_access(uv_loop_t* loop, uv_fs_t* req, const char* path, diff --git a/wpinet/src/main/native/thirdparty/libuv/src/unix/internal.h b/wpinet/src/main/native/thirdparty/libuv/src/unix/internal.h index 854d98a16a..35ac6d1f6d 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/unix/internal.h +++ b/wpinet/src/main/native/thirdparty/libuv/src/unix/internal.h @@ -427,6 +427,7 @@ UV_UNUSED(static int uv__stat(const char* path, struct stat* s)) { } #if defined(__linux__) +void uv__fs_post(uv_loop_t* loop, uv_fs_t* req); ssize_t uv__fs_copy_file_range(int fd_in, off_t* off_in, diff --git a/wpinet/src/main/native/thirdparty/libuv/src/unix/kqueue.cpp b/wpinet/src/main/native/thirdparty/libuv/src/unix/kqueue.cpp index 939a426967..bd09ac39dd 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/unix/kqueue.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/unix/kqueue.cpp @@ -490,11 +490,21 @@ static void uv__fs_event(uv_loop_t* loop, uv__io_t* w, unsigned int fflags) { * the struct's kf_structsize must be initialised beforehand * whether with the KINFO_FILE_SIZE constant or this way. */ + struct stat statbuf; struct kinfo_file kf; - kf.kf_structsize = sizeof(kf); - if (fcntl(handle->event_watcher.fd, F_KINFO, &kf) == 0) - path = uv__basename_r(kf.kf_path); + if (handle->event_watcher.fd != -1 && + (!uv__fstat(handle->event_watcher.fd, &statbuf) && !(statbuf.st_mode & S_IFDIR))) { + /* we are purposely not using KINFO_FILE_SIZE here + * as it is not available on non intl archs + * and here it gives 1392 too on intel. + * anyway, the man page also mentions we can proceed + * this way. + */ + kf.kf_structsize = sizeof(kf); + if (fcntl(handle->event_watcher.fd, F_KINFO, &kf) == 0) + path = uv__basename_r(kf.kf_path); + } #endif handle->cb(handle, path, events, 0); diff --git a/wpinet/src/main/native/thirdparty/libuv/src/unix/linux.cpp b/wpinet/src/main/native/thirdparty/libuv/src/unix/linux.cpp index 95a2fe2b42..091c0474cf 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/unix/linux.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/unix/linux.cpp @@ -36,12 +36,16 @@ #include #include +#include +#include #include +#include #include #include #include #include #include +#include #include #include #include @@ -119,25 +123,6 @@ # endif #endif /* __NR_getrandom */ -#define HAVE_IFADDRS_H 1 - -# if defined(__ANDROID_API__) && __ANDROID_API__ < 24 -# undef HAVE_IFADDRS_H -#endif - -#ifdef __UCLIBC__ -# if __UCLIBC_MAJOR__ < 0 && __UCLIBC_MINOR__ < 9 && __UCLIBC_SUBLEVEL__ < 32 -# undef HAVE_IFADDRS_H -# endif -#endif - -#ifdef HAVE_IFADDRS_H -# include -# include -# include -# include -#endif /* HAVE_IFADDRS_H */ - #include enum { @@ -479,6 +464,9 @@ static int uv__use_io_uring(void) { #elif defined(__arm__) && __SIZEOF_POINTER__ == 4 /* See https://github.com/libuv/libuv/issues/4158. */ return 0; /* All 32 bits kernels appear buggy. */ +#elif defined(__powerpc64__) || defined(__ppc64__) + /* See https://github.com/libuv/libuv/issues/4283. */ + return 0; /* Random SIGSEGV in signal handler. */ #else /* Ternary: unknown=0, yes=1, no=-1 */ static std::atomic use_io_uring; @@ -488,8 +476,16 @@ static int uv__use_io_uring(void) { use = std::atomic_load_explicit(&use_io_uring, std::memory_order_relaxed); if (use == 0) { + use = uv__kernel_version() >= +#if defined(__hppa__) + /* io_uring first supported on parisc in 6.1, functional in .51 */ + /* https://lore.kernel.org/all/cb912694-b1fe-dbb0-4d8c-d608f3526905@gmx.de/ */ + /* 6.1.51 */ 0x060133 +#else /* Older kernels have a bug where the sqpoll thread uses 100% CPU. */ - use = uv__kernel_version() >= /* 5.10.186 */ 0x050ABA ? 1 : -1; + /* 5.10.186 */ 0x050ABA +#endif + ? 1 : -1; /* But users can still enable it if they so desire. */ val = getenv("UV_USE_IO_URING"); @@ -1163,6 +1159,12 @@ static void uv__poll_io_uring(uv_loop_t* loop, struct uv__iou* iou) { uv__req_unregister(loop, req); iou->in_flight--; + /* If the op is not supported by the kernel retry using the thread pool */ + if (e->res == -EOPNOTSUPP) { + uv__fs_post(loop, req); + continue; + } + /* io_uring stores error codes as negative numbers, same as libuv. */ req->result = e->res; @@ -1909,7 +1911,6 @@ nocpuinfo: } -#ifdef HAVE_IFADDRS_H static int uv__ifaddr_exclude(struct ifaddrs *ent, int exclude_type) { if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING))) return 1; @@ -1923,14 +1924,8 @@ static int uv__ifaddr_exclude(struct ifaddrs *ent, int exclude_type) { return exclude_type; return !exclude_type; } -#endif int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { -#ifndef HAVE_IFADDRS_H - *count = 0; - *addresses = NULL; - return UV_ENOSYS; -#else struct ifaddrs *addrs, *ent; uv_interface_address_t* address; int i; @@ -2009,7 +2004,6 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { freeifaddrs(addrs); return 0; -#endif } diff --git a/wpinet/src/main/native/thirdparty/libuv/src/unix/pipe.cpp b/wpinet/src/main/native/thirdparty/libuv/src/unix/pipe.cpp index a60b1a0e44..ea26ce45c9 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/unix/pipe.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/unix/pipe.cpp @@ -30,6 +30,19 @@ #include +/* Does the file path contain embedded nul bytes? */ +static int includes_nul(const char *s, size_t n) { + if (n == 0) + return 0; +#ifdef __linux__ + /* Accept abstract socket namespace path ("\0/virtual/path"). */ + s++; + n--; +#endif + return NULL != memchr(s, '\0', n); +} + + int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle, int ipc) { uv__stream_init(loop, (uv_stream_t*)handle, UV_NAMED_PIPE); handle->shutdown_req = NULL; @@ -53,6 +66,7 @@ int uv_pipe_bind2(uv_pipe_t* handle, char* pipe_fname; int sockfd; int err; + socklen_t addrlen; pipe_fname = NULL; @@ -65,11 +79,8 @@ int uv_pipe_bind2(uv_pipe_t* handle, if (namelen == 0) return UV_EINVAL; -#ifndef __linux__ - /* Abstract socket namespace only works on Linux. */ - if (*name == '\0') + if (includes_nul(name, namelen)) return UV_EINVAL; -#endif if (flags & UV_PIPE_NO_TRUNCATE) if (namelen > sizeof(saddr.sun_path)) @@ -90,10 +101,15 @@ int uv_pipe_bind2(uv_pipe_t* handle, * We unlink the file later but abstract sockets disappear * automatically since they're not real file system entities. */ - if (*name != '\0') { - pipe_fname = uv__strdup(name); + if (*name == '\0') { + addrlen = offsetof(struct sockaddr_un, sun_path) + namelen; + } else { + pipe_fname = (char*)uv__malloc(namelen + 1); if (pipe_fname == NULL) return UV_ENOMEM; + memcpy(pipe_fname, name, namelen); + pipe_fname[namelen] = '\0'; + addrlen = sizeof saddr; } err = uv__socket(AF_UNIX, SOCK_STREAM, 0); @@ -105,7 +121,7 @@ int uv_pipe_bind2(uv_pipe_t* handle, memcpy(&saddr.sun_path, name, namelen); saddr.sun_family = AF_UNIX; - if (bind(sockfd, (struct sockaddr*)&saddr, sizeof saddr)) { + if (bind(sockfd, (struct sockaddr*)&saddr, addrlen)) { err = UV__ERR(errno); /* Convert ENOENT to EACCES for compatibility with Windows. */ if (err == UV_ENOENT) @@ -117,7 +133,7 @@ int uv_pipe_bind2(uv_pipe_t* handle, /* Success. */ handle->flags |= UV_HANDLE_BOUND; - handle->pipe_fname = pipe_fname; /* NULL or a strdup'ed copy. */ + handle->pipe_fname = pipe_fname; /* NULL or a copy of |name| */ handle->io_watcher.fd = sockfd; return 0; @@ -210,7 +226,22 @@ void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle, const char* name, uv_connect_cb cb) { - uv_pipe_connect2(req, handle, name, strlen(name), 0, cb); + int err; + + err = uv_pipe_connect2(req, handle, name, strlen(name), 0, cb); + + if (err) { + handle->delayed_error = err; + handle->connect_req = req; + + uv__req_init(handle->loop, req, UV_CONNECT); + req->handle = (uv_stream_t*) handle; + req->cb = cb; + uv__queue_init(&req->queue); + + /* Force callback to run on next tick in case of error. */ + uv__io_feed(handle->loop, &handle->io_watcher); + } } @@ -224,6 +255,7 @@ int uv_pipe_connect2(uv_connect_t* req, int new_sock; int err; int r; + socklen_t addrlen; if (flags & ~UV_PIPE_NO_TRUNCATE) return UV_EINVAL; @@ -234,11 +266,8 @@ int uv_pipe_connect2(uv_connect_t* req, if (namelen == 0) return UV_EINVAL; -#ifndef __linux__ - /* Abstract socket namespace only works on Linux. */ - if (*name == '\0') + if (includes_nul(name, namelen)) return UV_EINVAL; -#endif if (flags & UV_PIPE_NO_TRUNCATE) if (namelen > sizeof(saddr.sun_path)) @@ -261,9 +290,13 @@ int uv_pipe_connect2(uv_connect_t* req, memcpy(&saddr.sun_path, name, namelen); saddr.sun_family = AF_UNIX; + if (*name == '\0') + addrlen = offsetof(struct sockaddr_un, sun_path) + namelen; + else + addrlen = sizeof saddr; + do { - r = connect(uv__stream_fd(handle), - (struct sockaddr*)&saddr, sizeof saddr); + r = connect(uv__stream_fd(handle), (struct sockaddr*)&saddr, addrlen); } while (r == -1 && errno == EINTR); @@ -295,7 +328,7 @@ out: handle->connect_req = req; uv__req_init(handle->loop, req, UV_CONNECT); - req->handle = (uv_stream_t*)handle; + req->handle = (uv_stream_t*) handle; req->cb = cb; uv__queue_init(&req->queue); diff --git a/wpinet/src/main/native/thirdparty/libuv/src/unix/process.cpp b/wpinet/src/main/native/thirdparty/libuv/src/unix/process.cpp index 2d622c956d..8271d513b1 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/unix/process.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/unix/process.cpp @@ -972,6 +972,7 @@ int uv_spawn(uv_loop_t* loop, assert(!(options->flags & ~(UV_PROCESS_DETACHED | UV_PROCESS_SETGID | UV_PROCESS_SETUID | + UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME | UV_PROCESS_WINDOWS_HIDE | UV_PROCESS_WINDOWS_HIDE_CONSOLE | UV_PROCESS_WINDOWS_HIDE_GUI | diff --git a/wpinet/src/main/native/thirdparty/libuv/src/unix/tcp.cpp b/wpinet/src/main/native/thirdparty/libuv/src/unix/tcp.cpp index 4c4213a424..6fe6361c81 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/unix/tcp.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/unix/tcp.cpp @@ -30,12 +30,8 @@ #include #include -#if defined(__PASE__) -#include -#define ifaddrs ifaddrs_pase -#define getifaddrs Qp2getifaddrs -#define freeifaddrs Qp2freeifaddrs -#else +/* ifaddrs is not implemented on AIX and IBM i PASE */ +#if !defined(_AIX) #include #endif @@ -225,16 +221,39 @@ static int uv__is_ipv6_link_local(const struct sockaddr* addr) { static int uv__ipv6_link_local_scope_id(void) { struct sockaddr_in6* a6; + int rv; +#if defined(_AIX) + /* AIX & IBM i do not have ifaddrs + * so fallback to use uv_interface_addresses */ + uv_interface_address_t* interfaces; + uv_interface_address_t* ifa; + int count, i; + + if (uv_interface_addresses(&interfaces, &count)) + return 0; + + rv = 0; + + for (ifa = interfaces; ifa != &interfaces[count]; ifa++) { + if (uv__is_ipv6_link_local((struct sockaddr*) &ifa->address)) { + rv = ifa->address.address6.sin6_scope_id; + break; + } + } + + uv_free_interface_addresses(interfaces, count); + +#else struct ifaddrs* ifa; struct ifaddrs* p; - int rv; if (getifaddrs(&ifa)) return 0; for (p = ifa; p != NULL; p = p->ifa_next) - if (uv__is_ipv6_link_local(p->ifa_addr)) - break; + if (p->ifa_addr != NULL) + if (uv__is_ipv6_link_local(p->ifa_addr)) + break; rv = 0; if (p != NULL) { @@ -243,6 +262,8 @@ static int uv__ipv6_link_local_scope_id(void) { } freeifaddrs(ifa); +#endif /* defined(_AIX) */ + return rv; } @@ -432,26 +453,91 @@ int uv__tcp_nodelay(int fd, int on) { int uv__tcp_keepalive(int fd, int on, unsigned int delay) { + int idle; int intvl; int cnt; + (void) &idle; (void) &intvl; (void) &cnt; - + if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on))) return UV__ERR(errno); if (!on) return 0; + if (delay == 0) + return -1; + +#ifdef __sun + /* The implementation of TCP keep-alive on Solaris/SmartOS is a bit unusual + * compared to other Unix-like systems. + * Thus, we need to specialize it on Solaris. + * + * There are two keep-alive mechanisms on Solaris: + * - By default, the first keep-alive probe is sent out after a TCP connection is idle for two hours. + * If the peer does not respond to the probe within eight minutes, the TCP connection is aborted. + * You can alter the interval for sending out the first probe using the socket option TCP_KEEPALIVE_THRESHOLD + * in milliseconds or TCP_KEEPIDLE in seconds. + * The system default is controlled by the TCP ndd parameter tcp_keepalive_interval. The minimum value is ten seconds. + * The maximum is ten days, while the default is two hours. If you receive no response to the probe, + * you can use the TCP_KEEPALIVE_ABORT_THRESHOLD socket option to change the time threshold for aborting a TCP connection. + * The option value is an unsigned integer in milliseconds. The value zero indicates that TCP should never time out and + * abort the connection when probing. The system default is controlled by the TCP ndd parameter tcp_keepalive_abort_interval. + * The default is eight minutes. + * + * - The second implementation is activated if socket option TCP_KEEPINTVL and/or TCP_KEEPCNT are set. + * The time between each consequent probes is set by TCP_KEEPINTVL in seconds. + * The minimum value is ten seconds. The maximum is ten days, while the default is two hours. + * The TCP connection will be aborted after certain amount of probes, which is set by TCP_KEEPCNT, without receiving response. + */ + + idle = delay; + /* Kernel expects at least 10 seconds. */ + if (idle < 10) + idle = 10; + /* Kernel expects at most 10 days. */ + if (idle > 10*24*60*60) + idle = 10*24*60*60; + + /* `TCP_KEEPIDLE`, `TCP_KEEPINTVL`, and `TCP_KEEPCNT` were not available on Solaris + * until version 11.4, but let's take a chance here. */ +#if defined(TCP_KEEPIDLE) && defined(TCP_KEEPINTVL) && defined(TCP_KEEPCNT) + if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &idle, sizeof(idle))) + return UV__ERR(errno); + + intvl = idle/3; + if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &intvl, sizeof(intvl))) + return UV__ERR(errno); + + cnt = 3; + if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, &cnt, sizeof(cnt))) + return UV__ERR(errno); +#else + /* Fall back to the first implementation of tcp-alive mechanism for older Solaris, + * simulate the tcp-alive mechanism on other platforms via `TCP_KEEPALIVE_THRESHOLD` + `TCP_KEEPALIVE_ABORT_THRESHOLD`. + */ + idle *= 1000; /* kernel expects milliseconds */ + if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE_THRESHOLD, &idle, sizeof(idle))) + return UV__ERR(errno); + + /* Note that the consequent probes will not be sent at equal intervals on Solaris, + * but will be sent using the exponential backoff algorithm. */ + intvl = idle/3; + cnt = 3; + int time_to_abort = intvl * cnt; + if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE_ABORT_THRESHOLD, &time_to_abort, sizeof(time_to_abort))) + return UV__ERR(errno); +#endif + +#else /* !defined(__sun) */ + #ifdef TCP_KEEPIDLE if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &delay, sizeof(delay))) return UV__ERR(errno); -/* Solaris/SmartOS, if you don't support keep-alive, - * then don't advertise it in your system headers... - */ -/* FIXME(bnoordhuis) That's possibly because sizeof(delay) should be 1. */ -#elif defined(TCP_KEEPALIVE) && !defined(__sun) +#elif defined(TCP_KEEPALIVE) + /* Darwin/macOS uses TCP_KEEPALIVE in place of TCP_KEEPIDLE. */ if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE, &delay, sizeof(delay))) return UV__ERR(errno); #endif @@ -468,6 +554,7 @@ int uv__tcp_keepalive(int fd, int on, unsigned int delay) { return UV__ERR(errno); #endif +#endif /* !defined(__sun) */ return 0; } diff --git a/wpinet/src/main/native/thirdparty/libuv/src/win/fs-event.cpp b/wpinet/src/main/native/thirdparty/libuv/src/win/fs-event.cpp index 381220bf24..2f566f796a 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/win/fs-event.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/win/fs-event.cpp @@ -116,7 +116,7 @@ static int uv__split_path(const WCHAR* filename, WCHAR** dir, } } - *file = wcsdup(filename); + *file = _wcsdup(filename); } else { if (dir) { *dir = (WCHAR*)uv__malloc((i + 2) * sizeof(WCHAR)); diff --git a/wpinet/src/main/native/thirdparty/libuv/src/win/fs.cpp b/wpinet/src/main/native/thirdparty/libuv/src/win/fs.cpp index 3c73d6294e..d6b2b3f1d0 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/win/fs.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/win/fs.cpp @@ -410,8 +410,8 @@ void fs__open(uv_fs_t* req) { /* Obtain the active umask. umask() never fails and returns the previous * umask. */ - current_umask = umask(0); - umask(current_umask); + current_umask = _umask(0); + _umask(current_umask); /* convert flags and mode to CreateFile parameters */ switch (flags & (UV_FS_O_RDONLY | UV_FS_O_WRONLY | UV_FS_O_RDWR)) { diff --git a/wpinet/src/main/native/thirdparty/libuv/src/win/pipe.cpp b/wpinet/src/main/native/thirdparty/libuv/src/win/pipe.cpp index b2348bd043..d747dc7236 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/win/pipe.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/win/pipe.cpp @@ -100,6 +100,14 @@ static void eof_timer_destroy(uv_pipe_t* pipe); static void eof_timer_close_cb(uv_handle_t* handle); +/* Does the file path contain embedded nul bytes? */ +static int includes_nul(const char *s, size_t n) { + if (n == 0) + return 0; + return NULL != memchr(s, '\0', n); +} + + static void uv__unique_pipe_name(char* ptr, char* name, size_t size) { snprintf(name, size, "\\\\?\\pipe\\uv\\%p-%lu", ptr, GetCurrentProcessId()); } @@ -193,7 +201,7 @@ static void close_pipe(uv_pipe_t* pipe) { if (pipe->u.fd == -1) CloseHandle(pipe->handle); else - close(pipe->u.fd); + _close(pipe->u.fd); pipe->u.fd = -1; pipe->handle = INVALID_HANDLE_VALUE; @@ -707,6 +715,7 @@ int uv_pipe_bind2(uv_pipe_t* handle, uv_loop_t* loop = handle->loop; int i, err; uv_pipe_accept_t* req; + char* name_copy; if (flags & ~UV_PIPE_NO_TRUNCATE) { return UV_EINVAL; @@ -720,16 +729,10 @@ int uv_pipe_bind2(uv_pipe_t* handle, return UV_EINVAL; } - if (*name == '\0') { + if (includes_nul(name, namelen)) { return UV_EINVAL; } - if (flags & UV_PIPE_NO_TRUNCATE) { - if (namelen > 256) { - return UV_EINVAL; - } - } - if (handle->flags & UV_HANDLE_BOUND) { return UV_EINVAL; } @@ -738,14 +741,24 @@ int uv_pipe_bind2(uv_pipe_t* handle, return UV_EINVAL; } + name_copy = (char*)uv__malloc(namelen + 1); + if (name_copy == NULL) { + return UV_ENOMEM; + } + + memcpy(name_copy, name, namelen); + name_copy[namelen] = '\0'; + if (!(handle->flags & UV_HANDLE_PIPESERVER)) { handle->pipe.serv.pending_instances = default_pending_pipe_instances; } + err = UV_ENOMEM; handle->pipe.serv.accept_reqs = (uv_pipe_accept_t*) uv__malloc(sizeof(uv_pipe_accept_t) * handle->pipe.serv.pending_instances); - if (!handle->pipe.serv.accept_reqs) - return UV_ENOMEM; + if (handle->pipe.serv.accept_reqs == NULL) { + goto error; + } for (i = 0; i < handle->pipe.serv.pending_instances; i++) { req = &handle->pipe.serv.accept_reqs[i]; @@ -755,9 +768,14 @@ int uv_pipe_bind2(uv_pipe_t* handle, req->next_pending = NULL; } - err = uv__convert_utf8_to_utf16(name, &handle->name); - if (err) - return err; + /* TODO(bnoordhuis) Add converters that take a |length| parameter. */ + err = uv__convert_utf8_to_utf16(name_copy, &handle->name); + uv__free(name_copy); + name_copy = NULL; + + if (err) { + goto error; + } /* * Attempt to create the first pipe with FILE_FLAG_FIRST_PIPE_INSTANCE. @@ -769,9 +787,11 @@ int uv_pipe_bind2(uv_pipe_t* handle, TRUE)) { err = GetLastError(); if (err == ERROR_ACCESS_DENIED) { - err = WSAEADDRINUSE; /* Translates to UV_EADDRINUSE. */ + err = UV_EADDRINUSE; } else if (err == ERROR_PATH_NOT_FOUND || err == ERROR_INVALID_NAME) { - err = WSAEACCES; /* Translates to UV_EACCES. */ + err = UV_EACCES; + } else { + err = uv_translate_sys_error(err); } goto error; } @@ -783,10 +803,13 @@ int uv_pipe_bind2(uv_pipe_t* handle, return 0; error: + uv__free(handle->pipe.serv.accept_reqs); uv__free(handle->name); + uv__free(name_copy); + handle->pipe.serv.accept_reqs = NULL; handle->name = NULL; - return uv_translate_sys_error(err); + return err; } @@ -836,7 +859,19 @@ void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle, const char* name, uv_connect_cb cb) { - uv_pipe_connect2(req, handle, name, strlen(name), 0, cb); + uv_loop_t* loop; + int err; + + err = uv_pipe_connect2(req, handle, name, strlen(name), 0, cb); + + if (err) { + loop = handle->loop; + /* Make this req pending reporting an error. */ + SET_REQ_ERROR(req, err); + uv__insert_pending_req(loop, (uv_req_t*) req); + handle->reqs_pending++; + REGISTER_HANDLE_REQ(loop, handle, req); + } } @@ -846,11 +881,20 @@ int uv_pipe_connect2(uv_connect_t* req, size_t namelen, unsigned int flags, uv_connect_cb cb) { - uv_loop_t* loop = handle->loop; + uv_loop_t* loop; int err; size_t nameSize; HANDLE pipeHandle = INVALID_HANDLE_VALUE; DWORD duplex_flags; + char* name_copy; + + loop = handle->loop; + UV_REQ_INIT(req, UV_CONNECT); + req->handle = (uv_stream_t*) handle; + req->cb = cb; + req->u.connect.pipeHandle = INVALID_HANDLE_VALUE; + req->u.connect.duplex_flags = 0; + req->u.connect.name = NULL; if (flags & ~UV_PIPE_NO_TRUNCATE) { return UV_EINVAL; @@ -864,22 +908,17 @@ int uv_pipe_connect2(uv_connect_t* req, return UV_EINVAL; } - if (*name == '\0') { + if (includes_nul(name, namelen)) { return UV_EINVAL; } - if (flags & UV_PIPE_NO_TRUNCATE) { - if (namelen > 256) { - return UV_EINVAL; - } + name_copy = (char*)uv__malloc(namelen + 1); + if (name_copy == NULL) { + return UV_ENOMEM; } - UV_REQ_INIT(req, UV_CONNECT); - req->handle = (uv_stream_t*) handle; - req->cb = cb; - req->u.connect.pipeHandle = INVALID_HANDLE_VALUE; - req->u.connect.duplex_flags = 0; - req->u.connect.name = NULL; + memcpy(name_copy, name, namelen); + name_copy[namelen] = '\0'; if (handle->flags & UV_HANDLE_PIPESERVER) { err = ERROR_INVALID_PARAMETER; @@ -891,7 +930,11 @@ int uv_pipe_connect2(uv_connect_t* req, } uv__pipe_connection_init(handle); - err = uv__convert_utf8_to_utf16(name, &handle->name); + /* TODO(bnoordhuis) Add converters that take a |length| parameter. */ + err = uv__convert_utf8_to_utf16(name_copy, &handle->name); + uv__free(name_copy); + name_copy = NULL; + if (err) { err = ERROR_NO_UNICODE_TRANSLATION; goto error; @@ -937,6 +980,8 @@ int uv_pipe_connect2(uv_connect_t* req, return 0; error: + uv__free(name_copy); + if (handle->name) { uv__free(handle->name); handle->name = NULL; diff --git a/wpinet/src/main/native/thirdparty/libuv/src/win/process.cpp b/wpinet/src/main/native/thirdparty/libuv/src/win/process.cpp index eeb0f6a984..e4bf93d707 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/win/process.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/win/process.cpp @@ -28,7 +28,7 @@ #include #include #include -#include /* alloca */ +#include /* _alloca */ #include "uv.h" #include "internal.h" @@ -303,8 +303,9 @@ static WCHAR* path_search_walk_ext(const WCHAR *dir, * - If there's really only a filename, check the current directory for file, * then search all path directories. * - * - If filename specified has *any* extension, search for the file with the - * specified extension first. + * - If filename specified has *any* extension, or already contains a path + * and the UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME flag is specified, + * search for the file with the exact specified filename first. * * - If the literal filename is not found in a directory, try *appending* * (not replacing) .com first and then .exe. @@ -330,7 +331,8 @@ static WCHAR* path_search_walk_ext(const WCHAR *dir, */ static WCHAR* search_path(const WCHAR *file, WCHAR *cwd, - const WCHAR *path) { + const WCHAR *path, + unsigned int flags) { int file_has_dir; WCHAR* result = NULL; WCHAR *file_name_start; @@ -371,16 +373,18 @@ static WCHAR* search_path(const WCHAR *file, file, file_name_start - file, file_name_start, file_len - (file_name_start - file), cwd, cwd_len, - name_has_ext); + name_has_ext || (flags & UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME)); } else { dir_end = path; - /* The file is really only a name; look in cwd first, then scan path */ - result = path_search_walk_ext(L"", 0, - file, file_len, - cwd, cwd_len, - name_has_ext); + if (NeedCurrentDirectoryForExePathW(L"")) { + /* The file is really only a name; look in cwd first, then scan path */ + result = path_search_walk_ext(L"", 0, + file, file_len, + cwd, cwd_len, + name_has_ext); + } while (result == NULL) { if (dir_end == NULL || *dir_end == L'\0') { @@ -508,7 +512,7 @@ WCHAR* quote_cmd_arg(const WCHAR *source, WCHAR *target) { } } target[0] = L'\0'; - wcsrev(start); + _wcsrev(start); *(target++) = L'"'; return target; } @@ -612,8 +616,8 @@ int env_strncmp(const wchar_t* a, int na, const wchar_t* b) { assert(b_eq); nb = b_eq - b; - A = (wchar_t*)alloca((na+1) * sizeof(wchar_t)); - B = (wchar_t*)alloca((nb+1) * sizeof(wchar_t)); + A = (wchar_t*)_alloca((na+1) * sizeof(wchar_t)); + B = (wchar_t*)_alloca((nb+1) * sizeof(wchar_t)); r = LCMapStringW(LOCALE_INVARIANT, LCMAP_UPPERCASE, a, na, A, na); assert(r==na); @@ -690,7 +694,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) { if (dst_copy == NULL && env_len > 0) { return UV_ENOMEM; } - env_copy = (WCHAR**)alloca(env_block_count * sizeof(WCHAR*)); + env_copy = (WCHAR**)_alloca(env_block_count * sizeof(WCHAR*)); ptr = dst_copy; ptr_copy = env_copy; @@ -932,6 +936,7 @@ int uv_spawn(uv_loop_t* loop, assert(!(options->flags & ~(UV_PROCESS_DETACHED | UV_PROCESS_SETGID | UV_PROCESS_SETUID | + UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME | UV_PROCESS_WINDOWS_HIDE | UV_PROCESS_WINDOWS_HIDE_CONSOLE | UV_PROCESS_WINDOWS_HIDE_GUI | @@ -1011,7 +1016,8 @@ int uv_spawn(uv_loop_t* loop, application_path = search_path(application, cwd, - path); + path, + options->flags); if (application_path == NULL) { /* Not found. */ err = ERROR_FILE_NOT_FOUND; @@ -1178,7 +1184,6 @@ static int uv__kill(HANDLE process_handle, int signum) { case SIGINT: { /* Unconditionally terminate the process. On Windows, killed processes * normally return 1. */ - DWORD status; int err; if (TerminateProcess(process_handle, 1)) @@ -1188,8 +1193,7 @@ static int uv__kill(HANDLE process_handle, int signum) { * TerminateProcess will fail with ERROR_ACCESS_DENIED. */ err = GetLastError(); if (err == ERROR_ACCESS_DENIED && - GetExitCodeProcess(process_handle, &status) && - status != STILL_ACTIVE) { + WaitForSingleObject(process_handle, 0) == WAIT_OBJECT_0) { return UV_ESRCH; } @@ -1198,15 +1202,16 @@ static int uv__kill(HANDLE process_handle, int signum) { case 0: { /* Health check: is the process still alive? */ - DWORD status; - - if (!GetExitCodeProcess(process_handle, &status)) - return uv_translate_sys_error(GetLastError()); - - if (status != STILL_ACTIVE) - return UV_ESRCH; - - return 0; + switch (WaitForSingleObject(process_handle, 0)) { + case WAIT_OBJECT_0: + return UV_ESRCH; + case WAIT_FAILED: + return uv_translate_sys_error(GetLastError()); + case WAIT_TIMEOUT: + return 0; + default: + return UV_UNKNOWN; + } } default: @@ -1241,7 +1246,7 @@ int uv_kill(int pid, int signum) { if (pid == 0) { process_handle = GetCurrentProcess(); } else { - process_handle = OpenProcess(PROCESS_TERMINATE | PROCESS_QUERY_INFORMATION, + process_handle = OpenProcess(PROCESS_TERMINATE | PROCESS_QUERY_INFORMATION | SYNCHRONIZE, FALSE, pid); } diff --git a/wpinet/src/main/native/thirdparty/libuv/src/win/tty.cpp b/wpinet/src/main/native/thirdparty/libuv/src/win/tty.cpp index c0461ae56d..f7d5ef6c29 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/win/tty.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/win/tty.cpp @@ -699,7 +699,7 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle, DWORD records_left, records_read; uv_buf_t buf; - off_t buf_used; + _off_t buf_used; assert(handle->type == UV_TTY); assert(handle->flags & UV_HANDLE_TTY_READABLE); @@ -2250,7 +2250,7 @@ void uv__tty_close(uv_tty_t* handle) { if (handle->u.fd == -1) CloseHandle(handle->handle); else - close(handle->u.fd); + _close(handle->u.fd); handle->u.fd = -1; handle->handle = INVALID_HANDLE_VALUE; diff --git a/wpinet/src/main/native/thirdparty/libuv/src/win/util.cpp b/wpinet/src/main/native/thirdparty/libuv/src/win/util.cpp index 14295c4134..6529aa36f3 100644 --- a/wpinet/src/main/native/thirdparty/libuv/src/win/util.cpp +++ b/wpinet/src/main/native/thirdparty/libuv/src/win/util.cpp @@ -1477,6 +1477,48 @@ int uv_os_setpriority(uv_pid_t pid, int priority) { return r; } +int uv_thread_getpriority(uv_thread_t tid, int* priority) { + int r; + + if (priority == NULL) + return UV_EINVAL; + + r = GetThreadPriority(tid); + if (r == THREAD_PRIORITY_ERROR_RETURN) + return uv_translate_sys_error(GetLastError()); + + *priority = r; + return 0; +} + +int uv_thread_setpriority(uv_thread_t tid, int priority) { + int r; + + switch (priority) { + case UV_THREAD_PRIORITY_HIGHEST: + r = SetThreadPriority(tid, THREAD_PRIORITY_HIGHEST); + break; + case UV_THREAD_PRIORITY_ABOVE_NORMAL: + r = SetThreadPriority(tid, THREAD_PRIORITY_ABOVE_NORMAL); + break; + case UV_THREAD_PRIORITY_NORMAL: + r = SetThreadPriority(tid, THREAD_PRIORITY_NORMAL); + break; + case UV_THREAD_PRIORITY_BELOW_NORMAL: + r = SetThreadPriority(tid, THREAD_PRIORITY_BELOW_NORMAL); + break; + case UV_THREAD_PRIORITY_LOWEST: + r = SetThreadPriority(tid, THREAD_PRIORITY_LOWEST); + break; + default: + return 0; + } + + if (r == 0) + return uv_translate_sys_error(GetLastError()); + + return 0; +} int uv_os_uname(uv_utsname_t* buffer) { /* Implementation loosely based on