Alternative implementation using poll or select?
Opened this issue · 3 comments
FreeBSD users have trouble compiling this because epoll isn't portable. Providing an alternative implementation using poll or select would solve the issue, but I have no experience with those (yet).
A bit of research shows that for FreeBSD, maybe kqueue might even be the better choice, as it seems to be the functional equivalent to Linux' epoll. The only issue is that I'd have to set up another machine (or virtual machine) with FreeBSD in order to develop for it.
I almost forgot that FreeBSD users have some form of epoll, but is lacking in features as seen in these errors:
src/libkita.c: In function 'kita_child_kill':
src/libkita.c:1025:9: error: implicit declaration of function 'kill' [-Werror=implicit-function-declaration]
1025 | return kill(child->pid, SIGKILL);
| ^~~~
src/libkita.c: In function 'libkita_poll':
src/libkita.c:1389:2: error: implicit declaration of function 'sigemptyset' [-Werror=implicit-function-declaration]
1389 | sigemptyset(&sigset);
| ^~~~~~~~~~~
src/libkita.c:1390:2: error: implicit declaration of function 'sigaddset' [-Werror=implicit-function-declaration]
1390 | sigaddset(&sigset, SIGCHLD); // default: ignore
| ^~~~~~~~~
cc1: all warnings being treated as errors
This comes from the package devel/libepoll-shim so I had to add /usr/local/include/libepoll-shim to the include path. I think it might be based on
an older version of epoll, but I don't really know much about Linux system calls, so make your own guesses about this.
Pulling down Linux epoll will not solve anything due to incompatible system calls. kqueue does look like a good, compatible alternative for the FreeBSD side of things.
Interesting! I'll see if I can get libepoll-shim to work. Two things I'd like to point out:
- My current experiments with kqueue (which seem to mostly work) sit in the
kqueuebranch on thesuccadeproject, the reason being that it is easier to test there, as I can just run succade and see if things work as expected or not. Should I get kqueue to work there, then I'll copy the changes to libkita over to this repo. - You might notice that there is a
header-onlybranch here atlibkita. As I'm not expecting many people using this code anytime soon, I think having it as header only is probably better, which means that I'll probably merge that into master at some point. In other words, if you plan on doing some work, I'd suggest basing it off theheader-onlybranch.
Sorry, everything is a bit of a mess. :-)