28 Commits
Author SHA1 Message Date
Joachim Wiberg 3b3d6a3802 Update changelogs and bump version for v2.3.2 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-12 13:03:18 +01:00
Joachim Wiberg f819d658fb debian: update and relocate .symbols file
- Use v2.3.0 as minver, some were added earlier but this file wasn't

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-12 10:55:08 +01:00
Joachim Wiberg 5851282d1a debian: add .symbols file
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-12 10:44:58 +01:00
Joachim Wiberg deef49f85f debian: change -dev package priorty to optional, as per policy 4.0.1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-12 09:54:29 +01:00
Joachim Wiberg b4b021b21f Update changelogs for v2.3.2 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-12 09:37:00 +01:00
Joachim Wiberg d7fd789378 Makefile: refactor and sync with libite
- Create .sha256 checksums for tarballs, in addition to the .md5
- Use debuild to build .deb package, runs lintian as well
- List all resulting build artifacts
- Call release-hook first, to check if tagged

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-12 09:35:05 +01:00
Joachim Wiberg b26eea6442 configure: enable tar.gz dist archives, by popular demand
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-12 09:35:05 +01:00
Joachim Wiberg 6c467cd594 debian: sync build-depends from libite
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-12 09:16:24 +01:00
Joachim Wiberg 86e01be26e Update copyright years and maintainer surname
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-12 09:15:40 +01:00
Joachim Nilsson 5fd29f7241 Clarify documentation of uev_timer_start()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-20 15:27:12 +02:00
Joachim Nilsson 8d07cc616e Update changelogs and bump version for v2.3.1 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-02-22 15:51:16 +01:00
Joachim Nilsson 9db9daec07 Use separate aux/ dir for auxilliary files and check for install
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-02-22 15:48:11 +01:00
Joachim Nilsson af1a484c46 debian: Update Build-Depends, debhelper >= 10 is sufficient
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-02-22 15:45:08 +01:00
Joachim Nilsson 1e6395a85a debian: Step library name to match SONAME, fixes lintian warning
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 Nilsson <troglobit@gmail.com>
2020-02-22 15:44:36 +01:00
Joachim Nilsson 5c8a258c3f Update ChangeLog and bump version for v2.3.0 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-04-06 13:33:06 +02:00
Joachim Nilsson e79d25bb42 Bump ABI version 2.1.0 --> 2.2.0
New eventfd() API added.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-04-06 13:30:07 +02:00
Joachim Nilsson 6dccc05e0d debian: Update copyright to meet recommendations for machine parsing
Also, clarify copyright for main sources and debian/* files.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-04-06 13:25:03 +02:00
Joachim Nilsson de95022f44 debian: Update package description and include usr/share files
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-04-06 13:24:36 +02:00
Joachim Nilsson 041240a93d debian: Update to latest std version
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-04-06 13:24:13 +02:00
Joachim Nilsson 837d8c1e16 Maintenance and release checklist
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-04-06 12:51:44 +02:00
Joachim Nilsson a334d230a1 Update copyright years
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-04-06 12:45:50 +02:00
Joachim Nilsson 2a709f739d Reverse christmas tree and simplify a bit
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-04-06 12:45:29 +02:00
Joachim Nilsson d4096c8c0c Simplify ingress, example and origin
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-04-06 12:23:48 +02:00
Joachim Nilsson 38858488b9 Update ChangeLog with new eventfd support
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-04-05 06:48:43 +02:00
Joachim Nilsson 90048e5996 Add support for generic events using Linux eventfd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-10-08 07:15:40 +02:00
Joachim Nilsson fd89af6ca1 Minor, fix old copy-paste error in comment
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-10-08 07:14:54 +02:00
Joachim Nilsson 399d75a05c Bump version for new release cycle
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-10-08 07:14:32 +02:00
Joachim Nilsson 6439a34670 Minor, reorder watchers a bit => same order in all functions
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-10-08 07:13:05 +02:00
37 changed files with 569 additions and 142 deletions

No files matched your search

+8 -3
View File
@@ -87,6 +87,11 @@ int uev_signal_init (uev_ctx_t *ctx, uev_t *w, uev_cb_t *cb, void *arg, int sign
int uev_signal_set (uev_t *w, int signo); /* Change signal to wait for */ int uev_signal_set (uev_t *w, int signo); /* Change signal to wait for */
int uev_signal_start(uev_t *w); /* Restart a stopped signal watcher */ int uev_signal_start(uev_t *w); /* Restart a stopped signal watcher */
int uev_signal_stop (uev_t *w); /* Stop signal watcher */ int uev_signal_stop (uev_t *w); /* Stop signal watcher */
/* Generic event watcher, post events for later processing, or from forked child */
int uev_event_init (uev_ctx_t *ctx, uev_t *w, uev_cb_t *cb, void *arg);
int uev_event_post (uev_t *w);
int uev_event_stop (uev_t *w);
``` ```
@@ -309,16 +314,16 @@ static void joystick_cb(uev_t *w, void *arg, int events)
int main(void) int main(void)
{ {
int fd;
uev_t watcher;
uev_ctx_t ctx; uev_ctx_t ctx;
uev_t js;
int fd;
fd = open("/dev/input/js0", O_RDONLY, O_NONBLOCK); fd = open("/dev/input/js0", O_RDONLY, O_NONBLOCK);
if (fd < 0) if (fd < 0)
errx(errno, "Cannot find a joystick attached."); errx(errno, "Cannot find a joystick attached.");
uev_init(&ctx); uev_init(&ctx);
uev_io_init(&ctx, &watcher, joystick_cb, NULL, fd, UEV_READ); uev_io_init(&ctx, &js, joystick_cb, NULL, fd, UEV_READ);
puts("Starting, press Ctrl-C to exit."); puts("Starting, press Ctrl-C to exit.");
+1 -1
View File
@@ -1,5 +1,5 @@
Current maintainer of libuEv: Current maintainer of libuEv:
Joachim Nilsson <troglobit()gmail!com> Joachim Wiberg <troglobit()gmail!com>
Original LibUEvent author: Original LibUEvent author:
Flemming Madsen <flemming!madsen()madsensoft!dk> Flemming Madsen <flemming!madsen()madsensoft!dk>
+31 -1
View File
@@ -3,6 +3,33 @@ Change Log
All notable changes to the project are documented in this file. All notable changes to the project are documented in this file.
[v2.3.2][] - 2021-02-12
-----------------------
### Changes
- Copyright updates, including LICENSE file, year + author last name
- Add tar.gz archives to distribution
- Enable .sha256 checksums for all tarballs
### Fixes
- Debian packaging fixes only
[v2.3.1][] - 2020-02-22
-----------------------
### Fixes
- Debian packaging fixes only
[v2.3.0][] - 2019-04-06
-----------------------
### Changes
- Support for Linux eventfd, `uev_event_*()` see [API.md][] for details
[v2.2.0][] - 2018-10-04 [v2.2.0][] - 2018-10-04
----------------------- -----------------------
@@ -384,7 +411,10 @@ v0.0.1 - 2012-03-17
Lua users mailing list. Lua users mailing list.
[UNRELEASED]: https://github.com/troglobit/libuev/compare/v2.2.0...HEAD [UNRELEASED]: https://github.com/troglobit/libuev/compare/v2.3.2...HEAD
[v2.3.2]: https://github.com/troglobit/libuev/compare/v2.3.1...v2.3.2
[v2.3.1]: https://github.com/troglobit/libuev/compare/v2.3.0...v2.3.1
[v2.3.0]: https://github.com/troglobit/libuev/compare/v2.2.0...v2.3.0
[v2.2.0]: https://github.com/troglobit/libuev/compare/v2.1.3...v2.2.0 [v2.2.0]: https://github.com/troglobit/libuev/compare/v2.1.3...v2.2.0
[v2.1.3]: https://github.com/troglobit/libuev/compare/v2.1.2...v2.1.3 [v2.1.3]: https://github.com/troglobit/libuev/compare/v2.1.2...v2.1.3
[v2.1.2]: https://github.com/troglobit/libuev/compare/v2.1.1...v2.1.2 [v2.1.2]: https://github.com/troglobit/libuev/compare/v2.1.1...v2.1.2
+106
View File
@@ -0,0 +1,106 @@
Maintenance and Release Checklist
=================================
Maintenance
-----------
* Encourage contributors to write tests, in particular for new features
* Run tests regularly, use Travis-CI to do this automatically
* Leverage GitHub issues for milestone planning
* Reference issues from GitHub pull requests to alert issue subscribers
* Bump library ABI version just before release!
Release Checklist
-----------------
* Update ChangeLog, follow http://keepachangelog.com/ loosely
- Inform users in a plain language of changes and bug fixes
- Do *not* copy-paste GIT commit logs!
- Order entries according to importance, most relevant first
* Run unit tests: `make check`
* Make at least one `-rcN` release and test it in an actual real project
* **REMEMBER:** bump ABI version according to below rules
* Tag
* Push last commit(s) *and* tags to GitHub
* Make release
make distclean
./autogen.sh
./configure
make release
* Create new release in GitHub releases page
* Copy and paste ChangeLog entry, check any stale links!
* Upload release tarball and MD5 files
Library Versioning
------------------
libuEv relies on GNU Libtool for building the library. For users of the
library it is important to maintain a clear ABI versioning scheme. This
is not the same as the libuEv version, but rather its "compatibility
level".
The libuEv ABI version is specified in `src/Makefile.am`:
libuev_la_LDFLAGS = -version-info 0:0:0
\ \ `-- age
\ `--- revision
`---- current
It must be updated according to the [GNU Libtool recommendations][1]:
1. Start with version information of `0:0:0` for each libtool library.
2. Update the version information only immediately before a public
release of your software. More frequent updates are unnecessary, and
only guarantee that the current interface number gets larger faster.
3. If the library *source code has changed at all* since the last update,
then increment revision (`c:r:a` becomes `c:r+1:a`).
4. If any *interfaces have been added, removed, or changed* since the
last update, increment current, and set revision to 0.
5. If any *interfaces have been added* since the last public release,
then increment age.
6. If any *interfaces have been removed or changed* since the last
public release, then set age to 0.
The libtool ABI versioning logic is very confusing but works if you just
disable your brain and follow the rules, one by one.
**Example #1:** a new function has been added, none of the existing ones
have changed. The initial version is 1:0:0, we follow the rules above to
the letter: increase revision, increase current and set revision to zero,
and finally increase age. This, rather confusingly, gives us 2:0:1 which
libtool then translates to `libuev.so.1.1.0`.
**Example #2:** some existing functions are changed, they now return an
`int` instead of `void`. The initial version is 0:0:0, and we follow the
rules again: increment revision, increment current and set revision to
zero, set age to zero. This gives us 1:0:0, which is then translated to
`libuev.so.1.0.0`.
### Note
Usually, non-developers have no interest in running development versions
(releases are frequent enough), and developers are expected to know how
to juggle versions. In such an ideal world, it is good enough to bump
the library version just prior to a release, point 2.
However, if releases are few and far between, distributors may start to
use snapshots. When a distributor uses a snapshot, the distributor has
to handle the library version manually. Things can get ugly when the
distributor has released an intermediate version with a bumped library
version, and when the official release is bumped to that version, the
distributor will then have to bump the library version for the official
release, and it can be confusing if someone reports bugs on versions
that you didn't even know existed.
The problem with bumping the version with every change is that if your
interface is not finished, the version number might run away, and it
looks pretty bad if a library is at version 262. It kind of tells the
user that the library interface is volatile, which is not good for
business.
[1]: https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
+1 -1
View File
@@ -1,5 +1,5 @@
Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk> Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk>
Copyright (c) 2013-2017 Joachim Nilsson <troglobit()gmail!com> Copyright (c) 2013-2021 Joachim Wiberg <troglobit()gmail!com>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
+20 -16
View File
@@ -8,20 +8,9 @@ if ENABLE_EXAMPLES
SUBDIRS += examples SUBDIRS += examples
endif endif
## Generate .deb package
package:
@dpkg-buildpackage -uc -us -B
## Generate MD5 checksum file
MD5 = md5sum
md5-dist:
@for file in $(DIST_ARCHIVES); do \
$(MD5) $$file > $$file.md5; \
done
## Check if tagged in git ## Check if tagged in git
release-hook: release-hook:
if [ ! `git tag | grep $(PACKAGE_VERSION)` ]; then \ @if [ ! `git tag | grep $(PACKAGE_VERSION)` ]; then \
echo; \ echo; \
printf "\e[1m\e[41mCannot find release tag $(PACKAGE_VERSION)\e[0m\n"; \ printf "\e[1m\e[41mCannot find release tag $(PACKAGE_VERSION)\e[0m\n"; \
printf "\e[1m\e[5mDo release anyway?\e[0m "; read yorn; \ printf "\e[1m\e[5mDo release anyway?\e[0m "; read yorn; \
@@ -37,10 +26,25 @@ release-hook:
echo; \ echo; \
fi fi
## Generate .deb package
package:
@debuild -uc -us -B --lintian-opts --profile debian -i -I --show-overrides
## Target to run when building a release ## Target to run when building a release
release: distcheck release-hook md5-dist release: release-hook distcheck package
@for file in $(DIST_ARCHIVES); do \ @for file in $(DIST_ARCHIVES); do \
printf "$$file \tDistribution tarball\n"; \ md5sum $$file > ../$$file.md5; \
printf "$$file.md5\t"; cat $$file.md5 | cut -f1 -d' '; \ sha256sum $$file > ../$$file.sha256; \
mv $$file* ../; \ done
@mv $(DIST_ARCHIVES) ../
@echo
@echo "Resulting release files:"
@echo "================================================================="
@for file in $(DIST_ARCHIVES); do \
printf "%-32s Distribution tarball\n" $$file; \
printf "%-32s " $$file.md5; cat ../$$file.md5 | cut -f1 -d' '; \
printf "%-32s " $$file.sha256; cat ../$$file.sha256 | cut -f1 -d' '; \
done
@for file in `cd ..; ls $(PACKAGE)*_$(VERSION)*`; do \
printf "%-32s Debian/Ubuntu package\n" $$file; \
done done
+29 -24
View File
@@ -1,5 +1,5 @@
libuEv | Simple event loop for Linux µEv | Simple event loop for Linux
==================================== ==================================
[![Travis Status][]][Travis] [![Coverity Status][]][Coverity Scan] [![Travis Status][]][Travis] [![Coverity Status][]][Coverity Scan]
@@ -20,10 +20,10 @@ libuEv | Simple event loop for Linux
Introduction Introduction
------------ ------------
[libuEv][] is a simple event loop in the style of the more established [libuEv][] is a small event loop that wraps the Linux `epoll()` family
[libevent][1], [libev][2] and the venerable [Xt(3)][3] event loop. The of APIs. It is similar to the more established [libevent][], [libev][]
*u* (micro) in the name refers to both the small feature set and the and the venerable [Xt(3)][] event loop. The *µ* in the name refers to
small size overhead impact of the library. both its limited feature set and the size impact of the library.
Failure mode changes introduced in v2.0 may affect users of v1.x, See Failure mode changes introduced in v2.0 may affect users of v1.x, See
the [ChangeLog][] for the full details. the [ChangeLog][] for the full details.
@@ -34,12 +34,13 @@ The [API documentation](API.md) is available as a separate document.
Example Example
------- -------
Notice below how watcher `UEV_ERROR` conditions must be handled by each Notice how watcher conditions like `UEV_ERROR` must be handled by each
callback. I/O watchers must also check for `UEV_HUP`. Both errors are callback. I/O watchers must also check for `UEV_HUP`. Both errors are
usually fatal, libuEv makes sure to stop each watcher before a callback usually fatal, libuEv makes sure to stop each watcher before a callback
runs, leaving it up to the callback to take appropriate action. runs, leaving it up to the callback to take appropriate action.
```C ```C
/* Set up a timer watcher to call cb() every other second */
#include <stdio.h> #include <stdio.h>
#include <uev/uev.h> #include <uev/uev.h>
@@ -49,16 +50,16 @@ static void cb(uev_t *w, void *arg, int events)
puts("Problem with timer, attempting to restart."); puts("Problem with timer, attempting to restart.");
uev_timer_start(w); uev_timer_start(w);
} }
puts("Every other second"); puts("Every other second");
} }
int main(void) int main(void)
{ {
uev_t timer;
uev_ctx_t ctx; uev_ctx_t ctx;
uev_t timer;
uev_init(&ctx); uev_init(&ctx);
/* Set up a timer watcher to call cb() every other second */
uev_timer_init(&ctx, &timer, cb, NULL, 2 * 1000, 2 * 1000); uev_timer_init(&ctx, &timer, cb, NULL, 2 * 1000, 2 * 1000);
return uev_run(&ctx, 0); return uev_run(&ctx, 0);
@@ -82,36 +83,40 @@ sudo make install-strip
sudo ldconfig sudo ldconfig
``` ```
The resulting .so file is ~14 kiB. The resulting .so library is ~23 kiB.
To build from GIT sources; clone the repository and run the `autogen.sh`
script. This requires GNU `automake`, `autoconf` amd `libtool` to be
installed on your system. (If you build from a released tarball you do
not need them.)
Origin & References Origin & References
------------------- -------------------
[libuEv][] originates from [LibUEvent][8] by [Flemming Madsen][], but [libuEv][] is developed and maintained by [Joachim Wiberg][] on GitHub.
with a rewritten and much cleaner API. It is now more similar to the It is primarily built for and developed on GNU/Linux systems, patches to
famous [libev][2] by [Mark Lehmann][]. Another library inspiring this support the BSD [kqueue][] interface are most welcome.
project is [picoev][9] by [Oku Kazuho][].
[libuEv][] is developed and maintained by [Joachim Nilsson][]. It is Originally based on [LibUEvent][] by [Flemming Madsen][], uEv has since
built for and developed on GNU/Linux systems, patches to support *BSD evolved to support all of the Linux `epoll()` family APIs. It is now
and its [kqueue][] interface are most welcome. more similar to the excellent [libev][] by [Mark Lehmann][], with some
inspiration also from [picoev][] by [Oku Kazuho][].
[1]: http://libevent.org
[2]: http://software.schmorp.de/pkg/libev.html
[3]: http://unix.com/man-page/All/3x/XtDispatchEvent
[8]: http://code.google.com/p/libuevent/
[9]: https://github.com/kazuho/picoev
[ChangeLog]: https://github.com/troglobit/libuev/blob/master/ChangeLog.md [ChangeLog]: https://github.com/troglobit/libuev/blob/master/ChangeLog.md
[Travis]: https://travis-ci.org/troglobit/libuev [Travis]: https://travis-ci.org/troglobit/libuev
[Travis Status]: https://travis-ci.org/troglobit/libuev.png?branch=master [Travis Status]: https://travis-ci.org/troglobit/libuev.png?branch=master
[Coverity Scan]: https://scan.coverity.com/projects/3846 [Coverity Scan]: https://scan.coverity.com/projects/3846
[Coverity Status]: https://scan.coverity.com/projects/3846/badge.svg [Coverity Status]: https://scan.coverity.com/projects/3846/badge.svg
[libevent]: https://libevent.org
[Xt(3)]: https://unix.com/man-page/All/3x/XtDispatchEvent
[LibUEvent]: https://code.google.com/p/libuevent/
[picoev]: https://github.com/kazuho/picoev
[libev]: http://software.schmorp.de/pkg/libev.html
[LibuEv]: https://github.com/troglobit/libuev [LibuEv]: https://github.com/troglobit/libuev
[kqueue]: https://github.com/mheily/libkqueue [kqueue]: https://github.com/mheily/libkqueue
[Oku Kazuho]: https://github.com/kazuho [Oku Kazuho]: https://github.com/kazuho
[Mark Lehmann]: http://software.schmorp.de [Mark Lehmann]: http://software.schmorp.de
[Joachim Nilsson]: http://troglobit.com [Joachim Wiberg]: http://troglobit.com
[Flemming Madsen]: http://www.madsensoft.dk [Flemming Madsen]: http://www.madsensoft.dk
[Dave Zarzycki, Apple]: http://www.youtube.com/watch?v=cD_s6Fjdri8
+4 -2
View File
@@ -1,5 +1,6 @@
AC_INIT(libuev, 2.2.0, https://github.com/troglobit/libuev/issues) AC_INIT(libuev, 2.3.2, https://github.com/troglobit/libuev/issues)
AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz]) AC_CONFIG_AUX_DIR(aux)
AM_INIT_AUTOMAKE([1.11 foreign dist-xz])
AM_SILENT_RULES([yes]) AM_SILENT_RULES([yes])
AC_CONFIG_SRCDIR(src/uev.c) AC_CONFIG_SRCDIR(src/uev.c)
@@ -8,6 +9,7 @@ AC_CONFIG_FILES([Makefile src/libuev.pc src/Makefile examples/Makefile tests/Mak
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC AC_PROG_CC
AC_PROG_INSTALL
m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
LT_INIT LT_INIT
+2 -2
View File
@@ -9,6 +9,6 @@ based operating system, e.g. Debian, Ubuntu, Linux Mint, etc.
Recommended reading is the upstream README and API docs. Recommended reading is the upstream README and API docs.
less /usr/share/doc/libuev-dev/README.md less /usr/share/doc/libuev-dev/README.md
zless /usr/share/doc/libuev-dev/API.md.gz less /usr/share/doc/libuev-dev/API.md
-- Joachim Nilsson <troglobit@gmail.com> Thu, 21 Sep 18:10, 2017 -- Joachim Nilsson <troglobit@gmail.com> Sat, 6 Apr 13:18, 2019
+20
View File
@@ -1,3 +1,23 @@
libuev (2.3.2) stable; urgency=low
* Copyright updates, including LICENSE file, year + author last name
* Debian packaging fixes, including a .symbols file
-- Joachim Wiberg <troglobit@gmail.com> Fri, 12 Feb 2021 09:36:39 +0100
libuev (2.3.1) stable; urgency=high
* Step library name to match SONAME, found by lintian
* Update Build-Depends to debhelper >= 10, drop other deps
-- Joachim Nilsson <troglobit@gmail.com> Sat, 22 Feb 2020 15:50:06 +0100
libuev (2.3.0) unstable; urgency=medium
* Support for Linux eventfd, uev_event_*(), see API.md for details.
-- Joachim Nilsson <troglobit@gmail.com> Thu, 06 Apr 2019 13:09:31 +0200
libuev (2.2.0) unstable; urgency=medium libuev (2.2.0) unstable; urgency=medium
* Replaced BSD queue.h with own linked list implementation. This means * Replaced BSD queue.h with own linked list implementation. This means
+1 -1
View File
@@ -1 +1 @@
9 10
+25 -24
View File
@@ -1,39 +1,40 @@
Source: libuev Source: libuev
Priority: optional
Maintainer: Joachim Nilsson <troglobit@gmail.com>
Build-Depends: dpkg-dev (>= 1.14.9), debhelper (>= 9), dh-autoreconf
Standards-Version: 3.9.6
Section: libs Section: libs
Priority: optional
Maintainer: Joachim Wiberg <troglobit@gmail.com>
Build-Depends: debhelper (>= 10), libtool
Standards-Version: 4.3.0
Homepage: https://github.com/troglobit/libuev/ Homepage: https://github.com/troglobit/libuev/
Vcs-Git: https://github.com/troglobit/libuev.git
Vcs-Browser: https://github.com/troglobit/libuev/ Vcs-Browser: https://github.com/troglobit/libuev/
Vcs-Git: https://github.com/troglobit/libuev.git
Package: libuev-dev Package: libuev-dev
Priority: extra Priority: optional
Section: libdevel Section: libdevel
Architecture: any Architecture: any
Depends: ${misc:Depends}, libuev (= ${binary:Version}) Depends: ${misc:Depends}, libuev2 (= ${binary:Version})
Description: static library, header files, and docs for libuev Description: static library, header files, and docs for libuev
Static library, header files, and documentation for libuev. Static library, header files, and documentation for libuEv
. .
libuEv is a simple event loop in the style of the more established libuEv is a small event loop that wraps the Linux epoll() family of APIs.
libevent, libev and the venerable Xt(3) event loop. The u (micro) in the It is similar to the more established libevent, libev and the venerable
name refers to both the small feature set and the small size overhead Xt(3) event loop. The u (micro) in the name refers to both its limited
impact of the library. feature set and the small size impact of the library.
. .
Experienced developers may appreciate that libuEv is built on top of Experienced developers may appreciate libuEv is built on top of modern
modern Linux APIs: epoll, timerfd and signalfd. Note however, a certain Linux APIs like epoll, eventfd, timerf, and signalfd.
amount of care is needed when dealing with APIs that employ signalfd.
Package: libuev Package: libuev2
Replaces: libuev
Conflicts: libuev
Provides: libuev
Architecture: any Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends} Depends: ${misc:Depends}, ${shlibs:Depends}
Description: Lightweight event loop library Description: Lightweight event loop library for Linux
libuEv is a simple event loop in the style of the more established libuEv is a small event loop that wraps the Linux epoll() family of APIs.
libevent, libev and the venerable Xt(3) event loop. The u (micro) in the It is similar to the more established libevent, libev and the venerable
name refers to both the small feature set and the small size overhead Xt(3) event loop. The u (micro) in the name refers to both its limited
impact of the library. feature set and the small size impact of the library.
. .
Experienced developers may appreciate that libuEv is built on top of Experienced developers may appreciate libuEv is built on top of modern
modern Linux APIs: epoll, timerfd and signalfd. Note however, a certain Linux APIs like epoll, eventfd, timerfd, and signalfd.
amount of care is needed when dealing with APIs that employ signalfd.
+28 -19
View File
@@ -1,26 +1,35 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: libuEv
Upstream-Contact: troglobit@gmail.com
Source: https.//github.com/troglobit/libuev/ Source: https.//github.com/troglobit/libuev/
Comment: Debianized by upstream on Mon, Nov 28 2016 23:23:17 +0100
Files: * Files: *
Copyright: 2013-2017 Joachim Nilsson <troglobit@gmail.com> Copyright: 2012 Flemming Madsen <flemming.madsen@madsensoft.dk>
2013-2021 Joachim Wiberg <troglobit@gmail.com>
License: MIT License: MIT
Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk>
Copyright (c) 2013-2017 Joachim Nilsson <troglobit()gmail!com>
Permission is hereby granted, free of charge, to any person obtaining a copy Files: debian/*
of this software and associated documentation files (the "Software"), to deal Copyright: 2016-2021 Joachim Wiberg <troglobit@gmail.com>
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in License: MIT
all copies or substantial portions of the Software. Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk>
Copyright (c) 2013-2021 Joachim Wiberg <troglobit()gmail!com>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR .
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, Permission is hereby granted, free of charge, to any person obtaining a copy
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE of this software and associated documentation files (the "Software"), to deal
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER in the Software without restriction, including without limitation the rights
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN copies of the Software, and to permit persons to whom the Software is
THE SOFTWARE. furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-1
View File
@@ -1 +0,0 @@
usr/lib
+2
View File
@@ -0,0 +1,2 @@
usr/lib
usr/share
View File
File renamed without changes.
+30
View File
@@ -0,0 +1,30 @@
libuev.so.2 libuev2 #MINVER#
* Build-Depends-Package: libite-dev
_uev_watcher_active@Base 2.3.0
_uev_watcher_init@Base 2.3.0
_uev_watcher_rearm@Base 2.3.0
_uev_watcher_start@Base 2.3.0
_uev_watcher_stop@Base 2.3.0
uev_cron_init@Base 2.3.0
uev_cron_set@Base 2.3.0
uev_cron_start@Base 2.3.0
uev_cron_stop@Base 2.3.0
uev_event_init@Base 2.3.0
uev_event_post@Base 2.3.0
uev_event_stop@Base 2.3.0
uev_exit@Base 2.3.0
uev_init1@Base 2.3.0
uev_init@Base 2.3.0
uev_io_init@Base 2.3.0
uev_io_set@Base 2.3.0
uev_io_start@Base 2.3.0
uev_io_stop@Base 2.3.0
uev_run@Base 2.3.0
uev_signal_init@Base 2.3.0
uev_signal_set@Base 2.3.0
uev_signal_start@Base 2.3.0
uev_signal_stop@Base 2.3.0
uev_timer_init@Base 2.3.0
uev_timer_set@Base 2.3.0
uev_timer_start@Base 2.3.0
uev_timer_stop@Base 2.3.0
+8 -1
View File
@@ -1,10 +1,17 @@
#!/usr/bin/make -f #!/usr/bin/make -f
# Uncomment this to turn on verbose mode. # Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1 #export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
%: %:
dh $@ --with autoreconf dh $@ --with autoreconf
override_dh_compress: override_dh_compress:
dh_compress -A -X.md dh_compress -A -X.md
override_dh_installchangelogs:
dh_installchangelogs ChangeLog.md
override_dh_auto_install:
dh_auto_install
find debian -name LICENSE -delete
+4 -4
View File
@@ -1,6 +1,6 @@
/* Simple example of how to use libuEv with Linux joystick API /* Simple example of how to use libuEv with Linux joystick API
* *
* Copyright (c) 2014-2017 Joachim Nilsson <troglobit()gmail!com> * Copyright (c) 2014-2021 Joachim Wiberg <troglobit()gmail!com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -74,16 +74,16 @@ static void joystick_cb(uev_t *w, void *arg, int events)
int main(void) int main(void)
{ {
int fd;
uev_t js1_watcher;
uev_ctx_t ctx; uev_ctx_t ctx;
uev_t js1;
int fd;
fd = open("/dev/input/js0", O_RDONLY, O_NONBLOCK); fd = open("/dev/input/js0", O_RDONLY, O_NONBLOCK);
if (fd < 0) if (fd < 0)
errx(errno, "Cannot find a joystick attached."); errx(errno, "Cannot find a joystick attached.");
uev_init(&ctx); uev_init(&ctx);
uev_io_init(&ctx, &js1_watcher, joystick_cb, NULL, fd, UEV_READ); uev_io_init(&ctx, &js1, joystick_cb, NULL, fd, UEV_READ);
puts("Starting, press Ctrl-C to exit."); puts("Starting, press Ctrl-C to exit.");
+2 -2
View File
@@ -47,9 +47,9 @@ void process_stdin(uev_t *w, void *arg, int events)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int ret;
uev_t watcher;
uev_ctx_t ctx; uev_ctx_t ctx;
uev_t watcher;
int ret;
uev_init(&ctx); uev_init(&ctx);
+2 -2
View File
@@ -1,8 +1,8 @@
lib_LTLIBRARIES = libuev.la lib_LTLIBRARIES = libuev.la
libuev_la_SOURCES = uev.c uev.h private.h io.c timer.c signal.c cron.c libuev_la_SOURCES = uev.c uev.h private.h io.c timer.c signal.c cron.c event.c
libuev_la_CPPFLAGS = -D_GNU_SOURCE -D_TIME_BITS=64 libuev_la_CPPFLAGS = -D_GNU_SOURCE -D_TIME_BITS=64
libuev_la_CFLAGS = -W -Wall -Wextra -std=gnu11 libuev_la_CFLAGS = -W -Wall -Wextra -std=gnu11
libuev_la_LDFLAGS = $(AM_LDFLAGS) -version-info 3:0:1 libuev_la_LDFLAGS = $(AM_LDFLAGS) -version-info 4:0:2
noinst_PROGRAMS = bench noinst_PROGRAMS = bench
bench_CPPFLAGS = -D_GNU_SOURCE bench_CPPFLAGS = -D_GNU_SOURCE
+1 -1
View File
@@ -1,7 +1,7 @@
/* libuEv - Micro event loop library /* libuEv - Micro event loop library
* *
* Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk> * Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk>
* Copyright (c) 2013-2017 Joachim Nilsson <troglobit()gmail!com> * Copyright (c) 2013-2021 Joachim Wiberg <troglobit()gmail!com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
+106
View File
@@ -0,0 +1,106 @@
/* libuEv - Micro event loop library
*
* Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk>
* Copyright (c) 2013-2021 Joachim Wiberg <troglobit()gmail!com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <errno.h>
#include <sys/eventfd.h>
#include <unistd.h> /* close(), read() */
#include "uev.h"
/**
* Create a generic event watcher
* @param ctx A valid libuEv context
* @param w Pointer to an uev_t watcher
* @param cb Callback when an event is posted
* @param arg Optional callback argument
*
* @return POSIX OK(0) or non-zero with @param errno set on error.
*/
int uev_event_init(uev_ctx_t *ctx, uev_t *w, uev_cb_t *cb, void *arg)
{
int fd;
if (!w || !ctx) {
errno = EINVAL;
return -1;
}
w->fd = -1;
fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
if (fd < 0)
return -1;
return _uev_watcher_init(ctx, w, UEV_EVENT_TYPE, cb, arg, fd, UEV_READ)
|| _uev_watcher_start(w);
}
/**
* Post a generic event
* @param w Watcher to post to
*
* @return POSIX OK(0) or non-zero with @param errno set on error.
*/
int uev_event_post(uev_t *w)
{
uint64_t val = 1;
if (!w || -1 == w->fd) {
errno = EINVAL;
return -1;
}
if (write(w->fd, &val, sizeof(val)) != sizeof(val))
return -1;
return 0;
}
/**
* Stop a generic event watcher
* @param w Watcher to stop
*
* @return POSIX OK(0) or non-zero with @param errno set on error.
*/
int uev_event_stop(uev_t *w)
{
if (!_uev_watcher_active(w))
return 0;
if (_uev_watcher_stop(w))
return -1;
close(w->fd);
w->fd = -1;
return 0;
}
/**
* Local Variables:
* indent-tabs-mode: t
* c-file-style: "linux"
* End:
*/
+1 -1
View File
@@ -1,7 +1,7 @@
/* libuEv - Micro event loop library /* libuEv - Micro event loop library
* *
* Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk> * Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk>
* Copyright (c) 2013-2017 Joachim Nilsson <troglobit()gmail!com> * Copyright (c) 2013-2021 Joachim Wiberg <troglobit()gmail!com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
+2 -1
View File
@@ -1,7 +1,7 @@
/* libuEv - Private methods and data types, do not use directly! /* libuEv - Private methods and data types, do not use directly!
* *
* Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk> * Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk>
* Copyright (c) 2013-2015 Joachim Nilsson <troglobit()gmail!com> * Copyright (c) 2013-2021 Joachim Wiberg <troglobit()gmail!com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -66,6 +66,7 @@ typedef enum {
UEV_SIGNAL_TYPE, UEV_SIGNAL_TYPE,
UEV_TIMER_TYPE, UEV_TIMER_TYPE,
UEV_CRON_TYPE, UEV_CRON_TYPE,
UEV_EVENT_TYPE,
} uev_type_t; } uev_type_t;
/* Event mask, used internally only. */ /* Event mask, used internally only. */
+3 -3
View File
@@ -1,7 +1,7 @@
/* libuEv - Micro event loop library /* libuEv - Micro event loop library
* *
* Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk> * Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk>
* Copyright (c) 2013-2017 Joachim Nilsson <troglobit()gmail!com> * Copyright (c) 2013-2021 Joachim Wiberg <troglobit()gmail!com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -34,7 +34,7 @@
* Create a signal watcher * Create a signal watcher
* @param ctx A valid libuEv context * @param ctx A valid libuEv context
* @param w Pointer to an uev_t watcher * @param w Pointer to an uev_t watcher
* @param cb Timer callback * @param cb Signal callback
* @param arg Optional callback argument * @param arg Optional callback argument
* @param signo Signal to watch for * @param signo Signal to watch for
* *
@@ -42,8 +42,8 @@
*/ */
int uev_signal_init(uev_ctx_t *ctx, uev_t *w, uev_cb_t *cb, void *arg, int signo) int uev_signal_init(uev_ctx_t *ctx, uev_t *w, uev_cb_t *cb, void *arg, int signo)
{ {
int fd;
sigset_t mask; sigset_t mask;
int fd;
if (!w || !ctx) { if (!w || !ctx) {
errno = EINVAL; errno = EINVAL;
+14 -8
View File
@@ -1,7 +1,7 @@
/* libuEv - Micro event loop library /* libuEv - Micro event loop library
* *
* Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk> * Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk>
* Copyright (c) 2013-2017 Joachim Nilsson <troglobit()gmail!com> * Copyright (c) 2013-2021 Joachim Wiberg <troglobit()gmail!com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -49,18 +49,24 @@ static void msec2tspec(int msec, struct timespec *ts)
* @param timeout Timeout in milliseconds before @param cb is called * @param timeout Timeout in milliseconds before @param cb is called
* @param period For periodic timers this is the period time that @param timeout is reset to * @param period For periodic timers this is the period time that @param timeout is reset to
* *
* For one-shot timers you set @param period to zero and only use @param * This function creates, and optionally starts, a timer watcher. There
* timeout. For periodic timers you likely set @param timeout to either * are two types of timers: one-shot and periodic.
* zero, to call it as soon as the event loop starts, or to the same *
* value as @param period. When the timer expires, the @param cb * One-shot timers only use @param timeout, @param period is zero.
* is called, with the optional @param arg argument. A non-periodic *
* timer ends its life there, while a periodic task's @param timeout is * Periodic timers can either start their life disabled, with @param
* reset to the @param period and restarted. * timeout set to zero, or with the same value as @param period.
*
* When the timeout expires, for either of the two types, @param cb is
* called, with the optional @param arg argument. A one-shot timer ends
* its life there, while a periodic task's @param timeout is reset to
* the @param period and restarted.
* *
* A timer is automatically started if the event loop is already * A timer is automatically started if the event loop is already
* running, otherwise it is kept on hold until triggered by calling * running, otherwise it is kept on hold until triggered by calling
* uev_run(). * uev_run().
* *
* @see uev_timer_set
* @return POSIX OK(0) or non-zero with @param errno set on error. * @return POSIX OK(0) or non-zero with @param errno set on error.
*/ */
int uev_timer_init(uev_ctx_t *ctx, uev_t *w, uev_cb_t *cb, void *arg, int timeout, int period) int uev_timer_init(uev_ctx_t *ctx, uev_t *w, uev_cb_t *cb, void *arg, int timeout, int period)
+19 -10
View File
@@ -1,7 +1,7 @@
/* libuEv - Micro event loop library /* libuEv - Micro event loop library
* *
* Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk> * Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk>
* Copyright (c) 2013-2017 Joachim Nilsson <troglobit()gmail!com> * Copyright (c) 2013-2021 Joachim Wiberg <troglobit()gmail!com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -245,17 +245,21 @@ int uev_exit(uev_ctx_t *ctx)
continue; continue;
switch (w->type) { switch (w->type) {
case UEV_CRON_TYPE: case UEV_IO_TYPE:
case UEV_TIMER_TYPE: uev_io_stop(w);
uev_timer_stop(w);
break; break;
case UEV_SIGNAL_TYPE: case UEV_SIGNAL_TYPE:
uev_signal_stop(w); uev_signal_stop(w);
break; break;
case UEV_IO_TYPE: case UEV_TIMER_TYPE:
uev_io_stop(w); case UEV_CRON_TYPE:
uev_timer_stop(w);
break;
case UEV_EVENT_TYPE:
uev_event_stop(w);
break; break;
} }
} }
@@ -285,8 +289,8 @@ int uev_exit(uev_ctx_t *ctx)
*/ */
int uev_run(uev_ctx_t *ctx, int flags) int uev_run(uev_ctx_t *ctx, int flags)
{ {
int timeout = -1;
uev_t *w; uev_t *w;
int timeout = -1;
if (!ctx || ctx->fd < 0) { if (!ctx || ctx->fd < 0) {
errno = EINVAL; errno = EINVAL;
@@ -308,8 +312,8 @@ int uev_run(uev_ctx_t *ctx, int flags)
} }
while (ctx->running && ctx->watchers) { while (ctx->running && ctx->watchers) {
int i, nfds, rerun = 0;
struct epoll_event ee[UEV_MAX_EVENTS]; struct epoll_event ee[UEV_MAX_EVENTS];
int i, nfds, rerun = 0;
/* Handle special case: `application < file.txt` */ /* Handle special case: `application < file.txt` */
if (ctx->workaround) { if (ctx->workaround) {
@@ -345,9 +349,9 @@ int uev_run(uev_ctx_t *ctx, int flags)
} }
for (i = 0; ctx->running && i < nfds; i++) { for (i = 0; ctx->running && i < nfds; i++) {
uint64_t exp;
uint32_t events;
struct signalfd_siginfo fdsi; struct signalfd_siginfo fdsi;
uint32_t events;
uint64_t exp;
ssize_t sz = sizeof(fdsi); ssize_t sz = sizeof(fdsi);
w = (uev_t *)ee[i].data.ptr; w = (uev_t *)ee[i].data.ptr;
@@ -396,6 +400,11 @@ int uev_run(uev_ctx_t *ctx, int flags)
if (!w->u.c.when) if (!w->u.c.when)
uev_timer_stop(w); uev_timer_stop(w);
break; break;
case UEV_EVENT_TYPE:
if (read(w->fd, &exp, sizeof(exp)) != sizeof(exp))
events = UEV_HUP;
break;
} }
/* /*
+7 -2
View File
@@ -1,7 +1,7 @@
/* libuEv - Micro event loop library /* libuEv - Micro event loop library
* *
* Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk> * Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk>
* Copyright (c) 2013-2015 Joachim Nilsson <troglobit()gmail!com> * Copyright (c) 2013-2021 Joachim Wiberg <troglobit()gmail!com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -47,9 +47,10 @@
/* Macros */ /* Macros */
#define uev_io_active(w) _uev_watcher_active(w) #define uev_io_active(w) _uev_watcher_active(w)
#define uev_signal_active(w) _uev_watcher_active(w)
#define uev_timer_active(w) _uev_watcher_active(w) #define uev_timer_active(w) _uev_watcher_active(w)
#define uev_cron_active(w) _uev_watcher_active(w) #define uev_cron_active(w) _uev_watcher_active(w)
#define uev_signal_active(w) _uev_watcher_active(w) #define uev_event_active(w) _uev_watcher_active(w)
/* Event watcher */ /* Event watcher */
typedef struct uev { typedef struct uev {
@@ -100,6 +101,10 @@ int uev_signal_set (uev_t *w, int signo);
int uev_signal_start (uev_t *w); int uev_signal_start (uev_t *w);
int uev_signal_stop (uev_t *w); int uev_signal_stop (uev_t *w);
int uev_event_init (uev_ctx_t *ctx, uev_t *w, uev_cb_t *cb, void *arg);
int uev_event_post (uev_t *w);
int uev_event_stop (uev_t *w);
#endif /* LIBUEV_UEV_H_ */ #endif /* LIBUEV_UEV_H_ */
/** /**
+1
View File
@@ -6,3 +6,4 @@ complete
cronrun cronrun
signal signal
timer timer
event
+1
View File
@@ -8,6 +8,7 @@ TESTS += complete
TESTS += cronrun TESTS += cronrun
TESTS += signal TESTS += signal
TESTS += timer TESTS += timer
TESTS += event
check_PROGRAMS = $(TESTS) check_PROGRAMS = $(TESTS)
+1 -1
View File
@@ -38,8 +38,8 @@ static void cb(uev_t *w, void *arg, int events)
int main(void) int main(void)
{ {
uev_ctx_t ctx;
struct timeval tomorrow; struct timeval tomorrow;
uev_ctx_t ctx;
gettimeofday(&tomorrow, NULL); gettimeofday(&tomorrow, NULL);
tomorrow.tv_sec += 24 * 60 * 60; tomorrow.tv_sec += 24 * 60 * 60;
+1 -1
View File
@@ -1,7 +1,7 @@
/* Test libuEv event library /* Test libuEv event library
* *
* Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk> * Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk>
* Copyright (c) 2013-2015 Joachim Nilsson <troglobit()gmail!com> * Copyright (c) 2013-2021 Joachim Wiberg <troglobit()gmail!com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
+5 -5
View File
@@ -1,6 +1,6 @@
/* Test cron API in libuEv event library /* Test cron API in libuEv event library
* *
* Copyright (c) 2016 Joachim Nilsson <troglobit()gmail!com> * Copyright (c) 2016-2021 Joachim Wiberg <troglobit()gmail!com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -33,8 +33,8 @@ struct timeval tv;
static void cron_job(uev_t *w, void *arg, int events) static void cron_job(uev_t *w, void *arg, int events)
{ {
static int laps = 3;
struct timeval now; struct timeval now;
static int laps = 3;
if (UEV_ERROR == events) if (UEV_ERROR == events)
fprintf(stderr, "cron watcher failed, ignoring ...\n"); fprintf(stderr, "cron watcher failed, ignoring ...\n");
@@ -54,10 +54,10 @@ static void cron_job(uev_t *w, void *arg, int events)
int main(void) int main(void)
{ {
int rc;
uev_t cron_watcher;
uev_ctx_t ctx; uev_ctx_t ctx;
time_t when, interval; time_t when, interval;
uev_t cron;
int rc;
uev_init(&ctx); uev_init(&ctx);
@@ -68,7 +68,7 @@ int main(void)
printf("Expected cron %s", ctime(&when)); printf("Expected cron %s", ctime(&when));
interval = INTERVAL; interval = INTERVAL;
uev_cron_init(&ctx, &cron_watcher, cron_job, NULL, when, interval); uev_cron_init(&ctx, &cron, cron_job, NULL, when, interval);
rc = uev_run(&ctx, 0); rc = uev_run(&ctx, 0);
fail_unless(result == 0); fail_unless(result == 0);
+78
View File
@@ -0,0 +1,78 @@
/* Verifies eventfd support
*
* Copyright (c) 2018-2021 Joachim Wiberg <troglobit@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "check.h"
#include <err.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
#define LAPS 10
pid_t pid;
static void cb(uev_t *w, void *arg, int events)
{
static int num = LAPS;
num--;
// printf("Got event %d ...\n", LAPS - num);
if (num == 0) {
waitpid(pid, NULL, 0);
uev_exit(w->ctx);
}
}
int main(void)
{
uev_ctx_t ctx;
uev_t ev;
int i;
/* Initialize libuEv */
uev_init(&ctx);
/* Setup callbacks */
uev_event_init(&ctx, &ev, cb, NULL);
pid = fork();
if (-1 == pid)
err(1, "fork");
/* Start event loop */
if (pid > 0)
return uev_run(&ctx, 0);
for (i = 0; i < LAPS; i++) {
uev_event_post(&ev);
usleep(10000);
}
return 0;
}
/**
* Local Variables:
* indent-tabs-mode: t
* c-file-style: "linux"
* End:
*/
+3 -3
View File
@@ -1,6 +1,6 @@
/* Multiple signals, segfault and fork() to test sub-processes. /* Multiple signals, segfault and fork() to test sub-processes.
* *
* Copyright (c) 2015 Joachim Nilsson <troglobit@gmail.com> * Copyright (c) 2015-2021 Joachim Wiberg <troglobit@gmail.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -81,8 +81,8 @@ static void sigchld_cb(uev_t *w, void *arg, int events)
static void work_cb(uev_t *w, void *arg, int events) static void work_cb(uev_t *w, void *arg, int events)
{ {
int status = 0;
pid_t pid; pid_t pid;
int status = 0;
pid = fork(); pid = fork();
if (-1 == pid) if (-1 == pid)
@@ -113,8 +113,8 @@ static void exit_cb(uev_t *w, void *arg, int events)
int main(void) int main(void)
{ {
uev_t sigsegv_watcher, sigchld_watcher, timeout_watcher, deadline_watcher;
uev_ctx_t ctx; uev_ctx_t ctx;
uev_t sigsegv_watcher, sigchld_watcher, timeout_watcher, deadline_watcher;
/* Initialize libuEv */ /* Initialize libuEv */
uev_init(&ctx); uev_init(&ctx);
+2 -2
View File
@@ -23,9 +23,9 @@ static void cb(uev_t *w, void *arg, int events)
int main(void) int main(void)
{ {
int rc;
uev_t w;
uev_ctx_t ctx; uev_ctx_t ctx;
uev_t w;
int rc;
uev_init(&ctx); uev_init(&ctx);
uev_timer_init(&ctx, &w, cb, NULL, TIMEOUT * 1000, 0); uev_timer_init(&ctx, &w, cb, NULL, TIMEOUT * 1000, 0);