Commit Graph
15 Commits
Author SHA1 Message Date
Joachim Nilsson e3d40ef010 Check timer period and timeout arguments
The uev_timer_init() and uev_timer_set() functions allow timeout and
period to be set < 0, which is not supported.  This patch adds a very
simple range check.

Signed-off-by: Joachim Nilsson <joachim.nilsson@westermo.se>
2016-06-17 13:45:11 +02:00
Joachim Nilsson 98c8e9f8b1 Fix leaking descriptors, use CLOEXEC
The signal and timer fd's used in libuEv were not created properly with
the CLOEXEC flag.  Hence, all forked off children calling exec*() could
access all file descriptor, sockets, etc., used by the parent process.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-04-22 14:31:51 +02:00
Joachim Nilsson 9fc5227343 Update copyright years
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-04-22 14:30:56 +02:00
Joachim Nilsson ac5f01ea22 Remove Emacs version-control handling
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-04-22 14:29:19 +02:00
Joachim Nilsson 3adc7a03c0 Fix issue #6: Segfault when stopping timer before calling uev_exit()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-30 18:02:47 +02:00
Joachim Nilsson b94023faed Reflow paragraphs to match original line breaks, no change in licensing terms!
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>
2015-06-18 01:36:48 +02:00
Joachim Nilsson 9e7f6865fc uev_timer_set(): Bugfix, call uev_watcher_start() even if not running yet!
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-09 13:05:55 +02:00
Joachim Nilsson 2f8c45f438 Fix TODO: Add uev_*_start() functions.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-02-15 18:13:36 +01:00
Joachim Nilsson 618480140c Update copyright years and reflow LICENSE file.
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>
2015-01-07 02:11:09 +01:00
Joachim Nilsson 5065440f52 Minor change libuev --> libuEv and bump version for release.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-01-07 01:18:07 +01:00
Joachim Nilsson d6e0146803 Major refactor: API change, code cleanup, remove calloc()/free()
- 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>
2013-08-06 02:00:24 +02:00
Joachim Nilsson c69ce87eb8 Rename uev_t --> uev_ctx_t and uev_watcher_t --> uev_t
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-08-06 02:00:24 +02:00
Joachim Nilsson 1319f2ba5a Add support for signals using signalfd(2)
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-07-23 03:19:13 +02:00
Joachim Nilsson b1de765841 Further cleanup, rename uev_io_t --> uev_watcher_t
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-07-23 02:25:51 +02:00
Joachim Nilsson 9b5be13e62 Split libuev.c into smaller files to help linker
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>
2013-07-23 00:54:52 +02:00