[systemd-devel] dbus API for unit state change?

Lennart Poettering lennart at poettering.net
Thu Oct 3 05:06:23 PDT 2013


On Thu, 03.10.13 06:05, Mantas Mikulėnas (grawity at gmail.com) wrote:

> On Thu, Oct 3, 2013 at 5:27 AM, Brandon Philips <brandon at ifup.co> wrote:
> > Hello-
> >
> > While writing against the dbus bindings I found one missing feature:
> > signals from org.freedesktop.systemd1.Manager on unit "ActiveState"
> > changes.
> >
> > I can do this today by polling ListUnits but I would rather not have
> > my process doing this.
> >
> > There are two possible APIs:
> >
> > 1. Distinct signal per type
> >
> > UnitActive()
> > UnitInactive()
> > UnitReloading()
> > UnitFailed()
> > UnitActivating()
> > UnitDeactivating()
> >
> > 2. One signal type for all changes:
> >
> > UnitActiveStateChanged()
> >
> > This would encode the ActiveState and SubState in that signals
> > properties. That seems a much simpler.
> >
> > Before writing the patch I wanted to get some feedback on the API and
> > make sure this hadn't been implemented for some other reason either.
> 
> This is already handled by the PropertiesChanged signal in the
> standard org.freedesktop.DBus.Properties interface. (Although systemd
> only sends invalidated_properties and the new values have to be
> retrieved manually, so that's not really perfect yet.)

The latter is going to change soonishly btw. I am currently working on
adding automatic property handling support to libsystemd-bus. With that
in place we'll like start sending the actual property contents around
too, and not just invalidate things.

Client libraries hence need to handle PropertiesChanged signals in full,
i.e. handle both invalidating messages and the others for the same
properties even if for now only invalidating messages are sent.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list