Skip to content

Commit b53ce6e

Browse files
cjihrigBethGriggs
authored andcommittedMar 2, 2020
deps: upgrade to libuv 1.29.1
Notable changes: - uv_get_constrained_memory() has been added. - A race condition in uv_async_send() has been fixed. - uv_get_free_memory() and uv_get_total_memory() now read from /proc/meminfo, which should improve correctness when called from inside an lxc container. - A failed assertion in uv_fs_poll_stop() has been fixed. - A bug in MAC addresses for IP-aliases has been fixed. Fixes: #27170 Fixes: #27493 PR-URL: #27718 Backport-PR-URL: #31969 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent ecbb331 commit b53ce6e

39 files changed

+596
-76
lines changed
 

Diff for: ‎deps/uv/.mailmap

+1
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ Yuki Okumura <mjt@cltn.org>
4646
jBarz <jBarz@users.noreply.github.com> <jbarboza@ca.ibm.com>
4747
jBarz <jBarz@users.noreply.github.com> <jbarz@users.noreply.github.com>
4848
ptlomholt <pt@lomholt.com>
49+
zlargon <zlargon1988@gmail.com>

Diff for: ‎deps/uv/AUTHORS

+6
Original file line numberDiff line numberDiff line change
@@ -376,3 +376,9 @@ Rich Trott <rtrott@gmail.com>
376376
Milad Farazmand <miladfar@ca.ibm.com>
377377
zlargon <zlargon1988@gmail.com>
378378
Yury Selivanov <yury@magic.io>
379+
Oscar Waddell <owaddell@beckman.com>
380+
FX Coudert <fxcoudert@gmail.com>
381+
George Zhao <zhaozg@gmail.com>
382+
Kyle Edwards <kyle.edwards@kitware.com>
383+
ken-cunningham-webuse <ken.cunningham.webuse@gmail.com>
384+
Kelvin Jin <kelvinjin@google.com>

Diff for: ‎deps/uv/CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
297297
src/unix/linux-inotify.c
298298
src/unix/linux-syscalls.c
299299
src/unix/procfs-exepath.c
300-
src/unix/sysinfo-loadavg.c
301-
src/unix/sysinfo-memory.c)
300+
src/unix/sysinfo-loadavg.c)
302301
endif()
303302

304303
if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")

Diff for: ‎deps/uv/ChangeLog

+56
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
1+
2019.05.22, Version 1.29.1 (Stable), d16e6094e1eb3b0b5981ef1dd7e03ec4d466944d
2+
3+
Changes since version 1.29.0:
4+
5+
* unix: simplify uv/posix.h include logic (cjihrig)
6+
7+
* test: increase test timeout (cjihrig)
8+
9+
* linux: fix sscanf() overflows reading from /proc (Ben Noordhuis)
10+
11+
12+
2019.05.16, Version 1.29.0 (Stable), 43957efd92c167b352b4c948b617ca7afbee0ed1
13+
14+
Changes since version 1.28.0:
15+
16+
* ibmi: read memory and CPU usage info (Xu Meng)
17+
18+
* doc: update the cmake testing instruction (zlargon)
19+
20+
* unix: fix race condition in uv_async_send() (Ben Noordhuis)
21+
22+
* linux: use O_CLOEXEC instead of EPOLL_CLOEXEC (Ben Noordhuis)
23+
24+
* doc: mark uv_async_send() as async-signal-safe (Ben Noordhuis)
25+
26+
* linux: init st_flags and st_gen when using statx (Oscar Waddell)
27+
28+
* linux: read free/total memory from /proc/meminfo (Ben Noordhuis)
29+
30+
* test: test zero-sized uv_fs_sendfile() writes (Ben Noordhuis)
31+
32+
* unix: don't assert on UV_PROCESS_WINDOWS_* flags (Ben Noordhuis)
33+
34+
* linux: set correct mac address for IP-aliases (Santiago Gimeno)
35+
36+
* win,util: fix null pointer dereferencing (Tobias Nießen)
37+
38+
* unix,win: fix `uv_fs_poll_stop()` when active (Anna Henningsen)
39+
40+
* doc: add missing uv_fs_type entries (Michele Caini)
41+
42+
* doc: fix build with sphinx 2.x (FX Coudert)
43+
44+
* unix: don't make statx system call on Android (George Zhao)
45+
46+
* unix: fix clang scan-build warning (Kyle Edwards)
47+
48+
* unix: fall back to kqueue on older macOS systems (ken-cunningham-webuse)
49+
50+
* unix,win: add uv_get_constrained_memory() (Kelvin Jin)
51+
52+
* darwin: fix thread cancellation fd leak (Ben Noordhuis)
53+
54+
* linux: fix thread cancellation fd leak (Ben Noordhuis)
55+
56+
157
2019.04.16, Version 1.28.0 (Stable), 7bf8fabfa934660ee0fe889f78e151198a1165fc
258

359
Changes since version 1.27.0:

Diff for: ‎deps/uv/Makefile.am

+1-2
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,7 @@ libuv_la_SOURCES += src/unix/linux-core.c \
425425
src/unix/linux-syscalls.h \
426426
src/unix/procfs-exepath.c \
427427
src/unix/proctitle.c \
428-
src/unix/sysinfo-loadavg.c \
429-
src/unix/sysinfo-memory.c
428+
src/unix/sysinfo-loadavg.c
430429
test_run_tests_LDFLAGS += -lutil
431430
endif
432431

Diff for: ‎deps/uv/README.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,14 @@ $ make install
172172
To build with [CMake](https://cmake.org/):
173173

174174
```bash
175-
$ mkdir -p out/cmake ; cd out/cmake ; cmake -DBUILD_TESTING=ON ../..
176-
$ make all test
177-
# Or manually:
178-
$ ./uv_run_tests # shared library build
179-
$ ./uv_run_tests_a # static library build
175+
$ mkdir -p out/cmake ; cd out/cmake # create build directory
176+
$ cmake ../.. -DBUILD_TESTING=ON # generate project with test
177+
$ cmake --build . # build
178+
$ ctest -C Debug --output-on-failure # run tests
179+
180+
# Or manually run tests:
181+
$ ./out/cmake/uv_run_tests # shared library build
182+
$ ./out/cmake/uv_run_tests_a # static library build
180183
```
181184

182185
To build with GYP, first run:

Diff for: ‎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.28.0], [https://github.com/libuv/libuv/issues])
16+
AC_INIT([libuv], [1.29.1], [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])

Diff for: ‎deps/uv/docs/src/async.rst

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ API
5050
It's safe to call this function from any thread. The callback will be called on the
5151
loop thread.
5252
53+
.. note::
54+
:c:func:`uv_async_send` is `async-signal-safe <http://man7.org/linux/man-pages/man7/signal-safety.7.html>`_.
55+
It's safe to call this function from a signal handler.
56+
5357
.. warning::
5458
libuv will coalesce calls to :c:func:`uv_async_send`, that is, not every call to it will
5559
yield an execution of the callback. For example: if :c:func:`uv_async_send` is called 5

Diff for: ‎deps/uv/docs/src/fs.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ Data types
9696
UV_FS_FCHOWN,
9797
UV_FS_REALPATH,
9898
UV_FS_COPYFILE,
99-
UV_FS_LCHOWN
99+
UV_FS_LCHOWN,
100+
UV_FS_OPENDIR,
101+
UV_FS_READDIR,
102+
UV_FS_CLOSEDIR
100103
} uv_fs_type;
101104

102105
.. c:type:: uv_dirent_t

Diff for: ‎deps/uv/docs/src/misc.rst

+13
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,19 @@ API
461461
462462
Gets memory information (in bytes).
463463
464+
.. c:function:: uint64_t uv_get_constrained_memory(void)
465+
466+
Gets the amount of memory available to the process (in bytes) based on
467+
limits imposed by the OS. If there is no such constraint, or the constraint
468+
is unknown, `0` is returned. Note that it is not unusual for this value to
469+
be less than or greater than :c:func:`uv_get_total_memory`.
470+
471+
.. note::
472+
This function currently only returns a non-zero value on Linux, based
473+
on cgroups if it is present.
474+
475+
.. versionadded:: 1.29.0
476+
464477
.. c:function:: uint64_t uv_hrtime(void)
465478
466479
Returns the current high-resolution real time. This is expressed in

Diff for: ‎deps/uv/docs/src/sphinx-plugins/manpage.py

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def man_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
3939

4040

4141
def setup(app):
42-
app.info('Initializing manpage plugin')
4342
app.add_role('man', man_role)
4443
app.add_config_value('man_url_regex', None, 'env')
4544
return

Diff for: ‎deps/uv/include/uv.h

+1
Original file line numberDiff line numberDiff line change
@@ -1561,6 +1561,7 @@ UV_EXTERN int uv_chdir(const char* dir);
15611561

15621562
UV_EXTERN uint64_t uv_get_free_memory(void);
15631563
UV_EXTERN uint64_t uv_get_total_memory(void);
1564+
UV_EXTERN uint64_t uv_get_constrained_memory(void);
15641565

15651566
UV_EXTERN uint64_t uv_hrtime(void);
15661567

Diff for: ‎deps/uv/include/uv/unix.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949
# include "uv/linux.h"
5050
#elif defined (__MVS__)
5151
# include "uv/os390.h"
52-
#elif defined(__PASE__)
53-
# include "uv/posix.h"
5452
#elif defined(_AIX)
5553
# include "uv/aix.h"
5654
#elif defined(__sun)
@@ -63,9 +61,10 @@
6361
defined(__OpenBSD__) || \
6462
defined(__NetBSD__)
6563
# include "uv/bsd.h"
66-
#elif defined(__CYGWIN__) || defined(__MSYS__)
67-
# include "uv/posix.h"
68-
#elif defined(__GNU__)
64+
#elif defined(__PASE__) || \
65+
defined(__CYGWIN__) || \
66+
defined(__MSYS__) || \
67+
defined(__GNU__)
6968
# include "uv/posix.h"
7069
#endif
7170

Diff for: ‎deps/uv/include/uv/version.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
*/
3232

3333
#define UV_VERSION_MAJOR 1
34-
#define UV_VERSION_MINOR 28
35-
#define UV_VERSION_PATCH 0
34+
#define UV_VERSION_MINOR 29
35+
#define UV_VERSION_PATCH 1
3636
#define UV_VERSION_IS_RELEASE 1
3737
#define UV_VERSION_SUFFIX ""
3838

Diff for: ‎deps/uv/src/fs-poll.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ static void timer_close_cb(uv_handle_t* timer) {
241241
handle = ctx->parent_handle;
242242
if (ctx == handle->poll_ctx) {
243243
handle->poll_ctx = ctx->previous;
244-
if (handle->poll_ctx == NULL)
244+
if (handle->poll_ctx == NULL && uv__is_closing(handle))
245245
uv__make_close_pending((uv_handle_t*)handle);
246246
} else {
247247
for (last = handle->poll_ctx, it = last->previous;

Diff for: ‎deps/uv/src/unix/aix.c

+5
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,11 @@ uint64_t uv_get_total_memory(void) {
344344
}
345345

346346

347+
uint64_t uv_get_constrained_memory(void) {
348+
return 0; /* Memory constraints are unknown. */
349+
}
350+
351+
347352
void uv_loadavg(double avg[3]) {
348353
perfstat_cpu_total_t ps_total;
349354
int result = perfstat_cpu_total(NULL, &ps_total, sizeof(ps_total), 1);

Diff for: ‎deps/uv/src/unix/async.c

+33-4
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,43 @@ int uv_async_send(uv_async_t* handle) {
6161
if (ACCESS_ONCE(int, handle->pending) != 0)
6262
return 0;
6363

64-
if (cmpxchgi(&handle->pending, 0, 1) == 0)
65-
uv__async_send(handle->loop);
64+
/* Tell the other thread we're busy with the handle. */
65+
if (cmpxchgi(&handle->pending, 0, 1) != 0)
66+
return 0;
67+
68+
/* Wake up the other thread's event loop. */
69+
uv__async_send(handle->loop);
70+
71+
/* Tell the other thread we're done. */
72+
if (cmpxchgi(&handle->pending, 1, 2) != 1)
73+
abort();
6674

6775
return 0;
6876
}
6977

7078

79+
/* Only call this from the event loop thread. */
80+
static int uv__async_spin(uv_async_t* handle) {
81+
int rc;
82+
83+
for (;;) {
84+
/* rc=0 -- handle is not pending.
85+
* rc=1 -- handle is pending, other thread is still working with it.
86+
* rc=2 -- handle is pending, other thread is done.
87+
*/
88+
rc = cmpxchgi(&handle->pending, 2, 0);
89+
90+
if (rc != 1)
91+
return rc;
92+
93+
/* Other thread is busy with this handle, spin until it's done. */
94+
cpu_relax();
95+
}
96+
}
97+
98+
7199
void uv__async_close(uv_async_t* handle) {
100+
uv__async_spin(handle);
72101
QUEUE_REMOVE(&handle->queue);
73102
uv__handle_stop(handle);
74103
}
@@ -109,8 +138,8 @@ static void uv__async_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
109138
QUEUE_REMOVE(q);
110139
QUEUE_INSERT_TAIL(&loop->async_handles, q);
111140

112-
if (cmpxchgi(&h->pending, 1, 0) == 0)
113-
continue;
141+
if (0 == uv__async_spin(h))
142+
continue; /* Not pending. */
114143

115144
if (h->async_cb == NULL)
116145
continue;

Diff for: ‎deps/uv/src/unix/core.c

+28-1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@
8888
#include <sys/ioctl.h>
8989
#endif
9090

91+
#if defined(__linux__)
92+
#include <sys/syscall.h>
93+
#endif
94+
9195
static int uv__run_pending(uv_loop_t* loop);
9296

9397
/* Verify that uv_buf_t is ABI-compatible with struct iovec. */
@@ -510,14 +514,37 @@ int uv__accept(int sockfd) {
510514
}
511515

512516

517+
/* close() on macos has the "interesting" quirk that it fails with EINTR
518+
* without closing the file descriptor when a thread is in the cancel state.
519+
* That's why libuv calls close$NOCANCEL() instead.
520+
*
521+
* glibc on linux has a similar issue: close() is a cancellation point and
522+
* will unwind the thread when it's in the cancel state. Work around that
523+
* by making the system call directly. Musl libc is unaffected.
524+
*/
525+
int uv__close_nocancel(int fd) {
526+
#if defined(__APPLE__)
527+
#pragma GCC diagnostic push
528+
#pragma GCC diagnostic ignored "-Wdollar-in-identifier-extension"
529+
extern int close$NOCANCEL(int);
530+
return close$NOCANCEL(fd);
531+
#pragma GCC diagnostic pop
532+
#elif defined(__linux__)
533+
return syscall(SYS_close, fd);
534+
#else
535+
return close(fd);
536+
#endif
537+
}
538+
539+
513540
int uv__close_nocheckstdio(int fd) {
514541
int saved_errno;
515542
int rc;
516543

517544
assert(fd > -1); /* Catch uninitialized io_watcher.fd bugs. */
518545

519546
saved_errno = errno;
520-
rc = close(fd);
547+
rc = uv__close_nocancel(fd);
521548
if (rc == -1) {
522549
rc = UV__ERR(errno);
523550
if (rc == UV_EINTR || rc == UV__ERR(EINPROGRESS))

Diff for: ‎deps/uv/src/unix/darwin.c

+5
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ uint64_t uv_get_total_memory(void) {
117117
}
118118

119119

120+
uint64_t uv_get_constrained_memory(void) {
121+
return 0; /* Memory constraints are unknown. */
122+
}
123+
124+
120125
void uv_loadavg(double avg[3]) {
121126
struct loadavg info;
122127
size_t size = sizeof(info);

Diff for: ‎deps/uv/src/unix/freebsd.c

+5
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ uint64_t uv_get_total_memory(void) {
137137
}
138138

139139

140+
uint64_t uv_get_constrained_memory(void) {
141+
return 0; /* Memory constraints are unknown. */
142+
}
143+
144+
140145
void uv_loadavg(double avg[3]) {
141146
struct loadavg info;
142147
size_t size = sizeof(info);

Diff for: ‎deps/uv/src/unix/fs.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ extern char *mkdtemp(char *template); /* See issue #740 on AIX < 7 */
145145
static int uv__fs_close(int fd) {
146146
int rc;
147147

148-
rc = close(fd);
148+
rc = uv__close_nocancel(fd);
149149
if (rc == -1)
150150
if (errno == EINTR || errno == EINPROGRESS)
151151
rc = 0; /* The close is in progress, not an error. */
@@ -1165,6 +1165,8 @@ static int uv__fs_statx(int fd,
11651165
buf->st_ctim.tv_nsec = statxbuf.stx_ctime.tv_nsec;
11661166
buf->st_birthtim.tv_sec = statxbuf.stx_btime.tv_sec;
11671167
buf->st_birthtim.tv_nsec = statxbuf.stx_btime.tv_nsec;
1168+
buf->st_flags = 0;
1169+
buf->st_gen = 0;
11681170

11691171
return 0;
11701172
#else

Diff for: ‎deps/uv/src/unix/fsevents.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
#include "uv.h"
2222
#include "internal.h"
2323

24-
#if TARGET_OS_IPHONE
24+
#if TARGET_OS_IPHONE || MAC_OS_X_VERSION_MAX_ALLOWED < 1070
2525

2626
/* iOS (currently) doesn't provide the FSEvents-API (nor CoreServices) */
27+
/* macOS prior to 10.7 doesn't provide the full FSEvents API so use kqueue */
2728

2829
int uv__fsevents_init(uv_fs_event_t* handle) {
2930
return 0;

Diff for: ‎deps/uv/src/unix/ibmi.c

+139-3
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,155 @@
5555
#include <strings.h>
5656
#include <sys/vnode.h>
5757

58+
#include <as400_protos.h>
59+
60+
61+
typedef struct {
62+
int bytes_available;
63+
int bytes_returned;
64+
char current_date_and_time[8];
65+
char system_name[8];
66+
char elapsed_time[6];
67+
char restricted_state_flag;
68+
char reserved;
69+
int percent_processing_unit_used;
70+
int jobs_in_system;
71+
int percent_permanent_addresses;
72+
int percent_temporary_addresses;
73+
int system_asp;
74+
int percent_system_asp_used;
75+
int total_auxiliary_storage;
76+
int current_unprotected_storage_used;
77+
int maximum_unprotected_storage_used;
78+
int percent_db_capability;
79+
int main_storage_size;
80+
int number_of_partitions;
81+
int partition_identifier;
82+
int reserved1;
83+
int current_processing_capacity;
84+
char processor_sharing_attribute;
85+
char reserved2[3];
86+
int number_of_processors;
87+
int active_jobs_in_system;
88+
int active_threads_in_system;
89+
int maximum_jobs_in_system;
90+
int percent_temporary_256mb_segments_used;
91+
int percent_temporary_4gb_segments_used;
92+
int percent_permanent_256mb_segments_used;
93+
int percent_permanent_4gb_segments_used;
94+
int percent_current_interactive_performance;
95+
int percent_uncapped_cpu_capacity_used;
96+
int percent_shared_processor_pool_used;
97+
long main_storage_size_long;
98+
} SSTS0200;
99+
100+
101+
static int get_ibmi_system_status(SSTS0200* rcvr) {
102+
/* rcvrlen is input parameter 2 to QWCRSSTS */
103+
unsigned int rcvrlen = sizeof(*rcvr);
104+
105+
/* format is input parameter 3 to QWCRSSTS ("SSTS0200" in EBCDIC) */
106+
unsigned char format[] = {0xE2, 0xE2, 0xE3, 0xE2, 0xF0, 0xF2, 0xF0, 0xF0};
107+
108+
/* reset_status is input parameter 4 to QWCRSSTS ("*NO " in EBCDIC) */
109+
unsigned char reset_status[] = {
110+
0x5C, 0xD5, 0xD6, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40
111+
};
112+
113+
/* errcode is input parameter 5 to QWCRSSTS */
114+
struct _errcode {
115+
int bytes_provided;
116+
int bytes_available;
117+
char msgid[7];
118+
} errcode;
119+
120+
/* qwcrssts_pointer is the 16-byte tagged system pointer to QWCRSSTS */
121+
ILEpointer __attribute__((aligned(16))) qwcrssts_pointer;
122+
123+
/* qwcrssts_argv is the array of argument pointers to QWCRSSTS */
124+
void* qwcrssts_argv[6];
125+
126+
/* Set the IBM i pointer to the QSYS/QWCRSSTS *PGM object */
127+
int rc = _RSLOBJ2(&qwcrssts_pointer, RSLOBJ_TS_PGM, "QWCRSSTS", "QSYS");
128+
129+
if (rc != 0)
130+
return rc;
131+
132+
/* initialize the QWCRSSTS returned info structure */
133+
memset(rcvr, 0, sizeof(*rcvr));
134+
135+
/* initialize the QWCRSSTS error code structure */
136+
memset(&errcode, 0, sizeof(errcode));
137+
errcode.bytes_provided = sizeof(errcode);
138+
139+
/* initialize the array of argument pointers for the QWCRSSTS API */
140+
qwcrssts_argv[0] = rcvr;
141+
qwcrssts_argv[1] = &rcvrlen;
142+
qwcrssts_argv[2] = &format;
143+
qwcrssts_argv[3] = &reset_status;
144+
qwcrssts_argv[4] = &errcode;
145+
qwcrssts_argv[5] = NULL;
146+
147+
/* Call the IBM i QWCRSSTS API from PASE */
148+
rc = _PGMCALL(&qwcrssts_pointer, (void**)&qwcrssts_argv, 0);
149+
150+
return rc;
151+
}
152+
153+
58154
uint64_t uv_get_free_memory(void) {
59-
return (uint64_t) sysconf(_SC_PAGESIZE) * sysconf(_SC_AVPHYS_PAGES);
155+
SSTS0200 rcvr;
156+
157+
if (get_ibmi_system_status(&rcvr))
158+
return 0;
159+
160+
/* The amount of main storage, in kilobytes, in the system. */
161+
uint64_t main_storage_size = rcvr.main_storage_size;
162+
163+
/* The current amount of storage in use for temporary objects.
164+
* in millions (M) of bytes.
165+
*/
166+
uint64_t current_unprotected_storage_used =
167+
rcvr.current_unprotected_storage_used * 1024ULL;
168+
169+
uint64_t free_storage_size =
170+
(main_storage_size - current_unprotected_storage_used) * 1024ULL;
171+
172+
return free_storage_size < 0 ? 0 : free_storage_size;
60173
}
61174

62175

63176
uint64_t uv_get_total_memory(void) {
64-
return (uint64_t) sysconf(_SC_PAGESIZE) * sysconf(_SC_PHYS_PAGES);
177+
SSTS0200 rcvr;
178+
179+
if (get_ibmi_system_status(&rcvr))
180+
return 0;
181+
182+
return (uint64_t)rcvr.main_storage_size * 1024ULL;
183+
}
184+
185+
186+
uint64_t uv_get_constrained_memory(void) {
187+
return 0; /* Memory constraints are unknown. */
65188
}
66189

67190

68191
void uv_loadavg(double avg[3]) {
192+
SSTS0200 rcvr;
193+
194+
if (get_ibmi_system_status(&rcvr)) {
69195
avg[0] = avg[1] = avg[2] = 0;
70196
return;
197+
}
198+
199+
/* The average (in tenths) of the elapsed time during which the processing
200+
* units were in use. For example, a value of 411 in binary would be 41.1%.
201+
* This percentage could be greater than 100% for an uncapped partition.
202+
*/
203+
double processing_unit_used_percent =
204+
rcvr.percent_processing_unit_used / 1000.0;
205+
206+
avg[0] = avg[1] = avg[2] = processing_unit_used_percent;
71207
}
72208

73209

@@ -110,4 +246,4 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
110246
*count = numcpus;
111247

112248
return 0;
113-
}
249+
}

Diff for: ‎deps/uv/src/unix/internal.h

+1
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ int uv__nonblock_ioctl(int fd, int set);
183183
int uv__nonblock_fcntl(int fd, int set);
184184
int uv__close(int fd); /* preserves errno */
185185
int uv__close_nocheckstdio(int fd);
186+
int uv__close_nocancel(int fd);
186187
int uv__socket(int domain, int type, int protocol);
187188
ssize_t uv__recvmsg(int fd, struct msghdr *msg, int flags);
188189
void uv__make_close_pending(uv_handle_t* handle);

Diff for: ‎deps/uv/src/unix/kqueue.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ int uv__kqueue_init(uv_loop_t* loop) {
5959
}
6060

6161

62-
#if defined(__APPLE__)
62+
#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
6363
static int uv__has_forked_with_cfrunloop;
6464
#endif
6565

@@ -70,7 +70,7 @@ int uv__io_fork(uv_loop_t* loop) {
7070
if (err)
7171
return err;
7272

73-
#if defined(__APPLE__)
73+
#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
7474
if (loop->cf_state != NULL) {
7575
/* We cannot start another CFRunloop and/or thread in the child
7676
process; CF aborts if you try or if you try to touch the thread
@@ -86,7 +86,7 @@ int uv__io_fork(uv_loop_t* loop) {
8686
uv__free(loop->cf_state);
8787
loop->cf_state = NULL;
8888
}
89-
#endif
89+
#endif /* #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 */
9090
return err;
9191
}
9292

@@ -458,7 +458,7 @@ int uv_fs_event_start(uv_fs_event_t* handle,
458458
if (uv__is_active(handle))
459459
return UV_EINVAL;
460460

461-
#if defined(__APPLE__)
461+
#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
462462
/* Nullify field to perform checks later */
463463
handle->cf_cb = NULL;
464464
handle->realpath = NULL;
@@ -482,7 +482,7 @@ int uv_fs_event_start(uv_fs_event_t* handle,
482482
}
483483
return r;
484484
}
485-
#endif /* defined(__APPLE__) */
485+
#endif /* #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 */
486486

487487
/* TODO open asynchronously - but how do we report back errors? */
488488
fd = open(path, O_RDONLY);
@@ -513,7 +513,7 @@ int uv_fs_event_stop(uv_fs_event_t* handle) {
513513

514514
uv__handle_stop(handle);
515515

516-
#if defined(__APPLE__)
516+
#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
517517
if (!uv__has_forked_with_cfrunloop)
518518
r = uv__fsevents_close(handle);
519519
#endif

Diff for: ‎deps/uv/src/unix/linux-core.c

+138-18
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "uv.h"
2727
#include "internal.h"
2828

29+
#include <inttypes.h>
2930
#include <stdint.h>
3031
#include <stdio.h>
3132
#include <stdlib.h>
@@ -79,16 +80,20 @@ static int read_times(FILE* statfile_fp,
7980
unsigned int numcpus,
8081
uv_cpu_info_t* ci);
8182
static void read_speeds(unsigned int numcpus, uv_cpu_info_t* ci);
82-
static unsigned long read_cpufreq(unsigned int cpunum);
83+
static uint64_t read_cpufreq(unsigned int cpunum);
8384

8485

8586
int uv__platform_loop_init(uv_loop_t* loop) {
8687
int fd;
8788

88-
fd = epoll_create1(EPOLL_CLOEXEC);
89+
/* It was reported that EPOLL_CLOEXEC is not defined on Android API < 21,
90+
* a.k.a. Lollipop. Since EPOLL_CLOEXEC is an alias for O_CLOEXEC on all
91+
* architectures, we just use that instead.
92+
*/
93+
fd = epoll_create1(O_CLOEXEC);
8994

9095
/* epoll_create1() can fail either because it's not implemented (old kernel)
91-
* or because it doesn't understand the EPOLL_CLOEXEC flag.
96+
* or because it doesn't understand the O_CLOEXEC flag.
9297
*/
9398
if (fd == -1 && (errno == ENOSYS || errno == EINVAL)) {
9499
fd = epoll_create(256);
@@ -715,20 +720,20 @@ static int read_models(unsigned int numcpus, uv_cpu_info_t* ci) {
715720
static int read_times(FILE* statfile_fp,
716721
unsigned int numcpus,
717722
uv_cpu_info_t* ci) {
718-
unsigned long clock_ticks;
719723
struct uv_cpu_times_s ts;
720-
unsigned long user;
721-
unsigned long nice;
722-
unsigned long sys;
723-
unsigned long idle;
724-
unsigned long dummy;
725-
unsigned long irq;
726-
unsigned int num;
727-
unsigned int len;
724+
uint64_t clock_ticks;
725+
uint64_t user;
726+
uint64_t nice;
727+
uint64_t sys;
728+
uint64_t idle;
729+
uint64_t dummy;
730+
uint64_t irq;
731+
uint64_t num;
732+
uint64_t len;
728733
char buf[1024];
729734

730735
clock_ticks = sysconf(_SC_CLK_TCK);
731-
assert(clock_ticks != (unsigned long) -1);
736+
assert(clock_ticks != (uint64_t) -1);
732737
assert(clock_ticks != 0);
733738

734739
rewind(statfile_fp);
@@ -761,7 +766,8 @@ static int read_times(FILE* statfile_fp,
761766
* fields, they're not allowed in C89 mode.
762767
*/
763768
if (6 != sscanf(buf + len,
764-
"%lu %lu %lu %lu %lu %lu",
769+
"%" PRIu64 " %" PRIu64 " %" PRIu64
770+
"%" PRIu64 " %" PRIu64 " %" PRIu64,
765771
&user,
766772
&nice,
767773
&sys,
@@ -783,8 +789,8 @@ static int read_times(FILE* statfile_fp,
783789
}
784790

785791

786-
static unsigned long read_cpufreq(unsigned int cpunum) {
787-
unsigned long val;
792+
static uint64_t read_cpufreq(unsigned int cpunum) {
793+
uint64_t val;
788794
char buf[1024];
789795
FILE* fp;
790796

@@ -797,7 +803,7 @@ static unsigned long read_cpufreq(unsigned int cpunum) {
797803
if (fp == NULL)
798804
return 0;
799805

800-
if (fscanf(fp, "%lu", &val) != 1)
806+
if (fscanf(fp, "%" PRIu64, &val) != 1)
801807
val = 0;
802808

803809
fclose(fp);
@@ -900,7 +906,10 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
900906
address = *addresses;
901907

902908
for (i = 0; i < (*count); i++) {
903-
if (strcmp(address->name, ent->ifa_name) == 0) {
909+
size_t namelen = strlen(ent->ifa_name);
910+
/* Alias interface share the same physical address */
911+
if (strncmp(address->name, ent->ifa_name, namelen) == 0 &&
912+
(address->name[namelen] == 0 || address->name[namelen] == ':')) {
904913
sll = (struct sockaddr_ll*)ent->ifa_addr;
905914
memcpy(address->phys_addr, sll->sll_addr, sizeof(address->phys_addr));
906915
}
@@ -932,3 +941,114 @@ void uv__set_process_title(const char* title) {
932941
prctl(PR_SET_NAME, title); /* Only copies first 16 characters. */
933942
#endif
934943
}
944+
945+
946+
static uint64_t uv__read_proc_meminfo(const char* what) {
947+
uint64_t rc;
948+
ssize_t n;
949+
char* p;
950+
int fd;
951+
char buf[4096]; /* Large enough to hold all of /proc/meminfo. */
952+
953+
rc = 0;
954+
fd = uv__open_cloexec("/proc/meminfo", O_RDONLY);
955+
956+
if (fd == -1)
957+
return 0;
958+
959+
n = read(fd, buf, sizeof(buf) - 1);
960+
961+
if (n <= 0)
962+
goto out;
963+
964+
buf[n] = '\0';
965+
p = strstr(buf, what);
966+
967+
if (p == NULL)
968+
goto out;
969+
970+
p += strlen(what);
971+
972+
if (1 != sscanf(p, "%" PRIu64 " kB", &rc))
973+
goto out;
974+
975+
rc *= 1024;
976+
977+
out:
978+
979+
if (uv__close_nocheckstdio(fd))
980+
abort();
981+
982+
return rc;
983+
}
984+
985+
986+
uint64_t uv_get_free_memory(void) {
987+
struct sysinfo info;
988+
uint64_t rc;
989+
990+
rc = uv__read_proc_meminfo("MemFree:");
991+
992+
if (rc != 0)
993+
return rc;
994+
995+
if (0 == sysinfo(&info))
996+
return (uint64_t) info.freeram * info.mem_unit;
997+
998+
return 0;
999+
}
1000+
1001+
1002+
uint64_t uv_get_total_memory(void) {
1003+
struct sysinfo info;
1004+
uint64_t rc;
1005+
1006+
rc = uv__read_proc_meminfo("MemTotal:");
1007+
1008+
if (rc != 0)
1009+
return rc;
1010+
1011+
if (0 == sysinfo(&info))
1012+
return (uint64_t) info.totalram * info.mem_unit;
1013+
1014+
return 0;
1015+
}
1016+
1017+
1018+
static uint64_t uv__read_cgroups_uint64(const char* cgroup, const char* param) {
1019+
char filename[256];
1020+
uint64_t rc;
1021+
int fd;
1022+
ssize_t n;
1023+
char buf[32]; /* Large enough to hold an encoded uint64_t. */
1024+
1025+
snprintf(filename, 256, "/sys/fs/cgroup/%s/%s", cgroup, param);
1026+
1027+
rc = 0;
1028+
fd = uv__open_cloexec(filename, O_RDONLY);
1029+
1030+
if (fd < 0)
1031+
return 0;
1032+
1033+
n = read(fd, buf, sizeof(buf) - 1);
1034+
1035+
if (n > 0) {
1036+
buf[n] = '\0';
1037+
sscanf(buf, "%" PRIu64, &rc);
1038+
}
1039+
1040+
if (uv__close_nocheckstdio(fd))
1041+
abort();
1042+
1043+
return rc;
1044+
}
1045+
1046+
1047+
uint64_t uv_get_constrained_memory(void) {
1048+
/*
1049+
* This might return 0 if there was a problem getting the memory limit from
1050+
* cgroups. This is OK because a return value of 0 signifies that the memory
1051+
* limit is unknown.
1052+
*/
1053+
return uv__read_cgroups_uint64("memory", "memory.limit_in_bytes");
1054+
}

Diff for: ‎deps/uv/src/unix/linux-syscalls.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,10 @@ int uv__statx(int dirfd,
358358
int flags,
359359
unsigned int mask,
360360
struct uv__statx* statxbuf) {
361-
#if defined(__NR_statx)
361+
/* __NR_statx make Android box killed by SIGSYS.
362+
* That looks like a seccomp2 sandbox filter rejecting the system call.
363+
*/
364+
#if defined(__NR_statx) && !defined(__ANDROID__)
362365
return syscall(__NR_statx, dirfd, path, flags, mask, statxbuf);
363366
#else
364367
return errno = ENOSYS, -1;

Diff for: ‎deps/uv/src/unix/netbsd.c

+5
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ uint64_t uv_get_total_memory(void) {
126126
}
127127

128128

129+
uint64_t uv_get_constrained_memory(void) {
130+
return 0; /* Memory constraints are unknown. */
131+
}
132+
133+
129134
int uv_resident_set_memory(size_t* rss) {
130135
kvm_t *kd = NULL;
131136
struct kinfo_proc2 *kinfo = NULL;

Diff for: ‎deps/uv/src/unix/openbsd.c

+5
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ uint64_t uv_get_total_memory(void) {
136136
}
137137

138138

139+
uint64_t uv_get_constrained_memory(void) {
140+
return 0; /* Memory constraints are unknown. */
141+
}
142+
143+
139144
int uv_resident_set_memory(size_t* rss) {
140145
struct kinfo_proc kinfo;
141146
size_t page_size = getpagesize();

Diff for: ‎deps/uv/src/unix/os390.c

+5
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,11 @@ uint64_t uv_get_total_memory(void) {
356356
}
357357

358358

359+
uint64_t uv_get_constrained_memory(void) {
360+
return 0; /* Memory constraints are unknown. */
361+
}
362+
363+
359364
int uv_resident_set_memory(size_t* rss) {
360365
char* ascb;
361366
char* rax;

Diff for: ‎deps/uv/src/unix/process.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ static void uv__process_child_init(const uv_process_options_t* options,
315315
use_fd = open("/dev/null", fd == 0 ? O_RDONLY : O_RDWR);
316316
close_fd = use_fd;
317317

318-
if (use_fd == -1) {
318+
if (use_fd < 0) {
319319
uv__write_int(error_fd, UV__ERR(errno));
320320
_exit(127);
321321
}
@@ -431,6 +431,8 @@ int uv_spawn(uv_loop_t* loop,
431431
UV_PROCESS_SETGID |
432432
UV_PROCESS_SETUID |
433433
UV_PROCESS_WINDOWS_HIDE |
434+
UV_PROCESS_WINDOWS_HIDE_CONSOLE |
435+
UV_PROCESS_WINDOWS_HIDE_GUI |
434436
UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS)));
435437

436438
uv__handle_init(loop, (uv_handle_t*)process, UV_PROCESS);

Diff for: ‎deps/uv/src/unix/sunos.c

+5
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,11 @@ uint64_t uv_get_total_memory(void) {
380380
}
381381

382382

383+
uint64_t uv_get_constrained_memory(void) {
384+
return 0; /* Memory constraints are unknown. */
385+
}
386+
387+
383388
void uv_loadavg(double avg[3]) {
384389
(void) getloadavg(avg, 3);
385390
}

Diff for: ‎deps/uv/src/win/util.c

+10-3
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,11 @@ uint64_t uv_get_total_memory(void) {
320320
}
321321

322322

323+
uint64_t uv_get_constrained_memory(void) {
324+
return 0; /* Memory constraints are unknown. */
325+
}
326+
327+
323328
uv_pid_t uv_os_getpid(void) {
324329
return GetCurrentProcessId();
325330
}
@@ -703,9 +708,11 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos_ptr, int* cpu_count_ptr) {
703708
return 0;
704709

705710
error:
706-
/* This is safe because the cpu_infos array is zeroed on allocation. */
707-
for (i = 0; i < cpu_count; i++)
708-
uv__free(cpu_infos[i].model);
711+
if (cpu_infos != NULL) {
712+
/* This is safe because the cpu_infos array is zeroed on allocation. */
713+
for (i = 0; i < cpu_count; i++)
714+
uv__free(cpu_infos[i].model);
715+
}
709716

710717
uv__free(cpu_infos);
711718
uv__free(sppi);

Diff for: ‎deps/uv/test/test-fs-poll.c

+39
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ static void poll_cb_fail(uv_fs_poll_t* handle,
3737
int status,
3838
const uv_stat_t* prev,
3939
const uv_stat_t* curr);
40+
static void poll_cb_noop(uv_fs_poll_t* handle,
41+
int status,
42+
const uv_stat_t* prev,
43+
const uv_stat_t* curr);
4044

4145
static uv_fs_poll_t poll_handle;
4246
static uv_timer_t timer_handle;
@@ -84,6 +88,12 @@ static void poll_cb_fail(uv_fs_poll_t* handle,
8488
ASSERT(0 && "fail_cb called");
8589
}
8690

91+
static void poll_cb_noop(uv_fs_poll_t* handle,
92+
int status,
93+
const uv_stat_t* prev,
94+
const uv_stat_t* curr) {
95+
}
96+
8797

8898
static void poll_cb(uv_fs_poll_t* handle,
8999
int status,
@@ -259,3 +269,32 @@ TEST_IMPL(fs_poll_close_request_multi_stop_start) {
259269
MAKE_VALGRIND_HAPPY();
260270
return 0;
261271
}
272+
273+
TEST_IMPL(fs_poll_close_request_stop_when_active) {
274+
/* Regression test for https://github.com/libuv/libuv/issues/2287. */
275+
uv_loop_t loop;
276+
uv_fs_poll_t poll_handle;
277+
278+
remove(FIXTURE);
279+
280+
ASSERT(0 == uv_loop_init(&loop));
281+
282+
/* Set up all handles. */
283+
ASSERT(0 == uv_fs_poll_init(&loop, &poll_handle));
284+
ASSERT(0 == uv_fs_poll_start(&poll_handle, poll_cb_noop, FIXTURE, 100));
285+
uv_run(&loop, UV_RUN_ONCE);
286+
287+
/* Close the timer handle, and do not crash. */
288+
ASSERT(0 == uv_fs_poll_stop(&poll_handle));
289+
uv_run(&loop, UV_RUN_ONCE);
290+
291+
/* Clean up after the test. */
292+
uv_close((uv_handle_t*) &poll_handle, close_cb);
293+
uv_run(&loop, UV_RUN_ONCE);
294+
ASSERT(close_cb_called == 1);
295+
296+
ASSERT(0 == uv_loop_close(&loop));
297+
298+
MAKE_VALGRIND_HAPPY();
299+
return 0;
300+
}

Diff for: ‎deps/uv/test/test-fs.c

+37-13
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,15 @@ static void sendfile_cb(uv_fs_t* req) {
611611
}
612612

613613

614+
static void sendfile_nodata_cb(uv_fs_t* req) {
615+
ASSERT(req == &sendfile_req);
616+
ASSERT(req->fs_type == UV_FS_SENDFILE);
617+
ASSERT(req->result == 0);
618+
sendfile_cb_count++;
619+
uv_fs_req_cleanup(req);
620+
}
621+
622+
614623
static void open_noent_cb(uv_fs_t* req) {
615624
ASSERT(req->fs_type == UV_FS_OPEN);
616625
ASSERT(req->result == UV_ENOENT);
@@ -1049,7 +1058,7 @@ TEST_IMPL(fs_async_dir) {
10491058
}
10501059

10511060

1052-
TEST_IMPL(fs_async_sendfile) {
1061+
static int test_sendfile(void (*setup)(int), uv_fs_cb cb, off_t expected_size) {
10531062
int f, r;
10541063
struct stat s1, s2;
10551064

@@ -1062,14 +1071,8 @@ TEST_IMPL(fs_async_sendfile) {
10621071
f = open("test_file", O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR);
10631072
ASSERT(f != -1);
10641073

1065-
r = write(f, "begin\n", 6);
1066-
ASSERT(r == 6);
1067-
1068-
r = lseek(f, 65536, SEEK_CUR);
1069-
ASSERT(r == 65542);
1070-
1071-
r = write(f, "end\n", 4);
1072-
ASSERT(r != -1);
1074+
if (setup != NULL)
1075+
setup(f);
10731076

10741077
r = close(f);
10751078
ASSERT(r == 0);
@@ -1087,7 +1090,7 @@ TEST_IMPL(fs_async_sendfile) {
10871090
uv_fs_req_cleanup(&open_req2);
10881091

10891092
r = uv_fs_sendfile(loop, &sendfile_req, open_req2.result, open_req1.result,
1090-
0, 131072, sendfile_cb);
1093+
0, 131072, cb);
10911094
ASSERT(r == 0);
10921095
uv_run(loop, UV_RUN_DEFAULT);
10931096

@@ -1100,9 +1103,10 @@ TEST_IMPL(fs_async_sendfile) {
11001103
ASSERT(r == 0);
11011104
uv_fs_req_cleanup(&close_req);
11021105

1103-
stat("test_file", &s1);
1104-
stat("test_file2", &s2);
1105-
ASSERT(65546 == s2.st_size && s1.st_size == s2.st_size);
1106+
ASSERT(0 == stat("test_file", &s1));
1107+
ASSERT(0 == stat("test_file2", &s2));
1108+
ASSERT(s1.st_size == s2.st_size);
1109+
ASSERT(s2.st_size == expected_size);
11061110

11071111
/* Cleanup. */
11081112
unlink("test_file");
@@ -1113,6 +1117,23 @@ TEST_IMPL(fs_async_sendfile) {
11131117
}
11141118

11151119

1120+
static void sendfile_setup(int f) {
1121+
ASSERT(6 == write(f, "begin\n", 6));
1122+
ASSERT(65542 == lseek(f, 65536, SEEK_CUR));
1123+
ASSERT(4 == write(f, "end\n", 4));
1124+
}
1125+
1126+
1127+
TEST_IMPL(fs_async_sendfile) {
1128+
return test_sendfile(sendfile_setup, sendfile_cb, 65546);
1129+
}
1130+
1131+
1132+
TEST_IMPL(fs_async_sendfile_nodata) {
1133+
return test_sendfile(NULL, sendfile_nodata_cb, 0);
1134+
}
1135+
1136+
11161137
TEST_IMPL(fs_mkdtemp) {
11171138
int r;
11181139
const char* path_template = "test_dir_XXXXXX";
@@ -1171,6 +1192,7 @@ TEST_IMPL(fs_fstat) {
11711192
ASSERT(req.result == sizeof(test_buf));
11721193
uv_fs_req_cleanup(&req);
11731194

1195+
memset(&req.statbuf, 0xaa, sizeof(req.statbuf));
11741196
r = uv_fs_fstat(NULL, &req, file, NULL);
11751197
ASSERT(r == 0);
11761198
ASSERT(req.result == 0);
@@ -1257,6 +1279,8 @@ TEST_IMPL(fs_fstat) {
12571279
s->st_birthtim.tv_sec == t.st_ctim.tv_sec);
12581280
ASSERT(s->st_birthtim.tv_nsec == 0 ||
12591281
s->st_birthtim.tv_nsec == t.st_ctim.tv_nsec);
1282+
ASSERT(s->st_flags == 0);
1283+
ASSERT(s->st_gen == 0);
12601284
#endif
12611285

12621286
uv_fs_req_cleanup(&req);

Diff for: ‎deps/uv/test/test-get-memory.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
TEST_IMPL(get_memory) {
2626
uint64_t free_mem = uv_get_free_memory();
2727
uint64_t total_mem = uv_get_total_memory();
28+
uint64_t constrained_mem = uv_get_constrained_memory();
2829

29-
printf("free_mem=%llu, total_mem=%llu\n",
30+
printf("free_mem=%llu, total_mem=%llu, constrained_mem=%llu\n",
3031
(unsigned long long) free_mem,
31-
(unsigned long long) total_mem);
32+
(unsigned long long) total_mem,
33+
(unsigned long long) constrained_mem);
3234

3335
ASSERT(free_mem > 0);
3436
ASSERT(total_mem > 0);

Diff for: ‎deps/uv/test/test-list.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ TEST_DECLARE (fs_poll_getpath)
290290
TEST_DECLARE (fs_poll_close_request)
291291
TEST_DECLARE (fs_poll_close_request_multi_start_stop)
292292
TEST_DECLARE (fs_poll_close_request_multi_stop_start)
293+
TEST_DECLARE (fs_poll_close_request_stop_when_active)
293294
TEST_DECLARE (kill)
294295
TEST_DECLARE (kill_invalid_signum)
295296
TEST_DECLARE (fs_file_noent)
@@ -300,6 +301,7 @@ TEST_DECLARE (fs_file_sync)
300301
TEST_DECLARE (fs_file_write_null_buffer)
301302
TEST_DECLARE (fs_async_dir)
302303
TEST_DECLARE (fs_async_sendfile)
304+
TEST_DECLARE (fs_async_sendfile_nodata)
303305
TEST_DECLARE (fs_mkdtemp)
304306
TEST_DECLARE (fs_fstat)
305307
TEST_DECLARE (fs_access)
@@ -843,6 +845,7 @@ TASK_LIST_START
843845
TEST_ENTRY (fs_poll_close_request)
844846
TEST_ENTRY (fs_poll_close_request_multi_start_stop)
845847
TEST_ENTRY (fs_poll_close_request_multi_stop_start)
848+
TEST_ENTRY (fs_poll_close_request_stop_when_active)
846849
TEST_ENTRY (kill)
847850
TEST_ENTRY (kill_invalid_signum)
848851

@@ -886,6 +889,7 @@ TASK_LIST_START
886889
TEST_ENTRY (fs_file_write_null_buffer)
887890
TEST_ENTRY (fs_async_dir)
888891
TEST_ENTRY (fs_async_sendfile)
892+
TEST_ENTRY (fs_async_sendfile_nodata)
889893
TEST_ENTRY (fs_mkdtemp)
890894
TEST_ENTRY (fs_fstat)
891895
TEST_ENTRY (fs_access)
@@ -959,7 +963,7 @@ TASK_LIST_START
959963
TEST_ENTRY (strscpy)
960964
TEST_ENTRY (threadpool_queue_work_simple)
961965
TEST_ENTRY (threadpool_queue_work_einval)
962-
TEST_ENTRY (threadpool_multiple_event_loops)
966+
TEST_ENTRY_CUSTOM (threadpool_multiple_event_loops, 0, 0, 60000)
963967
TEST_ENTRY (threadpool_cancel_getaddrinfo)
964968
TEST_ENTRY (threadpool_cancel_getnameinfo)
965969
TEST_ENTRY (threadpool_cancel_work)

Diff for: ‎deps/uv/test/test-spawn.c

+6
Original file line numberDiff line numberDiff line change
@@ -1406,6 +1406,12 @@ TEST_IMPL(spawn_setuid_fails) {
14061406
options.flags |= UV_PROCESS_SETUID;
14071407
options.uid = 0;
14081408

1409+
/* These flags should be ignored on Unices. */
1410+
options.flags |= UV_PROCESS_WINDOWS_HIDE;
1411+
options.flags |= UV_PROCESS_WINDOWS_HIDE_CONSOLE;
1412+
options.flags |= UV_PROCESS_WINDOWS_HIDE_GUI;
1413+
options.flags |= UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS;
1414+
14091415
r = uv_spawn(uv_default_loop(), &process, &options);
14101416
#if defined(__CYGWIN__)
14111417
ASSERT(r == UV_EINVAL);

Diff for: ‎deps/uv/uv.gyp

-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@
241241
'src/unix/linux-syscalls.h',
242242
'src/unix/procfs-exepath.c',
243243
'src/unix/sysinfo-loadavg.c',
244-
'src/unix/sysinfo-memory.c',
245244
],
246245
'link_settings': {
247246
'libraries': [ '-ldl' ],

0 commit comments

Comments
 (0)
Please sign in to comment.