Bug 223530 - devel/libepoll-shim: Update version
Summary: devel/libepoll-shim: Update version
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-x11 (Nobody)
Depends on:
Blocks: 222905
  Show dependency treegraph
Reported: 2017-11-08 12:18 UTC by Greg V
Modified: 2018-12-19 11:47 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (x11)

libepoll-shim.patch (1.20 KB, patch)
2017-11-08 12:18 UTC, Greg V
no flags Details | Diff
Updated patch 20171220 (1.20 KB, patch)
2017-12-20 11:03 UTC, Johannes Lundberg
no flags Details | Diff
epoll-shim.patch (2.74 KB, patch)
2018-01-22 15:10 UTC, Greg V
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Greg V 2017-11-08 12:18:22 UTC
Created attachment 187851 [details]

The old version is broken now: it doesn't link to librt, but uses timer_ symbols from it. So linking anything (e.g. libinput) to libepoll-shim failed on the old version.

Plus, the new version is better in general.
Comment 1 Niclas Zeising freebsd_committer 2017-12-16 19:52:09 UTC
Working on this
Comment 2 Vladimir Kondratyev freebsd_committer 2017-12-16 23:05:51 UTC
It is better to update this port to latest d7abd75 commit as it contains some timerfd stability fixes. I attached a patch to PR/222905 as part of libinput-1.9.4.patch (https://bugs.freebsd.org/bugzilla/attachment.cgi?id=188894).
Comment 3 Johannes Lundberg 2017-12-17 12:13:24 UTC
If you're going to transfer back to jiixyj's repo, make sure it contains the improvements we've done on the FreeBSDDesktop repo.
Comment 4 Johannes Lundberg 2017-12-17 12:15:48 UTC
The reason we forked was that the original repo was not maintained and we failed to get in contact with the developer. We should also make sure that jiixyj is committed to maintaining the library otherwise we might as well keep using our fork.
Comment 5 Niclas Zeising freebsd_committer 2017-12-17 13:00:02 UTC
I don't care which version we use, as long as it works.  Can you help in pointing out which changes were made to the FreeBSDdesktop repo, that might not have been backported, or perhaps update the FreeBSDDesktop version?

As far as I understand, we need this updated to update libinput and friends.
Comment 6 Vladimir Kondratyev freebsd_committer 2017-12-17 21:56:58 UTC
(In reply to Niclas Zeising from comment #5)
FreeBSDDesktop repo looks like unmaintained one now. Epoll-shim fork has not been updated for a *one year*!!!
Comment 7 Johannes Lundberg 2017-12-18 09:43:35 UTC
> FreeBSDDesktop repo looks like unmaintained one now. Epoll-shim fork has not been updated for a *one year*!!!

I didn't know it was broken until now. There's no issues or PRs on github and I must have missed this bug report. It's been working fine for a year so why update if not broken? It's not like the epoll interface changes a lot... As I said, the reason for a fork was no response from the developer to PRs and issues.

I will look into what's been updated on the original repo and see what's the best solution. If the original developer wants to take back ownership I'm all for it.
Comment 8 Vladimir Kondratyev freebsd_committer 2017-12-18 12:39:27 UTC
(In reply to Johannes Lundberg from comment #7)
> I didn't know it was broken until now. There's no issues or PRs on github and I must have missed this bug report. It's been working fine for a year so why update if not broken?
It was easy to workaround with adding "-lrt -pthread" options to top level library link command. But libinput switching from autotools to meson made this kludge broken.

> It's not like the epoll interface changes a lot...
Really epoll-shim covers minimal subset of features required by libinput/wayland so if someone dared to use it for something other, he should wrote missed parts like eventfd, fcntl support, signal info e.t.c. So *this library's* epoll interface is not stable yet.

> I will look into what's been updated on the original repo and see what's the best solution. If the original developer wants to take back ownership I'm all for it.
I see no difference if original repo is used or it's mirror if mirror is up-to-date. And its possible to update repo keeping commit number in port Makefile intact to stay with old version and avoid regressions.
Comment 9 Johannes Lundberg 2017-12-20 11:03:50 UTC
Created attachment 188990 [details]
Updated patch 20171220

Seems like jiixyj's repo has been getting a lot of updates through the year and includes more improvements than ours so I agree that we switch to that repo.

I updated the patch to most recent version. 

Funny note: it's a year on the day since previous port version was created :)
Comment 10 Jan Kokemüller 2017-12-21 19:16:25 UTC
I'm the original author of the epoll-shim library. Please, if you have improvements to the library, or are seeing a bug, post an issue or PR on Github -- I've seen the freebsd-desktop branch and merged it almost a year ago.

The original reason for this lib was really just supporting libinput. I've tried to port libinput to kqueue/kevent directly, but then I thought a small epoll wrapper would be better -- the code changes to upstream could be kept to a minimum.

Also, more Wayland related projects use epoll, so in theory they should 'just work' with this library. I haven't really tried to get Wayland to work yet on my side, but it is definitely also a goal of this library. For example, I've added support for polling a DRM device. In FreeBSD, those devices don't support kqueue yet, just poll, and therefore require a special hack in epoll-shim.

In general, the library should be quite useful if you need epoll as long as you don't do anything too fancy.

That said, there are still some limitations:
 - forget fork/exec behavior as in Linux...
 - no edge triggering or other 'fancy' flags (EPOLLET, EPOLLONESHOT, EPOLLEXCLUSIVE...)
 - no eventfd support yet (but who uses this, anyway?)
 - there is just support for _one_ poll/DRM device per process (yes, I know it's currently a giant hack but it seemed to work).
 - I define 'read' and 'close' macros that point to functions of the library because signalfd and timerfd need some special handling. This is ugly, but I haven't found a more elegant way yet. This means that you cannot really call vanilla 'read'/'close' on timer- and signalfds in some other translation unit and expect everything to keep working properly. Luckily, libinput does not do this.
 - Each timerfd spawns a thread doing some custom timer/signal stuff because EVFILT_TIMER does not really support the itimer interface very well.
Comment 11 Johannes Lundberg 2017-12-22 07:15:03 UTC
(In reply to Jan Kokemüller from comment #10)

Hi Jan

Thanks for your effort! Using this shim reduces porting effort a lot in many Wayland applications/libraries :) 

Porting every single application to use kqueue just seem like such a waste of time that can be spent better elsewhere. 

A bit off-topic, but.. Actually I'm also thinking about a tty-shim so we don't need to add custom tty code for every Wayland compositor that will show up.. (down the road we probably need logind solution as well if we want to support compositors that don't support pam/tty)
Comment 12 Greg V 2017-12-23 14:39:08 UTC
(In reply to Johannes Lundberg from comment #11)
About logind, I've been thinking of (and kinda started working on) a "logind solution" of sorts…

basically a generalized version of weston-launch, a "logind without the d" — a setuid wrapper that would open drm/input devices, manage the tty, launch compositors (or Xorg!) unprivileged. Plus, like logind does, provide shutdown/reboot/suspend commands.

(BTW just realized: it could also replace \n with \r\n on the compositor's stdout/stderr to deal with FreeBSD's raw tty mode)

systemd-free Linux distros might get interested in this too I guess…
Comment 13 Greg V 2018-01-22 15:10:19 UTC
Created attachment 189971 [details]

Final update of libepoll-shim + addition of devel/py-pyudev, from https://bugs.freebsd.org/bugzilla/attachment.cgi?id=188894&action=diff (since I posted an update to 222905 that does not include these changes)
Comment 14 Niclas Zeising freebsd_committer 2018-06-10 06:56:43 UTC
I've added this update, as well as a whole bunch of other updates to a branch in our development Github tree.  The branch updates a whole lot of ports that has to do with input devices and similar.  Please help me test it.
The branch can be found here:


It contains upates to libinput, libeevdev, libwacom, xf86-input-libinput and dependencies.
Comment 15 commit-hook freebsd_committer 2018-12-19 11:43:11 UTC
A commit references this bug:

Author: zeising
Date: Wed Dec 19 11:42:51 UTC 2018
New revision: 487796
URL: https://svnweb.freebsd.org/changeset/ports/487796

  devel/libepoll-shim: Update snashot

  Update devel/libepoll-shim to a more recent snapshot.

  PR:		223530 (original version)
  Submitted by:	Greg V
  Obtained from:	FreeBSD Graphics Team development repo

Comment 16 Niclas Zeising freebsd_committer 2018-12-19 11:47:27 UTC
libepoll-shim version updated to a more recent snapshot, closing this.  Thank you for the report!