devel/libepoll-shim - The NetBSD Packages Collection

Small epoll implemented using kevent

This is a small library that implements epoll on top of kqueue. It
has been successfully used to port libinput, libevdev, Wayland and
more software to FreeBSD: https://www.freshports.org/devel/libepoll-shim/

It may be useful for porting other software that uses epoll as well.

The library provides implementation of Linux timerfd_create(2) related
APIs, eventfd(2), signalfd(2).

However, this library contains some very ugly hacks and workarounds.
For example:

- When using timerfd, signalfd or eventfd, the system calls read,
  write and close are redefined as macros to internal helper
  functions.  This is needed as there is some internal context that
  has to be free'd properly. This means that you shouldn't create
  a timerfd/signalfd in one part of a program and close it in a
  different part where sys/timerfd.h isn't included. The context
  would leak. Luckily, software such as libinput behaves very nicely
  and puts all timerfd related code in a single source file.

- There is limited support for file descriptors that lack support
  for kqueue but are supported by poll(2). This includes graphics
  or sound devices under /dev. Those descriptors are handled in an
  outer poll(2) loop. Edge triggering using EPOLLET will not work.

- Shimmed file descriptors cannot be shared between processes. On
  fork() those fds are closed. When trying to pass a shimmed fd to
  another process the sendmsg call will return EOPNOTSUPP. In most
  cases sharing epoll/timerfd/signalfd is a bad idea anyway, but
  there are some legitimate use cases (for example sharing semaphore
  eventfds, issue #23). When the OS natively supports eventfds (as
  is the case for FreeBSD >= 13) this library won't provide eventfd
  shims or the sys/eventfd.h header.

- There is no proper notification mechanism for changes to the
  system CLOCK_REALTIME clock on BSD systems. Also, kevent
  EVFILT_TIMERs use the system monotonic clock as reference.
  Therefore, in order to implement absolute (TFD_TIMER_ABSTIME)
  CLOCK_REALTIME timerfds or cancellation support
  (TFD_TIMER_CANCEL_ON_SET), a thread is spawned that periodically
  polls the system boot time for changes to the realtime clock.

The following operating systems are supported:

FreeBSD >= 11.4, >= 12.2, >= 13.0
NetBSD >= 9.1
OpenBSD >= 6.7

Build dependencies

pkgtools/cwrappers devel/cmake devel/pkgconf

Runtime dependencies

(none)

Binary packages

OSArchitectureVersion
NetBSD 8.0earmv7hflibepoll-shim-0.0.20210418.tgz
NetBSD 8.0earmv7hflibepoll-shim-0.0.20210418.tgz
NetBSD 8.0i386libepoll-shim-0.0.20210418.tgz
NetBSD 8.0powerpclibepoll-shim-0.0.20210418.tgz
NetBSD 8.0powerpclibepoll-shim-0.0.20210418.tgz
NetBSD 8.0powerpclibepoll-shim-0.0.20210418.tgz
NetBSD 8.0x86_64libepoll-shim-0.0.20210418.tgz
NetBSD 9.0aarch64libepoll-shim-0.0.20210418.tgz
NetBSD 9.0aarch64libepoll-shim-0.0.20210418.tgz
NetBSD 9.0alphalibepoll-shim-0.0.20210418.tgz
NetBSD 9.0alphalibepoll-shim-0.0.20210418.tgz
NetBSD 9.0earmlibepoll-shim-0.0.20210418.tgz
NetBSD 9.0earmlibepoll-shim-0.0.20210418.tgz
NetBSD 9.0earmv6hflibepoll-shim-0.0.20210418.tgz
NetBSD 9.0earmv6hflibepoll-shim-0.0.20210418.tgz
NetBSD 9.0earmv7hflibepoll-shim-0.0.20210418.tgz
NetBSD 9.0earmv7hflibepoll-shim-0.0.20210418.tgz
NetBSD 9.0earmv7hflibepoll-shim-0.0.20210418.tgz
NetBSD 9.0i386libepoll-shim-0.0.20210418.tgz
NetBSD 9.0m68klibepoll-shim-0.0.20210418.tgz
NetBSD 9.0mips64eblibepoll-shim-0.0.20210418.tgz
NetBSD 9.0mips64eblibepoll-shim-0.0.20210418.tgz
NetBSD 9.0mipsellibepoll-shim-0.0.20210418.tgz
NetBSD 9.0mipsellibepoll-shim-0.0.20210418.tgz
NetBSD 9.0powerpclibepoll-shim-0.0.20210418.tgz
NetBSD 9.0powerpclibepoll-shim-0.0.20210418.tgz
NetBSD 9.0powerpclibepoll-shim-0.0.20210418.tgz
NetBSD 9.0sh3ellibepoll-shim-0.0.20210418.tgz
NetBSD 9.0sh3ellibepoll-shim-0.0.20210418.tgz
NetBSD 9.0sparc64libepoll-shim-0.0.20210418.tgz
NetBSD 9.0sparc64libepoll-shim-0.0.20210418.tgz
NetBSD 9.0sparclibepoll-shim-0.0.20210418.tgz
NetBSD 9.0sparclibepoll-shim-0.0.20210418.tgz
NetBSD 9.0x86_64libepoll-shim-0.0.20210418.tgz
NetBSD 9.0x86_64libepoll-shim-0.0.20210418.tgz
NetBSD 9.0x86_64libepoll-shim-0.0.20210418.tgz
NetBSD 9.0x86_64libepoll-shim-0.0.20210418.tgz

Binary packages can be installed with the high-level tool pkgin (which can be installed with pkg_add) or pkg_add(1) (installed by default). The NetBSD packages collection is also designed to permit easy installation from source.

Available build options

(none)

Known vulnerabilities

The pkg_admin audit command locates any installed package which has been mentioned in security advisories as having vulnerabilities.

Please note the vulnerabilities database might not be fully accurate, and not every bug is exploitable with every configuration.


Problem reports, updates or suggestions for this package should be reported with send-pr.