]>
Commit | Line | Data |
---|---|---|
cd6d5e1c ZJS |
1 | <?xml version='1.0'?> <!--*-nxml-*--> |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | |
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | |
4 | ||
5 | <!-- | |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2014 Zbigniew Jędrzejewski-Szmek | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
11 | under the terms of the GNU Lesser General Public License as published by | |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
13 | (at your option) any later version. | |
14 | ||
15 | systemd is distributed in the hope that it will be useful, but | |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | Lesser General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU Lesser General Public License | |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
22 | --> | |
23 | ||
7c071fda | 24 | <refentry id="sd_bus_new" conditional="ENABLE_KDBUS"> |
cd6d5e1c ZJS |
25 | |
26 | <refentryinfo> | |
27 | <title>sd_bus_new</title> | |
28 | <productname>systemd</productname> | |
29 | ||
30 | <authorgroup> | |
31 | <author> | |
32 | <contrib>A monkey with a typewriter</contrib> | |
33 | <firstname>Zbigniew</firstname> | |
34 | <surname>Jędrzejewski-Szmek</surname> | |
35 | <email>zbyszek@in.waw.pl</email> | |
36 | </author> | |
37 | </authorgroup> | |
38 | </refentryinfo> | |
39 | ||
40 | <refmeta> | |
41 | <refentrytitle>sd_bus_new</refentrytitle> | |
42 | <manvolnum>3</manvolnum> | |
43 | </refmeta> | |
44 | ||
45 | <refnamediv> | |
46 | <refname>sd_bus_new</refname> | |
47 | <refname>sd_bus_ref</refname> | |
48 | <refname>sd_bus_unref</refname> | |
49 | ||
50 | <refpurpose>Create a new bus object and create or destroy references to it</refpurpose> | |
51 | </refnamediv> | |
52 | ||
53 | <refsynopsisdiv> | |
54 | <funcsynopsis> | |
55 | <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo> | |
56 | ||
57 | <funcprototype> | |
58 | <funcdef>int <function>sd_bus_new</function></funcdef> | |
8dc385e7 | 59 | <paramdef>sd_bus **<parameter>bus</parameter></paramdef> |
cd6d5e1c ZJS |
60 | </funcprototype> |
61 | ||
62 | <funcprototype> | |
8dc385e7 JE |
63 | <funcdef>sd_bus *<function>sd_bus_ref</function></funcdef> |
64 | <paramdef>sd_bus *<parameter>bus</parameter></paramdef> | |
cd6d5e1c ZJS |
65 | </funcprototype> |
66 | ||
67 | <funcprototype> | |
8dc385e7 JE |
68 | <funcdef>sd_bus *<function>sd_bus_unref</function></funcdef> |
69 | <paramdef>sd_bus *<parameter>bus</parameter></paramdef> | |
cd6d5e1c ZJS |
70 | </funcprototype> |
71 | </funcsynopsis> | |
72 | </refsynopsisdiv> | |
73 | ||
74 | <refsect1> | |
75 | <title>Description</title> | |
76 | ||
77 | <para><function>sd_bus_new()</function> creates a new bus | |
73e231ab | 78 | object. This object is reference-counted, and will be destroyed |
cd6d5e1c ZJS |
79 | when all references are gone. Initially, the caller of this |
80 | function owns the sole reference.</para> | |
81 | ||
82 | <para><function>sd_bus_ref()</function> creates a new reference to | |
83 | <parameter>bus</parameter>. This bus object will not be destroyed | |
84 | until <function>sd_bus_unref()</function> has been called as many | |
85 | times plus once more. Once the reference count has dropped to | |
86 | zero, <parameter>bus</parameter> cannot be used anymore, so | |
87 | further calls to <function>sd_bus_ref()</function> or | |
88 | <function>sd_bus_unref()</function> are illegal.</para> | |
89 | ||
4cf8496d | 90 | <para><function>sd_bus_unref()</function> destroys a reference to |
cd6d5e1c ZJS |
91 | <parameter>bus</parameter>.</para> |
92 | </refsect1> | |
93 | ||
94 | <refsect1> | |
95 | <title>Return Value</title> | |
96 | ||
97 | <para>On success, <function>sd_bus_new()</function> returns 0 or a | |
98 | positive integer. On failure, it returns a negative errno-style | |
99 | error code.</para> | |
100 | ||
101 | <para><function>sd_bus_ref</function> always returns the argument. | |
102 | </para> | |
103 | ||
104 | <para><function>sd_bus_unref</function> always returns | |
105 | <constant>NULL</constant>.</para> | |
106 | </refsect1> | |
107 | ||
108 | <refsect1> | |
109 | <title>Errors</title> | |
110 | ||
111 | <para>Returned errors may indicate the following problems:</para> | |
112 | ||
113 | <variablelist> | |
114 | <varlistentry> | |
115 | <term><varname>-ENOMEM</varname></term> | |
116 | ||
117 | <listitem><para>Memory allocation failed.</para></listitem> | |
118 | </varlistentry> | |
119 | </variablelist> | |
120 | </refsect1> | |
121 | ||
122 | <refsect1> | |
123 | <title>Notes</title> | |
124 | ||
125 | <para><function>sd_bus_new()</function> and other functions | |
126 | described here are available as a shared library, which can be | |
127 | compiled and linked to with the | |
6bb648a1 | 128 | <constant>libsystemd</constant> <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
cd6d5e1c ZJS |
129 | file.</para> |
130 | </refsect1> | |
131 | ||
132 | <refsect1> | |
133 | <title>See Also</title> | |
134 | ||
135 | <para> | |
136 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
137 | <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
138 | <citerefentry><refentrytitle>sd_bus_open_user</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
139 | <citerefentry><refentrytitle>sd_bus_open_system</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
140 | <citerefentry><refentrytitle>sd_bus_default_user</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
141 | <citerefentry><refentrytitle>sd_bus_default_system</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
142 | </para> | |
143 | </refsect1> | |
144 | ||
145 | </refentry> |