Skip to content

Commit d9d541c

Browse files
cjihrigMylesBorins
authored andcommitted
deps: upgrade to libuv 1.23.0
Notable changes: - Restores compatibility with the old IPC protocol. - Adds uv_open_osfhandle(). - Adds uv_os_{get,set}priority(). Backport-PR-URL: #24103 PR-URL: #22365 Fixes: #21671 Fixes: #15433 Refs: #21675 Refs: nodejs/node-addon-api#304 Refs: nodejs/abi-stable-node#318 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent e3d08af commit d9d541c

24 files changed

+633
-104
lines changed

deps/uv/AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -345,3 +345,4 @@ Peter Johnson <[email protected]>
345345
Paolo Greppi <[email protected]>
346346
Shelley Vohr <[email protected]>
347347
Ujjwal Sharma <[email protected]>
348+
Michał Kozakiewicz <[email protected]>

deps/uv/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ set(uv_test_sources
9898
test/test-poll-closesocket.c
9999
test/test-poll-oob.c
100100
test/test-poll.c
101+
test/test-process-priority.c
101102
test/test-process-title-threadsafe.c
102103
test/test-process-title.c
103104
test/test-queue-foreach-delete.c

deps/uv/ChangeLog

+22
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
2018.08.18, Version 1.23.0 (Stable), 7ebb26225f2eaae6db22f4ef34ce76fa16ff89ec
2+
3+
Changes since version 1.22.0:
4+
5+
* win,pipe: restore compatibility with the old IPC framing protocol (Bert
6+
Belder)
7+
8+
* fs: add uv_open_osfhandle (Bartosz Sosnowski)
9+
10+
* doc: update Visual C++ Build Tools URL (Michał Kozakiewicz)
11+
12+
* unix: loop starvation on successful write complete (jBarz)
13+
14+
* win: add uv__getnameinfo_work() error handling (A. Hauptmann)
15+
16+
* win: return UV_ENOMEM from uv_loop_init() (cjihrig)
17+
18+
* unix,win: add uv_os_{get,set}priority() (cjihrig)
19+
20+
* test: fix warning in test-tcp-open (Santiago Gimeno)
21+
22+
123
2018.07.11, Version 1.22.0 (Stable), 8568f78a777d79d35eb7d6994617267b9fb33967
224

325
Changes since version 1.21.0:

deps/uv/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
224224
test/test-poll-close-doesnt-corrupt-stack.c \
225225
test/test-poll-closesocket.c \
226226
test/test-poll-oob.c \
227+
test/test-process-priority.c \
227228
test/test-process-title.c \
228229
test/test-process-title-threadsafe.c \
229230
test/test-queue-foreach-delete.c \

deps/uv/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ See the [guidelines for contributing][].
349349
[libuv_banner]: https://raw.githubusercontent.com/libuv/libuv/master/img/banner.png
350350
[x32]: https://en.wikipedia.org/wiki/X32_ABI
351351
[Python 2.6 or 2.7]: https://www.python.org/downloads/
352-
[Visual C++ Build Tools]: http://landinghub.visualstudio.com/visual-cpp-build-tools
352+
[Visual C++ Build Tools]: https://visualstudio.microsoft.com/visual-cpp-build-tools/
353353
[Visual Studio 2015 Update 3]: https://www.visualstudio.com/vs/older-downloads/
354354
[Visual Studio 2017]: https://www.visualstudio.com/downloads/
355355
[Git for Windows]: http://git-scm.com/download/win

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.22.0], [https://github.com/libuv/libuv/issues])
16+
AC_INIT([libuv], [1.23.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/fs.rst

+9
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,15 @@ Helper functions
403403
404404
.. versionadded:: 1.12.0
405405
406+
.. c:function:: int uv_open_osfhandle(uv_os_fd_t os_fd)
407+
408+
For a OS-dependent handle, get the file descriptor in the C runtime.
409+
On UNIX, returns the ``os_fd`` intact. On Windows, this calls `_open_osfhandle <https://msdn.microsoft.com/en-us/library/bdts1c9x.aspx>`_.
410+
Note that the return value is still owned by the CRT,
411+
any attempts to close it or to use it after closing the handle may lead to malfunction.
412+
413+
.. versionadded:: 1.23.0
414+
406415
File open constants
407416
-------------------
408417

deps/uv/docs/src/misc.rst

+28
Original file line numberDiff line numberDiff line change
@@ -517,3 +517,31 @@ API
517517
storage required to hold the value.
518518
519519
.. versionadded:: 1.12.0
520+
521+
.. c:function:: int uv_os_getpriority(uv_pid_t pid, int* priority)
522+
523+
Retrieves the scheduling priority of the process specified by `pid`. The
524+
returned value of `priority` is between -20 (high priority) and 19 (low
525+
priority).
526+
527+
.. note::
528+
On Windows, the returned priority will equal one of the `UV_PRIORITY`
529+
constants.
530+
531+
.. versionadded:: 1.23.0
532+
533+
.. c:function:: int uv_os_setpriority(uv_pid_t pid, int priority)
534+
535+
Sets the scheduling priority of the process specified by `pid`. The
536+
`priority` value range is between -20 (high priority) and 19 (low priority).
537+
The constants `UV_PRIORITY_LOW`, `UV_PRIORITY_BELOW_NORMAL`,
538+
`UV_PRIORITY_NORMAL`, `UV_PRIORITY_ABOVE_NORMAL`, `UV_PRIORITY_HIGH`, and
539+
`UV_PRIORITY_HIGHEST` are also provided for convenience.
540+
541+
.. note::
542+
On Windows, this function utilizes `SetPriorityClass()`. The `priority`
543+
argument is mapped to a Windows priority class. When retrieving the
544+
process priority, the result will equal one of the `UV_PRIORITY`
545+
constants, and not necessarily the exact value of `priority`.
546+
547+
.. versionadded:: 1.23.0

deps/uv/include/uv.h

+11
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,7 @@ UV_EXTERN int uv_set_process_title(const char* title);
10651065
UV_EXTERN int uv_resident_set_memory(size_t* rss);
10661066
UV_EXTERN int uv_uptime(double* uptime);
10671067
UV_EXTERN uv_os_fd_t uv_get_osfhandle(int fd);
1068+
UV_EXTERN int uv_open_osfhandle(uv_os_fd_t os_fd);
10681069

10691070
typedef struct {
10701071
long tv_sec;
@@ -1099,6 +1100,16 @@ UV_EXTERN void uv_os_free_passwd(uv_passwd_t* pwd);
10991100
UV_EXTERN uv_pid_t uv_os_getpid(void);
11001101
UV_EXTERN uv_pid_t uv_os_getppid(void);
11011102

1103+
#define UV_PRIORITY_LOW 19
1104+
#define UV_PRIORITY_BELOW_NORMAL 10
1105+
#define UV_PRIORITY_NORMAL 0
1106+
#define UV_PRIORITY_ABOVE_NORMAL -7
1107+
#define UV_PRIORITY_HIGH -14
1108+
#define UV_PRIORITY_HIGHEST -20
1109+
1110+
UV_EXTERN int uv_os_getpriority(uv_pid_t pid, int* priority);
1111+
UV_EXTERN int uv_os_setpriority(uv_pid_t pid, int priority);
1112+
11021113
UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count);
11031114
UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count);
11041115

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 22
34+
#define UV_VERSION_MINOR 23
3535
#define UV_VERSION_PATCH 0
3636
#define UV_VERSION_IS_RELEASE 1
3737
#define UV_VERSION_SUFFIX ""

deps/uv/src/unix/core.c

+31
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,9 @@ uv_os_fd_t uv_get_osfhandle(int fd) {
13381338
return fd;
13391339
}
13401340

1341+
int uv_open_osfhandle(uv_os_fd_t os_fd) {
1342+
return os_fd;
1343+
}
13411344

13421345
uv_pid_t uv_os_getpid(void) {
13431346
return getpid();
@@ -1347,3 +1350,31 @@ uv_pid_t uv_os_getpid(void) {
13471350
uv_pid_t uv_os_getppid(void) {
13481351
return getppid();
13491352
}
1353+
1354+
1355+
int uv_os_getpriority(uv_pid_t pid, int* priority) {
1356+
int r;
1357+
1358+
if (priority == NULL)
1359+
return UV_EINVAL;
1360+
1361+
errno = 0;
1362+
r = getpriority(PRIO_PROCESS, (int) pid);
1363+
1364+
if (r == -1 && errno != 0)
1365+
return UV__ERR(errno);
1366+
1367+
*priority = r;
1368+
return 0;
1369+
}
1370+
1371+
1372+
int uv_os_setpriority(uv_pid_t pid, int priority) {
1373+
if (priority < UV_PRIORITY_HIGHEST || priority > UV_PRIORITY_LOW)
1374+
return UV_EINVAL;
1375+
1376+
if (setpriority(PRIO_PROCESS, (int) pid, priority) != 0)
1377+
return UV__ERR(errno);
1378+
1379+
return 0;
1380+
}

deps/uv/src/unix/stream.c

+8-4
Original file line numberDiff line numberDiff line change
@@ -950,10 +950,16 @@ static void uv__write(uv_stream_t* stream) {
950950
static void uv__write_callbacks(uv_stream_t* stream) {
951951
uv_write_t* req;
952952
QUEUE* q;
953+
QUEUE pq;
953954

954-
while (!QUEUE_EMPTY(&stream->write_completed_queue)) {
955+
if (QUEUE_EMPTY(&stream->write_completed_queue))
956+
return;
957+
958+
QUEUE_MOVE(&stream->write_completed_queue, &pq);
959+
960+
while (!QUEUE_EMPTY(&pq)) {
955961
/* Pop a req off write_completed_queue. */
956-
q = QUEUE_HEAD(&stream->write_completed_queue);
962+
q = QUEUE_HEAD(&pq);
957963
req = QUEUE_DATA(q, uv_write_t, queue);
958964
QUEUE_REMOVE(q);
959965
uv__req_unregister(stream->loop, req);
@@ -969,8 +975,6 @@ static void uv__write_callbacks(uv_stream_t* stream) {
969975
if (req->cb)
970976
req->cb(req, req->error);
971977
}
972-
973-
assert(QUEUE_EMPTY(&stream->write_completed_queue));
974978
}
975979

976980

deps/uv/src/win/core.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,10 @@ int uv_loop_init(uv_loop_t* loop) {
249249
loop->endgame_handles = NULL;
250250

251251
loop->timer_heap = timer_heap = uv__malloc(sizeof(*timer_heap));
252-
if (timer_heap == NULL)
252+
if (timer_heap == NULL) {
253+
err = UV_ENOMEM;
253254
goto fail_timers_alloc;
255+
}
254256

255257
heap_init(timer_heap);
256258

deps/uv/src/win/getnameinfo.c

+28-21
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static void uv__getnameinfo_work(struct uv__work* w) {
4242
uv_getnameinfo_t* req;
4343
WCHAR host[NI_MAXHOST];
4444
WCHAR service[NI_MAXSERV];
45-
int ret = 0;
45+
int ret;
4646

4747
req = container_of(w, uv_getnameinfo_t, work_req);
4848
if (GetNameInfoW((struct sockaddr*)&req->storage,
@@ -53,27 +53,34 @@ static void uv__getnameinfo_work(struct uv__work* w) {
5353
ARRAY_SIZE(service),
5454
req->flags)) {
5555
ret = WSAGetLastError();
56+
req->retcode = uv__getaddrinfo_translate_error(ret);
57+
return;
58+
}
59+
60+
ret = WideCharToMultiByte(CP_UTF8,
61+
0,
62+
host,
63+
-1,
64+
req->host,
65+
sizeof(req->host),
66+
NULL,
67+
NULL);
68+
if (ret == 0) {
69+
req->retcode = uv_translate_sys_error(GetLastError());
70+
return;
71+
}
72+
73+
ret = WideCharToMultiByte(CP_UTF8,
74+
0,
75+
service,
76+
-1,
77+
req->service,
78+
sizeof(req->service),
79+
NULL,
80+
NULL);
81+
if (ret == 0) {
82+
req->retcode = uv_translate_sys_error(GetLastError());
5683
}
57-
req->retcode = uv__getaddrinfo_translate_error(ret);
58-
59-
/* convert results to UTF-8 */
60-
WideCharToMultiByte(CP_UTF8,
61-
0,
62-
host,
63-
-1,
64-
req->host,
65-
sizeof(req->host),
66-
NULL,
67-
NULL);
68-
69-
WideCharToMultiByte(CP_UTF8,
70-
0,
71-
service,
72-
-1,
73-
req->service,
74-
sizeof(req->service),
75-
NULL,
76-
NULL);
7784
}
7885

7986

deps/uv/src/win/handle.c

+4
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,7 @@ int uv_is_closing(const uv_handle_t* handle) {
157157
uv_os_fd_t uv_get_osfhandle(int fd) {
158158
return uv__get_osfhandle(fd);
159159
}
160+
161+
int uv_open_osfhandle(uv_os_fd_t os_fd) {
162+
return _open_osfhandle((intptr_t) os_fd, 0);
163+
}

deps/uv/src/win/internal.h

+10-2
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,15 @@ extern UV_THREAD_LOCAL int uv__crt_assert_enabled;
6161
* TCP
6262
*/
6363

64+
typedef enum {
65+
UV__IPC_SOCKET_XFER_NONE = 0,
66+
UV__IPC_SOCKET_XFER_TCP_CONNECTION,
67+
UV__IPC_SOCKET_XFER_TCP_SERVER
68+
} uv__ipc_socket_xfer_type_t;
69+
6470
typedef struct {
6571
WSAPROTOCOL_INFOW socket_info;
6672
uint32_t delayed_error;
67-
uint32_t flags; /* Either zero or UV_HANDLE_CONNECTION. */
6873
} uv__ipc_socket_xfer_info_t;
6974

7075
int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb);
@@ -89,8 +94,11 @@ void uv_tcp_endgame(uv_loop_t* loop, uv_tcp_t* handle);
8994

9095
int uv__tcp_xfer_export(uv_tcp_t* handle,
9196
int pid,
97+
uv__ipc_socket_xfer_type_t* xfer_type,
98+
uv__ipc_socket_xfer_info_t* xfer_info);
99+
int uv__tcp_xfer_import(uv_tcp_t* tcp,
100+
uv__ipc_socket_xfer_type_t xfer_type,
92101
uv__ipc_socket_xfer_info_t* xfer_info);
93-
int uv__tcp_xfer_import(uv_tcp_t* tcp, uv__ipc_socket_xfer_info_t* xfer_info);
94102

95103

96104
/*

0 commit comments

Comments
 (0)