This patch adds support for exporting the signalfd_siginfo struct read
from the signal fd descriptor on signals. This allows watcher callbacks
to, e.g., figure out who sent a signal. See signalfd(2) for details on
struct signalfd_siginfo.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
- Create .sha256 checksums for tarballs, in addition to the .md5
- Use debuild to build .deb package, runs lintian as well
- List all resulting build artifacts
- Call release-hook first, to check if tagged
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This patch fixes the lintian warning package-name-doesnt-match-sonames,
which is a reminder to step the library version to match the soname.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
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>
Many users look at both examples *and* unit tests to learn how to use a
library. We should pride ourselves in that we have not just working but
also correct and readable tests.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Both cron and regular timers were closed twice on uev_exit(), first
when iterating over all watchers, next after each cb() has run in
uev_run(). This patch adds a check if a watcher is active before
attempting to stop it (again).
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch is a follow-up to 2f9cce9, and a complete refactor of
fe8f3f1 which first introduced the EPOLLERR and EPOLLHUP handling.
Then mainly for managing errors and hangups on stream sockets.
Now, instead of trying to reopen the epoll() fd, and breaking out
hard from the event loop on catastrophic error, we now delegate
I/O watcher EPOLLERR and EPOLLHUP to the watcher callback, just
like other watchers.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
In 2f9cce9 the invalidate_watcher() function was introduced to stop
invalid timer/cron and signal watchers. This patch refactors that
change to instead call the stop method for cron/timer and attempt to
restart failing signal watchers.
The cron/timer and signal watchers are quite different from regular
I/O watchers in that their internal "fd" is hidden from and not under
the control of the user, so we should try to handle them better. For
the former two we cannot do much other than stop and call the user's
registered callback with UEV_ERROR, but for the latter we can at least
try to restart it.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
With distcheck we not only build the distribution files, but also runs
test suite and verifies that the resulting dist file(s) can be built.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>