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>
BSD `signal(2)` semantics make some system calls (e.g. for `write`)
restartable when interrupted by a signal handler. Use `SA_RESTART` to
enable these semantics everywhere that supports them.
This was done by libev back when we used it. In addition to being
common practice, this is required by C++ stream libraries that interpret
`EINTR` as any other error, set `badbit`, and stop writing. I've
observed this with `libstdc++` during a `std::cout.flush()` call
interrupted by `SIGCHLD`.
PR-URL: https://github.com/libuv/libuv/pull/1696
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@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>
It appears that, at least on Windows, the process terminates abnormally
when the program exits before the worker threads complete initializing.
Wait for the threads to spin up in `init_threads()` to avoid that.
PR-URL: https://github.com/libuv/libuv/pull/1662
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jamie Davis <davisjam@vt.edu>
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>
It isn't necessary, and doesn't agree with the printed message.
PR-URL: https://github.com/libuv/libuv/pull/1620
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Changes since version 1.16.1:
* unix: avoid malloc() call in uv_spawn() (Ben Noordhuis)
* doc: clarify the description of uv_loop_alive() (Ed Schouten)
* win: map UV_FS_O_EXLOCK to a share mode of 0 (Joran Dirk Greef)
* win: fix build on case-sensitive file systems (Ben Noordhuis)
* win: fix test runner build with mingw64 (Ben Noordhuis)
* win: remove unused variable in test/test-fs.c (Ben Noordhuis)
* zos: add strnlen() implementation (jBarz)
* unix: keep track of bound sockets sent via spawn (jBarz)
* unix,win: wait for threads to start (Ben Noordhuis)
* test: add threadpool init/teardown test (Bartosz Sosnowski)
* test: avoid malloc() in threadpool test (Ben Noordhuis)
* test: lower number of tasks in threadpool test (Ben Noordhuis)
* win: issue memory barrier in uv_thread_join() (Ben Noordhuis)
* ibmi: add support for new platform (Xu Meng)
* test: fix test-spawn compilation (Bartosz Sosnowski)
Unbreaks libuv compilation on Windows.
PR-URL: https://github.com/libuv/libuv/pull/1641
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Support the IBM i platform.
- add a new file src/unix/ibmi.c
- extract the common functions from /src/unix/aix.c into aix-common.c
- update uv.gyp and include/uv-unix.h to enable the new file ibmi.c
PR-URL: https://github.com/libuv/libuv/pull/1601
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
I'm 99% sure `WaitForSingleObject()` already issues a memory barrier for
thread objects but since I could find no mention of that on MSDN, let's
play it safe and do it ourselves, too.
PR-URL: https://github.com/libuv/libuv/pull/1634
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Stack-allocate the `uv_loop_t` instance, no reason to heap-allocate it.
PR-URL: https://github.com/libuv/libuv/pull/1634
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>
It appears that, at least on Windows, the process terminates abnormally
when the program exits before the worker threads complete initializing.
Wait for the threads to spin up in `init_threads()` to avoid that.
Refs: https://github.com/libuv/libuv/pull/1613#issuecomment-344958863
PR-URL: https://github.com/libuv/libuv/pull/1639
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
We use the UV_HANDLE_BOUND flag to mark a socket as bound to a
port. We need to do this for sockets that are sent from another
process as well as sockets that created by the process itself.
First check if the port number is non-zero. If yes then mark
it as bound.
PR-URL: https://github.com/libuv/libuv/pull/1348
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Add an implementation of strnlen() which is not provided by default.
PR-URL: https://github.com/libuv/libuv/pull/1631
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Include `<winioctl.h>` for the definition of `FSCTL_SET_REPARSE_POINT`
and define `ERROR_SYMLINK_NOT_SUPPORTED` if not already defined.
PR-URL: https://github.com/libuv/libuv/pull/1632
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Cross-compiling with mingw64 was broken because the header files are
called `accctrl.h` and `aclapi.h` whereas libuv was trying to include
`AccCtrl.h` and `AclAPI.h`.
PR-URL: https://github.com/libuv/libuv/pull/1629
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This function not only returns true if there are active handles or
requests. First of all, it also takes into account whether handles are
referenced. Second, handles that are being closed also contribute to
whether a loop is alive.
Fixes: https://github.com/libuv/libuv/issues/1592
PR-URL: https://github.com/libuv/libuv/pull/1594
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
The stdio count for the new process is almost always a low number that
we can allocate on the stack instead of the heap.
PR-URL: https://github.com/libuv/libuv/pull/1626
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>