Commit Graph
503 Commits
Author SHA1 Message Date
NefelibateLG 28643fa599 Return from uev_run() when UEV_NONBLOCK and no event is pending
uev_run() with only UEV_NONBLOCK never returns when there are watchers
but no events, it spins at full CPU load:

    uev_run(ctx, UEV_NONBLOCK);

The loop polls epoll with a zero timeout and only stops on UEV_ONCE.

Leave the loop when a nonblocking poll finds no events.
2026-11-16 15:08:42 +01:00
omrzk 09d9b6ba04 Keep timer deadlines between calls to uev_run()
Timers never expire when the event loop is run one iteration at a time
and something else keeps it busy, e.g., when polled from another event
loop:

    uev_run(ctx, UEV_ONCE | UEV_NONBLOCK);

Every call to uev_run() starts all timers over from their full timeout.

Start dormant timers on the first call only.  A caller that wants a
timer restarted for each call must now use uev_timer_set().

Closes #36
2026-11-16 15:08:41 +01:00
Joachim Wiberg 354cdcaf7a Update ChangeLog with fixes from pull requests
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-11-16 14:54:56 +01:00
NefelibateLG 05bc6a0830 Do not leave stdin as descriptor of a failed context
uev_init() leaves the context descriptor at 0 when epoll_create1()
fails.  A following uev_exit() then closes stdin.

Set it to -1 before creating the epoll descriptor.
2026-11-16 14:54:49 +01:00
NefelibateLG 4792b988a1 Fix eventfd leak in uev_event_init()
uev_event_init() leaks its eventfd, and leaves it in the watcher, when
the watcher cannot be added to the event loop.

Close it and reset the descriptor in the watcher.
2026-11-16 14:54:49 +01:00
NefelibateLG ae28276f3f Fix restart of a stopped cron watcher
uev_cron_start() on a stopped cron watcher brings it back as a regular
timer, with a timeout made up of parts of the cron schedule.  It calls
uev_timer_start(), which reads the timer fields of the watcher and
creates a monotonic timer.

Restart with uev_cron_set() and the cron schedule instead.
2026-11-16 14:54:48 +01:00
omrzk e699cb7f5f Honor UEV_ONCE when stdin is redirected from a file
With stdin redirected from a regular file, uev_run() with UEV_ONCE does
not return until end of file:

    app < file.txt

The workaround for regular files, which epoll cannot watch, restarts
the loop before the UEV_ONCE check.

Check the flag there too.

Closes #37
2026-11-16 14:54:47 +01:00
omrzk fbe2c15377 Honor new descriptor and events in uev_io_set()
uev_io_set() on an active oneshot watcher keeps watching the old
descriptor, for the old events:

    uev_io_set(w, newfd, UEV_READ | UEV_ONESHOT);

It only rearms the watcher, with what is already stored in it.

Rearm only when neither has changed, otherwise stop the watcher and set
it up again.

Closes #35
2026-11-16 14:54:46 +01:00
Joachim Wiberg c964bbe8fb .github: bump actions
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-04-28 08:35:10 +02:00
Joachim Wiberg faf7667012 Create SECURITY.md policy 2025-04-28 07:56:01 +02:00
Joachim Wiberg 332f28e5e1 .github: drop 'needs:' and set release variables
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
v2.4.1
2024-01-04 17:23:17 +01:00
Joachim Wiberg d3c021af42 Update changelog and bump version for v2.4.1 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-01-04 17:16:57 +01:00
Joachim Wiberg 0f59096154 Update copyright years
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-01-04 17:16:49 +01:00
Joachim Wiberg d67290c073 .github: update and drop dep install, not needed
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-01-04 17:12:54 +01:00
Joachim Wiberg c23100c3f0 .github: bump action versions
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-01-04 17:05:32 +01:00
Joachim Wiberg ff2396b973 Mention new Linux APIs we use
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-28 23:40:30 +01:00
Joachim Wiberg 70ef23b9e3 Open v2.4.1 release cycle
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-17 15:14:35 +01:00
Joachim Wiberg 568fe6a9e1 Update changelog for upcoming v2.4.1 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-17 15:14:01 +01:00
Joachim Wiberg ae048605db .github: bump actions to latest supported Node.JS
Prepare for next release by importing necessary changes to release.yml
from SMCroute.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-17 15:10:55 +01:00
Joachim Wiberg 2d9f1c9ce6 Fix #27: possible buffer overrun in uev_run()
If uev_init1() is called with maxevents > 10 the call to epoll_wait()
might cause buffer overflow.  Reported by Steve Palmer.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-17 15:02:21 +01:00
Joachim Wiberg f9c72a01c8 Minor, coding style
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-17 15:02:12 +01:00
Joachim Wiberg 270e270591 test: fix signed vs unsigned comparison
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-17 15:01:25 +01:00
Joachim Wiberg 3c3b37c9aa debian: update library ABI version in .symbols file
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-11-28 14:50:19 +01:00
Joachim Wiberg 0c92a564d8 debian: drop libtool dep and add doxygen
Apparently libtool is an implicit dependency and does not have to be
listed explicitly.

Add doxygen since we now have full doxygen docs to build.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-11-28 14:47:37 +01:00
Joachim Wiberg 53eadaa1c9 debian: fix copy-paste from libite in .symbols file
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-11-28 14:47:37 +01:00
Joachim Wiberg 9591ac7efb debian: Step library name to match SONAME
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 Wiberg <troglobit@gmail.com>
2021-10-03 09:03:44 +02:00
Joachim Wiberg 2ceec8e61c Check for tag with 'v' prefix in release-hook
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
v2.4.0
2021-10-03 08:32:45 +02:00
Joachim Wiberg fd72b75b1b Update changelogs and bump version for v2.4.0 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-03 08:29:27 +02:00
Joachim Wiberg 5c3801bb4a Bump ABI version 2.3.0 -> 3.0.0
The change in the uev_t means the stack space required, and used by
libuEv, is incompatible with previous releases.  So applications
need to be rebuild against the new header file.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-03 08:26:33 +02:00
Joachim Wiberg 739b9f451f debian: API.md has moved
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-03 08:18:35 +02:00
Joachim Wiberg 02832543e3 test: use AM_LDFLAGS for linker args to test programs
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-03 08:13:21 +02:00
Joachim Wiberg 0fe9868fc7 .github: drop dh-systemd from debian job, not needed
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-03 08:04:50 +02:00
Joachim Wiberg 292a222127 .github: drop release job dependency
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-03 08:01:36 +02:00
Joachim Wiberg 611f4ffd00 Update changelogs for v2.4.0 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-03 08:00:26 +02:00
Joachim Wiberg 7bde82fc93 Bump ABI version 2.2.0 --> 2.3.0
New siginfo member in uev_t

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-03 07:56:12 +02:00
Joachim Wiberg c8d1de10a3 test: prefix CFLAGS/CPPFLAGS with AM_ to avoid clash with Fedora
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-03 07:40:06 +02:00
Joachim Wiberg 2872628ef3 .github: verify package building for all builds
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-03 07:23:07 +02:00
Joachim Wiberg 9f5e359bc7 .github: add Release General
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-03 07:22:53 +02:00
Joachim Wiberg a4abbe8aea Drop package from release target, built separately
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-03 07:21:52 +02:00
Joachim Wiberg ff1a3eccd9 Check for full version in git tag before starting release build
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-03 07:19:34 +02:00
Joachim Wiberg 207e211214 Bump version for v2.4.0-rc1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-02 17:30:29 +02:00
Joachim Wiberg c15e6f08e3 .github: enable hints for contributors
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-02 17:30:09 +02:00
Joachim Wiberg be4364236b .github: enable funding submissions for this project
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-02 17:27:59 +02:00
Joachim Wiberg 8aa549487f Update ChangeLog for upcoming v2.4.0 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-02 17:25:29 +02:00
Joachim Wiberg 0c8ff24353 Update .pc file with build reqs, issue #25
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-02 17:21:49 +02:00
Joachim Wiberg 0e0291f85e Fix #25: apps must be built with 64-bit time, just like the lib
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-02 17:21:17 +02:00
Joachim Wiberg 0f2e1521a8 Add MIT license badge
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-08-01 23:22:18 +02:00
Joachim Wiberg 6d56c8da98 Drop all notion of Travis-CI
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-08-01 23:20:12 +02:00
Joachim Wiberg 59dbc3260c .github: add coverity scan action
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-08-01 23:09:26 +02:00
Joachim Wiberg 44a8c08586 .github: initial build action to replace travis
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-08-01 22:59:51 +02:00