Commit Graph
324 Commits
Author SHA1 Message Date
Joachim Nilsson f78348a92a uev_run(): Return unique error codes in case of actual error.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-10 23:40:49 +01:00
Joachim Nilsson d1f5062e79 Bump major version, for upcoming v2.0 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-10 22:26:03 +01:00
Joachim Nilsson 1037eed481 Minor simplification, result is never changed
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-10 22:25:12 +01:00
Joachim Nilsson 2f9cce9150 Do NOT exit event loop on timer/signal watcher error
This patch fixes a blocking issue discovered in the Finit project.
At shutdown, or when there is any problem with a timer or signal
watcher, the event loop is abruptly terminated.

Instead of unconditionally exiting the event loop on problems with a
single watcher, invalidate the watcher and run the callback one last
time with UEV_ERROR in the events argument.

This is a semantic change wrt. watchers and their callbacks, so the
major version number will be bumped accordingly to signal the severity
of this change.  From now on it is STRONGLY recommended that each call
back function check for UEV_ERROR.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-10 22:18:40 +01:00
Joachim Nilsson f3b3177963 Introduce UEV_ERROR, for unexpected error on timer+signal watchers
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-10 21:49:57 +01:00
Joachim Nilsson ad262efa97 Update documentation to mention lack of support for regular files
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-24 08:10:36 +02:00
Joachim Nilsson 0dfc9152bd uev_run(): Exit event loop as soon as there are no more watchers
The purpose of the event loop is to process events on all registered
watches.  When all watchers have completed the event loop should exit.

Having implemented a workaround for issue #12 in commit e0cebc3 it has
become evident we need to check the list of watchers at the beginning
of the event loop rather than the end, since the workaround skips past
the end.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-24 00:33:28 +02:00
Joachim Nilsson 9642443a7c Clean up redirect example a bit
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-22 11:16:10 +02:00
Joachim Nilsson 98748277f3 Add Emacs hints for indentation
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-21 20:52:30 +02:00
Joachim Nilsson 1de445535e Fix periodic timer example
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-21 20:51:08 +02:00
Joachim Nilsson 151f9294c9 Simplify Origin & References section
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-21 20:50:52 +02:00
Joachim Nilsson 61bb69795d Use FIONREAD to detect if stdin has data, safer than just select()
When handling the stdin redirect workaround we should use FIONREAD to
figure out if there is any data to read.

When there is no more data to read from stdin we remove the watcher from
internal bookkeeping but allow the callback to run one last time so it
can detect a short read.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-21 19:55:17 +02:00
Joachim Nilsson d46ff8e396 redirect: Make sure example application does not exit on len==0
We want to continue running the event loop until it is exited properly,
not if the callback for stdin detects a short read.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-21 19:54:00 +02:00
Joachim Nilsson e0cebc33b1 Fix #12: Implement workaround for application < foo.txt
This patch implements a workaround for issue #12, i.e. when an I/O
watcher for redirected stdin is registered and causes epoll_ctl()
to return EPERM.

The workaround registers the watcher as `active = -1` and bypasses
the epoll_wait() call in the main loop until all data has been read
from stdin and the temporary -1 watcher(s) have completed.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-21 19:10:04 +02:00
Joachim Nilsson 82a1018dd2 Ignore TroglOS build files
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-21 18:47:31 +02:00
Joachim Nilsson 58ec8e1d6f Simple example of stdin redirect problem, issue #12
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-21 18:46:55 +02:00
Joachim Nilsson 704d7d5612 Refactor, leverage internal API
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-21 12:47:01 +02:00
Joachim Nilsson ce4f8d6ef5 Follow-up to ed5c9bb, fix examples Makefile after relocation
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-21 12:21:51 +02:00
Joachim Nilsson 6f5e6e5232 Make internal API more private
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-21 12:04:13 +02:00
Joachim Nilsson 9751be5859 Update ChangeLog diff URLs
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-22 16:26:02 +02:00
Joachim Nilsson 5e24736652 Bump version for v1.6.0 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
v1.6.0
2017-09-22 08:01:04 +02:00
Joachim Nilsson c8c84d12cd Add standard README.debian
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-21 21:29:56 +02:00
Joachim Nilsson 0bc466d112 Minor, reorder build vars a bit
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-21 21:29:21 +02:00
Joachim Nilsson 199e38c8dc debian/rules: Don't compress README.md and API.md in -dev package
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-21 21:28:54 +02:00
Joachim Nilsson f70693fd87 debian/docs: Also install new API.md docs
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-21 21:28:32 +02:00
Joachim Nilsson 777810cc83 Spellcheck ChangeLog(s)
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-21 07:55:06 +02:00
Joachim Nilsson e0b0924135 Add src/* to distribution archive files
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-21 07:53:30 +02:00
Joachim Nilsson 31fabccf7f README: Fix obvious error in example
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-20 13:38:39 +02:00
Joachim Nilsson f2d5192aa2 Reword note on time_t and GLIBC and add URL after user feedback
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-20 09:24:45 +02:00
Joachim Nilsson 891e641abe Sectionalize API docs better and update README ToC
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-20 09:04:54 +02:00
Joachim Nilsson b67c62045f Improve documentation for event flags on init and callback
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-20 08:59:39 +02:00
Joachim Nilsson 649f40e5d3 Reduce indentation in all code + shell examples
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-20 08:41:47 +02:00
Joachim Nilsson d92b4ce2ae Reduce indentation for very wide API desc.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-20 08:39:25 +02:00
Joachim Nilsson 653f605c25 Update doc string for possible I/O watcher events
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-20 08:38:21 +02:00
Joachim Nilsson fd6a2b02d8 Simplify comment
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-20 08:38:05 +02:00
Joachim Nilsson 310e8a7607 Try quoute at top of text
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-20 08:18:48 +02:00
Joachim Nilsson f7f14a4a64 Reduce indentation and remove '$' in shell build example
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-20 08:18:05 +02:00
Joachim Nilsson a6e185d4e9 Minor refactor of layout
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-20 08:15:31 +02:00
Joachim Nilsson 2f96d2fcd4 Move quote back to README
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-20 08:15:11 +02:00
Joachim Nilsson 25701b4fc4 API.md: We handle Y2038 on GLIBC systems, but use relative timers
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-20 08:14:12 +02:00
Joachim Nilsson cc7fdc747a Simplify and correct project name
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-20 08:05:29 +02:00
Joachim Nilsson 16892b0673 Move caveat about using signalfd from README to API doc
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-20 08:05:01 +02:00
Joachim Nilsson b6b4afc11b Update copyright years
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-19 09:09:29 +02:00
Joachim Nilsson 8f6a0a6847 README: Move around text a bit to get a better flow
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-19 09:06:44 +02:00
Joachim Nilsson 36599097d5 README: Add a simple example
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-19 09:05:08 +02:00
Joachim Nilsson ca7a99aba3 README: Simplify origin a bit
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-19 09:04:46 +02:00
Joachim Nilsson 4e0bb82899 Remove MOTIVATION.md, wrote another blog post about it instead
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-19 08:59:15 +02:00
Joachim Nilsson 77738130e3 Relocate API.md, again, and add to distribution archive and doc/
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-19 08:59:15 +02:00
Joachim Nilsson 7a316468b5 Rename src/README.md --> src/API.md, add README symlink for GitHub
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-19 08:32:25 +02:00
Joachim Nilsson 10d69fdee7 Fix URLs in API document
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-19 08:30:47 +02:00