[systemd-devel] Fwd: sdbus-filedescriptor does reproducibly NOT get triggered in a specific situation

Lennart Poettering lennart at poettering.net
Thu Dec 13 11:48:31 UTC 2018


On Do, 13.12.18 12:11, Jan Mueller (janmueller.email at googlemail.com) wrote:

> Hey Lennart - thank you for the quick response!
> Ok, originally I stripped it down to select() for better comprehension.
> Swichting back to epoll + making use of sd_bus_get_events() did not help
> receiving the signals in this very situation. The basic communication
> between
> sender and receiver works fine so far though. I did already make use of
> sd_bus_get_fd() and sd_bus_process() - please see the referenced +
> updated example project:
> https://github.com/mue-jan/dbus-missing-signals-or-fd-issue
>
> By the way: sd_bus_get_events() returns "0" in the referenced code-example.
> The function-result printing is located right before the while(1) loop
> around
> epoll.

You need to call the three calls on *every* loop iteration, and update
fd/events/timeout on the epoll object before you can go to sleep. The
I/O events, timeouts, fd can change on each iteration, hence this
requirement. (Instead of epoll consider just using ppoll()/poll()
where this is easier.)

BTW, prompted by this discussion I prepped this PR, which
substantially improves the documentation on these topics:

https://github.com/systemd/systemd/pull/11127

Lennart

--
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list