Changes since version 1.38.1:
* unix: use relaxed loads/stores for clock id (Ben Noordhuis)
* build,win: link to user32.lib and advapi32.lib (George Zhao)
* unix: squelch harmless valgrind warning (ssrlive)
* include: fx c++ style comments warnings (Turbinya)
* build,cmake: Change installation location on MinGW (erw7)
* linux: use copy_file_range for uv_fs_copyfile when possible (Carter
Li)
* win,tcp: avoid reinserting a pending request (
* docs: improve the descriptions for get memory info (Juan Sebastian
velez Posada)
* test: add udp-mmsg test (Ryan Liptak)
* udp: add uv_udp_using_recvmmsg query (Ryan Liptak)
* doc: add more error constants (TK-one)
* zos: fix potential event loop stall (Trevor Norris)
* include: add internal fields struct to uv_loop_t (Trevor Norris)
* core: add API to measure event loop idle time (Trevor Norris)
* win,fs: use CreateDirectoryW instead of _wmkdir (Mustafa M)
* win,nfc: fix integer comparison signedness (escherstair)
* win,nfc: use
* win,nfc: removed some unused variables (escherstair)
* win,nfc: add missing return statement (escherstair)
* win,nfc: disable clang-format for
* darwin: use IOKit for uv_cpu_info (Evan Lucas)
* test: fix thread race in process_title_threadsafe (Ben Noordhuis)
* win,fs: avoid implicit access to _doserrno (Jameson Nash)
* test: give hrtime test a custom 20s timeout (Jameson Nash)
* build: add more failed test, for qemu version bump (gengjiawen)
* unix: handle src, dest same in uv_fs_copyfile() (cjihrig)
* unix: error when uv_setup_args() is not called (Ryan Liptak)
* aix: protect uv_exepath() from uv_set_process_title() (Richard Lau)
* fs: clobber req->path on uv_fs_mkstemp() error (tjarlama)
* cmake: fix compile error C2001 on Chinese Windows (司徒玟琅)
* test: avoid double evaluation in ASSERT_BASE macro (tjarlama)
* tcp: fail instantly if local port is unbound (Bartosz Sosnowski)
* doc: fix most sphinx warnings (Jameson Nash)
* nfci: address some style nits (Jameson Nash)
* unix: don't use _POSIX_PATH_MAX (Ben Noordhuis)
The API addition `uv_metrics_idle_time()` is a thread safe call that
allows the user to retrieve the amount of time the event loop has spent
in the kernel's event provider (i.e. poll). It was done this way to
allow retrieving this value without needing to interrupt the execution
of the event loop. This option can be enabled by passing
`UV_METRICS_IDLE_TIME` to `uv_loop_configure()`.
One important aspect of this change is, when enabled, to always first
call the event provider with a `timeout == 0`. This allows libuv to know
whether any events were waiting in the event queue when the event
provider was called. The importance of this is because libuv is tracking
the amount of "idle time", not "poll time". Thus the provider entry time
is not recorded when `timeout == 0` (the event provider never idles in
this case).
While this does add a small amount of overhead, when enabled, but the
overhead decreases when the event loop has a heavier load. This is
because poll events will be waiting when the event provider is called.
Thus never actually recording the provider entry time.
Checking if `uv_loop_t` is configured with `UV_METRICS_IDLE_TIME` always
happens in `uv__metrics_set_provider_entry_time()` and
`uv__metrics_update_idle_time()`. Making the conditional logic wrapping
each call simpler and allows for instrumentation to always hook into
those two function calls.
Rather than placing the fields directly on `uv__loop_internal_fields_t`
add the struct `uv__loop_metrics_t` as a location for future metrics API
additions.
Tests and additional documentation has been included.
PR-URL: https://github.com/libuv/libuv/pull/2725
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Add struct `uv__loop_internal_fields_t` as a location for future
additions to `uv_loop_t` while also maintaining v1.x compatibility.
Currently `uv__loop_internal_fields_t` only contains the `flags` field.
The reason for adding the `flags` field is because the same field was
never added to `UV_LOOP_PRIVATE_FIELDS` in Windows as it was in Unix.
The idea for creating a struct and attaching it to `uv_loop_t` for
future API enhancements was taken from a comment by bnoordhuis in:
https://github.com/libuv/libuv/issues/2506#issuecomment-540050665
Also add `internal_fields` to `uv_loop_t` to store the pointer to
`uv__loop_internal_fields_t`. This naming makes more sense than just
using `active_reqs.unused[1]`. To maintain ABI compatibility, shrink the
`unused` array.
PR-URL: https://github.com/libuv/libuv/pull/2725
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Allows for determining if a buffer large enough for multiple dgrams
should be allocated in alloc_cb of uv_udp_recvstart, for example.
Contributes towards #2822.
PR-URL: https://github.com/libuv/libuv/pull/2830
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Exposes the original system error of the filesystem syscalls. Adds a new
uv_fs_get_system_error which returns orignal errno on Linux or
GetLastError on Windows.
Ref: https://github.com/libuv/libuv/issues/2348
PR-URL: https://github.com/libuv/libuv/pull/2810
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Make it possible to explicitly tell libuv to release any resources
it's still holding onto (memory, threads, file descriptors, etc.)
Before this commit, cleanup was performed in various destructors.
This commit centralizes the cleanup logic, enabling the addition of
`uv_library_shutdown()`, but maintains the current observable behavior
of cleaning up when libuv is unloaded by means of `dlclose(3)`.
Fixes: https://github.com/libuv/libuv/issues/2763
PR-URL: https://github.com/libuv/libuv/pull/2764
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
On Linux, cpu_times have been calculated differently to all other
platforms for a while. Other platforms (FreeBSD, Mac, Windows) are all
in milliseconds, but Linux has been returning values ten times larger.
libuv has not previously documented what unit cpu_times uses, even
though NodeJS did - as milliseconds.
Here we're both documenting that the cpu_times are indeed in
milliseconds, and fixing the inconsistency on Linux.
Fixes: https://github.com/libuv/libuv/issues/2773
PR-URL: https://github.com/libuv/libuv/pull/2796
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Changes since version 1.36.0:
* timer: remove redundant check in heap compare (Yash Ladha)
* udp: add flag to enable recvmmsg(2) explicitly (Saúl Ibarra Corretgé)
Upstream GYP has been unmaintained for some time now. The only big
downstream user is Node.js and they already maintain GYP build files
for their other dependencies.
This commit removes vcbuild.bat because:
1. it's entirely built around GYP, and
2. duplicates a lot of functionality that cmake provides out of the box
This commit also removes appveyor.yml. It hasn't been used after we
stopped providing prebuilt binaries for Windows about two years ago.
As if that isn't enough, this commit also removes the Android build
scripts. They were wrappers around GYP. Use CMake.
PR-URL: https://github.com/libuv/libuv/pull/2682
Refs: https://github.com/libuv/libuv/pull/2681
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
On IBMi PASE, the highest process priority is -10.
PR-URL: https://github.com/libuv/libuv/pull/2642
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
When recvmmsg support was added it returned the datagrams in reverse
received order, which may impact some applications.
To restore the previous behavior, we call recv_cb one last time with
nread == 0 and addr == NULL so applications can free the buffer.
PR-URL: https://github.com/libuv/libuv/pull/2736
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commits adds support for recvmmsg() and sendmmsg() extensions to
recvmsg() and sendmsg() that allows the caller to receive and send
multiple message from a socket using a single system call. This has
performance benefits for some applications.
Co-authored-by: Ondřej Surý <ondrej@sury.org>
Co-authored-by: Witold Kręcicki <wpk@culm.net>
PR-URL: https://github.com/libuv/libuv/pull/2532
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit exposes the uv_sleep() function that previously
only existed in the test runner.
PR-URL: https://github.com/libuv/libuv/pull/2548
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Add an API for obtaining cryptographically strong random data from the
system PRNG.
Co-authored-by: Saúl Ibarra Corretgé <s@saghul.net>
Refs: https://github.com/libuv/libuv/pull/1055
PR-URL: https://github.com/libuv/libuv/pull/2347
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
According to http://man7.org/linux/man-pages/man2/open.2.html, the
O_DIRECT flag is Linux-specific. One must define _GNU_SOURCE to obtain
the correct definition.
However, defining _GNU_SOURCE in the headers is unhygienic and affects
the libuv consumer.
On Linux, we now define UV_FS_O_DIRECT explicitly according to
architecture, only falling back to O_DIRECT if defined, or 0 if not.
Fixes: https://github.com/libuv/libuv/issues/2420
PR-URL: https://github.com/libuv/libuv/pull/2441
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
All the supported platforms support specific source multicast.
PR-URL: https://github.com/libuv/libuv/pull/2202
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
It resets a TCP connection by sending a RST packet. Due to some platform
inconsistencies, mixing of `uv_shutdown` and `uv_tcp_close_reset` calls
is not allowed.
Fixes: https://github.com/libuv/libuv/issues/1991
PR-URL: https://github.com/libuv/libuv/pull/2425
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>