The TAP specification [1] explicitely states:
A harness must only read TAP output from standard output and
not from standard error.
[1] https://testanything.org/tap-specification.html
PR-URL: https://github.com/libuv/libuv/pull/3153
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
In both `test-tcp-open` and `test-udp-open`.
PR-URL: https://github.com/libuv/libuv/pull/3137
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
In the codebase we have used empty for loop for infinite conditions, so
to bring consistency replaced other occurrences of while in the codebase
with for loop.
PR-URL: https://github.com/libuv/libuv/pull/3128
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
To properly handle sending UDP packet to unreachable address.
PR-URL: https://github.com/libuv/libuv/pull/2872
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit introduces ZOSLIB for z/OS, which is a C/C++ library that
implements additional POSIX APIs not available in the LE C Runtime
Library, and provides API for EBCDIC <-> ASCII conversion. This library
requires the linker to be set to CXX when building for z/OS. ZOSLIB is
designed to be installed separately, and then linked to libuv with the
`-DZOSLIB_DIR` option.
PR-URL: https://github.com/libuv/libuv/pull/3060
Reviewed-By: Richard Lau <rlau@redhat.com>
Nanosecond resolution for the timestamp fields `st_atim`, `st_mtim`, and
`st_ctim` are not supported on z/OS.
PR-URL: https://github.com/libuv/libuv/pull/3060
Reviewed-By: Richard Lau <rlau@redhat.com>
Moving to new style test macros will make debugging easier in case
of test failure and improve redability. This commit will replace all
ASSERT macros matching the statement:
`ASSERT(identifier (== or !=) value);`
to:
`ASSERT_(NOT_)NULL(identifier);`
Refs: https://github.com/libuv/libuv/issues/2974
PR-URL: https://github.com/libuv/libuv/pull/3081
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Consider the following scenario:
uv_poll_init(loop, poll, fd);
uv_poll_start(poll, UV_READABLE, cb);
// the cb gets invoked etc.
uv_poll_stop(poll);
close(fd);
fd = allocate_new_socket(); // allocate_new_socket() is assigned the same fd by "bad luck" from the OS
// some time later:
uv_poll_init(loop, otherpoll, fd);
uv_poll_start(otherpoll, UV_READABLE, cb);
uv_close(poll); // uv__io_stop: Assertion `loop->watchers[w->fd] == w' failed.
According to documentation, "however the fd can be safely closed
immediately after a call to uv_poll_stop() or uv_close()."
Though, in this scenario, we close()'d our file descriptor, and by
bad luck we got the same file descriptor again and register a new
handle for it and start polling.
Previously that would lead to an assertion failure, if we were to
properly free the original handle via uv_close().
This commit fixes that by moving the check whether a only a single
poll handle is active to uv_poll_start() instead of the stopping
routines.
Fixes: https://github.com/libuv/libuv/issues/1172
Fixes: https://github.com/bwoebi/php-uv/issues/81
Fixes: https://github.com/b2wdigital/aiologger/issues/82
Fixes: https://github.com/invenia/LibPQ.jl/issues/140
PR-URL: https://github.com/libuv/libuv/pull/2686
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
* Windows 7 went out of support earlier this year.
* As did Python 2.7. We no longer have to worry about MSVC 2008.
Python 3.5 and up use VS 2015.
PR-URL: https://github.com/libuv/libuv/pull/2821
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Joao Reis <reis@janeasystems.com>
RFC 2606 reserves the .invalid top-level domain for this purpose.
PR-URL: https://github.com/libuv/libuv/pull/3063
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
`uv_fs_utime()` and `uv_fs_futime()` receive the timestamp as
a `double` and then convert it to `struct timeval` or `struct timespec`
where necessary but the calculation for the sub-second part exhibited
rounding errors for dates in the deep past or the far-flung future,
causing the timestamps to be off by sometimes over half a second on
unix, or to be reinterpreted as unsigned and end up off by more than
just sign but many also decades.
Fixes: https://github.com/nodejs/node/issues/32369 (partially)
PR-URL: https://github.com/libuv/libuv/pull/2747
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
`check_utime()` already calls `uv_fs_stat()`, no point in doing it
twice.
PR-URL: https://github.com/libuv/libuv/pull/2747
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Equivalents of `pipe` and `socketpair` for cross-platform use.
PR-URL: https://github.com/libuv/libuv/pull/2953
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Return `UV_EINVAL` when one or more arguments are NULL.
Fixes: https://github.com/libuv/help/issues/137
PR-URL: https://github.com/libuv/libuv/pull/2795
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
The behavior of `uv_read_start()` when the handle is closing or already
busy reading wasn't consistent across platforms. Now it is.
Fixes: https://github.com/libuv/help/issues/137
PR-URL: https://github.com/libuv/libuv/pull/2795
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Fix a bug where libuv forgets about EADDRINUSE errors reported earlier:
uv_tcp_bind() + uv_tcp_connect() seemingly succeed but the socket isn't
actually bound to the requested address.
This bug goes back to at least 2011 if indeed it ever worked at all.
PR-URL: https://github.com/libuv/libuv/pull/2218
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
On Windows when connecting to an unavailable port, the connect() will
retry for 2s, even on loopback devices. This uses a call to WSAIoctl to
make the connect() call fail instantly on local connections.
PR-URL: https://github.com/libuv/libuv/pull/2896
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Passing expression as an argument to a function-like macro will replace
all occurrence of the arguments with expressions during preprocessing.
This result in multiple evaluation of the same expression and can
slow-down the program or even change program state. Here ASSERT_BASE
macro gets an expression involving a and b as first argument and macro
definition has a print statement with a and b, which means there is
double evaluation of a and b when the expression evaluates to false. To
avoid double evaluation temporary variables are created to store results
of a and b.
Since the expression argument is dropped from ASSERT_BASE, the macro no
longer works for string assertions. So a new macro, ASSERT_BASE_STR, is
introduced to deal with strings. ASSERT_BASE can still work with
pointers.
Fixes: https://github.com/libuv/libuv/issues/2916
PR-URL: https://github.com/libuv/libuv/pull/2926
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Contents of template variable passed for posix call mkstemp on error
code EINVAL is unknown. On AIX platform, template will get clobbered
on EINVAL and any attempt to read template might result in error.
In libuv, req->path is passed directly to the mkstemp call and
behavior of this string on error is platform dependent. To avoid
portability issues, it's better to have a common behavior on all
platform. For both unix and windows platform libuv will rewrite path
with an empty string on all error cases.
Fixes: https://github.com/libuv/libuv/issues/2913
Refs: https://github.com/nodejs/node/pull/33549
Refs: https://github.com/libuv/libuv/pull/2933
PR-URL: https://github.com/libuv/libuv/pull/2938
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Store a copy of the original argv[0] to protect `uv_exepath()`
against `uv_set_process_title()` changing the value of argv[0].
Extract common code for finding a program on the current PATH.
Fixes: https://github.com/libuv/libuv/issues/2674
PR-URL: https://github.com/libuv/libuv/pull/2677
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
This commit handles the case where the source and destination
are the same. This behavior was originally addressed in #2298,
but the test added in that PR doesn't validate the file size
after the operation. This commit also updates the test to check
for that case.
Refs: https://github.com/libuv/libuv/pull/2298
Refs: https://github.com/nodejs/node/issues/34624
PR-URL: https://github.com/libuv/libuv/pull/2947
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Libuv calls uv__process_title_cleanup() on shutdown, which raced with
one of the threads from the test that calls uv_get_process_title() in
an infinite loop. Change the test to properly shut down the thread
before exiting.
PR-URL: https://github.com/libuv/libuv/pull/2946
Refs: https://github.com/libuv/libuv/pull/2853#issuecomment-665259082
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
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>
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>
This fix avoids inserting a duplicate pending request in the case where
`WSARecv()` returns an error (e.g. when a connection has been terminated
by its peer) when `uv_read_start()` is called in a read callback.
Fixes: https://github.com/libuv/libuv/issues/2687
PR-URL: https://github.com/libuv/libuv/pull/2688
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
This issue manifested on `connected` udp sockets trying to send
datagrams to a non-existent server and returning `ECONNREFUSED` because
an ICMP error was received before the actual sending was performed.
PR-URL: https://github.com/libuv/libuv/pull/2899
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This test was consistently timing out on macOS. Some printf()
debugging on the CI showed that the test was still making forward
progress, but legitimately timed out. This commit bumps the test
timeout to a value that should provide much more than enough time.
Fixes: https://github.com/libuv/libuv/issues/2775
PR-URL: https://github.com/libuv/libuv/pull/2865
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
This commit runs the test suite via QEMU on GitHub Actions on
a variety of platforms.
Fixes: https://github.com/libuv/libuv/issues/2842
PR-URL: https://github.com/libuv/libuv/pull/2846
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Previously libuv was tested under the user class QSECOFR on IBM i.
But most IBM i users does not have that authority.
Refine some assertions to support common user profiles on IBM i.
Fixes: https://github.com/libuv/libuv/issues/2851
PR-URL: https://github.com/libuv/libuv/pull/2852
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@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>
The Windows documentation states these should not be possible
but several people have reported that they do in fact happen.
Try with a smallish stack-allocated buffer first and switch to
a heap-allocated buffer if the first one is too small.
Fixes: https://github.com/libuv/libuv/issues/2587
PR-URL: https://github.com/libuv/libuv/pull/2589
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Commit 5736658b ("udp: add flag to enable recvmmsg(2) explicitly") added
the flag but didn't update the validation logic in src/win/udp.c.
This commit moves the validation logic to src/uv-common.c. The flag is
now accepted as a no-op on Windows.
Fixes: https://github.com/libuv/libuv/issues/2806
PR-URL: https://github.com/libuv/libuv/pull/2809
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
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>
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>
PR-URL: https://github.com/libuv/libuv/pull/2741
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Commit ff29322b ("test: canonicalize test runner path") from 2014
changed the test runner to call `realpath(3)` on `argv[0]` in order
to fix the `get_currentexe` test failing with the autotools build when
the executable path contained symbolic links but that is now causing
the `spawn_reads_child_path` test to fail on z/os with the cmake build.
Fix that by only doing path canonicalization in the `get_currentexe`
test, not always.
An auxiliary fix is applied to the `process_title_threadsafe` test
because it assumed that setting the process title to a long string,
then reading it back produces in the original string.
On some platforms however the maximum size of the process title is
limited to the size of the `argv` vector.
Because the test runner used absolute paths until now, the argv vector
was bigger than it is with relative paths, big enough to let this bad
assumption go unnoticed until now.
Minor fixes are applied to tests that assumed 1024 for the maximum
path size because this commit makes visible that some of the CI matrix
systems support much longer paths.
PR-URL: https://github.com/libuv/libuv/pull/2755
Refs: https://github.com/libuv/libuv/pull/2737#issuecomment-602800431
Refs: https://github.com/libuv/libuv/pull/2754#issuecomment-604015785
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
To make the debugging of test issues easier.
The following integer macros are added:
`ASSERT_EQ(a, b)`, `ASSERT_GE(a, b)`, `ASSERT_GT(a, b)`,
`ASSERT_LE(a, b)`, `ASSERT_LT(a, b)` and `ASSERT_NE(a, b)`.
And its corresponding unsigned integer macros:
`ASSERT_UINT64_EQ(a, b)`, `ASSERT_UINT64_GE(a, b)`,
`ASSERT_UINT64_GT(a, b)`, `ASSERT_UINT64_LE(a, b)`,
`ASSERT_UINT64_LT(a, b)` and `ASSERT_UINT64_NE(a, b)`.
Also these macros for `NULL` and pointer checks:
`ASSERT_NULL(a)`, `ASSERT_NOT_NULL(a)`, `ASSERT_PTR_EQ(a, b)` and
`ASSERT_PTR_NE(a, b)`.
And finally these macros for strings and buffers:
`ASSERT_STR_EQ(a, b)`/`ASSERT_STR_NEQ(a, b)` that use the `strcmp()`
call.
`ASSERT_MEM_EQ(a, b)`/`ASSERT_MEM_NEQ(a, b)` and
`ASSERT_MEM_HEX_EQ(a, b)`/`ASSERT_MEM_HEX_NEQ(a, b)` that use the
`memcmp()` call. The former, prints the data in string format and the
latter in hex format.
These macros are used in the following way:
```c
ASSERT_EQ(UV_EINVAL, uv_loop_close(&loop));
```
With a sample output that would be as follows:
```
Assertion failed in test/test-loop-close.c on line 44: `UV_EINVAL == uv_loop_close(&loop)` (-22 == -16)
```
To view multiples examples if their use, the `test-ipc.c` file has been
modified to use these macros.
The `_ISOC99_SOURCE` is defined to support `inttypes.h` in `z/OS`.
PR-URL: https://github.com/libuv/libuv/pull/2739
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
z/OS uses LIBPATH instead of LD_LIBRARY_PATH for the search path
for shared libraries.
PR-URL: https://github.com/libuv/libuv/pull/2737
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
The way libuv handled closing of `uv_signal_t` handles with pending
events introduced an infidelity where `uv_loop_alive()` returned false
while the signal handle was still in the closing-but-not-closed state.
Fixes: https://github.com/libuv/libuv/issues/2721
PR-URL: https://github.com/libuv/libuv/pull/2722
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
The test had two bugs:
1. It didn't handle EINTR when calling send() and recv().
2. It checked `errno` on EOF but that's only set when the return value
is less than zero.
PR-URL: https://github.com/libuv/libuv/pull/2713
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
On IBMi PASE, the value of pw_shell is always an empty string.
PR-URL: https://github.com/libuv/libuv/pull/2592
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Add an environment variable that lets people running the test suite
specify a timeout multiplier. Useful when running the tests on slow
machines.
Fixes: https://github.com/libuv/libuv/issues/2678
PR-URL: https://github.com/libuv/libuv/pull/2679
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
On IBMi PASE, there is no root user or nobody user.
User may grant root-like privileges, including setting uid/gid
to 0.
PR-URL: https://github.com/libuv/libuv/pull/2676
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
The watcher_cross_stop test timeout with too many AF_INET sockets
on IBMi PASE. In the udp_connect test, UDP connections can not be
disconnected with AF_UNSPEC on IBMi PASE.
PR-URL: https://github.com/libuv/libuv/pull/2673
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Previously, this field was being used uninitialized, leading to the
uv_write call returning failure. This only happens in the rare fallback
path where UV_HANDLE_EMULATE_IOCP is set, meaning that the OVERLAPPED
opened pipe already was associated with an IOCP.
Fixes: https://github.com/libuv/libuv/issues/629
PR-URL: https://github.com/libuv/libuv/pull/2620
Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
The UDP pummel benchmark does not model usual UDP servers well,
in UDP services like DNS, DHCP or NTP, there is usually just one
socket bound to the registered port and a large number of
requestors asking queries, this benchmark is simple 1 sender : 1 receiver thread
benchmark with multiple senders multiplexing on the event loop.
The test reports number of senders and attained rate of requests,
and is based on TCP benchmark-ping-pong.c.
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>
It was missing socket binding and the on_recv() callback was wrong.
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>
It was checking that the destination buffer was big enough to hold
the total capacity of the process title (the total storage of argv)
when instead it should be checking that it's big enough to hold
the _current_ process title, which is normally much shorter.
Fixes: https://github.com/libuv/libuv/issues/2666
PR-URL: https://github.com/libuv/libuv/pull/2668
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This test sometimes times out on `macos` because not all the expected events are
received: the create and delete events may coalesce. To avoid it, make sure
not to start deleting the files until all the create events are received.
Also, take into account in the test that a create event of the `subdir`
directory can be detected even though we start watching for the events after its
creation.
PR-URL: https://github.com/libuv/libuv/pull/2648
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
On IBMi PASE, we need to skip some file permission tests for `root`.
And the file stat of symbolic links are different as well.
PR-URL: https://github.com/libuv/libuv/pull/2628
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
On IBMi PASE we need to call Qp2getifaddrs() to get the network
interface configurations. And to call QDCRLIND to get the physical
addresses.
PR-URL: https://github.com/libuv/libuv/pull/2614
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
If the output data contained a null byte (for example, because it was
really utf16), we'd truncate the output there. This commonly would
manifest as the output on the CI bot being:
> not ok 308 - threadpool_cancel_random
> # exit code 3
> # Output from process :
> # A
Now we'll attempt to print out the whole error message as text (albeit
with the wrong encoding, but the ascii content should still nearly
always be readable).
PR-URL: https://github.com/libuv/libuv/pull/2611
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
It has been observed that running the tests via shell script
can cause special environment variables to be missing. This
commit ensures that a special Windows environment variable is set.
Fixes: https://github.com/libuv/libuv/issues/2622
PR-URL: https://github.com/libuv/libuv/pull/2624
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
The test checks that the creation time equals the birth time on systems
that support the notion of birth time (macOS, Linux.)
The test was flaky because there was a write taking place between the
creation of the file and the fstat() call, sometimes changing the ctime
by fractions of milliseconds... First fstat(), only then write().
Fixes: https://github.com/libuv/libuv/issues/2235
PR-URL: https://github.com/libuv/libuv/pull/2621
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
When the thread attributes object returned by pthread_getattr_np() is no
longer required, it should be destroyed using pthread_attr_destroy().
PR-URL: https://github.com/libuv/libuv/pull/2583
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
uv_(get|set)_process_title is not implemented on IBMi.
PR-URL: https://github.com/libuv/libuv/pull/2574
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@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, uv_uptime() and uv_fs_event_init() return UV_ENOSYS.
Set NO_FS_EVENTS on IBMi.
PR-URL: https://github.com/libuv/libuv/pull/2573
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@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>
For the dl api, OpenBSD reports only wrong binary format.
Others are unsupported.
PR-URL: https://github.com/libuv/libuv/pull/2572
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This reverts commit 038eacfbf4.
It was reported that this change causes a regression when trying
to obtain the screen resolution with `CGDisplayPixelsWide()` or
`CGDisplayPixelsHigh()` after changing the process title.
This is the second time this change had to be reverted due to
regressions and, although third time is allegedly the charm,
leaving well enough alone is the proverb I plan to adhere to...
Fixes: https://github.com/libuv/libuv/issues/2566
PR-URL: https://github.com/libuv/libuv/pull/2568
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@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>
This commit fixes uv_fs_copyfile() in cases where an unknown error
occurs when copy-on-write is requested by setting
UV_FS_COPYFILE_FICLONE. The original approach tried to catch some of
the errors raised by the ioctl() call, assuming that sendfile() would
also fail in those cases. This is not necessarily true, as some
variants of ioctl() also raise EINVAL (some maybe EBADF), but sendfile()
works just fine.
This patch reverses the logic, falling back to sendfile() in any
case where ioctl() returns an error. In other words, it tries much
harder to make uv_fs_copyfile() work.
Related to that, the original approach returned UV_ENOTSUP
unconditionally in cases where ioctl() failed and
UV_FS_COPYFILE_FICLONE_FORCE was set. However, ioctl() may have
failed for other reasons than being not supported. The function
now returns the actual error raised by ioctl(), leaving it to the
caller to deal with it.
Fixes: https://github.com/libuv/libuv/issues/2483
PR-URL: https://github.com/libuv/libuv/pull/2514
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Otherwise we run the risk of running the timer before the fsevent
callback since the timer due time is "now" because it's as long as the
process already slept.
Refs: https://github.com/libuv/libuv/issues/2491
PR-URL: https://github.com/libuv/libuv/pull/2516
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Libuv loaded and unloaded the Core Services and Application Services for
every call to uv_set_process_title().
Change that to load them on the first call to uv_set_process_title() and
delay unloading until libuv is unloaded.
Speeds up process_title_threadsafe by about 10x on my system. It should
fail less often (hopefully not at all) on the CI now.
PR-URL: https://github.com/libuv/libuv/pull/2480
Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
Remove duplicated test-ip6-addr.c in cmake build file
and gyp file.
PR-URL: https://github.com/libuv/libuv/pull/2494
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
In the fs_readdir_empty_dir test, the uv_fs_readdir() request is
cleaned up after calling uv_fs_closedir(). However, the readdir
request should be cleaned up before calling uv_fs_closedir().
Fixes: https://github.com/libuv/libuv/issues/2496
PR-URL: https://github.com/libuv/libuv/pull/2497
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
FreeBSD defines `sin_len` and `sin6_len` inside `sockaddr_in` and
`sockaddr_in6`. `sockaddr`s come from `getsockname` and `uv_ip4_addr`
will differ in the first byte if libuv doesn't set `sin_len` correctly.
PR-URL: https://github.com/libuv/libuv/pull/2492
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
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>
There are some special environment variables on Windows that
start with a '=' sign, e.g. per-drive working directories.
In those cases, an initial '=' in the name of the environment
variable needs to be skipped when looking for the '=' that separates
it from its value.
PR-URL: https://github.com/libuv/libuv/pull/2473
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jameson Nash <vtjnash+github@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The f_files value can equal 0, making the current assertion
incorrect. Including 0 in the assertion range leads to a
type-limits compiler warning. So, this commit just removes
the redundant assertion.
Fixes: https://github.com/libuv/libuv/issues/2417
PR-URL: https://github.com/libuv/libuv/pull/2426
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The messages must be actually sent to the multicast address.
PR-URL: https://github.com/libuv/libuv/pull/2185
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>
It looks like I managed to introduce a typo between two incarnations
of the pull request, causing the test to fail on macOS when using the
autotools dynamic library build.
I even managed to spell it correctly in the skip message, just not in
the actual environment variable lookup... I hang my head in shame at
such a silly mistake.
Fixes: https://github.com/libuv/libuv/issues/2421
PR-URL: https://github.com/libuv/libuv/pull/2422
Refs: https://github.com/libuv/libuv/pull/2408
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Commit ba780231 ("unix,win: handle zero-sized allocations uniformly")
makes `uv__malloc()` return NULL when `size == 0`.
That's exactly the size that is passed to it when uv_spawn() tries to
spawn a process with an empty environment so handle that edge case.
Fixes: https://github.com/nodejs/node/issues/29008
PR-URL: https://github.com/libuv/libuv/pull/2408
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jameson Nash <vtjnash+github@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
MinGW does not export the _set_fmode function via its
libmsvcrt.a import library unless on an ARM platform. This
causes the test target build to fail without manually
adjusting the link parameters.
It is safe to assume that _fmode is available in all stable
releases, and it should be preferred unless using MSVC. This
is unrelated to #2407, but when both are fixed, MinGW builds
should complete successfully.
PR-URL: https://github.com/libuv/libuv/pull/2411
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
In test-ipc.c, remove unnecessarily casting uv_stream_s to
uv_pipe_s that makes gcc complain about stric-aliasing
(-Wstrict-aliasing).
In test-queue-foreach-delete.c, using C99 variadic macros
to fix a gcc 8 warnings (-Wcast-function-type).
PR-URL: https://github.com/libuv/libuv/pull/2344
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This reverts commit 00c6b1649d.
It's been reported (and I can confirm) that this change breaks
`process.title = 'foo'` in Node.js.
Since libuv just calls out to Core Services and Application Services,
and since those frameworks are really just black boxes that you can't
look inside, it's impossible to debug what exactly goes wrong. Revert
it is then.
Fixes: https://github.com/nodejs/node/issues/28945
PR-URL: https://github.com/libuv/libuv/pull/2405
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Linux specific and practically an alias of AF_UNIX which is POSIX
PR-URL: https://github.com/libuv/libuv/pull/2388
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reading and writing files using a memory file mapping can be
significantly faster on Windows.
PR-URL: https://github.com/libuv/libuv/pull/2295
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
When TMP environment variable is 261 chars (including the trailing
slash) or 260 chars without the trailing slash, uv_os_tmpdir throws an
UV_EIO error which it shouldn't, since the total input string size
allowable for this function is PATH_MAX+1 (including the trailing slash)
PR-URL: https://github.com/libuv/libuv/pull/2341
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
The MSVC runtime provides a global variable that can be used to set the
default file translation mode so that file open calls don't need to
explicitly specify that mode.
libuv was changing that global mode to binary from its default of text.
However, libuv doesn't actually need to do that anymore, and the
application may not want the default changed under it. This change stops
libuv from modifying that global mode.
PR-URL: https://github.com/libuv/libuv/pull/2324
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Recent CI failures imply that uv_try_write() can return
UV_ECONNRESET - specifically on FreeBSD. This commit
updates the test to pass when that error code is returned.
PR-URL: https://github.com/libuv/libuv/pull/2355
Reviewed-By: Anna Henningsen <anna@addaleax.net>
The fallback for systems that lack preadv() only filled the first
buffer.
This commit rectifies that to fill all (or at least as many as possible)
buffers.
Fixes: https://github.com/libuv/libuv/issues/2332
PR-URL: https://github.com/libuv/libuv/pull/2338
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Make uv_cwd() do what the documentation says it did when the destination
buffer is too small: report UV_ENOBUFS and set the `size` in/out param
to the size of the path including the trailing nul byte.
Fixes: https://github.com/libuv/libuv/issues/2333
PR-URL: https://github.com/libuv/libuv/pull/2335
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>
So far, for some (?) errors, `uv_try_write()` returns `EAGAIN`
regardless of the actual error, so `ECONNRESET` and `EPIPE` errors
can be swallowed here.
This commit changes `uv_try_write()` so that it prefers to return
the actual error it has seen.
PR-URL: https://github.com/libuv/libuv/pull/2321
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit add support for Haiku, an open-source operating system
inspired by BeOS.
PR-URL: https://github.com/libuv/libuv/pull/2301
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
The test threadpool_multiple_event_loops has been timing
out consistently on FreeBSD in the CI. This commit attempts
to mitigate the problem by extending the test timeout.
PR-URL: https://github.com/libuv/libuv/pull/2304
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
UV_PROCESS_WINDOWS_HIDE_CONSOLE and UV_PROCESS_WINDOWS_HIDE_GUI were
whitelisted on Windows but not Unices. Now they are.
Bug introduced in commit 4c2dcca27 ("win: support more fine-grained
windows hiding") which I reviewed but where I failed to spot it. Mea
culpa.
Fixes: https://github.com/libuv/libuv/issues/2266
PR-URL: https://github.com/libuv/libuv/pull/2278
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Kyle Edwards <kyle.edwards@kitware.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This was reported as a bug in November 2018 but it appears to be working
now. Add a regression test to ensure it stays that way.
Fixes: https://github.com/libuv/libuv/issues/2076
PR-URL: https://github.com/libuv/libuv/pull/2279
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Explicitly initialize uv_stat_t fields st_flags and st_gen when using
statx as uv__to_stat does when statx is not available. This makes
valgrind happier.
PR-URL: https://github.com/libuv/libuv/pull/2263
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Add test to test-fs-copyfile.c to check that uv_fs_copyfile() respects
destination file permissions. Previously, in macOS, it did not.
PR-URL: https://github.com/libuv/libuv/pull/2233
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
PR-URL: https://github.com/libuv/libuv/pull/2221
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Using `floor()` instead of integer division causes the test driver
to require linking against `libm` on Solaris.
PR-URL: https://github.com/libuv/libuv/pull/2200
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
The return type is changed to avoid having to craft an artificial
`return` just for the Studio compiler.
PR-URL: https://github.com/libuv/libuv/pull/2200
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
The Studio compiler issues a warning because the source file lacks a
newline at the end of the file.
PR-URL: https://github.com/libuv/libuv/pull/2200
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
The Studio C compiler issues a warning if there is a `return` after an
`abort()` call or an unreachable `return` after a prior `return`.
The Studio C compiler issues a warning if there is a `return` after a
prior `return`, or an endless loop (e.g., `for (;;)`) with a `return` at
the end of the function.
PR-URL: https://github.com/libuv/libuv/pull/2200
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Solaris does not support the non-standard Linux `POLLRDHUP` event, so
disable the code awaiting the disconnects to exit the loop. Without
this, the `poll_duplex` and `poll_unidirectional` tests will hang and
timeout.
PR-URL: https://github.com/libuv/libuv/pull/2200
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Add two new methods:
`uv_udp_connect()` to connect / disconnect an UDP handle.
`uv_udp_getpeername()` to get the remote peer address of a connected UDP
handle.
Modify `uv_udp_send()` and `uv_udp_try_send()` to accept a `NULL` `addr`
to send messages over an "UDP connection".
Refs: https://github.com/libuv/leps/pull/10
PR-URL: https://github.com/libuv/libuv/pull/1872
Backport-PR-URL: https://github.com/libuv/libuv/pull/2217
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Expecting `uv_sleep(45)` to wake up within 80 ms is not a reasonable
assumption: the operating system may not reschedule the process within
that time frame when the system is overloaded.
The test fails intermittently on our own CI and packagers have reported
similar failures.
Fixes: https://github.com/libuv/libuv/issues/2117
PR-URL: https://github.com/libuv/libuv/pull/2186
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Kernels > 4.11 support the statx() system call that lets one retrieve
the birth time of a file. Teach libuv about it.
Fixes: https://github.com/libuv/libuv/issues/2152
PR-URL: https://github.com/libuv/libuv/pull/2184
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit adds UV_MAXHOSTNAMESIZE for working with
uv_os_gethostname(). Prior to this commit, this logic was
duplicated in several places across libuv and Node.js alone.
PR-URL: https://github.com/libuv/libuv/pull/2175
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
New versions of Windows ship with 8.3 short-names disabled.
This commit adds 8.3 detection logic in the
fs_event_watch_dir_short_path test.
PR-URL: https://github.com/libuv/libuv/pull/2103
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
A couple of ipc tests failures where undercover by the previous commit.
- In `ipc-heavy-traffic-deadlock-bug`, `uv_shutdown` can fail with
`UV_ENOTCONN`. Allow it.
- `ipc_closed_handle` was failing consistently on `Centos6` because the
first large write was completed in just one syscall. Also, there were
issues with the lifetime of the `uv_write_t` requests. Refactor the
test so it passes consistently on `Centos6` while fixing the
`uv_write_t` issues.
PR-URL: https://github.com/libuv/libuv/pull/2108
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Make sure an ipc test fails if `term_signal` is not zero. This can
happen on failing assertions in the child process.
PR-URL: https://github.com/libuv/libuv/pull/2108
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
In the original PR, the ifdef conditional was reversed,
leading to the old code-path still being used.
This also reduces some of the redundancy in the conditional checks,
by factoring out the common test.
And fixes a divergence in functionality kFSEventsRenamed =>
kFSEventStreamEventFlagItemRenamed
And actually includes the part of the original PR to kqueue that enabled
watching files with fsevents!
Fixes: https://github.com/libuv/libuv/pull/387
PR-URL: https://github.com/libuv/libuv/pull/2082
Refs: https://github.com/libuv/libuv/pull/1572
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Guard against sending the handle over the UNIX domain socket twice
when the first sendmsg() didn't write all bytes.
The changes to src/win partially undo changes made earlier this year,
see the referenced pull request for details.
Libuv never made promises about the value of `req->send_handle` at
different points in time so this should be a safe, non-breaking change.
No tests because this particular condition is hard to hit reliably
across platforms. I spent a lot of time trying to write one but it
turned out hideously complex, and worse, flaky.
Fixes: https://github.com/libuv/libuv/issues/2086
PR-URL: https://github.com/libuv/libuv/pull/2097
Refs: https://github.com/libuv/libuv/pull/1843
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
On Windows, `fs__open()` maps `UV_FS_O_DIRECT` to
`FILE_FLAG_NO_BUFFERING`.
When `access` is only `FILE_GENERIC_READ` this succeeds, but when
`access` is `FILE_GENERIC_WRITE` this returns an error:
```
0x00000057, ERROR_INVALID_PARAMETER, The parameter is incorrect.
```
The reason is that `FILE_GENERIC_WRITE` includes `FILE_APPEND_DATA`,
but `FILE_APPEND_DATA` and `FILE_FLAG_NO_BUFFERING` are mutually
exclusive:
```
FILE_GENERIC_WRITE = STANDARD_RIGHTS_WRITE |
FILE_WRITE_DATA |
FILE_WRITE_ATTRIBUTES |
FILE_WRITE_EA |
FILE_APPEND_DATA |
SYNCHRONIZE
```
This incompatibility between access and attribute flags does not appear
to be documented by Microsoft for `FILE_FLAG_NO_BUFFERING` but it is
indirectly documented under [NtCreateFile](https://bit.ly/2rm5wRT):
```
FILE_NO_INTERMEDIATE_BUFFERING
The file cannot be cached or buffered in a driver's internal buffers.
This flag is incompatible with the DesiredAccess FILE_APPEND_DATA flag.
```
The solution is to remove `FILE_APPEND_DATA` from the access flags when
`FILE_FLAG_NO_BUFFERING` is set. Note that this does not prevent
appends, since `FILE_GENERIC_WRITE` also includes `FILE_WRITE_DATA`,
which in turn allows appends.
PR-URL: https://github.com/libuv/libuv/pull/2102
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Libuv had coverage for the AF_INET6 path but not the AF_INET path.
Now it does.
PR-URL: https://github.com/libuv/libuv/pull/2065
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Libuv loaded and unloaded the Core Services and Application Services for
every call to uv_set_process_title().
Change that to load them on the first call to uv_set_process_title() and
delay unloading until libuv is unloaded.
Speeds up process_title_threadsafe by about 10x on my system.
PR-URL: https://github.com/libuv/libuv/pull/2064
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Encode domain names before passing them on to the libc resolver.
Some getaddrinfo() implementations support IDNA 2008, some only
IDNA 2003 and some don't support i18n domain names at all.
This is a potential security issue because it means a domain name
might resolve differently depending on the system that libuv is
running on.
Fixes: https://github.com/libuv/libuv/issues/2028
PR-URL: https://github.com/libuv/libuv/pull/2046
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
The test runner inserted a 250 ms delay to give helper processes time to
settle. That's intrinsically race-y and caused tests to intermittently
fail on platforms like AIX.
Instead of a fixed delay, pass a file descriptor to the helper process
and wait until it closes the descriptor. That way we know for sure the
process has started.
Incidentally, this change reduces the running time of the test suite
from 112 to 26 seconds on my machine.
Fixes: https://github.com/libuv/libuv/issues/2041
PR-URL: https://github.com/libuv/libuv/pull/2056
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
execvp() is not async-signal-safe, execve() is.
PR-URL: https://github.com/libuv/libuv/pull/2056
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
getenv() and atoi() are not safe to call between fork() and execve()
so call them before forking.
PR-URL: https://github.com/libuv/libuv/pull/2056
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
PR-URL: https://github.com/libuv/libuv/pull/2017
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: John Barboza <jbarboza@ca.ibm.com>
Ensure that uv_barrier_wait returns positive only after all threads have
exited the barrier. If this value is returned too early and the barrier
is destroyed prematurely, then this test may see a crash.
PR-URL: https://github.com/libuv/libuv/pull/2019
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
New Windows version requires `EventType` to be set to something
meaningful, otherwise WriteConsoleInputW() will fail with
`ERROR_INVALID_PARAMETER`. This sets it to `FOCUS_EVENT` which
is ignored by `uv_process_tty_read_raw_req()`.
Fixes: https://github.com/nodejs/node/issues/21773
PR-URL: https://github.com/libuv/libuv/pull/1989
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Previously, we required the user to specify the expected read/write
flags for a pipe or tty. But we've already been asking the OS to tell us
what they actually are (fcntl F_GETFL), so we can hopefully just use
that information directly.
Fixes: https://github.com/libuv/libuv/issues/1936
PR-URL: https://github.com/libuv/libuv/pull/1964
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Problem:
Upper bound on thread wakeup was set to 1.5 * (requested timeout).
On MacOS wakeup delay factors of 1.75 have been reported.
Solution:
Increase the bound to 5 * (requested timeout).
Refs: https://github.com/libuv/libuv/issues/1910
PR-URL: https://github.com/libuv/libuv/pull/1990
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Problem:
libuv is compiled with -Wunused-result.
In two tests, read() is used for ordering and the
rc is ignored because it doesn't matter.
But -Wunused-result causes warnings in these cases.
Fix:
Provide a (very generous) check on the rc of read()
in these cases.
PR-URL: https://github.com/libuv/libuv/pull/1956
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
A file descriptor that can do multiple successful write completion
requests in a row will starve the loop because it will keep feeding
the write_completed_queue. This fix will only process items on the
write_completed_queue once per event loop (in uv__run_pending).
Any new items on the queue will be processed in the next loop.
PR-URL: https://github.com/libuv/libuv/pull/1787
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Problem:
The condvar tests could pass without uv_cond_wait
(or uv_cond_timedwait) ever being invoked.
Solution:
Introduce semaphores to enforce ordering.
Now there will always be a thread waiting on the condition
when a signal() occurs.
Gotchas:
1. On Windows, waiting for a timeout may return earlier
than requested, depending on the granularity of timer ticks.
2. Timeout bounds are tuned based on our CI machines.
Bonuses:
1. I added additional test cases to complete the test matrix.
2. It seemed to me that several of the condvar tests were redundant,
because they used timing to probabilistically explore cases where there
would be "missed connections" (signal without a waiter).
Because it was not clear to me what the purpose of such tests were,
I have removed them.
Fixes: https://github.com/libuv/libuv/issues/1714
PR-URL: https://github.com/libuv/libuv/pull/1718
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This PR creates two new externally-facing APIs, uv_err_name_r() and
uv_strerror_r().
In keeping with the precedent set by POSIX, the *_r() suffix of these
two new methods indicate that the caller does the memory management and
passes in the memory that the output will be stored in, which provides
an alternative for the two existent methods (uv_err_name() and
uv_strerror()), which, when called with an unknown error code, leak a
few bytes of memory.
PR-URL: https://github.com/libuv/libuv/pull/1898
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno santiago.gimeno@gmail.com
Some long overdue refactoring that unifies more of the UNIX and Windows
backends.
PR-URL: https://github.com/libuv/libuv/pull/1904
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This test has been timing out on macOS. Try to avoid that by
reducing the number of iterations run.
PR-URL: https://github.com/libuv/libuv/pull/1867
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
We don't control the running time of the test and as a result it
frequently times out on some of the CI buildbots.
We are already using a custom timeout for getaddrinfo_fail so it only
makes sense to do the same for its synchronous counterpart.
PR-URL: https://github.com/libuv/libuv/pull/1856
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Libuv does not support multiple handles watching the same file
descriptor. That condition is caught by an assert but it's detached
from the call site and therefore not always trivial to track down.
This commit turns cases where we can easily detect duplicates into
runtime `UV_EEXIST` errors. More work is needed to catch _all_ cases.
Partially addresses https://github.com/libuv/libuv/issues/1172.
PR-URL: https://github.com/libuv/libuv/pull/1851
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Back in the day I wrote comments in a really unusual way. Nowadays it
makes my eyes bleed, and clang-format doesn't know how to deal with it.
PR-URL: https://github.com/libuv/libuv/pull/1853
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
PR-URL: https://github.com/libuv/libuv/pull/1840
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Use the same code path as other BSDs.
Upstreamed from the OpenBSD Ports Collection.
PR-URL: https://github.com/libuv/libuv/pull/1797
Reviewed-By: Aaron Bieber <deftly@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
IPv6-IPv4 dual stack is not supported on OpenBSD.
Upstreamed from the OpenBSD Ports Collection.
PR-URL: https://github.com/libuv/libuv/pull/1797
Reviewed-By: Aaron Bieber <deftly@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
According to its man page, there is a bug in fstat()
on macOS related to pipes. This commit replaces a
fstat() call in uv_pipe_chmod() with a stat() call in
order to get the correct permissions.
PR-URL: https://github.com/libuv/libuv/pull/1635
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
The previous timeout of 1 millisecond could lead to intermittent
failures. Increase it to 1 second to be on the safe side.
PR-URL: https://github.com/libuv/libuv/pull/1776
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
On FreeBSD `close()` can fail with `ECONNRESET` if the socket was
shutdown by the peer before all pending data was delivered.
PR-URL: https://github.com/libuv/libuv/pull/1780
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
uv_fs_unlink would fail for read-only files with Archive attribute
cleared. This fixes this issue.
PR-URL: https://github.com/libuv/libuv/pull/1774
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
UV_FS_COPYFILE_FICLONE attemps to use copy-on-write
semantics in uv_fs_copyfile(). If CoW is not available,
it falls back to a normal copy operation.
Refs: https://github.com/libuv/libuv/pull/1465
PR-URL: https://github.com/libuv/libuv/pull/1491
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit adds checks for fs request values when a call
fails with UV_EINVAL.
PR-URL: https://github.com/libuv/libuv/pull/1752
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit adds tests that pass bad options to uv_fs_copyfile(),
uv_fs_read(), and uv_fs_write(). These tests verify that the
asynchronous version of these functions do not hold the event
loop open on bad inputs.
Refs: https://github.com/nodejs/node/pull/18811
PR-URL: https://github.com/libuv/libuv/pull/1747
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Using -errno, -E**, and -pthread_function() can be
error prone, and breaks compatibility with some operating
systems that already negate errno's (e.g. Haiku).
This commit adds a UV__ERR() macro that ensures libuv
errors are negative.
Fixes: https://github.com/libuv/help/issues/39
PR-URL: https://github.com/libuv/libuv/pull/1687
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Problem:
The "timeout" functionality of uv_cond_timedwait was not being tested.
The test (condvar_3) would use a worker that signaled the condition.
Solution:
Introduce a new condvar test case to ensure that the timeout also works.
PR-URL: https://github.com/libuv/libuv/pull/1713
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: John Barboza <jbarboza@ca.ibm.com>
Make it easier for Node.js to ship libuv in its tarballs without also
including the test suite. Node.js already does so but recent changes
to its build system complicate that.
Kills two birds with one stone: it helps out Node.js and it makes it
harder for us to introduce hidden dependencies between the library and
the test suite.
PR-URL: https://github.com/libuv/libuv/pull/1725
Refs: https://github.com/nodejs/node/pull/18287
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit fixes two assertions of the form
(events == UV_CHANGE || UV_RENAME) which always passed because
UV_RENAME is 1.
Refs: https://github.com/libuv/help/issues/41
PR-URL: https://github.com/libuv/libuv/pull/1722
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reverted for breaking `test/parallel/test-child-process-cwd.js` from the
Node.js test suite. Instead of ENOENT when trying to remove a directory
that does not exist, it started failing with ENOTDIR.
This reverts commit 15f29dc08f.
PR-URL: https://github.com/libuv/libuv/pull/1717
Refs: https://github.com/nodejs/node/issues/18014
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reverted for breaking Node.js in rather spectacular fashion.
The bug is arguably on the Node.js side. It looks like Node.js starts
reading before the socket is actually connected to something.
Until that is fixed downstream, let's revert the change.
This reverts commit fd049399aa.
Fixes: https://github.com/libuv/libuv/issues/1716
Fixes: https://github.com/nodejs/node/issues/18225
PR-URL: https://github.com/libuv/libuv/pull/1717
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Use RemoveDirectoryW() and remap ERROR_DIRECTORY from UV_ENOENT
to UV_ENOTDIR so that attempted removal of a non-directory produces
the right (and legible) error message.
Fixes: https://github.com/nodejs/node/issues/18014
PR-URL: https://github.com/libuv/libuv/pull/1698
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Sending a SIGTERM to a process that is still starting up kills it with
SIGKILL instead of SIGTERM.
PR-URL: https://github.com/libuv/libuv/pull/1709
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Added a check in uv__fs_buf_iter to detect partial reads and writes.
Partial reads and writes are looped until all data has been processed.
PR-URL: https://github.com/libuv/libuv/pull/640
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
PR-URL: https://github.com/libuv/libuv/pull/1689
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
The two minute timeout should not be necessary anymore after commit
aeaff5f0 ("test: lower number of tasks in threadpool test".)
PR-URL: https://github.com/libuv/libuv/pull/1681
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
On Linux when connecting IP addresses 0.0.0.0 and :: are automatically
converted to localhost. This adds same functionality to Windows.
PR-URL: https://github.com/libuv/libuv/pull/1515
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
It shouldn't be setting READABLE and WRITABLE on the socket server,
since they aren't, and this could confuse the client.
PR-URL: https://github.com/libuv/libuv/pull/1655
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit uses the Register File Interest feature on z/OS
to enable users to monitor file system events.
The poll call is used to check for file descriptors as well
as a message queue that z/OS will report file system events
on. The last item on the list used by poll will contain the
message queue id instead of a file descriptor.
Limitation:
Writes to a directory (that is, file creation and deletion)
do not generate a change message for a registered directory.
PR-URL: https://github.com/libuv/libuv/pull/1311
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Maps pid 0 to the current process, simulating Linux kill sending signal
to the process group.
Adds detection of invalid signals. If the signum is invalid - below 0
or NSIG or above – UV_EINVAL will be returned instead of UV_ENOSYS.
PR-URL: https://github.com/libuv/libuv/pull/1642
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Verify that quick setup and teardown of the threadpool doesn't cause
crashes or hangs.
PR-URL: https://github.com/libuv/libuv/pull/1639
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Used a shared uv_mutex_t in unix implementations of these functions
to prevent simultaneous execution.
Fixes: https://github.com/libuv/libuv/issues/271
PR-URL: https://github.com/libuv/libuv/pull/1640
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Add getter/setter functions for the fields of public structs that
might be relevant to e.g. Node.js addons.
Through these methods, ABI compatibility for a subset of the ABI
is easier to achieve, since using them makes code independent
of the exact offsets of these fields.
The intended use case that prompted this are N-API addons for
Node.js, which look for more long-term ABI compatibility guarantees
than typical Node code. With these helper functions, using libuv
directly should no longer be an obstacle for such addons.
PR-URL: https://github.com/libuv/libuv/pull/1657
Refs: https://github.com/nodejs/node/issues/13512
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>