<div dir="ltr"><div dir="auto"><div></div><div>GLib's `gdbus introspect` can show you the parameter names if they're included in the introspection XML:</div><div><br></div><div> gdbus introspect -y -d org.freedesktop.systemd1 -o /org/freedesktop/systemd1/unit/cups_2eservice</div><div><br></div><div>But introspection is mainly for use by language bindings (e.g. perl-dbus) – it is not a substitute for documentation.</div><div><br></div><div>For anything beyond that, systemd has manual pages for each bus service it implements, e.g.:</div><div><br></div><div> man org.freedesktop.systemd1</div><div> <a href="https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.systemd1.html">https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.systemd1.html</a></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 17, 2025, 06:33 Chris Kottaridis <<a href="mailto:chris@quietwind.net" target="_blank">chris@quietwind.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<pre>I am beginning to use the sd-bus library. I have been able to get a couple of properties, MainPID and SubState.</pre>
<pre>I would like to use the Stop method. I am using cups as an example. This commands shows that in thee Unit interface there is a Start and Stop method:
</pre>
<pre>$ busctl introspect org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/cups_2eservice</pre>
<pre>NAME TYPE SIGNATURE RESULT/VALUE FLAGS
</pre>
<pre>org.freedesktop.systemd1.Unit interface - - -
</pre>
<pre>.Start method s o -
.Stop method s o -
</pre>
<pre>Each has a signature of "s" I assume it takes one parameter of type string.</pre>
<pre>I have tried the sample on this page. Pasting it into a file and compiling and running it works
great.
</pre>
<pre><a href="https://0pointer.net/blog/the-new-sd-bus-api-of-systemd.html" rel="noreferrer" target="_blank">https://0pointer.net/blog/the-new-sd-bus-api-of-systemd.html</a></pre>
<pre>This sample starts the cups service by acccessing the systemd Manager and calling StartUnit.</pre>
<pre><code><span></span><span> /* Issue the method call and store the respons message in m */</span>
<span> </span><span>r</span><span> </span><span>=</span><span> </span><span>sd_bus_call_method</span><span>(</span><span>bus</span><span>,</span>
<span> </span><span>"org.freedesktop.systemd1"</span><span>,</span><span> </span><span>/* service to contact */</span>
<span> </span><span>"/org/freedesktop/systemd1"</span><span>,</span><span> </span><span>/* object path */</span>
<span> </span><span>"org.freedesktop.systemd1.Manager"</span><span>,</span><span> </span><span>/* interface name */</span>
<span> </span><span>"StartUnit"</span><span>,</span><span> </span><span>/* method name */</span>
<span> </span><span>&</span><span>error</span><span>,</span><span> </span><span>/* object to return error in */</span>
<span> </span><span>&</span><span>m</span><span>,</span><span> </span><span>/* return message on success */</span>
<span> </span><span>"ss"</span><span>,</span><span> </span><span>/* input signature */</span>
<span> </span><span>"cups.service"</span><span>,</span><span> </span><span>/* first argument */</span>
<span> </span><span>"replace"</span><span>);</span><span> </span><span>/* second argument */
It has a signature of "ss" which I assume means the method takes 2 arguments each of a type string.
My question is for any given method how do I get what the arguments for it are ?
Like if I use Start what are valid values to pass for the one argument?
In StartUnit the first argument seems obvious with an example to be the unit you want to start. I
am not sure what the "replace" means or what other strings would be valid.
Again I am interested in the Stop method specifically, but in general would like to know where I can
get a list of the arguments and possible values for any method.
Thanks
Chris
</span></code></pre>
</div>
</blockquote></div></div></div>
</div>