summaryrefslogtreecommitdiff
path: root/deps/uv/src/win
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2019-02-10 11:55:38 -0500
committercjihrig <cjihrig@gmail.com>2019-02-13 08:15:42 -0500
commit0109e121d3a2f87c4bad75ac05436b56c9fd3407 (patch)
tree9b721863be4723c2785387a8900f719305a3a979 /deps/uv/src/win
parentec76f7cf8f4becb2c388aa6ad771f134f1466147 (diff)
downloadandroid-node-v8-0109e121d3a2f87c4bad75ac05436b56c9fd3407.tar.gz
android-node-v8-0109e121d3a2f87c4bad75ac05436b56c9fd3407.tar.bz2
android-node-v8-0109e121d3a2f87c4bad75ac05436b56c9fd3407.zip
deps: upgrade to libuv 1.26.0
Notable changes: - A bug that could result in 100% CPU utilization in Node has been fixed (https://github.com/libuv/libuv/issues/2162) - Node's report module will now include the entire Windows product name (https://github.com/libuv/libuv/pull/2170) PR-URL: https://github.com/nodejs/node/pull/26037 Fixes: https://github.com/nodejs/node/issues/26013 Fixes: https://github.com/nodejs/node/issues/25875 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'deps/uv/src/win')
-rw-r--r--deps/uv/src/win/thread.c27
-rw-r--r--deps/uv/src/win/tty.c4
-rw-r--r--deps/uv/src/win/util.c80
3 files changed, 85 insertions, 26 deletions
diff --git a/deps/uv/src/win/thread.c b/deps/uv/src/win/thread.c
index fd4b7c9868..89c53ada75 100644
--- a/deps/uv/src/win/thread.c
+++ b/deps/uv/src/win/thread.c
@@ -112,9 +112,34 @@ static UINT __stdcall uv__thread_start(void* arg) {
int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) {
+ uv_thread_options_t params;
+ params.flags = UV_THREAD_NO_FLAGS;
+ return uv_thread_create_ex(tid, &params, entry, arg);
+}
+
+int uv_thread_create_ex(uv_thread_t* tid,
+ const uv_thread_options_t* params,
+ void (*entry)(void *arg),
+ void *arg) {
struct thread_ctx* ctx;
int err;
HANDLE thread;
+ SYSTEM_INFO sysinfo;
+ size_t stack_size;
+ size_t pagesize;
+
+ stack_size =
+ params->flags & UV_THREAD_HAS_STACK_SIZE ? params->stack_size : 0;
+
+ if (stack_size != 0) {
+ GetNativeSystemInfo(&sysinfo);
+ pagesize = (size_t)sysinfo.dwPageSize;
+ /* Round up to the nearest page boundary. */
+ stack_size = (stack_size + pagesize - 1) &~ (pagesize - 1);
+
+ if ((unsigned)stack_size != stack_size)
+ return UV_EINVAL;
+ }
ctx = uv__malloc(sizeof(*ctx));
if (ctx == NULL)
@@ -126,7 +151,7 @@ int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) {
/* Create the thread in suspended state so we have a chance to pass
* its own creation handle to it */
thread = (HANDLE) _beginthreadex(NULL,
- 0,
+ (unsigned)stack_size,
uv__thread_start,
ctx,
CREATE_SUSPENDED,
diff --git a/deps/uv/src/win/tty.c b/deps/uv/src/win/tty.c
index f38e9a8863..a98fe26335 100644
--- a/deps/uv/src/win/tty.c
+++ b/deps/uv/src/win/tty.c
@@ -736,8 +736,8 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle,
/* Ignore keyup events, unless the left alt key was held and a valid
* unicode character was emitted. */
if (!KEV.bKeyDown &&
- KEV.wVirtualKeyCode != VK_MENU &&
- KEV.uChar.UnicodeChar != 0) {
+ (KEV.wVirtualKeyCode != VK_MENU ||
+ KEV.uChar.UnicodeChar == 0)) {
continue;
}
diff --git a/deps/uv/src/win/util.c b/deps/uv/src/win/util.c
index 923789129e..395d958c03 100644
--- a/deps/uv/src/win/util.c
+++ b/deps/uv/src/win/util.c
@@ -59,13 +59,6 @@
# define UNLEN 256
#endif
-/*
- Max hostname length. The Windows gethostname() documentation states that 256
- bytes will always be large enough to hold the null-terminated hostname.
-*/
-#ifndef MAXHOSTNAMELEN
-# define MAXHOSTNAMELEN 256
-#endif
/* Maximum environment variable size, including the terminating null */
#define MAX_ENV_VAR_LENGTH 32767
@@ -684,12 +677,9 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos_ptr, int* cpu_count_ptr) {
NULL,
(BYTE*)&cpu_brand,
&cpu_brand_size);
- if (err != ERROR_SUCCESS) {
- RegCloseKey(processor_key);
- goto error;
- }
-
RegCloseKey(processor_key);
+ if (err != ERROR_SUCCESS)
+ goto error;
cpu_info = &cpu_infos[i];
cpu_info->speed = cpu_speed;
@@ -1510,7 +1500,7 @@ int uv_os_unsetenv(const char* name) {
int uv_os_gethostname(char* buffer, size_t* size) {
- char buf[MAXHOSTNAMELEN + 1];
+ char buf[UV_MAXHOSTNAMESIZE];
size_t len;
if (buffer == NULL || size == NULL || *size == 0)
@@ -1634,6 +1624,10 @@ int uv_os_uname(uv_utsname_t* buffer) {
https://github.com/gagern/gnulib/blob/master/lib/uname.c */
OSVERSIONINFOW os_info;
SYSTEM_INFO system_info;
+ HKEY registry_key;
+ WCHAR product_name_w[256];
+ DWORD product_name_w_size;
+ int version_size;
int processor_level;
int r;
@@ -1658,16 +1652,56 @@ int uv_os_uname(uv_utsname_t* buffer) {
}
/* Populate the version field. */
- if (WideCharToMultiByte(CP_UTF8,
- 0,
- os_info.szCSDVersion,
- -1,
- buffer->version,
- sizeof(buffer->version),
- NULL,
- NULL) == 0) {
- r = uv_translate_sys_error(GetLastError());
- goto error;
+ version_size = 0;
+ r = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
+ L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
+ 0,
+ KEY_QUERY_VALUE,
+ &registry_key);
+
+ if (r == ERROR_SUCCESS) {
+ product_name_w_size = sizeof(product_name_w);
+ r = RegGetValueW(registry_key,
+ NULL,
+ L"ProductName",
+ RRF_RT_REG_SZ,
+ NULL,
+ (PVOID) product_name_w,
+ &product_name_w_size);
+ RegCloseKey(registry_key);
+
+ if (r == ERROR_SUCCESS) {
+ version_size = WideCharToMultiByte(CP_UTF8,
+ 0,
+ product_name_w,
+ -1,
+ buffer->version,
+ sizeof(buffer->version),
+ NULL,
+ NULL);
+ if (version_size == 0) {
+ r = uv_translate_sys_error(GetLastError());
+ goto error;
+ }
+ }
+ }
+
+ /* Append service pack information to the version if present. */
+ if (os_info.szCSDVersion[0] != L'\0') {
+ if (version_size > 0)
+ buffer->version[version_size - 1] = ' ';
+
+ if (WideCharToMultiByte(CP_UTF8,
+ 0,
+ os_info.szCSDVersion,
+ -1,
+ buffer->version + version_size,
+ sizeof(buffer->version) - version_size,
+ NULL,
+ NULL) == 0) {
+ r = uv_translate_sys_error(GetLastError());
+ goto error;
+ }
}
/* Populate the sysname field. */