Faulty logic in commit fdf7c2a ("build: split off tests into separate
gyp file") accidentally disabled `-D_FILE_OFFSET_BITS=64` on Unices,
breaking file operations on files > 2 GB on 32 bits platforms.
Fixes: https://github.com/nodejs/node/issues/19455
PR-URL: https://github.com/libuv/libuv/pull/1779
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
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>
uv_process_tty_accept_req() and uv_process_tty_connect_req()
are marked with "TODO: remove me" comments. This commit
updates the comments to give a better explanation of why
they exist.
PR-URL: https://github.com/libuv/libuv/pull/1335
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit preserves errno properly in the following cases:
- new_socket() was previously discarding errno in some cases,
and replacing it with the result of getsockname().
- uv__close() was not preserving errno when __MVS__ is defined.
Fixes: https://github.com/libuv/libuv/issues/1756
PR-URL: https://github.com/libuv/libuv/pull/1763
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Problem:
The instructions assume you have already installed gyp to
build/gyp.
If you run 'make' without doing so, it asks you to read the README,
which does not actually tell you about installing gyp.
Solution:
Add a one-liner `git clone` command to the setup instructions.
PR-URL: https://github.com/libuv/libuv/pull/1712
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Fix bug in `uv__pollfds_del()` where only one invalidated fd is purged.
Calls to `uv__platform_invalidate_fd()` will invalidate descriptors
(rather than removing them) when `poll()` is iterating. Under stressful
conditions, this may happen more frequently than `uv__pollfds_del()` is
called. So, when uv__pollfds_del() is called with a value of -1, it
should iterate the entire array to remove all invalidated descriptors.
PR-URL: https://github.com/libuv/libuv/pull/1738
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit refactors uv_os_homedir() to to use uv_os_getenv()
to retrieve the USERPROFILE environment variable. This removes
a fair amount of duplicated code, while introducing the following
changes:
1. The function no longer returns UV_EIO when USERPROFILE is
longer than MAX_PATH. This can be reinstated by adding a
check for r == 0 && *size >= MAX_PATH.
2. The USERPROFILE string is now a char*, meaning that it must
be converted from utf8 to utf16 by uv_os_getenv().
Refs: https://github.com/libuv/libuv/pull/1760
PR-URL: https://github.com/libuv/libuv/pull/1761
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
- Remove the `active_reqs` queue, which is never used. There are more
efficient per-stream queues that `libuv` uses whenever it needs this
information, so duplicating it and managing it here seems
like unnecessary extra space and work.
- Unix `uv_loop_init` didn't explicitly initialize.
`loop->active_handles` (although it did memset the whole struct
to 0, so it wasn't wrong previously, just inconsistent).
- Consolidate repeated code for `uv__has_active_reqs`.
- Change `uv__loop_alive` to use the helper functions (mirroring the
unix copy of the same function).
- Initialize some more uv_stream_t fields in init, rather than waiting
for the connection callback. This helps surface bugs in libuv or the
caller better, since it ensures libuv doesn't see uninitialized
memory if asked to look at these fields before it thinks the socket
is connected.
- Fixes what appears to be a double-counting of `handle->reqs_pending`,
in the highly-unlikely event that the code wants to emulate IOCP,
but `RegisterWaitForSingleObject` somehow managed to fail.
PR-URL: https://github.com/libuv/libuv/pull/1746
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
`UV_READABLE_PIPE` and `UV_WRITABLE_PIPE` flags should be honored on
unices.
Windows is better about already doing this, so this will make the
behavior of these flags more consistent across platforms.
It also is just better to set these flags to reflect the actual
mode of the stream, rather than guessing at it based on typical usage.
Refs: https://github.com/libuv/libuv/pull/1655
Refs: https://github.com/nodejs/node/pull/18701
PR-URL: https://github.com/libuv/libuv/pull/1741
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>
On OSX when sending handles via `sendmsg()` it can return `EMSGSIZE` if
there isn't room in the socket output buffer to store the whole message.
If that's the case, return control to the loop and try again in the next
iteration.
Fixes: https://github.com/nodejs/node/issues/14828
PR-URL: https://github.com/libuv/libuv/pull/1739
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
The pthread_cond_timedwait requires a timeout relative to the Epoch.
So don't use uv__hrtime to set the timeout because it is relative to an
arbitrary time in the past. Use gettimeofday instead.
PR-URL: https://github.com/libuv/libuv/pull/1711
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jamie Davis <davisjam@vt.edu>
This commit addresses POD variable initialization issues with older
Visual Studio compilers.
PR-URL: https://github.com/libuv/libuv/pull/1740
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/libuv/libuv/pull/1732
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@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>
Drop obsolete workarounds from the `gyp_uv.py` wrapper script.
The bugs they work around were fixed about five years ago.
PR-URL: https://github.com/libuv/libuv/pull/1725
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>
Changes since version 1.18.0:
* core: add getter/setter functions for easier ABI compat (Anna
Henningsen)
* unix: make get(set)_process_title MT-safe (Matt Harrison)
* unix,win: wait for threads to start (Ben Noordhuis)
* test: add threadpool init/teardown test (Bartosz Sosnowski)
* win, process: uv_kill improvements (Bartosz Sosnowski)
* win: set _WIN32_WINNT to 0x0600 (cjihrig)
* zos: implement uv_fs_event* functions (jBarz)
* unix,tcp: avoid marking server sockets connected (Jameson Nash)
* doc: mark Windows 7 as Tier 1 support (Bartosz Sosnowski)
* win: map 0.0.0.0 and :: addresses to localhost (Bartosz Sosnowski)
* build: install libuv.pc unconditionally (Ben Noordhuis)
* test: remove custom timeout for thread test on ppc (Ben Noordhuis)
* test: allow multicast not permitted status (Jérémy Lal)
* test: allow net unreachable status in udp test (Ben Noordhuis)
* unix: use SA_RESTART when setting our sighandler (Brad King)
* unix,fs: fix for potential partial reads/writes (Ben Wijen)
* win,build: do not build executable installer for dll (Bert Belder)
* win: allow directory symlinks to be created in a non-elevated context
(Bert Belder)
* zos,test: accept SIGKILL for flaky test (jBarz)
* win: use RemoveDirectoryW() instead of _wmrmdir() (Ben Noordhuis)
* unix: fix uv_cpu_info() error on FreeBSD (elephantp)
* zos,test: decrease pings to avoid timeout (jBarz)