This patch replaces the BSD doubly linked list implementation with a
simplified homegrown version. This not only reduces the dependency on
an external "library", but also greatly simplifies licensing and gives
us a clean name space that does not intrude on users who want to use
their own version of queue.h in their application that also includes
the libuEv header file.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
The __attribute__ ((unused)) is useful sometimes to declare variables as
intended to be unused, e.g. in callback functions. However, they tend
to clutter up the code making hard to read. We therefore remove all
uses of it and instead set -Wno-unused-parameter.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
The semantics for timerfd in Linux is to use close() to stop,
so no need for the extra overhead with uev_timer_set().
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
There's an issue with uftpd not exiting properly. Cannot nail it down
properly but it seems to be related to the stopping of active timers.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch facilitates building newer versions of libuEv on systems with
older versions of autoconf and automake.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
A watcher callback may be a timeout callback, or similar, that deletes
itself and the watcher. So we should not dereference anything in the
watcher after the callback.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
No need to check fd with fcntl(). On EPOLLERR the descriptor has an
error condition that must bed ACK'ed by the callback. On EPOLLHUP
we got a hang-up on the remote end, usually a stream or pipe, either
way the callback must ACK this too, regardless.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
The `examples/` directory was never built. The documentation however
indicated the existence of an `--enable-examples` option, which didn't
really exist. This patch adds that option.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
If an I/O watcher callback fails to read(), returning zero, we check
events for UEV_HUP to detect EOF or socket remote end shutdown().
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch adds UEV_ERROR handling to the test I/O watcher, restarting
the watcher properly. Also, additional error handling to read(), which
was unchecked and failed when fuzzing the libc read() function.
We also take the opportunity to document the reasons for when using the
w->fd (watcher descriptor) and when *not* to in the test. Even to the
author this was confusing and looked suspicious.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>