[systemd-devel] Dynamically add and remove sd-bus paths in a process
guhan balasubramanian
guhan.sac at gmail.com
Fri Nov 2 07:12:19 UTC 2018
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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20181102/30f8f97c/attachment.html>
More information about the systemd-devel
mailing list