Changes since version 1.10.1:
* Now working on version 1.10.2 (cjihrig)
* darwin: fix fsync and fdatasync (Joran Dirk Greef)
* Revert "Revert "win,tty: add support for ANSI codes in win10 v1511""
(Santiago Gimeno)
* win,tty: fix MultiByteToWideChar output buffer (Santiago Gimeno)
* win: remove dead code related to BACKUP_SEMANTICS (Sam Roberts)
* win: fix comment in quote_cmd_arg (Eric Sciple)
* darwin: use clock_gettime in macOS 10.12 (Saúl Ibarra Corretgé)
* win, tty: fix crash on restarting with pending data (Nicholas Vavilov)
* fs: fix uv__to_stat on BSD platforms (Santiago Gimeno)
* win: map ERROR_ELEVATION_REQUIRED to UV_EACCES (Richard Lau)
* win: fix free() on bad input in uv_getaddrinfo() (Ben Noordhuis)
The error path frees `req->alloc` but that hasn't been set yet when
`service` and `node` are both NULL. Simply return instead of jumping
to the error handling block.
Fixes: https://github.com/libuv/libuv/issues/1122
PR-URL: https://github.com/libuv/libuv/pull/1123
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
uv_spawn() on Windows will fail with ERROR_ELEVATION_REQUIRED
if attempting to run an application that requires elevation.
Fixes: https://github.com/nodejs/node/issues/9464
PR-URL: https://github.com/libuv/libuv/pull/1154
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Fix the #ifdef logic to make sure all the available fields filled in the
`stat` struct are correcly copied into the `uv_stat_t` struct. Before
this change, the `n_sec` were being set to 0.
PR-URL: https://github.com/libuv/libuv/pull/1152
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
When reading from tty is restarted while there is pending data,
uv_tty_read_start calls uv_insert_pending_req instead of uv_tty_queue_read
to avoid losing keypresses. But reading can be stopped and restarted
multiple times before the req is handled, which caused an assertion error.
Setting the UV_HANDLE_READ_PENDING flag prevents uv_insert_pending_req
from being called again until the req is handled.
Fixes: https://github.com/nodejs/node/issues/9690
PR-URL: https://github.com/libuv/libuv/pull/1158
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Remove several conditionals which appear to carefully set or clear
FILE_FLAG_BACKUP_SEMANTICS, but since 4365896,
FILE_FLAG_BACKUP_SEMANTICS is unconditionally ORed into the attributes
before CreateFileW() is called.
PR-URL: https://github.com/libuv/libuv/pull/1149
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-by: Bert Belder <bertbelder@gmail.com>
Apple's fsync and fdatasync explicitly do NOT flush the drive write
cache to the drive platters. This is in contrast to Linux's fsync and
fdatasync which do, according to recent man pages. F_FULLFSYNC is
Apple's equivalent for flushing buffered data to permanent storage.
PR-URL: https://github.com/libuv/libuv/pull/1124
Refs: https://github.com/nodejs/node/issues/9439
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.10.0:
* Now working on version 1.10.1 (cjihrig)
* win: fix anonymous union syntax (Brad King)
* unix: use uv__is_closing everywhere (Santiago Gimeno)
* win: add missing break statement (cjihrig)
* doc: fix wrong man page link for uv_fs_lstat() (Michele Caini)
* win, tty: handle empty buffer in uv_tty_write_bufs (Hitesh
Kanwathirtha)
* doc: add cjihrig alternative GPG ID (cjihrig)
* Revert "win,tty: add support for ANSI codes in win10 v1511" (Ben
Noordhuis)
Remove use of the DUMMYUNIONNAME macro from our definitions of
internal winapi anonymous unions. This macro was added to
winternl.h in Windows SDK v7.0a in combination with a conditional
definition of DUMMYUNIONNAME to either empty or `u` depending on
compiler support. libuv doesn't support any compilers that lack
anonymous unions, but does support compilers such as VS 2008 that
complain about the presence of the DUMMYUNIONNAME identifier on an
anonymous union because their winapi headers do not define the
macro publicly.
PR-URL: https://github.com/libuv/libuv/pull/1090
Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
The saved_data variable in uv_loop_close() is only used when
NDEBUG is defined. This commit makes the variable declaration
depend on NDEBUG as well.
PR-URL: https://github.com/libuv/libuv/pull/1093
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
So it aborts in case `pthread_once` fails.
PR-URL: https://github.com/libuv/libuv/pull/1098
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The compiler is wrong about it being used uninitialized but the warning
is sufficiently annoying that I decided to squelch it.
PR-URL: https://github.com/libuv/libuv/pull/1097
Reviewed-By: Andrius Bentkus <andrius.bentkus@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
default_loop_struct and default_loop_ptr seem to have been overlooked
in commit 32747c7 ("win,unix: move loop functions which have identical
implementations".)
PR-URL: https://github.com/libuv/libuv/pull/1097
Reviewed-By: Andrius Bentkus <andrius.bentkus@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
uv_translate_sys_error() was a private function for Windows.
This commit adds an equivalent function on other platforms, and
exposes it as public API.
Exposing this is useful in scenarios where the application uses
both libuv functions and platform-specific system calls and wants
to report errors uniformly as libuv errors.
Fixes: https://github.com/libuv/libuv/issues/79
PR-URL: https://github.com/libuv/libuv/pull/1060
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
In unix/internal.h, CoreServices is included for AvailabilityMacros.h.
This commit just includes AvailabilityMacros.h directly instead.
PR-URL: https://github.com/libuv/libuv/pull/1092
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Simplify and optimize uv_thread_create() by casting the function pointer
to the prototype that pthread_create() wants. Avoids the indirection of
an intermediate callback and heap-allocating custom state that is really
only there to placate the compiler.
PR-URL: https://github.com/libuv/libuv/pull/1094
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Use a deterministic approach for saturating the threadpool instead of
depending on a timeout. Should help reduce the flakiness of the CI.
PR-URL: https://github.com/libuv/libuv/pull/1014
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Saturate the thread pool before trying to post-and-cancel the work
request. Before this commit we simply posted requests in a loop,
in the (sometimes idle) hope that one would get queued up instead
of being dispatched right away.
PR-URL: https://github.com/libuv/libuv/pull/1014
Refs: https://github.com/libuv/libuv/pull/1010
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The expected error is UV_ECANCELED but the test tries to connect to what
is basically an arbitrary address in the expectation that no network
path exists, so UV_ENETUNREACH is an equally plausible outcome.
This commit undoes the change from commit e994000 ("test: make
tcp_close_while_connecting more resilient") because I don't think
the connection ever actually succeeds.
PR-URL: https://github.com/libuv/libuv/pull/1048
Refs: https://github.com/libuv/libuv/pull/1005
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Imran Iqbal <imran@imraniqbal.org>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Move the `PASCAL` calling convention marker from:
typedef void PASCAL (*f)(...);
to the proper place for a calling convention in a function pointer type:
typedef void (PASCAL *f)(...);
This is where the MS-provided winapi headers place it too.
PR-URL: https://github.com/libuv/libuv/pull/1075
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This prevents tests from using non-reentrant implementations of common
APIs (e.g `errno`) when using POSIX threads and building with autotools.
This is consistent with the way tests are builds when using gyp.
The problem was found when investigating tests failures on SmartOS for
one test added by https://github.com/libuv/libuv/pull/640. These
failures were due to that test using POSIX threads and also using a
non-reentrant errno global variable, instead of the reentrant `___errno`
function.
PR-URL: https://github.com/libuv/libuv/pull/1052
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Under Windows uv_fs_event_start with UV_FS_EVENT_RECURSIVE will report new file
creation and file deletion twice - once with the name of the file, and second
time with the name of the directory itself. This will filter out callbacks with
directory name, making observed callbacks count match expected values.
Fixes: https://github.com/libuv/libuv/issues/1009
PR-URL: https://github.com/libuv/libuv/pull/1061
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Additional synchronization is needed to ensure that the program
cannot modify the screen state while a line read is getting cancelled.
Also, we need to stop any pending reads *before* calling SetConsoleMode,
or a call to ReadConsole could start while the console is still in raw
mode.
Credit: @orangemocha - Alexis Campailla <orangemocha@nodejs.org>
Fixes: https://github.com/nodejs/node/issues/7837
PR-URL: https://github.com/libuv/libuv/pull/1054
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>