Replace a few internal functions in uv-common.h with macros to avoid
strict aliasing warnings with older versions of gcc.
It's not smart enough to figure out that e.g. a uv_tcp_t is an instance
of uv_handle_t with similar alignment requirements and therefore no
aliasing happens. More recent versions of gcc don't suffer from this.
I'm not normally in the habit of catering to compiler defects but the
aliasing warnings drown out legitimate warnings, hence the change.
In very rare circumstances a uv_read_start() call on a uv_tty_t handle
in raw mode would return -1 but there was no actual failure. This patch
fixes that.
Fixes a busy loop when the file descriptor emits POLLHUP but not POLLIN
or POLLOUT, e.g. when polling the read end of a pipe and the write end
is closed.
Fixesjoyent/node#4923.
Older versions of GYP would set up the Visual Studio project to link
with these libraries by default, but this was changed in r1584 (see
https://codereview.chromium.org/12256017).
Closes#728
We abuse uv_write2() to send over UDP handles to child processes.
Don't call uv__stream_fd() on those handles, it's a macro that on OS X
evaluates to a function that operates on a uv_stream_t with a couple of
OS X specific fields. On other Unices it does (handle)->io_watcher.fd,
which works but only by accident.
Fixesjoyent/node#4870.
I debug tests regularly as root (because dtrace and dtruss require the
additional privileges). The 'is root?' check gets in the way more often
than it prevents me from doing something silly. Remove it.
Don't overwrite the environment. On OS X, the entries in the environ
table are not necessarily adjacent. It's arguably also safer for setuid
binaries.
Fixesjoyent/node#4847.
The default loop lives in the bss section so it's zeroed on startup
but loops created with uv_loop_new() live on the heap and contain
random garbage. Initialize the stop_flag explicitly to avoid spurious
bugs.
* Make uv_stop() work when libuv is embedded in another event loop.
* Fix a small bug where loop->stop_flag was not reset when mode ==
UV_RUN_ONCE or UV_RUN_NOWAIT. The next call to uv_run() would return
immediately without doing any work.
The sendfile emulation in src/unix/fs.c polls the file descriptor for
write readiness. If POLLERR or POLLHUP is set, it bails out but doesn't
set errno (hence it doesn't report a useful error code). Rectify that.
Fixes#620.
Make changes to the process title visible to tools like `ps`.
The argv clobber technique is reasonably portable across Unices;
the common code has been moved into src/unix/proctitle.c and is used
on Linux and OS X. Other platforms will probably follow in the future.
Don't add the io watcher to the watcher queue if the requested change
is effectively a no-op, that is, when the event mask doesn't change.
The exception here is sunos because the event ports backend requires
that watched file descriptors are re-added on every turn of the event
loop.
This commit is a micro-optimization, it does not change the event
loop's observable behavior in any way.
Before this commit, it was assumed that connect() on UNIX sockets never
returns EINPROGRESS. It turned out to be a bad assumption: Dave Pacheco
reports sporadic hangups on SmartOS because of that.
It's not clear to me _why_ the Illumos kernel returns that error but
that's inconsequential: whatever the cause, libuv needs to handle it
and now it does.
Fixesjoyent/node#4785.
Don't check the return value of epoll_ctl(EPOLL_CTL_DEL). When the
file descriptor is closed, we're potentially racing with another
thread and that means the errno is not a reliable indicator of
the actual error.
The other event mechanisms (kqueue, event ports) are not affected
because:
* kqueue returns either EBADF or ENOENT. Both are handled by libuv.
* event ports rearms all file descriptors on each call to port_getn().
Fixesjoyent/node#4558.
Executing `make libuv.so` after `make libuv.a` failed because the
libuv.a target compiled the files in src/ without -fPIC.
Make the libuv.so target depend on files with a different suffix to
keep them separated.