History log of /libuv/src/unix/poll.c (Results 1 – 24 of 24)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 6b0051d1 08-Jun-2021 Ali Mohammad Pur

core: Correct the conditionals for {cloexec,nonblock}_ioctl

These functions are declared with one set of conditionals in the
header, and defined with another set of conditionals in the c

core: Correct the conditionals for {cloexec,nonblock}_ioctl

These functions are declared with one set of conditionals in the
header, and defined with another set of conditionals in the c file.
This commit makes all decisions regarding `uv__{nonblock,cloexec}_ioctl`
depend on a boolean macro instead.
There's one function that expects `uv__nonblock_ioctl` to be defined,
so that bit of the function is also conditionally compiled.

PR-URL: https://github.com/libuv/libuv/pull/3163
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>

show more ...


Revision tags: v1.41.0
# c9406ba0 28-Dec-2020 Bob Weinand

poll,unix: ensure safety of rapid fd reuse

Consider the following scenario:

uv_poll_init(loop, poll, fd);
uv_poll_start(poll, UV_READABLE, cb);
// the cb gets invoked etc.

poll,unix: ensure safety of rapid fd reuse

Consider the following scenario:

uv_poll_init(loop, poll, fd);
uv_poll_start(poll, UV_READABLE, cb);
// the cb gets invoked etc.
uv_poll_stop(poll);

close(fd);
fd = allocate_new_socket(); // allocate_new_socket() is assigned the same fd by "bad luck" from the OS

// some time later:
uv_poll_init(loop, otherpoll, fd);
uv_poll_start(otherpoll, UV_READABLE, cb);

uv_close(poll); // uv__io_stop: Assertion `loop->watchers[w->fd] == w' failed.

According to documentation, "however the fd can be safely closed
immediately after a call to uv_poll_stop() or uv_close()."
Though, in this scenario, we close()'d our file descriptor, and by
bad luck we got the same file descriptor again and register a new
handle for it and start polling.

Previously that would lead to an assertion failure, if we were to
properly free the original handle via uv_close().

This commit fixes that by moving the check whether a only a single
poll handle is active to uv_poll_start() instead of the stopping
routines.

Fixes: https://github.com/libuv/libuv/issues/1172
Fixes: https://github.com/bwoebi/php-uv/issues/81
Fixes: https://github.com/b2wdigital/aiologger/issues/82
Fixes: https://github.com/invenia/LibPQ.jl/issues/140
PR-URL: https://github.com/libuv/libuv/pull/2686
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>

show more ...

Revision tags: v1.40.0, v1.39.0, v1.38.1, v1.38.0, v1.37.0, v1.36.0, v1.35.0, v1.34.2, v1.34.1, v1.34.0, v1.33.1, v1.33.0, v1.32.0, v1.31.0, v1.30.1, v1.30.0, v1.29.1, v1.29.0, v1.28.0, v1.27.0, v1.26.0, v1.25.0, v1.24.1, v1.24.0, v1.23.2, v1.23.1, v1.23.0, v1.22.0, v1.21.0
# 2256be01 28-May-2018 Ben Noordhuis

unix: catch some cases of watching fd twice

Libuv does not support multiple handles watching the same file
descriptor. That condition is caught by an assert but it's detached
from t

unix: catch some cases of watching fd twice

Libuv does not support multiple handles watching the same file
descriptor. That condition is caught by an assert but it's detached
from the call site and therefore not always trivial to track down.

This commit turns cases where we can easily detect duplicates into
runtime `UV_EEXIST` errors. More work is needed to catch _all_ cases.

Partially addresses https://github.com/libuv/libuv/issues/1172.

PR-URL: https://github.com/libuv/libuv/pull/1851
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>

show more ...

Revision tags: v1.20.3, v1.20.2, v1.20.1, v1.20.0, v1.19.2, v1.19.1
# 89cbbc89 19-Jan-2018 Mason X

include,src: introduce UV__ERR() macro

Using -errno, -E**, and -pthread_function() can be
error prone, and breaks compatibility with some operating
systems that already negate errno'

include,src: introduce UV__ERR() macro

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>

show more ...

Revision tags: v1.19.0, v1.18.0, v1.17.0, v1.16.1, v1.16.0, v1.15.0, v1.14.1, v1.14.0
# ce56a85b 08-Aug-2017 Ben Noordhuis

unix: make uv_poll_stop() remove fd from pollset

Avoid repeated wake-ups in `uv__io_poll()` when the previously watched
file descriptor has been duplicated (with `dup(2)`) and then close

unix: make uv_poll_stop() remove fd from pollset

Avoid repeated wake-ups in `uv__io_poll()` when the previously watched
file descriptor has been duplicated (with `dup(2)`) and then closed.

Because epoll reports events for _file descriptions_ rather than _file
descriptors_, events on the duplicated file descriptor cause the event
loop to wake up.

Libuv then tries to unregister the event listener for the original file
descriptor but that fails with EBADF because the file descriptor is
closed.

Since libuv uses epoll in level-triggered mode, it effectively results
in a busy loop because the event is re-reported as soon as libuv calls
epoll_wait() again.

I tried hard to write a test case for this but there is no directly
observable behavior, only increased CPU usuage.

Fixes: https://github.com/libuv/libuv/issues/1148
PR-URL: https://github.com/libuv/libuv/pull/1468
Reviewed-By: Colin Ihrig <cjihrig@gmail.com
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>

show more ...

Revision tags: v1.13.1, v1.13.0, v1.12.0, v1.11.0, v1.10.2, v1.10.1, v1.10.0
# d731fd1b 08-Sep-2016 CurlyMoo

poll: add support for OOB TCP and GPIO interrupts

Out-of-band TCP messages are used for TCP data
transmission outside (outband) the inbound TCP
data. These packets are sent with an

poll: add support for OOB TCP and GPIO interrupts

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>

show more ...

# 668d24d8 01-Nov-2016 Santiago Gimeno

unix: use uv__is_closing everywhere

PR-URL: https://github.com/libuv/libuv/pull/1117
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

Revision tags: v0.10.37
# c5c419f7 23-May-2016 Ben Noordhuis

unix: allow nesting of kqueue fds in uv_poll_start

kqueue file descriptors don't support ioctl(FIONBIO) (or any other ioctl
for that matter) so retry using fcntl(F_GETFL) + fcntl(F_SETFL

unix: allow nesting of kqueue fds in uv_poll_start

kqueue file descriptors don't support ioctl(FIONBIO) (or any other ioctl
for that matter) so retry using fcntl(F_GETFL) + fcntl(F_SETFL) when we
receive a ENOTTY error.

Fixes: https://github.com/libuv/libuv/issues/883
PR-URL: https://github.com/libuv/libuv/pull/885
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

Revision tags: v1.9.1
# 375ba2d7 09-Apr-2016 Ben Noordhuis

unix: use POLL{IN,OUT,etc} constants directly

Remove the UV__POLL defines and use POLL{IN,OUT,etc} directly.
On Linux, we lean on the fact that the POLL constants correspond
one-to-o

unix: use POLL{IN,OUT,etc} constants directly

Remove the UV__POLL defines and use POLL{IN,OUT,etc} directly.
On Linux, we lean on the fact that the POLL constants correspond
one-to-one to their EPOLL counterparts.

Fixes: https://github.com/libuv/libuv/issues/816
PR-URL: https://github.com/libuv/libuv/pull/817
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

Revision tags: v1.9.0
# c7c8e916 11-Jan-2016 Santiago Gimeno

poll: add UV_DISCONNECT event

It allows detecting the remote socket closing the connection. It's
emitted when `EPOLLRDHUP`(Linux), `EV_EOF`(BSD), `POLLRDHUP`(Solaris,
AIX) and `AFD_P

poll: add UV_DISCONNECT event

It allows detecting the remote socket closing the connection. It's
emitted when `EPOLLRDHUP`(Linux), `EV_EOF`(BSD), `POLLRDHUP`(Solaris,
AIX) and `AFD_POLL_DISCONNECT`(Windows) events are received.

PR-URL: https://github.com/libuv/libuv/pull/691
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

show more ...

# a0b56059 20-Dec-2015 Ben Noordhuis

unix: report errors for unpollable fds

Libuv would abort() when trying to watch a file descriptor that is
not compatible with epoll-style polling; file descriptors referring
to on-di

unix: report errors for unpollable fds

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>

show more ...

Revision tags: v1.8.0, v1.7.5, v1.7.4, v1.7.3, v1.7.2, v1.7.1
# 01544d86 07-Aug-2015 Saúl Ibarra Corretgé

Revert "stream: squelch ECONNRESET error if already closed"

This reverts commit 05a003a3f78d07185b7137601fe8e93561855a8d.

This commit triggerd "test-tls-hello-parser-failure" failur

Revert "stream: squelch ECONNRESET error if already closed"

This reverts commit 05a003a3f78d07185b7137601fe8e93561855a8d.

This commit triggerd "test-tls-hello-parser-failure" failure in io.js.
See the reference below for a more thorough explanation.

Refs: https://github.com/nodejs/io.js/pull/2310
PR-URL: https://github.com/libuv/libuv/pull/475
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

show more ...

Revision tags: v1.7.0
# 05a003a3 17-Jun-2015 Santiago Gimeno

stream: squelch ECONNRESET error if already closed

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.

stream: squelch ECONNRESET error if already closed

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>

show more ...

Revision tags: v1.6.1, v1.6.0, v1.5.0, v0.10.36, v1.4.2, v0.10.35, v1.4.1, v0.10.34, v1.4.0, v1.3.0, v0.10.33, v1.2.1
# b30a3e67 14-Jan-2015 Saúl Ibarra Corretgé

unix, windows: set non-block mode in uv_poll_init

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

unix, windows: set non-block mode in uv_poll_init

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>

show more ...

Revision tags: v1.2.0, v0.10.32, v1.1.0, v0.10.31, v1.0.2, v0.10.30, v1.0.1, v1.0.0, v0.10.29, v1.0.0-rc2, v1.0.0-rc1, v0.11.29, v0.11.28, v0.11.27, v0.10.28, v0.11.26, v0.10.27, v0.11.25, v0.11.24, v0.11.23, v0.10.26, v0.11.22, v0.11.21, v0.11.20, v0.10.25, v0.11.19, v0.10.24, v0.11.18, v0.10.23, v0.10.22, v0.11.17, v0.10.21, v0.11.16, v0.10.20, v0.11.15, v0.10.19, v0.11.14, v0.10.18, v0.10.17, v0.10.16, v0.11.13, v0.11.12, v0.11.11, v0.11.10, v0.10.15, v0.11.9, v0.10.14, v0.11.8, v0.11.7, v0.10.13, v0.11.6, v0.10.12, v0.11.5, v0.10.11
# 3ee4d3f1 06-Jun-2013 Ben Noordhuis

unix, windows: return error codes directly

This commit changes the libuv API to return error codes directly rather
than storing them in a loop-global field.

A code snippet like

unix, windows: return error codes directly

This commit changes the libuv API to return error codes directly rather
than storing them in a loop-global field.

A code snippet like this one:

if (uv_foo(loop) < 0) {
uv_err_t err = uv_last_error(loop);
fprintf(stderr, "%s\n", uv_strerror(err));
}

Should be rewritten like this:

int err = uv_foo(loop);
if (err < 0)
fprintf(stderr, "%s\n", uv_strerror(err));

The rationale for this change is that it should make creating bindings
for other languages a lot easier: dealing with struct return values is
painful with most FFIs and often downright buggy.

show more ...

Revision tags: v0.10.10, v0.11.4, v0.10.9, v0.10.8, v0.11.3, v0.10.7, v0.10.6, v0.11.2, v0.10.5, v0.10.4, v0.11.1, node-v0.11.0, v0.10.2, node-v0.7.3, node-v0.7.7, node-v0.7.5, node-v0.5.3, node-v0.10.1, node-v0.10.0, node-v0.9.12, node-v0.9.11, node-v0.8.21, node-v0.8.19, node-v0.9.10, node-v0.9.7, node-v0.9.6, node-v0.9.4, node-v0.8.17
# 65bb6f06 15-Nov-2012 Ben Noordhuis

unix: rename UV__IO_* constants

Revision tags: node-v0.8.15, node-v0.9.3, node-v0.8.12, node-v0.8.10, node-v0.9.2, node-v0.8.9, node-v0.9.1
# 1282d648 22-Aug-2012 Ben Noordhuis

unix: remove dependency on libev

Revision tags: node-v0.8.8, node-v0.8.7
# 837edf4c 09-Aug-2012 Ben Noordhuis

unix, windows: remove handle init counters

Remove the handle init counters, no one uses them.

Revision tags: node-v0.8.6, node-v0.8.5, node-v0.6.21, node-v0.8.3, node-v0.9.0, node-v0.8.2, node-v0.8.1, node-v0.8.0, node-v0.7.12, node-v0.7.11, node-v0.7.10, node-v0.6.19, node-v0.7.9
# 2e3e658b 23-May-2012 Ben Noordhuis

unix: fix uv_poll CPU usage spike

Saúl Ibarra Corretgé reports that calling uv_poll_start() repeatedly results
in CPU usage spikes. Fixed by stopping the poll I/O watcher before updating

unix: fix uv_poll CPU usage spike

Saúl Ibarra Corretgé reports that calling uv_poll_start() repeatedly results
in CPU usage spikes. Fixed by stopping the poll I/O watcher before updating it.

Fixes #424.

show more ...

# 3bc97070 23-May-2012 Ben Noordhuis

unix: replace ev_io with uv__io_t

Replace ev_io usage with wrapper constructs.

This is preliminary work for the transition to a libev-less linux backend.

# ad279df7 21-May-2012 Bert Belder

Unix: remove superfluous variable from uv_poll_start

# 9efa8b35 17-May-2012 Ben Noordhuis

unix, windows: rework reference counting scheme

This commit changes how the event loop determines if it needs to stay alive.

Previously, an internal counter was increased whenever a

unix, windows: rework reference counting scheme

This commit changes how the event loop determines if it needs to stay alive.

Previously, an internal counter was increased whenever a handle got created
and decreased again when the handle was closed.

While conceptually simple, it turned out hard to work with: you often want
to keep the event loop alive only if the handle is actually doing something.
Stopped or inactive handles were a frequent source of hanging event loops.

That's why this commit changes the reference counting scheme to a model where
a handle only references the event loop when it's active. 'Active' means
different things for different handle types, e.g.:

* timers: ticking
* sockets: reading, writing or listening
* processes: always active (for now, subject to change)
* idle, check, prepare: only active when started

This commit also changes how the uv_ref() and uv_unref() functions work: they
now operate on the level of individual handles, not the whole event loop.

The Windows implementation was done by Bert Belder.

show more ...

Revision tags: node-v0.6.18
# b9504f79 03-May-2012 Bert Belder

Rename uv_platform_socket_t to uv_os_sock_t

# d60d94e0 02-May-2012 Bert Belder

Unix: implement uv_poll