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.
Working on this
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).
If you're going to transfer back to jiixyj's repo, make sure it contains the improvements we've done on the FreeBSDDesktop repo.
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.
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.
(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*!!!
> 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.
(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.
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 :)
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.
(In reply to Jan Kokemüller from comment #10)
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)
(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…
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)
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.
A commit references this bug:
Date: Wed Dec 19 11:42:51 UTC 2018
New revision: 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
libepoll-shim version updated to a more recent snapshot, closing this. Thank you for the report!