<div dir="ltr">Hi all:<div><br></div><div>hope you guys are doing great!. So i have a few questions, hope this is the best place for them. </div><div><br></div><div>I've been doing a lot of work with `sd-bus.h` (basically i've been trying to bind it to other languages to then interact with systemd natively). </div><div><br></div><div>I've been reading the man pages/blog post/general docs, but mostly the src code. and i stumble across <a href="https://github.com/systemd/systemd/blob/master/src/shared/bus-util.c#L598-L605">https://github.com/systemd/systemd/blob/master/src/shared/bus-util.c#L598-L605</a> and saw that you can connect to systemd using the sockets, for root would be `/run/systemd/private`, and for users something like `/run/user/<uid>/systemd/private` and this trigger lots of questions, that i have not been able to answer, so here they are:</div><div><br></div><div>Question 1) </div><div><br></div><div>what would be the advantage of connecting through dbus instead of directly through the socket?</div><div><br></div><div>the way i connect to systemd is with `sd_bus_open_system` but i can also do</div><div><br></div><div>```</div><div><div>sd_bus_new(&bus);</div><div>sd_bus_set_address(bus, "unix:path=/run/systemd/private");</div><div>sd_bus_start(bus);</div></div><div>```</div><div><div><div class="gmail_signature"><div dir="ltr"><br></div><div>why (or when) would one be better than the other? </div><div><br></div><div>question 2);</div><div><br></div><div>i also look that you can do the same with the user connections (and this is mostly true when the --user flag is given, at least on systemd-run), and you can connect to something like `/run/user/<uid>/systemd/private`, where `/run/user/<uid>` is $XDG_RUNTIME_DIR, and i guess this is really the best form to connect to systemd as a user, but is there any difference between using that socket or doing `sd_bus_open_user`. ?</div><div dir="ltr"><br></div><div dir="ltr"><div>question 3)</div></div><div dir="ltr"><br></div><div dir="ltr">systemd source code is pretty clear, really easy to learn from, also sd-bus.h is incredible helpful and easy to use.</div><div dir="ltr"><br></div><div dir="ltr">But the docs is good, don't get me wrong, but it could definitely use more love. for instance the usage of the sockets `/run/{user/uid,}/systemd/private`, is not documented anywhere that i could find. is this intentional?, is this because this is a implementation detail that may change in the future?. if so, what would be the correct way to connect to systemd's socket?   </div><div dir="ltr">i was particularly surprise that the sockets' path are hardcoded in the code.<br></div><div dir="ltr"><br></div><div>if this parts have not just gotten into the docs, i would be more than happy to submit the PR for the docs.</div><div><br></div><div>Thank you guys!</div><div dir="ltr">Alvaro Leiva<br></div></div></div>
</div></div>