Discussion:
Dynamically add and remove sd-bus paths in a process
(too old to reply)
guhan balasubramanian
2018-11-02 07:12:19 UTC
Permalink
Hi,

I have a question regarding manipulating sd-bus paths during run time.

Let us assume the calculator example from:
http://0pointer.net/blog/the-new-sd-bus-api-of-systemd.html

We host the object /net/poettering/Calculator through
net.poettering.Calculator.

I am looking for ways to add/remove objects to the service after the
process has started.
Say adding objects: /net/poettering/ScientificCalculator ,
/net/poettering/ProgrammerCalculator

One approach I could think of is:
- Stop the infinite loop
- Unref the bus and slot
- Call required number of sd_bus_add_object_vtable objects (3 in this case)
- Request a well known name and restart the infinite loop.

Is this the right way?
Can someone please help with any design patterns, references or pointers on
how we could achieve this?

Thanks,
Guhan

Another approach (Crude but not the desired way):
- Take the number of bus paths from a config file
- Change config file and restart the process (systemctl restart
process_name)

Continue reading on narkive:
Loading...