
Introducing Sd-Event: The Event Loop API of Libsystemd - maxmouchet
http://0pointer.net/blog/introducing-sd-event.html
======
vezzy-fnord
sd-event was announced to be the next systemd-private interface turned public
after sd-bus a while ago, and here we are.

If anything, it only further convinces me what a leaky abstraction epoll(7)
is, plus all the myriad of *fd calls that really just canonize things like the
self-pipe trick in the completely wrong layers. I'd probably use something
like libkqueue if I wanted a minimal event loop.

~~~
bcantrill
Agreed -- implementing epoll(7) for LX-branded zones on SmartOS[1] was a bit
of a shock in terms of how unbelievably broken the abstraction is. I had
assumed (ha!) that epoll(7) would have been inspired by the prior art: I/O
completion ports on Windows, kqueue on the BSDs, and event ports on Solaris.
Instead, despite being the last to the party, epoll(7) is but a more efficient
variant of poll(2) -- retaining the broken-by-design aspects of poll(2) with
respect to multi-threaded programs. (For details on these conditions, consult
the strange Q&A in the epoll(7) man page[2] or the aborted attempt to rectify
it with EPOLL_CTL_DISABLE[3].) I suppose that sd-event may represent an
improvement in that it attempts to patch some of the leaks in the abstraction
-- but I (certainly) agree that kqueue represents a much better design, and to
the degree that libkqueue is able to provide that abstraction on Linux, a much
better alternative.

[1] [http://www.slideshare.net/bcantrill/illumos-
lx](http://www.slideshare.net/bcantrill/illumos-lx)

[2] [http://man7.org/linux/man-
pages/man7/epoll.7.html](http://man7.org/linux/man-pages/man7/epoll.7.html)

[3] [https://lwn.net/Articles/520198/](https://lwn.net/Articles/520198/)

~~~
protomyth
Your BSD Now interview[1] where you talk about epoll/kthread is informative
and entertaining. The whole interview is worth watching.

1)
[http://www.bsdnow.tv/episodes/2015_08_19-ubuntu_slaughters_k...](http://www.bsdnow.tv/episodes/2015_08_19-ubuntu_slaughters_kittens)
around 55:59

~~~
twoodfin
The story about restricting rm -rf / without violating the letter of the
standard is also great stuff.

~~~
protomyth
That's probably a good question to ask about any piece of software or
standard: "Be honest, Is there a way that your software or software written to
the specification could render the computer unusable for someone not trying to
render the computer unusable?"

------
striking
I am confused about the fact that this is "something that allows us access to
all the Linux-specific bits, instead of limiting itself to the least common
denominator of UNIX." Doesn't that make anything written with this
incompatible with, say, FreeBSD or MacOS?

~~~
msbarnett
The systemd project doesn't value portability at all and everything they
release is basically tied to Linux only

~~~
0xFFC
I think personally (I may be wrong , please correct me) this was a huge push
from Redhat , because they want a Workstation , and with old design (having
SysVInit with whole bunch of small and separated stuff) and without launchd
clone in Linux world they think they cannot achieve that goal.

~~~
vezzy-fnord
Ironically enough, sysvinit and sysv-rc weren't particularly good on the whole
"small and separated" aspect [1]. This has been known for a while, and a lot
of work has been done to address the problem domain, much of it understudied
and not well known [2].

I don't think Red Hat had all that much of a stake initially. Kay Sievers was
actually a SUSE employee at the time systemd was conceived for public release,
IIRC.

Red Hat's interests seem far more directed at cloud and containers (see:
Project Atomic) than workstations, and indeed the direction systemd has been
heading reflects that.

[1]
[http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/sy...](http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/system-5-rc-
problems.html)

[2]
[http://blog.darknedgy.net/technology/2015/09/05/0/](http://blog.darknedgy.net/technology/2015/09/05/0/)

------
JdeBP
Duplicates
[https://news.ycombinator.com/item?id=10601046](https://news.ycombinator.com/item?id=10601046)
.

------
kator
One more step closer to launchd?

~~~
vezzy-fnord
systemd has long been a functional superset of launchd.

