Skip to content

Commit 8b5a2c4

Browse files
cjihrigaddaleax
authored andcommitted
deps: upgrade to libuv 1.26.0
Notable changes: - A bug that could result in 100% CPU utilization in Node has been fixed (libuv/libuv#2162) - Node's report module will now include the entire Windows product name (libuv/libuv#2170) PR-URL: #26037 Fixes: #26013 Fixes: #25875 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
1 parent b2b37c6 commit 8b5a2c4

28 files changed

+613
-58
lines changed

deps/uv/AUTHORS

+3
Original file line numberDiff line numberDiff line change
@@ -366,3 +366,6 @@ ptlomholt <pt@lomholt.com>
366366
Victor Costan <pwnall@chromium.org>
367367
sid <sidyhe@hotmail.com>
368368
Kevin Adler <kadler@us.ibm.com>
369+
Stephen Belanger <admin@stephenbelanger.com>
370+
yeyuanfeng <yeyuanfeng@bytedance.com>
371+
erw7 <erw7.github@gmail.com>

deps/uv/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ set(uv_test_sources
149149
test/test-timer-from-check.c
150150
test/test-timer.c
151151
test/test-tmpdir.c
152+
test/test-tty-duplicate-key.c
152153
test/test-tty.c
153154
test/test-udp-alloc-cb-fail.c
154155
test/test-udp-bind.c

deps/uv/ChangeLog

+23
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
2019.02.11, Version 1.26.0 (Stable), 8669d8d3e93cddb62611b267ef62a3ddb5ba3ca0
2+
3+
Changes since version 1.25.0:
4+
5+
* doc: fix uv_get_free_memory doc (Stephen Belanger)
6+
7+
* unix: fix epoll cpu 100% issue (yeyuanfeng)
8+
9+
* openbsd,tcp: special handling of EINVAL on connect (ptlomholt)
10+
11+
* win: simplify registry closing in uv_cpu_info() (cjihrig)
12+
13+
* src,include: define UV_MAXHOSTNAMESIZE (cjihrig)
14+
15+
* win: return product name in uv_os_uname() version (cjihrig)
16+
17+
* thread: allow specifying stack size for new thread (Anna Henningsen)
18+
19+
* win: fix duplicate tty vt100 fn key (erw7)
20+
21+
* unix: don't attempt to invalidate invalid fd (Ben Noordhuis)
22+
23+
124
2019.01.19, Version 1.25.0 (Stable), 4a10a9d425863330af199e4b74bd688e62d945f1
225

326
Changes since version 1.24.1:

deps/uv/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
277277
test/test-timer-from-check.c \
278278
test/test-timer.c \
279279
test/test-tmpdir.c \
280+
test/test-tty-duplicate-key.c \
280281
test/test-tty.c \
281282
test/test-udp-alloc-cb-fail.c \
282283
test/test-udp-bind.c \

deps/uv/configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1414

1515
AC_PREREQ(2.57)
16-
AC_INIT([libuv], [1.25.0], [https://github.com/libuv/libuv/issues])
16+
AC_INIT([libuv], [1.26.0], [https://github.com/libuv/libuv/issues])
1717
AC_CONFIG_MACRO_DIR([m4])
1818
m4_include([m4/libuv-extra-automake-flags.m4])
1919
m4_include([m4/as_case.m4])

deps/uv/docs/src/misc.rst

+8-1
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,10 @@ API
431431
432432
.. versionadded:: 1.9.0
433433
434-
.. uint64_t uv_get_free_memory(void)
434+
.. c:function:: uint64_t uv_get_free_memory(void)
435+
436+
Gets memory information (in bytes).
437+
435438
.. c:function:: uint64_t uv_get_total_memory(void)
436439
437440
Gets memory information (in bytes).
@@ -531,6 +534,10 @@ API
531534
532535
.. versionadded:: 1.12.0
533536
537+
.. versionchanged:: 1.26.0 `UV_MAXHOSTNAMESIZE` is available and represents
538+
the maximum `buffer` size required to store a
539+
hostname and terminating `nul` character.
540+
534541
.. c:function:: int uv_os_getpriority(uv_pid_t pid, int* priority)
535542
536543
Retrieves the scheduling priority of the process specified by `pid`. The

deps/uv/docs/src/threading.rst

+29
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,39 @@ API
5555
Threads
5656
^^^^^^^
5757

58+
.. c:type:: uv_thread_options_t
59+
60+
Options for spawning a new thread (passed to :c:func:`uv_thread_create_ex`).
61+
62+
::
63+
64+
typedef struct uv_process_options_s {
65+
enum {
66+
UV_THREAD_NO_FLAGS = 0x00,
67+
UV_THREAD_HAS_STACK_SIZE = 0x01
68+
} flags;
69+
size_t stack_size;
70+
} uv_process_options_t;
71+
72+
More fields may be added to this struct at any time, so its exact
73+
layout and size should not be relied upon.
74+
75+
.. versionadded:: 1.26.0
76+
5877
.. c:function:: int uv_thread_create(uv_thread_t* tid, uv_thread_cb entry, void* arg)
5978
6079
.. versionchanged:: 1.4.1 returns a UV_E* error code on failure
6180
81+
.. c:function:: int uv_thread_create_ex(uv_thread_t* tid, const uv_thread_options_t* params, uv_thread_cb entry, void* arg)
82+
83+
Like :c:func:`uv_thread_create`, but additionally specifies options for creating a new thread.
84+
85+
If `UV_THREAD_HAS_STACK_SIZE` is set, `stack_size` specifies a stack size for the new thread.
86+
`0` indicates that the default value should be used, i.e. behaves as if the flag was not set.
87+
Other values will be rounded up to the nearest page boundary.
88+
89+
.. versionadded:: 1.26.0
90+
6291
.. c:function:: uv_thread_t uv_thread_self(void)
6392
.. c:function:: int uv_thread_join(uv_thread_t *tid)
6493
.. c:function:: int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2)

deps/uv/include/uv.h

+29
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,17 @@ UV_EXTERN int uv_os_getenv(const char* name, char* buffer, size_t* size);
11441144
UV_EXTERN int uv_os_setenv(const char* name, const char* value);
11451145
UV_EXTERN int uv_os_unsetenv(const char* name);
11461146

1147+
#ifdef MAXHOSTNAMELEN
1148+
# define UV_MAXHOSTNAMESIZE (MAXHOSTNAMELEN + 1)
1149+
#else
1150+
/*
1151+
Fallback for the maximum hostname size, including the null terminator. The
1152+
Windows gethostname() documentation states that 256 bytes will always be
1153+
large enough to hold the null-terminated hostname.
1154+
*/
1155+
# define UV_MAXHOSTNAMESIZE 256
1156+
#endif
1157+
11471158
UV_EXTERN int uv_os_gethostname(char* buffer, size_t* size);
11481159

11491160
UV_EXTERN int uv_os_uname(uv_utsname_t* buffer);
@@ -1574,6 +1585,24 @@ UV_EXTERN void uv_key_set(uv_key_t* key, void* value);
15741585
typedef void (*uv_thread_cb)(void* arg);
15751586

15761587
UV_EXTERN int uv_thread_create(uv_thread_t* tid, uv_thread_cb entry, void* arg);
1588+
1589+
typedef enum {
1590+
UV_THREAD_NO_FLAGS = 0x00,
1591+
UV_THREAD_HAS_STACK_SIZE = 0x01
1592+
} uv_thread_create_flags;
1593+
1594+
struct uv_thread_options_s {
1595+
unsigned int flags;
1596+
size_t stack_size;
1597+
/* More fields may be added at any time. */
1598+
};
1599+
1600+
typedef struct uv_thread_options_s uv_thread_options_t;
1601+
1602+
UV_EXTERN int uv_thread_create_ex(uv_thread_t* tid,
1603+
const uv_thread_options_t* params,
1604+
uv_thread_cb entry,
1605+
void* arg);
15771606
UV_EXTERN uv_thread_t uv_thread_self(void);
15781607
UV_EXTERN int uv_thread_join(uv_thread_t *tid);
15791608
UV_EXTERN int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2);

deps/uv/include/uv/unix.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@
3131
#include <netinet/in.h>
3232
#include <netinet/tcp.h>
3333
#include <arpa/inet.h>
34-
#include <netdb.h>
34+
#include <netdb.h> /* MAXHOSTNAMELEN on Solaris */
3535

3636
#include <termios.h>
3737
#include <pwd.h>
3838

3939
#if !defined(__MVS__)
4040
#include <semaphore.h>
41+
#include <sys/param.h> /* MAXHOSTNAMELEN on Linux and the BSDs */
4142
#endif
4243
#include <pthread.h>
4344
#include <signal.h>

deps/uv/include/uv/version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*/
3232

3333
#define UV_VERSION_MAJOR 1
34-
#define UV_VERSION_MINOR 25
34+
#define UV_VERSION_MINOR 26
3535
#define UV_VERSION_PATCH 0
3636
#define UV_VERSION_IS_RELEASE 1
3737
#define UV_VERSION_SUFFIX ""

deps/uv/src/unix/aix.c

+1
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,7 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
10411041
struct poll_ctl pc;
10421042

10431043
assert(loop->watchers != NULL);
1044+
assert(fd >= 0);
10441045

10451046
events = (struct pollfd*) loop->watchers[loop->nwatchers];
10461047
nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1];

deps/uv/src/unix/core.c

+3-12
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
#include <sys/utsname.h>
4444

4545
#ifdef __sun
46-
# include <netdb.h> /* MAXHOSTNAMELEN on Solaris */
4746
# include <sys/filio.h>
4847
# include <sys/types.h>
4948
# include <sys/wait.h>
@@ -88,15 +87,6 @@
8887
#include <sys/ioctl.h>
8988
#endif
9089

91-
#if !defined(__MVS__)
92-
#include <sys/param.h> /* MAXHOSTNAMELEN on Linux and the BSDs */
93-
#endif
94-
95-
/* Fallback for the maximum hostname length */
96-
#ifndef MAXHOSTNAMELEN
97-
# define MAXHOSTNAMELEN 256
98-
#endif
99-
10090
static int uv__run_pending(uv_loop_t* loop);
10191

10292
/* Verify that uv_buf_t is ABI-compatible with struct iovec. */
@@ -892,7 +882,8 @@ void uv__io_close(uv_loop_t* loop, uv__io_t* w) {
892882
QUEUE_REMOVE(&w->pending_queue);
893883

894884
/* Remove stale events for this file descriptor */
895-
uv__platform_invalidate_fd(loop, w->fd);
885+
if (w->fd != -1)
886+
uv__platform_invalidate_fd(loop, w->fd);
896887
}
897888

898889

@@ -1291,7 +1282,7 @@ int uv_os_gethostname(char* buffer, size_t* size) {
12911282
instead by creating a large enough buffer and comparing the hostname length
12921283
to the size input.
12931284
*/
1294-
char buf[MAXHOSTNAMELEN + 1];
1285+
char buf[UV_MAXHOSTNAMESIZE];
12951286
size_t len;
12961287

12971288
if (buffer == NULL || size == NULL || *size == 0)

deps/uv/src/unix/kqueue.c

+1
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
387387
uintptr_t nfds;
388388

389389
assert(loop->watchers != NULL);
390+
assert(fd >= 0);
390391

391392
events = (struct kevent*) loop->watchers[loop->nwatchers];
392393
nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1];

deps/uv/src/unix/linux-core.c

+1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
141141
uintptr_t nfds;
142142

143143
assert(loop->watchers != NULL);
144+
assert(fd >= 0);
144145

145146
events = (struct epoll_event*) loop->watchers[loop->nwatchers];
146147
nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1];

deps/uv/src/unix/os390.c

+1
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
657657
uintptr_t nfds;
658658

659659
assert(loop->watchers != NULL);
660+
assert(fd >= 0);
660661

661662
events = (struct epoll_event*) loop->watchers[loop->nwatchers];
662663
nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1];

deps/uv/src/unix/pipe.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ void uv_pipe_connect(uv_connect_t* req,
215215
}
216216

217217
if (err == 0)
218-
uv__io_start(handle->loop, &handle->io_watcher, POLLIN | POLLOUT);
218+
uv__io_start(handle->loop, &handle->io_watcher, POLLOUT);
219219

220220
out:
221221
handle->delayed_error = err;

deps/uv/src/unix/posix-poll.c

+2
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
298298
void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
299299
size_t i;
300300

301+
assert(fd >= 0);
302+
301303
if (loop->poll_fds_iterating) {
302304
/* uv__io_poll is currently iterating. Just invalidate fd. */
303305
for (i = 0; i < loop->poll_fds_used; i++)

deps/uv/src/unix/sunos.c

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
117117
uintptr_t nfds;
118118

119119
assert(loop->watchers != NULL);
120+
assert(fd >= 0);
120121

121122
events = (struct port_event*) loop->watchers[loop->nwatchers];
122123
nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1];

deps/uv/src/unix/tcp.c

+9-5
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,16 @@ int uv__tcp_connect(uv_connect_t* req,
235235
if (r == -1 && errno != 0) {
236236
if (errno == EINPROGRESS)
237237
; /* not an error */
238-
else if (errno == ECONNREFUSED)
239-
/* If we get a ECONNREFUSED wait until the next tick to report the
240-
* error. Solaris wants to report immediately--other unixes want to
241-
* wait.
238+
else if (errno == ECONNREFUSED
239+
#if defined(__OpenBSD__)
240+
|| errno == EINVAL
241+
#endif
242+
)
243+
/* If we get ECONNREFUSED (Solaris) or EINVAL (OpenBSD) wait until the
244+
* next tick to report the error. Solaris and OpenBSD wants to report
245+
* immediately -- other unixes want to wait.
242246
*/
243-
handle->delayed_error = UV__ERR(errno);
247+
handle->delayed_error = UV__ERR(ECONNREFUSED);
244248
else
245249
return UV__ERR(errno);
246250
}

deps/uv/src/unix/thread.c

+23-2
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,34 @@ static size_t thread_stack_size(void) {
194194

195195

196196
int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) {
197+
uv_thread_options_t params;
198+
params.flags = UV_THREAD_NO_FLAGS;
199+
return uv_thread_create_ex(tid, &params, entry, arg);
200+
}
201+
202+
int uv_thread_create_ex(uv_thread_t* tid,
203+
const uv_thread_options_t* params,
204+
void (*entry)(void *arg),
205+
void *arg) {
197206
int err;
198-
size_t stack_size;
199207
pthread_attr_t* attr;
200208
pthread_attr_t attr_storage;
209+
size_t pagesize;
210+
size_t stack_size;
211+
212+
stack_size =
213+
params->flags & UV_THREAD_HAS_STACK_SIZE ? params->stack_size : 0;
201214

202215
attr = NULL;
203-
stack_size = thread_stack_size();
216+
if (stack_size == 0) {
217+
stack_size = thread_stack_size();
218+
} else {
219+
pagesize = (size_t)getpagesize();
220+
/* Round up to the nearest page boundary. */
221+
stack_size = (stack_size + pagesize - 1) &~ (pagesize - 1);
222+
if (stack_size < PTHREAD_STACK_MIN)
223+
stack_size = PTHREAD_STACK_MIN;
224+
}
204225

205226
if (stack_size > 0) {
206227
attr = &attr_storage;

deps/uv/src/win/thread.c

+26-1
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,34 @@ static UINT __stdcall uv__thread_start(void* arg) {
112112

113113

114114
int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) {
115+
uv_thread_options_t params;
116+
params.flags = UV_THREAD_NO_FLAGS;
117+
return uv_thread_create_ex(tid, &params, entry, arg);
118+
}
119+
120+
int uv_thread_create_ex(uv_thread_t* tid,
121+
const uv_thread_options_t* params,
122+
void (*entry)(void *arg),
123+
void *arg) {
115124
struct thread_ctx* ctx;
116125
int err;
117126
HANDLE thread;
127+
SYSTEM_INFO sysinfo;
128+
size_t stack_size;
129+
size_t pagesize;
130+
131+
stack_size =
132+
params->flags & UV_THREAD_HAS_STACK_SIZE ? params->stack_size : 0;
133+
134+
if (stack_size != 0) {
135+
GetNativeSystemInfo(&sysinfo);
136+
pagesize = (size_t)sysinfo.dwPageSize;
137+
/* Round up to the nearest page boundary. */
138+
stack_size = (stack_size + pagesize - 1) &~ (pagesize - 1);
139+
140+
if ((unsigned)stack_size != stack_size)
141+
return UV_EINVAL;
142+
}
118143

119144
ctx = uv__malloc(sizeof(*ctx));
120145
if (ctx == NULL)
@@ -126,7 +151,7 @@ int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) {
126151
/* Create the thread in suspended state so we have a chance to pass
127152
* its own creation handle to it */
128153
thread = (HANDLE) _beginthreadex(NULL,
129-
0,
154+
(unsigned)stack_size,
130155
uv__thread_start,
131156
ctx,
132157
CREATE_SUSPENDED,

0 commit comments

Comments
 (0)