IBM i defines both of the __PASE__ and _AIX macros.
Commit 693b534 includes the wrong header file.
Need to check macro __PASE__ prior to _AIX.
PR-URL: https://github.com/libuv/libuv/pull/2371
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.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>
Changes since version 1.29.1:
* darwin: fall back to F_BARRIERFSYNC (Ben Noordhuis)
* darwin: add 32 bit close$NOCANCEL implementation
(ken-cunningham-webuse)
* build, core, unix: add support for Haiku (Leorize)
* darwin,linux: more conservative minimum stack size (Ben Noordhuis)
* threadpool: increase UV_THREADPOOL_SIZE limit (Vlad A)
* unix: return actual error from `uv_try_write()` (Anna Henningsen)
* darwin: fix build error with macos 10.10 (Ben Noordhuis)
* unix: make uv_cwd() report UV_ENOBUFS (Ben Noordhuis)
* unix: make uv_fs_read() fill all buffers (Ben Noordhuis)
* test: give hrtime test a custom 10s timeout (Ben Noordhuis)
* fs: fix uv_fs_copyfile if same src and dst (Santiago Gimeno)
* build: add cmake option to skip building tests (Niels Lohmann)
* doc: add link to nodejs.org (Jenil Christo)
* unix: fix a comment typo in signal.c (Evgeny Ermakov)
* unix: remove redundant cast in process.c (gengjiawen)
* doc: fix wrong mutex function prototypes (Leo Chung)
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>
This commit includes uv/posix.h in one #elif instead of four.
PR-URL: https://github.com/libuv/libuv/pull/2302
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.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>
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>
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>
On OpenBSD 6.4 x86_64 the barrier_serial_thread test fails due to
OpenBSD's pthread_barrier_wait() implementation returning
PTHREAD_BARRIER_SERIAL_THREAD from the first thread that releases the
wait. Switch to libuv's internal implementation to address the issue.
Fixes: https://github.com/libuv/libuv/issues/2145
PR-URL: https://github.com/libuv/libuv/pull/2144
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Added UV_PROCESS_WINDOWS_HIDE_CONSOLE and
UV_PROCESS_WINDOWS_HIDE_GUI for specifying if console or GUI
subprocess windows are to be hidden.
Refs: https://github.com/nodejs/node/pull/24034
PR-URL: https://github.com/libuv/libuv/pull/2073
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Since SIGWINCH is being defined with a value above the existing NSIG,
redefine NSIG on WIN32.
PR-URL: https://github.com/libuv/libuv/pull/2032
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
* dissolve include/uv/pthread-barrier.h
* use libuv mutexes and condition variables, not pthreads's
* drive-by cleanup and simplification enabled by the first two items
PR-URL: https://github.com/libuv/libuv/pull/2019
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Change the position of UV_LS_LCHOWN, moving it to the end in order to go
around a bug due to it's initial position.
The original position of UV_LS_LCHOWN broke ABI compat, causing a binary
using UV_FS_REALPATH or UV_FS_COPYFILE to break, as the values point to
wrong function.
Refs: https://github.com/yarnpkg/yarn/issues/6043
Fixes: https://github.com/libuv/libuv/issues/1908
PR-URL: https://github.com/libuv/libuv/pull/1913
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.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
Merge src/unix/timer.c and src/win/timer.c into src/timer.c. This
changes the Windows implementation from a binary tree to a binary
heap for generally better performance.
PR-URL: https://github.com/libuv/libuv/pull/1882
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This fixes a C/C++ ambiguity about whether this structure is
scoped or global.
PR-URL: https://github.com/libuv/libuv/pull/1888
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This is a cherry-pick of commit d010030ad5 from the master branch.
Conflicts:
Makefile.am
include/uv.h
include/uv/unix.h
libuv.nsi (deleted)
src/unix/pthread-barrier.c (deleted)
PR-URL: https://github.com/libuv/libuv/pull/1850
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
The fallback implementation existed to support Windows XP and Server 2003,
but these old versions of windows are no longer supporter by libuv.
PR-URL: https://github.com/libuv/libuv/pull/1852
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* 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>
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)
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 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>
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_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>
- 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>
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>
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)
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>
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>
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)
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>
uv_if_indextoname() is used to convert an IPv6 scope_id
to an interface identifier string such as %eth0 or %lo.
uv_if_indextoiid() returns an IPv6 interface identifier.
On Unix it calls uv_if_indextoname(). On Windows it uses
snprintf() to return the numeric interface identifier as
a string.
Refs: https://github.com/nodejs/node/pull/14500
PR-URL: https://github.com/libuv/libuv/pull/1445
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Adds new uv_pipe_chmod function which can be used to make the pipe
writable or readable by all users.
PR-URL: https://github.com/libuv/libuv/pull/1386
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Define stable cross-platform file open constants so that users can
pass `UV_FS_O_RDWR` rather than `_O_RDWR` (win) or `O_RDWR` (unix).
Map `UV_FS_O_DIRECT`, `UV_FS_O_DSYNC` and `UV_FS_O_SYNC` to
`FILE_FLAG_NO_BUFFERING` and `FILE_FLAG_WRITE_THROUGH` (win).
Fixes: https://github.com/libuv/libuv/issues/1550
PR-URL: https://github.com/libuv/libuv/pull/1567
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Changes since version 1.14.0:
* fs, win: add support for user symlinks (Bartosz Sosnowski)
* cygwin: include uv-posix.h header (Joel Winarske)
* zos: fix semaphore initialization (jBarz)
* zos: improve loop_count benchmark performance (jBarz)
* zos, test: flush out the oob data in callback (jBarz)
* unix,win: check for bad flags in uv_fs_copyfile() (cjihrig)
* unix: modify argv[0] when process title is set (Matthew Taylor)
* unix: don't use req->loop in uv__fs_copyfile() (cjihrig)
* doc: fix a trivial typo (Vladimír Čunát)
* android: fix uv_cond_timedwait on API level < 21 (Gergely Nagy)
* win: add uv__once_init() calls (Bartosz Sosnowski)
* unix,windows: init all requests in fs calls (cjihrig)
* unix,windows: return UV_EINVAL on NULL fs reqs (cjihrig)
* windows: add POST macro to fs functions (cjihrig)
* unix: handle partial sends in uv_fs_copyfile() (A. Hauptmann)
* Revert "win, test: fix double close in test runner" (Bartosz
Sosnowski)
* win, test: remove surplus CloseHandle (Bartosz Sosnowski)
Changes since version 1.13.1:
* unix: check for NULL in uv_os_unsetenv for parameter name (André
Klitzing)
* doc: add thread safety warning for process title (Matthew Taylor)
* unix: always copy process title into local buffer (Matthew Taylor)
* poll: add support for OOB TCP and GPIO interrupts (CurlyMoo)
* win,build: fix appveyor properly (Refael Ackermann)
* win: include filename in dlopen error message (Ben Noordhuis)
* aix: add netmask, mac address into net interfaces (Gireesh Punathil)
* unix, windows: map EREMOTEIO errno (Ben Noordhuis)
* unix: fix wrong MAC of uv_interface_address (XadillaX)
* win,build: fix building from Windows SDK or VS console (Saúl Ibarra
Corretgé)
* github: fix link to help repo in issue template (Ben Noordhuis)
* zos: remove nonexistent include from autotools build (Saúl Ibarra
Corretgé)
* misc: remove reference to pthread-fixes.h from LICENSE (Saúl Ibarra
Corretgé)
* docs: fix guide source code example paths (Anticrisis)
* android: fix compilation with new NDK versions (Saúl Ibarra Corretgé)
* misc: add android-toolchain to .gitignore (Saúl Ibarra Corretgé)
* win, fs: support unusual reparse points (Bartosz Sosnowski)
* android: fix detection of pthread_condattr_setclock (Saúl Ibarra
Corretgé)
* android: remove no longer needed check (Saúl Ibarra Corretgé)
* doc: update instructions for building on Android (Saúl Ibarra
Corretgé)
* win, process: support semicolons in PATH variable (Bartosz Sosnowski)
* doc: document uv_async_(init|send) return values (Ben Noordhuis)
* doc: add Android as a tier 3 supported platform (Saúl Ibarra Corretgé)
* unix: add missing semicolon (jBarz)
* win, test: fix double close in test runner (Bartosz Sosnowski)
* doc: update supported windows version baseline (Ben Noordhuis)
* test,zos: skip chown root test (jBarz)
* test,zos: use gid=-1 to test spawn_setgid_fails (jBarz)
* zos: fix hr timer resolution (jBarz)
* android: fix blocking recvmsg due to netlink bug (Jacob Segal)
* zos: read more accurate rss info from RSM (jBarz)
* win: allow bound/connected socket in uv_tcp_open() (Maciej Szeptuch
(Neverous))
* doc: differentiate SmartOS and SunOS support (cjihrig)
* unix: make uv_poll_stop() remove fd from pollset (Ben Noordhuis)
* unix, windows: add basic uv_fs_copyfile() (cjihrig)
Out-of-band TCP messages are used for TCP data
transmission outside (outband) the inbound TCP
data. These packets are sent with an
"urgent pointer", but previously discarded.
Additionally, when using (e)poll a POLLPRI is
triggered when an interrupt signal is received
on GPIO capable systems such as the Raspberry Pi.
PR-URL: https://github.com/libuv/libuv/pull/1040
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Changes since version 1.12.0:
* Now working on version 1.12.1 (cjihrig)
* unix: avoid segfault in uv_get_process_title (Michele Caini)
* build: add a comma to uv.gyp (Gemini Wen)
* win: restore file pos after positional read/write (Bartosz Sosnowski)
* unix,stream: return error on closed handle passing (Santiago Gimeno)
* unix,benchmark: use fd instead of FILE* after fork (jBarz)
* zos: avoid compiler warnings (jBarz)
* win,pipe: race condition canceling readfile thread (Jameson Nash)
* sunos: filter out non-IPv4/IPv6 interfaces (Sebastian Wiedenroth)
* sunos: fix cmpxchgi and cmpxchgl type error (Sai Ke WANG)
* unix: reset signal disposition before execve() (Ben Noordhuis)
* unix: reset signal mask before execve() (Ben Noordhuis)
* unix: fix POLLIN assertion on server read (jBarz)
* zos: use stckf builtin for high-res timer (jBarz)
* win,udp: implements uv_udp_try_send (Barnabas Gema)
* win,udp: return UV_EINVAL instead of aborting (Romain Caire)
* freebsd: replace kvm with sysctl (Robert Ayrapetyan)
* aix: fix un-initialized pointer field in fs handle (Gireesh Punathil)
* win,build: support building with VS2017 (Refael Ackermann)
* doc: add instructions for building on Windows (Refael Ackermann)
* doc: format README (Refael Ackermann)
The uv__get_osfhandle() function is a private functio of the
Windows subsystem, and its used to get a Windows HANDLE out
of a file descriptor number.
The motivation behind making this function public is to
allow Node.js programs to pass file descriptors created
using fs.open() to native Node.js C++ add-ons, and be able to
successfully convert them to Windows HANDLEs.
Refs: https://github.com/libuv/libuv/pull/1166
Refs: https://github.com/nodejs/node/issues/6369
Fixes: https://github.com/libuv/libuv/issues/1291
PR-URL: https://github.com/libuv/libuv/pull/1323
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Cygwin and MSYS2 are POSIX layers implemented on top of Windows.
Use our POSIX `poll(2)` implementation of our poll abstraction.
For most other components we already have dedicated sources
implementing them in terms of APIs available on Cygwin or
providing non-implementations of components not supported.
This leaves only three components that need Cygwin-specific
implementations:
* uv_uptime: implement using sysinfo
* uv_resident_set_memory: add a placeholder returning UV_ENOSYS
* uv_cpu_info: add a placeholder returning UV_ENOSYS
Update our test suite to account for features not available
due to Cygwin platform limitations or our placeholders.
PR-URL: https://github.com/libuv/libuv/pull/1312
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
POSIX defines `poll()` as a portable way to wait on file descriptors.
Use it to provide an implementation of our poll abstraction for use
on platforms that do not provide a more specialized polling method.
PR-URL: https://github.com/libuv/libuv/pull/1312
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Added the uv_loop_fork() API that must be called in a child process to
continue using an existing loop. Internally this calls a uv__io_fork
function for each supported platform, similar to the way
uv__platform_loop_init works.
After this call, existing and new IO, async and signal watchers will
contiue working as before on all platforms, as will the
threadpool (although any threads it was using are of course gone).
On Linux and BSDs that use kqueue, existing and new fsevent watchers
will also continue to work as expected. On OS X, though, directory
fsevents will not be able to use the optimized CoreFoundation path if
they had already been used in the parent process, instead falling back
to the kqueue path used on other BSDs.
Existing fsevent watchers will not function on AIX or SunOS. This
could be relatively easily fixed by someone with AIX knowledge in the
future, but SunOS will require some additional work to keep track if
the watchers.
A new test file, test/test-fork.c, was added to contain fork-related
tests to verify functionality in the child process.
PR-URL: https://github.com/libuv/libuv/pull/846
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Remove the unused `nevents` parameter from `uv__async_event()`
and remove the indirection of having a separate `uv__async`
type. There is only one instance per event loop these days.
This incidentally removes the `assert(n == sizeof(val))` in a
Linux-specific code path that some users seem to hit from time
to time. The cause is not well-understood and I've never been
able to reproduce it myself. Presumably libuv gets an EAGAIN
when trying to read from the eventfd but when and why that
happens is unclear.
Since the byte count is unused, removing the assert seems safe.
Worst case, libuv sometimes iterates over the async watcher list
when it doesn't have to.
Fixes: https://github.com/libuv/libuv/issues/1171
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Supersedes: https://github.com/libuv/libuv/pull/1214
It behaves as `uv_signal_start` but it resets the signal handler as soon
as the signal is received.
Fixes: https://github.com/libuv/libuv/issues/1104
PR-URL: https://github.com/libuv/libuv/pull/1106
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Fix all functional test cases:
* use PLO compare,swap,store for atomic instruction
* do not use semaphore.h
* use xplink flag when linking
* scandir implementation
* nanosleep implementation
* add proctitle
* uv_loadavg
* uv_fs_event_init/start
* uv_fs_event_stop
* uv_exepath using __getthent syscall
* read free/total memory from mvs data areas
* uv_resident_set_memory implementation
* network interfaces implementation
* cpu_info implementation
* implement uv__hrtime
* make uv__fs_mkdtemp implementation
* epoll implementation for asyncio
* uv__fs_event_close implementation
* set process title
* read ancillary data that remains on queue
* ancillary data
* implement uv__fs_access
* use /dev/urandom for temporary directory name
* disable proctitle on zos completely
PR-URL: https://github.com/libuv/libuv/pull/1037
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
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)
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)
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>
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>
autotools support only, gvp does not support kfreebsd detection.
PR-URL: https://github.com/libuv/libuv/pull/960
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
- zos: disable test cases not applicable
- zos: build options
- zos: semaphore implementation
- zos: use compare and swap builtins
- zos: struct rusage not the same as other platforms
- zos: backlog<=0 produces undefined behaviour
Will redefine backlog in the following way
* if backlog == 0, set it to 1
* if backlog < 0, set it to SOMAXCONN
- zos: define IMAXBEL as empty flag and implement uv__tty_make_raw
- zos: use udp multicast operations from aix
- zos: ESC in ebcdic
- zos: use LIBPATH for dynamic linker path
- zos: uv_udp_set_ttl only works for ipv6
- zos: increase pthread stack size by factor of 4
- zos: return ENODEV instead of ENXIO errors for setsockopt
- zos: use uv_cond_init the same way as aix
- test: enable oob test for zos
- zos: return EINVAL for zos error code EOPNOTSUPP
PR-URL: https://github.com/libuv/libuv/pull/937
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Since we cancel ReadConsole by sending a newline, the duplicate
handle is no longer necessary.
PR-URL: https://github.com/libuv/libuv/pull/866
Reviewed-by: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
There was a memory corruption issue with the pthread barrier
implementation on android, where a barrier could still be in use by one
thread when being freed by another.
This fixes that issue and adds lots of missing error handling.
This implementation is now also used for the OSX fallback.
Fixes: https://github.com/libuv/libuv/issues/615
PR-URL: https://github.com/libuv/libuv/pull/790
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Equivalent to realpath(3), returns the full resolved absolute path of a
file or directory.
PR-URL: https://github.com/libuv/libuv/pull/531
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Fixes a compilation problem in some platforms (notably OSX) after
6490c50.
PR-URL: https://github.com/libuv/libuv/pull/618
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremy Whitlock <jwhitlock@apache.org>
Previously, on Windows Vista and later, we'd use the Windows native
SRWLock APIs. However they turned out to be semantically incompatible
with pthread read-write locks and/or plain buggy. This patch makes sure
that the custom implementation that was previously only used on old
Windows versions is now used everywhere.
This patch fixes a number of issues with the old fallback
implementation. Specifically:
* The reader count would not be incremented when a thread successfully
acquired a read lock while another thread *also* held a read lock.
* `uv_rwlock_tryrdlock()` and `uv_rwlock_trywrlock()` now
consistently return UV_EBUSY when a lock couldn't be acquired.
* Any unexpected errors now cause libuv to abort, with the exception of
`uv_rwlock_init()`.
See also https://github.com/libuv/libuv/issues/515.
PR-URL: https://github.com/libuv/libuv/pull/525
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Before this patch an uv_mutex_t (backed by a critical section) could be
released by a tread different from the thread that acquired it, which is
not allowed. This is fixed by using a semaphore instead.
Note that the affected code paths were used on Windows XP and Windows
Server 2003 only.
Fixes: https://github.com/libuv/libuv/issues/515
PR-URL: https://github.com/libuv/libuv/pull/516
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Introduce two new APIs:
int uv_tcp_init_ex(uv_loop_t*, uv_tcp_t* handle, int flags)
int uv_udp_init_ex(uv_loop_t*, uv_udp_t* handle, int flags)
The lower 8 bits of the flags field are used for the socket domain.
AF_INET, AF_INET6 and AF_UNSPEC are supported. If AF_UNSPEC is specified
the socket is created lazily, just like uv_{tcp,udp}_init.
Some Windows notes:
getsockname fails with WSAEINVAL if the socket is not bound. This could
potentially be improved by detecting the socket family and filling
the sockaddr_in/6 struct manually.
bind returns WSAEFAULT if we try to bind a socket to the wrong family.
Unix returns EINVAL.
PR-URL: https://github.com/libuv/libuv/pull/400
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Certain types of streams may be opened from a CRT file descriptor (as
opposed to a Windows HANDLE). In order to close the file descriptor
later, libuv must store the file descriptor used to open the stream.
PR-URL: https://github.com/libuv/libuv/pull/396
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
With uv_replace_allocator, it's possible to override the default
memory allocator's malloc and free calls with functions of the user's
choosing. This allows libuv to interoperate with projects requiring a
custom memory allocator.
Internally, all calls to malloc and free have been replaced with
uv__malloc and uv__free, respectively. The uv__malloc and uv__free
functions call malloc and free unless they have been overridden by a
previous call to uv_replace_allocator.
As part of this change, the special aligned memory allocations
performed in src/win/fs-event.c have been replaced with standard
allocations. The 4-byte alignment being requested in this file was
unnecessary, since standard allocators already guarantee at least an
8-byte alignment.
PR-URL: https://github.com/libuv/libuv/pull/231
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
All the public structs and unions in the private fields in uv-win.h have
been named and all code accessing them updated, to comply to the C89
spec (which were previously causing warnings with the -pedantic flag).
PR-URL: https://github.com/libuv/libuv/pull/239
Reviewed-By: Andrius Bentkus <andrius.bentkus@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Also make the tests more strict.
PR-URL: https://github.com/libuv/libuv/pull/201
Reviewed-By: Tim Caswell <tim@creationix.com>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Changes since version 1.3.0:
* unix: check Android support for pthread_cond_timedwait_monotonic_np
(Leith Bade)
* test: use modified path in test (cjihrig)
* unix: implement uv_stream_set_blocking() (Ben Noordhuis)
Changes since version 1.2.0:
* unix: remove unused dtrace file (Saúl Ibarra Corretgé)
* test: skip TTY select test if /dev/tty can't be opened (Saúl Ibarra
Corretgé)
* doc: clarify the behavior of uv_tty_init (Saúl Ibarra Corretgé)
* doc: clarify how uv_async_send behaves (Saúl Ibarra Corretgé)
* build: make dist now generates a full tarball (Johan Bergström)
* freebsd: make uv_exepath more resilient (Saúl Ibarra Corretgé)
* unix: make setting the tty mode to the same value a no-op (Saúl Ibarra
Corretgé)
* win,tcp: support uv_try_write (Bert Belder)
* test: enable test-tcp-try-write on windows (Bert Belder)
* win,tty: support uv_try_write (Bert Belder)
* unix: set non-block mode in uv_{pipe,tcp,udp}_open (Ben Noordhuis)
Introduce a uv_tty_mode_t enum for uv_tty_set_mode(), with backward
compatible values. Add a new mode UV_TTY_MODE_IO, which uses
cfmakeraw() internally.
PR-URL: https://github.com/libuv/libuv/pull/86
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Changes since version 1.0.2:
* test: test that closing a poll handle doesn't corrupt the stack (Bert
Belder)
* win: fix compilation of tests (Marc Schlaich)
* Revert "win: keep a reference to AFD_POLL_INFO in cancel poll" (Bert
Belder)
* win: avoid stack corruption when closing a poll handle (Bert Belder)
* test: fix test-fs-file-loop on Windows (Bert Belder)
* test: fix test-cwd-and-chdir (Bert Belder)
* doc: indicate what version uv_loop_configure was added on (Saúl Ibarra
Corretgé)
* doc: fix sphinx warning (Saúl Ibarra Corretgé)
* test: skip spawn_setuid_setgid if we get EACCES (Saúl Ibarra Corretgé)
* test: silence some Clang warnings (Saúl Ibarra Corretgé)
* test: relax osx_select_many_fds (Saúl Ibarra Corretgé)
* test: fix compilation warnings when building with Clang (Saúl Ibarra
Corretgé)
* win: fix autotools build of tests (Luis Lavena)
* gitignore: ignore Visual Studio files (Marc Schlaich)
* win: set fallback message if FormatMessage fails (Marc Schlaich)
* win: fall back to default language in uv_dlerror (Marc Schlaich)
* test: improve compatibility for dlerror test (Marc Schlaich)
* test: check dlerror is "no error" in no error case (Marc Schlaich)
* unix: change uv_cwd not to return a trailing slash (Saúl Ibarra
Corretgé)
* test: fix cwd_and_chdir test on Unix (Saúl Ibarra Corretgé)
* test: add uv_cwd output to platform_output test (Saúl Ibarra Corretgé)
* build: fix dragonflybsd autotools build (John Marino)
* win: scandir use 'ls' for formatting long strings (Kenneth Perry)
* build: remove clang and gcc_version gyp defines (Ben Noordhuis)
* unix, windows: don't treat uv_run_mode as a bitmask (Saúl Ibarra
Corretgé)
* unix, windows: fix UV_RUN_ONCE mode if progress was made (Saúl Ibarra
Corretgé)