Libuv would abort() when trying to watch a file descriptor that is
not compatible with epoll-style polling; file descriptors referring
to on-disk files fall into this category.
File descriptors that libuv creates itself are not an issue but
external ones that come in through the uv_poll_init() API are.
Make uv_poll_init() check whether the file descriptor is accepted by
the underlying system call and return an error when it's not.
Fixes: https://github.com/libuv/libuv/issues/658
PR-URL: https://github.com/libuv/libuv/pull/659
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Add new UV__POLLRDHUP event to be emitted when EPOLLRDHUP(in Linux) or
EV_EOF(in BSD / OSX) is detected and only if UV_READABLE is set.
When a read returns ECONNRESET after a UV__POLLRDHUP event, emit EOF instead
of the error.
Add tcp-squelch-connreset test. Not to be run on Windows as it returns
ECONNRESET error.
Fixes in test-poll and test-tcp-open so they pass after these changes.
PR-URL: https://github.com/libuv/libuv/pull/403
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
libuv requires that the socket/fd is in non-blocking mode, so do it
internally so the user doesn't need to write platform specific code to
do so.
This also makes the API consistent with uv_{tcp,udp,pipe}_open, since
it's not required to pass the fd in non-blocking mode there either.
PR-URL: https://github.com/libuv/libuv/pull/136
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
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.
This changes the prototype of uv_run() from:
int uv_run(uv_loop_t* loop);
To:
int uv_run(uv_loop_t* loop, uv_run_mode mode);
Where `mode` is UV_RUN_DEFAULT, UV_RUN_ONCE or UV_RUN_NOWAIT.
Fixes#683.
Replace `void f()` with `void f(void)`; the former means "a function
that takes any number of arguments, including none" while the latter
is what is actually intended: a function taking no arguments.
The first form also isn't strictly conforming ANSI/ISO C.