While comparing the library layout with libite, I noticed how the
formatting of the license paragraphs in all source files had been
garbled. This patch restores the orginal line breaks.
Note: Only whitespace changes, no change in licensing terms!
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
- Make sure to listen for EPOLLRDHUP in watchers so users can be
notified when a peer closes a connection.
- Handle EPOLLHUP and EPOLLERR gracefully. Even handle spurious
EPOLLHUP by means of an error counter. If we receive too many errors
we now restart the epoll fd and re-add all watchers.
- Return error from `epoll_ctl()` in `uev_watcher_stop()`
- Ignore any error from `uev_watcher_stop()` in `uev_watcher_set()`
- Move LIST_REMOVE() et al from io.c to core uev.c, should be
done for timer and signal callbacks as well, of course.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Update copyright years of all sources.
Reflow/reformat paragraphs in MIT license to match Finit,
i.e., no content changes only whitespace/linebreak changes.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
- Rename all _create() functions --> _init()
- Rename all _delete() functions --> _stop()
- Watchers are automatically started, except
- Timer watchers are automatically started by uev_run()
- Allow I/O watchers to watch either EV_READ/EV_WRITE or both events
- Extend callbacks with a received events field
- Remove calloc()/free(), let user handle this
- Make event has-a context when initializing it => simplifies API
- Internal uev_watcher_*() API mostly handles epoll stop/start
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Split libuev.c into one file per watcher type, mostly to give a better
overview and ease of maintenance, but also to help the linker.
Unfortunately this steals a few bytes when linking a full blown app, but
for apps that, e.g., only need I/O watchers and no timers the resulting
binary will be smaller. This applies to static binaries that are more
common in embedded systems.
$ size libuev.a libuev.so.1
text data bss dec hex filename
999 0 0 999 3e7 main.o (ex libuev.a)
90 0 0 90 5a io.o (ex libuev.a)
490 0 0 490 1ea timer.o (ex libuev.a)
4380 696 8 5084 13dc libuev.so.1
Also, move uev.h back to top from include/libuev/uev.h since a separate
namespace is not needed after the removal of the OpenBSD queue.h copy.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>