1 <html><head><meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8"><title>sd_bus_new
</title><meta name=
"generator" content=
"DocBook XSL Stylesheets V1.78.1"></head><body bgcolor=
"white" text=
"black" link=
"#0000FF" vlink=
"#840084" alink=
"#0000FF"><style>
11 background-color: #c60f0f;
15 h1:hover
> a.headerlink, h2:hover
> a.headerlink, h3:hover
> a.headerlink, dt:hover
> a.headerlink {
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>·
22 <span style=
"float:right">systemd
221</span><hr><div class=
"refentry"><a name=
"sd_bus_new"></a><div class=
"titlepage"></div><div class=
"refnamediv"><h2>Name
</h2><p>sd_bus_new, sd_bus_ref, sd_bus_unref — Create a new bus object and create or destroy references to it
</p></div><div class=
"refsynopsisdiv"><h2>Synopsis
</h2><div class=
"funcsynopsis"><pre class=
"funcsynopsisinfo">#include
<systemd/sd-bus.h
></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_new
</b>(
</code></td><td>sd_bus **
<var class=
"pdparam">bus
</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">sd_bus *
<b class=
"fsfunc">sd_bus_ref
</b>(
</code></td><td>sd_bus *
<var class=
"pdparam">bus
</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">sd_bus *
<b class=
"fsfunc">sd_bus_unref
</b>(
</code></td><td>sd_bus *
<var class=
"pdparam">bus
</var><code>)
</code>;
</td></tr></table><div class=
"funcprototype-spacer"> </div></div></div><div class=
"refsect1"><a name=
"idm47963153600704"></a><h2 id=
"Description">Description
<a class=
"headerlink" title=
"Permalink to this headline" href=
"#Description">¶
</a></h2><p><code class=
"function">sd_bus_new()
</code> creates a new bus
23 object. This object is reference-counted, and will be destroyed
24 when all references are gone. Initially, the caller of this
25 function owns the sole reference.
</p><p><code class=
"function">sd_bus_ref()
</code> creates a new reference to
26 <em class=
"parameter"><code>bus
</code></em>. This bus object will not be destroyed
27 until
<code class=
"function">sd_bus_unref()
</code> has been called as many
28 times plus once more. Once the reference count has dropped to
29 zero,
<em class=
"parameter"><code>bus
</code></em> cannot be used anymore, so
30 further calls to
<code class=
"function">sd_bus_ref()
</code> or
31 <code class=
"function">sd_bus_unref()
</code> are illegal.
</p><p><code class=
"function">sd_bus_unref()
</code> destroys a reference to
32 <em class=
"parameter"><code>bus
</code></em>.
</p></div><div class=
"refsect1"><a name=
"idm47963151984576"></a><h2 id=
"Return Value">Return Value
<a class=
"headerlink" title=
"Permalink to this headline" href=
"#Return%20Value">¶
</a></h2><p>On success,
<code class=
"function">sd_bus_new()
</code> returns
0 or a
33 positive integer. On failure, it returns a negative errno-style
34 error code.
</p><p><code class=
"function">sd_bus_ref
</code> always returns the argument.
35 </p><p><code class=
"function">sd_bus_unref
</code> always returns
36 <code class=
"constant">NULL
</code>.
</p></div><div class=
"refsect1"><a name=
"idm47963152157776"></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=
"-ENOMEM"><span class=
"term"><code class=
"constant">-ENOMEM
</code></span><a class=
"headerlink" title=
"Permalink to this term" href=
"#-ENOMEM">¶
</a></dt><dd><p>Memory allocation failed.
</p></dd></dl></div></div><div class=
"refsect1"><a name=
"idm47963155295984"></a><h2 id=
"Notes">Notes
<a class=
"headerlink" title=
"Permalink to this headline" href=
"#Notes">¶
</a></h2><p><code class=
"function">sd_bus_new()
</code> and other functions
37 described here are available as a shared library, which can be
38 compiled and linked to with the
39 <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>
40 file.
</p></div><div class=
"refsect1"><a name=
"idm47963154450576"></a><h2 id=
"See Also">See Also
<a class=
"headerlink" title=
"Permalink to this headline" href=
"#See%20Also">¶
</a></h2><p>
41 <a href=
"systemd.html"><span class=
"citerefentry"><span class=
"refentrytitle">systemd
</span>(
1)
</span></a>,
42 <a href=
"sd-bus.html"><span class=
"citerefentry"><span class=
"refentrytitle">sd-bus
</span>(
3)
</span></a>,
43 <a href=
"sd_bus_open_user.html"><span class=
"citerefentry"><span class=
"refentrytitle">sd_bus_open_user
</span>(
3)
</span></a>,
44 <a href=
"sd_bus_open_system.html"><span class=
"citerefentry"><span class=
"refentrytitle">sd_bus_open_system
</span>(
3)
</span></a>,
45 <a href=
"sd_bus_default_user.html"><span class=
"citerefentry"><span class=
"refentrytitle">sd_bus_default_user
</span>(
3)
</span></a>,
46 <a href=
"sd_bus_default_system.html"><span class=
"citerefentry"><span class=
"refentrytitle">sd_bus_default_system
</span>(
3)
</span></a>
47 </p></div></div></body></html>