<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <br>
    <div class="moz-cite-prefix">On 14/11/2017 04:26, aleivag wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CADByNONfcQ6L=wp_6BaQGdch4Ls2-q2bM=wWQBOWPio1LNsBiQ@mail.gmail.com">
      <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"
            moz-do-not-send="true">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? <br>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    My understanding is that you should always connect through the
    normal system dbus socket and not use systemd's private socket<br>
    <br>
    The private socket (afaiu) is meant to be used only by systemctl. It
    talks directly to systemd (without a dbus daemon) and is here to
    make sure systemd and systemctl can communicate even when dbus is
    broken or not started yet<br>
    <blockquote type="cite"
cite="mid:CADByNONfcQ6L=wp_6BaQGdch4Ls2-q2bM=wWQBOWPio1LNsBiQ@mail.gmail.com">
      <div dir="ltr">
        <div>
          <div>
            <div class="gmail_signature">
              <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>
          </div>
        </div>
      </div>
    </blockquote>
    Yesn systemd private sockets are private and systemd does not want
    to document private interfaces.<br>
    <br>
    That being said, the system socket location is hardcoded not just in
    systemd, but in the dbus specification itself. It won't change, so
    it 's ok to hardcode it...<br>
    <br>
    I didn't answer all your questions, but I hope the bits I know
    helped<br>
    <br>
    Jeremy<br>
    <blockquote type="cite"
cite="mid:CADByNONfcQ6L=wp_6BaQGdch4Ls2-q2bM=wWQBOWPio1LNsBiQ@mail.gmail.com">
      <div dir="ltr">
        <div>
          <div>
            <div class="gmail_signature">
              <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>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
systemd-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:systemd-devel@lists.freedesktop.org">systemd-devel@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel">https://lists.freedesktop.org/mailman/listinfo/systemd-devel</a>
</pre>
    </blockquote>
    <br>
    <div class="moz-signature">-- <br>
      <div>
        <link href="https://fonts.googleapis.com/css?family=Raleway"
          rel="stylesheet" type="text/css">
        <font face="Raleway, regular">
          <table style="padding:20px;margin-bottom:-10px" border="0">
            <tbody>
              <tr>
                <td style="font-size:13px; color:#ff8054; text-align:
                  center; padding-right:30px"> <a
                    href="http://www.smile.eu/"> <img
                      style="max-width:100%; height:auto"
src="http://ftp.smile.fr/client/Communication/signature/img/Logo-new.png"
                      alt="SMILE"> </a><br>
                  <br>
                  <p style="line-heigth:8px">20 rue des Jardins<br>
                    92600 Asnières-sur-Seine</p>
                </td>
                <td style="border-left: 1px solid #3b7ffe;
                  padding-left:20px; font-size:13px; color:#ff8054;">
                  <div style="color:#ff8054; font-size:14px;"> <b>Jérémy
                      ROSEN</b> </div>
                  <div style="color:#3b7ffe; font-size:13px;">
                    Architecte technique<br>
                    Responsable de l'expertise Smile-ECS </div>
                  <br>
                  <div style="color:#3b7ffe; font-size:13px;"> <span
                      style="white-space: nowrap"><img
                        style="margin-right:5px"
                        src="http://ftp.smile.fr/client/Communication/signature/img/mail.png"
                        alt="email" width="12" height="10"> <a
                        href="mailto:jeremy.rosen@smile.fr"
                        style="color:#3b7ffe; font-size:13px;
                        text-decoration:none;">jeremy.rosen@smile.fr</a>
                    </span> <br>
                    <span style="white-space: nowrap"><img
                        style="margin-right:5px"
                        src="http://ftp.smile.fr/client/Communication/signature/img/phone.png"
                        alt="phone" width="10" height="10"></span>
                    +33141402967 <br>
                    <span style="white-space: nowrap"><img
                        style="margin-right:5px"
                        src="http://ftp.smile.fr/client/Communication/signature/img/web.png"
                        alt="url" width="12" height="12">
                      <a href="http://www.smile.eu"
                        style="color:#3b7ffe; font-size:13px;
                        text-decoration:none;">http://www.smile.eu</a> </span>
                  </div>
                  <br>
                  <div> <span><a style="margin-right:5px"
                        href="https://twitter.com/GroupeSmile"><img
src="http://ftp.smile.fr/client/Communication/signature/img/rs-twitter.png"
                          alt="Twitter" style="max-width:100%;
                          height:auto"></a></span> <span><a
                        style="margin-right:5px"
                        href="https://www.facebook.com/smileopensource"><img
src="http://ftp.smile.fr/client/Communication/signature/img/rs-facebook.png"
                          alt="Facebook" style="max-width:100%;
                          height:auto"></a></span> <span><a
                        style="margin-right:5px"
                        href="https://www.linkedin.com/company/smile"><img
src="http://ftp.smile.fr/client/Communication/signature/img/rs-linkedin.png"
                          alt="LinkedIn" style="max-width:100%;
                          height:auto"></a></span> <span><a
                        style="margin-right:5px"
                        href="https://github.com/Smile-SA"><img
src="http://ftp.smile.fr/client/Communication/signature/img/rs-github.png"
                          alt="Github" style="max-width:100%;
                          height:auto"></a></span> </div>
                </td>
              </tr>
            </tbody>
          </table>
          <br>
          <div> <a
href="http://smile.eu/?utm_source=signature&utm_medium=email&utm_campaign=signature"><img
src="http://signature.smile.eu/assets/img/bandeau_mail_smile2017.gif.gif"
                alt="Découvrez l’univers Smile, rendez-vous sur
                smile.eu" border="0"></a></div>
          <br>
          <div style="color:#a3acb5; font-size:10px;"> <img
              src="http://ftp.smile.fr/client/Communication/signature/img/eco.png"
              alt="eco" width="13" height="11"> Pour la planète,
            n'imprimez ce mail que si c'est nécessaire </div>
        </font>
      </div>
    </div>
  </body>
</html>