]> git.proxmox.com Git - systemd.git/blame - man/sd_bus_release_name.html
Imported Upstream version 219
[systemd.git] / man / sd_bus_release_name.html
CommitLineData
60f067b4
JS
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_bus_request_name</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
2 a.headerlink {
3 color: #c60f0f;
4 font-size: 0.8em;
5 padding: 0 4px 0 4px;
6 text-decoration: none;
7 visibility: hidden;
8 }
9
10 a.headerlink:hover {
11 background-color: #c60f0f;
12 color: white;
13 }
14
15 h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
16 visibility: visible;
17 }
18 </style><a href="index.html">Index </a>·
19 <a href="systemd.directives.html">Directives </a>·
20 <a href="../python-systemd/index.html">Python </a>·
21 <a href="../libudev/index.html">libudev </a>·
e735f4d4
MP
22 <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 219</span><hr><div class="refentry"><a name="sd_bus_request_name"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_bus_request_name, sd_bus_release_name — Request or release a well-known name on a bus</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;systemd/sd-bus.h&gt;</pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_request_name</b>(</code></td><td>sd_bus *<var class="pdparam">bus</var>, </td></tr><tr><td> </td><td>const char *<var class="pdparam">name</var>, </td></tr><tr><td> </td><td>uint64_t <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_release_name</b>(</code></td><td>sd_bus *<var class="pdparam">bus</var>, </td></tr><tr><td> </td><td>const char *<var class="pdparam">name</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idm139697602185728"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p><code class="function">sd_bus_request_name()</code> requests a
23 well-known name on a bus. It takes a bus connection, a valid bus
24 name and a flags parameter. The flags parameter is a combination
25 of the following flags:</p><div class="variablelist"><dl class="variablelist"><dt id="SD_BUS_NAME_ALLOW_REPLACEMENT"><span class="term"><code class="varname">SD_BUS_NAME_ALLOW_REPLACEMENT</code></span><a class="headerlink" title="Permalink to this term" href="#SD_BUS_NAME_ALLOW_REPLACEMENT">¶</a></dt><dd><p>After acquiring the name successfully, permit
26 other peers to take over the name when they try to acquire it
27 with the <code class="varname">SD_BUS_NAME_REPLACE_EXISTING</code> flag
28 set. If <code class="varname">SD_BUS_NAME_ALLOW_REPLACEMENT</code> is
29 not set on the original request, such a request by other peers
30 will be denied.</p></dd><dt id="SD_BUS_NAME_REPLACE_EXISTING"><span class="term"><code class="varname">SD_BUS_NAME_REPLACE_EXISTING</code></span><a class="headerlink" title="Permalink to this term" href="#SD_BUS_NAME_REPLACE_EXISTING">¶</a></dt><dd><p>Take over the name if it is already acquired
31 by another peer, and that other peer has permitted takeover by
32 setting <code class="varname">SD_BUS_NAME_ALLOW_REPLACEMENT</code> while
33 acquiring it.</p></dd><dt id="SD_BUS_NAME_QUEUE"><span class="term"><code class="varname">SD_BUS_NAME_QUEUE</code></span><a class="headerlink" title="Permalink to this term" href="#SD_BUS_NAME_QUEUE">¶</a></dt><dd><p>Queue the acquisition of the name when the
34 name is already taken.</p></dd></dl></div><p><code class="function">sd_bus_release_name()</code> releases an
35 acquired well-known name. It takes a bus connection and a valid
36 bus name as parameters.</p></div><div class="refsect1"><a name="idm139697602176208"></a><h2 id="Return Value">Return Value<a class="headerlink" title="Permalink to this headline" href="#Return%20Value">¶</a></h2><p>On success, these calls return 0 or a positive integer. On
37 failure, these calls return a negative errno-style error
38 code.</p><p>If <code class="varname">SD_BUS_NAME_QUEUE</code> is specified,
39 <code class="function">sd_bus_request_name()</code> will return 0 when the
40 name is already taken by another peer and the client has been
41 added to the queue for the name. In that case, the caller can
42 subscribe to "<code class="literal">NameOwnerChanged</code>" signals to be
43 notified when the name is successfully acquired.
44 <code class="function">sd_bus_request_name()</code> returns &gt; 0 when the
45 name has immediately been acquired successfully.</p></div><div class="refsect1"><a name="idm139697602171600"></a><h2 id="Errors">Errors<a class="headerlink" title="Permalink to this headline" href="#Errors">¶</a></h2><p>Returned errors may indicate the following problems:</p><div class="variablelist"><dl class="variablelist"><dt id="-EALREADY"><span class="term"><code class="constant">-EALREADY</code></span><a class="headerlink" title="Permalink to this term" href="#-EALREADY">¶</a></dt><dd><p>The caller already is the owner of the
46 specified name.</p></dd><dt id="-EEXIST"><span class="term"><code class="constant">-EEXIST</code></span><a class="headerlink" title="Permalink to this term" href="#-EEXIST">¶</a></dt><dd><p>The name has already been acquired by a
47 different peer, and SD_BUS_NAME_REPLACE_EXISTING was not
48 specified or the other peer did not specify
49 SD_BUS_NAME_ALLOW_REPLACEMENT while acquiring the
50 name.</p></dd><dt id="-ESRCH"><span class="term"><code class="constant">-ESRCH</code></span><a class="headerlink" title="Permalink to this term" href="#-ESRCH">¶</a></dt><dd><p>It was attempted to release a name that is
51 currently not registered on the bus.</p></dd><dt id="-EADDRINUSE"><span class="term"><code class="constant">-EADDRINUSE</code></span><a class="headerlink" title="Permalink to this term" href="#-EADDRINUSE">¶</a></dt><dd><p>It was attempted to release a name that is
52 owned by a different peer on the bus.</p></dd><dt id="-EINVAL"><span class="term"><code class="constant">-EINVAL</code></span><a class="headerlink" title="Permalink to this term" href="#-EINVAL">¶</a></dt><dd><p>A specified parameter is
53 invalid.</p></dd><dt id="-ENOTCONN"><span class="term"><code class="constant">-ENOTCONN</code></span><a class="headerlink" title="Permalink to this term" href="#-ENOTCONN">¶</a></dt><dd><p>The bus connection has been
54 disconnected.</p></dd><dt id="-ECHILD"><span class="term"><code class="constant">-ECHILD</code></span><a class="headerlink" title="Permalink to this term" href="#-ECHILD">¶</a></dt><dd><p>The bus connection has been created in a
55 different process than the current one.</p></dd></dl></div></div><div class="refsect1"><a name="idm139697606062224"></a><h2 id="Notes">Notes<a class="headerlink" title="Permalink to this headline" href="#Notes">¶</a></h2><p>The <code class="function">sd_bus_acquire_name()</code> and
56 <code class="function">sd_bus_release_name()</code> interfaces are
57 available as a shared library, which can be compiled and linked to
58 with the
59 <code class="constant">libsystemd</code> <a href="http://linux.die.net/man/1/pkg-config"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a>
60 file.</p></div><div class="refsect1"><a name="idm139697606057824"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p>
61 <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
62 <a href="sd-bus.html"><span class="citerefentry"><span class="refentrytitle">sd-bus</span>(3)</span></a>,
63 <a href="sd_bus_new.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_new</span>(3)</span></a>
64 </p></div></div></body></html>