* Don't silently ignore ERROR_OPERATION_ABORTED.
Code to silently ignore this error was added in c42a4ca, under the
false premise that this error is somehow equivalent to EINTR on posix
platforms. This isn't true; ERROR_OPERATION_ABORTED doesn't happen
unless the application explicitly aborts an I/O operation.
Silently ignoring this error elsewhere could potentially hide bugs,
hence libuv shouldn't do it. Instead, explicitly deal with it where
it is expected.
* Don't mark aborted reads as successful.
The worker thread used to call ReadFile() on synchronous pipes would
incorrectly mark cancelled read requests as successful, leading to
issues later on.
* Rely on main thread to restart aborted reads.
After a blocking ReadFile() call was cancelled, the worker thread
would previously attempt to restart it immediately, making
synchronization logic needlessly complex. Instead, we simply cancel
the operation, and leave it to the main loop to restart it if so
desired.
Since we now realy on the main thread to restart interrupted
ReadFile() calls, we can now have a single function interrupts a
synchronous read until the event loop restarts it again.
* Clean up uv__pipe_read_stop().
A single function to interrupt blocking reads also allows us to
remove weird logic in uv__pipe_read_stop() that quickly pauses and
unpauses a read operation in the hope of cancelling it.
* Assume CancelIo() and CancelSynchronousIo() are always available.
Since libuv doesn't support windows XP and Server 2003 any more, we
can assume that these APIs are always available, and do away with
branching around them.
PR-URL: https://github.com/libuv/libuv/pull/1843
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.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>
Changes since version 1.20.2:
* win: add Windows XP support to uv_if_indextoname() (ssrlive)
* win: fix `'floor' undefined` compiler warning (ssrlive)
* win, pipe: stop read for overlapped pipe (Bartosz Sosnowski)
* build: fix utf-8 name of copyright holder (Jérémy Lal)
* zos: initialize pollfd revents (jBarz)
* zos,doc: add system V message queue note (jBarz)
* linux: don't use uv__nonblock_ioctl() on sparc (Ben Noordhuis)
uv__nonblock_fcntl() and uv__nonblock_ioctl() do not commute when
O_NDELAY is not equal to O_NONBLOCK. Case in point: linux/sparc32
and linux/sparc64, where O_NDELAY is O_NONBLOCK + another bit.
Libuv uses uv__nonblock_fcntl() directly sometimes so ensure that it
commutes with uv__nonblock().
Fixes: https://github.com/libuv/libuv/issues/1830
PR-URL: https://github.com/libuv/libuv/pull/1832
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
System V message queues will get left behind on z/OS if uv_loop_t
objects are not closed via uv_loop_close.
PR-URL: https://github.com/libuv/libuv/pull/1823
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
If not initialized to zero, revents could carry dirty bits in the
output from poll.
PR-URL: https://github.com/libuv/libuv/pull/1820
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit attempts to dynamically load
ConvertInterfaceIndexToLuid() and ConvertInterfaceLuidToNameW()
from iphlpapi.dll before using them. If they are not available,
UV_ENOSYS is returned.
PR-URL: https://github.com/libuv/libuv/pull/1810
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Changes since version 1.20.1:
* zos: use custom semaphore (jBarz)
* win: fix registry API error handling (Kyle Farnung)
* build: add support for 64-bit AIX (Richard Lau)
* aix: guard STATIC_ASSERT for glibc work around (Richard Lau)
The Reg* APIs on Windows don't use GetLastError() to report
failures. The errors are returned directly from the call.
For systems which don't have one of the values GetLastError() can
end up returning 0 to the caller, indicating success. The caller
then assumes that the data is valid and can attempt to execute on
garbage data. This change fixes the flow to correctly return the
error to the caller.
PR-URL: https://github.com/libuv/libuv/pull/1811
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
The System V semaphores on z/OS require explicit ending of the worker
threads and cleanup at process exit. The user will have to manually
cleanup these resources that are left behind. Instead use the custom
semaphore implementation which uses posix mutexes and condition
variables which are cleaned up automatically on process exit.
PR-URL: https://github.com/libuv/libuv/pull/1805
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
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>
OpenBSD does not support setting IPV6_ONLY to anything but 1; OpenBSD
does not support IPv4-mapped IPv6 addresses.
Upstreamed from 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>
Hack around https://sourceware.org/bugzilla/show_bug.cgi?id=12674
by providing a custom implementation for glibc < 2.21 in terms of other
concurrency primitives.
The glibc implementation on these versions is inherently unsafe.
So, while libuv and Node.js support those versions, it seems to make
sense for libuv in its functionality as a platform abstraction library
to provide a working version.
Fixes: https://github.com/nodejs/node/issues/19903
PR-URL: https://github.com/libuv/libuv/pull/1795
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.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>
Pipe naming conventions differ on Windows and Unix. This
commit calls out the naming conventions and requirements.
PR-URL: https://github.com/libuv/libuv/pull/1765
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.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>
IBM i compilers now predefine __PASE__. This commit updates
code to rely on that rather than manually setting (or relying on)
a _PASE definition.
PR-URL: https://github.com/libuv/libuv/pull/1782
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@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>