[systemd-devel] sd-bus object manager question

David Herrmann dh.herrmann at gmail.com
Thu Jun 25 07:25:29 PDT 2015


Hi

On Tue, Jun 23, 2015 at 2:41 PM, David Härdeman <david at hardeman.nu> wrote:
> Hi,
>
> as an experiment I've tried porting a toy dbus daemon over to sd-bus. It
> seems to be working well so far and I have to say I really like the sd-bus
> API over the gdbus one (sd-bus feels like I'm still writing C...can't say
> the same thing about gdbus).
>
> Now, a question...how is an object manager supposed to be implemented in
> sd-bus?
>
> I've seen that there's a sd_bus_add_object_manager() function in sd-bus.h,
> but how would I notify the object manager when objects are added and
> removed?
>
> Two likely candidates seemed to be:
> sd_bus_emit_object_added()
> sd_bus_emit_object_removed()
>
> But calling them did not seem to do the right thing. And there seems to be
> zero usage of sd_bus_add_object_manager() in the systemd tree itself (though
> plenty of calls to sd_bus_add_node_enumerator() which might be related?).

Not sure where the confusion is. Those calls generate the
InterfacesAdded/Removed signals that the objectmanager API specifies.
They collect the interfaces based on the vtables you registered on a
given path. have a look at test-bus-objects.c which uses these
interfaces.

Thanks
David


More information about the systemd-devel mailing list