Commit Graph
70 Commits
Author SHA1 Message Date
Joachim Nilsson 7f10528d80 main.c:uev_run() - Document mysterious flags parameter.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-12-30 20:49:08 +01:00
Joachim Nilsson d352e176dc Minor spell check fixes and additions.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-12-30 19:53:56 +01:00
Joachim Nilsson 93d9d06802 First cleanup of README after comments by @vonj, more to come ...
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-12-30 19:36:18 +01:00
Joachim Nilsson 23935c248a Add joystick reading example, for documentation.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-12-30 18:07:22 +01:00
Joachim Nilsson 59afe57995 Minor update to README
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-12-28 21:54:40 +01:00
Joachim Nilsson 1dfdc875d7 Update README
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-12-28 21:36:01 +01:00
Joachim Nilsson 3d93de3806 Update REAMDE v1.0.0 2013-08-06 14:12:54 +02:00
Joachim Nilsson 70881326d0 Minor fixes to bench.c when running many descriptors.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-08-06 02:54:09 +02:00
Joachim Nilsson 1b34da7a1a Update REAMDE 2013-08-06 02:15:41 +02:00
Joachim Nilsson 0de9cb6321 Adapt bench.c (from libev) to libuev, no libev/libevent API wrappers available
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-08-06 02:04:41 +02:00
Joachim Nilsson d9f078a119 Reindent bench.c to Linux coding style
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-08-06 02:04:41 +02:00
Joachim Nilsson f7e93f9d43 Import Niels Provos bench.c, this version from http://libev.schmorp.de/bench.c
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-08-06 02:03:33 +02:00
Joachim Nilsson 82a09196f0 Add support for make check using Sparse
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-08-06 02:00:24 +02:00
Joachim Nilsson 66c5606e34 Add support for UEV_ONCE and UEV_NONBLOCK run flags to uev_run()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-08-06 02:00:24 +02: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 689b407c8f Update .gitignore, improved filtering *.o, .*.d, *~ 2013-08-06 02:00:24 +02:00
Joachim Nilsson baa02de05f Makefile: Add dist target. 2013-07-23 13:28:49 +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 85da186489 Simplify epoll handling slightly
No need to allocate the epoll events array since it's static
in size anyway.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-07-23 02:09:13 +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
Joachim Nilsson 069294f28a Further reduce size and remove queue.h, we can use GLIBC's old queue.h now
- Cleanup code
- Further polish on total size using black magic
- Remove OpenBSD queue.h, code simplied so much now it's not needed anymore.
  Instead we can rely on the standard GNU/Linux sys/queue.h (old BSD copy)

$ size libuev.a libuev.so.1
   text	   data	    bss	    dec	    hex	filename
   1520	      0	      0	   1520	    5f0	libuev.o (ex libuev.a)
   4194	    680	      8	   4882	   1312	libuev.so.1

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-07-23 00:07:57 +02:00
Joachim Nilsson 6ed1352404 Optimize for size a bit
- Remove double book keeping, the kernel does all the heavy lifting now
- Trim the amount of #includes
- Use LIST_ instead of TAILQ_ now that we no longer handle timers ourselves

Original LibUEvent

$ size libuevent.a libuevent.so.1
   text	   data	    bss	    dec	    hex	filename
   2610	      0	      8	   2618	    a3a	libuevent.o (ex libuevent.a)
   5266	    648	     16	   5930	   172a	libuevent.so.1

Refactored libuev:

$ size libuev.a libuev.so.1
   text	   data	    bss	    dec	    hex	filename
   1557	      0	      0	   1557	    615	libuev.o (ex libuev.a)
   4186	    672	      8	   4866	   1302	libuev.so.1

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-07-22 23:07:15 +02:00
Joachim Nilsson ed22e88c81 Update README 2013-07-22 20:45:10 +02:00
Joachim Nilsson bccd32a7ee Update with info on original LibUEvent author vs current libuev maintainer. 2013-07-22 20:35:05 +02:00
Joachim Nilsson ce5f29db50 Refer to Wikipedia for information about the MIT license. 2013-07-22 20:33:23 +02:00
Joachim Nilsson 499cbd2032 Refactor to use modern timerfd and epoll
This is a major refactor of the original design by Flemming Madsen.  It
converts the library timers from poll() to timerfd, which at the same
time also unifies the file and timer watchers into one design.  The idea
is to also add signalfd to the mix later on.

Also a couple of hundred kilobytes smaller, although size a secondary
goal.  The primary goal is to further simplify the internal design and
to continuously strive to employ modern APIs.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-07-22 20:25:08 +02:00
Joachim Nilsson 30f6eccecd Update .gitignore 2013-07-22 20:25:05 +02:00
Joachim Nilsson 49c72c0914 Create unique include file namespace and fix install/uninstall make targets
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-07-21 13:08:40 +02:00
Joachim Nilsson f590237403 Update README 2013-07-21 11:55:07 +02:00
Joachim Nilsson ec9351bfdd Add support for peridic timers and resetting timers
Refactor uev_timer_create() to support a periodic (msec) argument. For
such timers libuev automaticlly respawns them.  Effectively resetting
the timeout using the period value.

Also, refactor argument order to uev_timer_create() and uev_io_create().

Rename UEV_FHIN, UEV_FHOUT to UEV_DIR_INBOUND and UEV_DIR_OUTBOUND.

Remove unnecessary return value for watcher callbacks.  What would those
have been usefu for, ever?  Not even the original code checked the return
value after calling a handler.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-07-21 11:39:26 +02:00
Joachim Nilsson 97398e0a7d Fix Makefile dependency handling and add install/uninstall targets
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-07-21 10:20:19 +02:00
Joachim Nilsson e1b1daf5e3 Simplify linked list of I/O watchers and its garbage collect mechanism.
Simplifed uev_io_t by removing uev_io_rem_t completely.  A refactor that
would not have been possible without the BSD queue.h API.  This makes
the code readable and thus maintainable and less error prone.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-07-21 08:31:33 +02:00
Joachim Nilsson ece4e31c52 Convert from homebrew linked list to BSD TAILQ using OpenBSD r1.38 sys/queue.h
- OpenBSD http://www.openbsd.org/cgi-bin/cvsweb/src/sys/sys/queue.h rev 1.38
- Convert lList*() to TAILQ_*()
- Minor local variable rename to clarify usage

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-07-21 07:53:25 +02:00
Joachim Nilsson ab8c70d501 Slight reorder and renaming to clarify, also update README. 2013-07-20 22:48:52 +02:00
Joachim Nilsson 7e87644bd1 Major cleanup, use Linux coding style, remove CamelCase.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-07-19 12:41:59 +02:00
Joachim Nilsson 0bba080660 Initial import of Flemming Madsen's LibUEvent
This fork is called libuev and will focus solely on embedded Linux
systems using C.  Patches for other UNIX-like operating systems are
welcome.

- Remove Lua support, will not be used.
- Rename from LibUEvent to libuev where applicable
- Add project's MIT license to top of all files, as is customary
- Add a LICENSE file, as is customary

This MIT licensed code was cloned from the Mercurial repository at
Google http://code.google.com/p/libuevent/ which had mislabled the
license as "New BSD License", which is wrong.  The actual license
of the project is https://en.wikipedia.org/wiki/MIT_License

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-07-18 23:37:07 +02:00
fm 812007f5bc Document lua api v0.0.1 2012-03-17 09:15:07 +01:00
fm 285ee70433 Lua test running 2012-03-16 21:53:56 +01:00
fm 22aa570846 pwtest 2012-03-16 10:28:41 +01:00
fm a2ab7c3685 Lua test coded, not yet running .. 2012-03-16 09:57:35 +01:00
fm c5878c6302 Lua basically running 2012-03-14 22:11:20 +01:00
fm 5c817c20ed Lua binding, done coding 2012-03-14 18:12:16 +01:00
fm c3f9d0dc8d Add README 2012-03-14 11:25:42 +01:00
fm 36a937505c Import from compactor 2012-03-14 10:30:20 +01:00
madsenco 89022a9faa A working test 2012-03-12 08:46:58 +01:00
madsenco 3dd80622f4 libuevent now compiles 2012-03-08 12:33:28 +01:00
madsenco 70dced803c Move default config to bottom 2011-05-27 10:58:32 +02:00
madsenco e590077849 Class gotcha fixed etc 2011-05-25 22:38:45 +02:00