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>
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>
Returns the platform specific file descriptor for handles that are
backed by one. The datatype is abstracted as uv_os_fd_t, which maps to
int on Unices and HANDLE on Windows.
Users can use this function to set specific socket options, for example,
in a non portable way.
This function is essentially a shotgun, you better be careful with
whatever you do with it, don't blame me if you used it to get the fd of
a stream, close it yourself and expect things to Just Work.
Support all possible types on Unix, and files, directories and links on
Windows. Some systems (hello SunOS!) don't have the d_type field on struct
dirent, so mark them as UV_DIRENT_UNKNOWN.
Introduce:
int uv_fs_readdir_next(uv_fs_t* req, uv_dirent_t* ent);
`uv_fs_readdir()` is not returning a file names list in `req->ptr`
anymore, the proper way to gather them is to call `uv_fs_readdir_next()`
in a callback.
The fields for UV_HANDLE_PRIVATE_FIELDS in uv-win.h and uv-unix.h are
the same, but in different order. Simply swap them so uv_handle_t are
the same on both platforms.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Introduce `int uv_pipe_pending_count(uv_pipe_t*)` and
`uv_handle_type uv_pipe_pending_type(uv_pipe_t*)`. They should be
used in IPC pipe's read cb to accept incoming handles:
int count = uv_pipe_pending_count(pipe);
int i;
for (i = 0; i < count; i++) {
uv_handle_type type = uv_pipe_pending_type(pipe);
/* ... */
uv_accept(...);
}
This improves API consistency with uv_read and uv_write and may
improve efficiency for some uses. Vectored IO is emulated when the
requisite system calls are unavailable.
Replace the red-black tree with a heap. The most common operation that
libuv performs on timers is looking up the first timer to expire. With
a red-black tree, that operation is O(log n). With a heap, it's O(1).
This improves API consistency with uv_read and uv_write and may
improve efficiency for some uses. Vectored IO is emulated when the
requisite system calls are unavailable.
Every file descriptor opened using libuv should be automatically marked
as CLOEXEC to prevent it from leaking to a child process. Note that
since we are opening fds in a thread pool, there is a possible race
condition between `uv_spawn()` and the `open()` + `uv__cloexec()`. The
rwlock was added to avoid it.
see https://github.com/joyent/node/issues/6905
If multiple handles arrive to the IPC pipe at the same time (happens on
some platforms), libuv will queue them internally, and call `read2_cb`
multiple times with a null-buffer and proper `handle_type`.
If spawning a process fails due to an exec() failure (but it succeeded
in forking), then this should be considered a spawn failure instead of
an asynchronous termination of the process. This allows to check for
common exec() failure conditions such as a bad path quickly instead of
having to rely on keeping track of the async callback.
Additionally, the meaning of the two fields returned in the callback are
now exactly what they advertise to be. The process exit argument is not
one of two values depending on what happened to the child.
Fixes#978.
Before this commit, multiple event loops raced with each other when a
SIGCHLD signal was received. More concretely, it was possible for
event loop A to consume waitpid() events that should have been
delivered to event loop B.
This commit addresses that by doing a linear scan over the list of
child processes. An O(n) scan is not terribly efficient but the
actual performance impact is not measurable in a benchmark that spawns
rounds of several thousands instances of /bin/false. For the time
being, this patch will suffice; we can always revisit it later.
Fixes#887.
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.
Fixes#684.
Uses the pthread_key_{create,delete} and pthread_{get,set}specific
functions on UNIX platforms, Tls{Alloc,Free} and Tls{Get,Set}Value
on Windows.
Fixes#904.
Switch to the build tool everyone loves to hate. The Makefile has
served us well over the years but it's been acquiring more and more
features that autotools gives us for free, like easy static+shared
library building, sane install targets, and so on.
This commit drops MinGW support. If there is demand for it, we'll
re-add it.
Based on UNIX sockets to avoid the vagaries of FIFOs
in asynchronous mode. Currently unlinks stale sockets
before binding and cleans them up again after shutdown.
Instead of uv_shutdown, uv_write, uv_connect taking raw uv_req_t we subclass
uv_req_t into uv_shutdown_t, uv_write_t, and uv_connect_t.
uv_req_init is removed.