]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_bus_add_object_manager.xml
man: fix link markup
[thirdparty/systemd.git] / man / sd_bus_add_object_manager.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1+ -->
5
6 <refentry id="sd_bus_add_object_manager"
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>sd_bus_add_object_manager</title>
11 <productname>systemd</productname>
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>sd_bus_add_object_manager</refentrytitle>
16 <manvolnum>3</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>sd_bus_add_object_manager</refname>
21
22 <refpurpose>Add a D-Bus object manager for a D-Bus object sub-tree</refpurpose>
23 </refnamediv>
24
25 <refsynopsisdiv>
26 <funcsynopsis>
27 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
28
29 <funcprototype>
30 <funcdef>int <function>sd_bus_add_object_manager</function></funcdef>
31 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
32 <paramdef>sd_bus_slot **<parameter>slot</parameter></paramdef>
33 <paramdef>const char *<parameter>path</parameter></paramdef>
34 </funcprototype>
35 </funcsynopsis>
36 </refsynopsisdiv>
37
38 <refsect1>
39 <title>Description</title>
40
41 <para><function>sd_bus_add_object_manager()</function> installs a handler for the given path
42 that implements the <function>GetManagedObjects()</function> method of the
43 <constant>org.freedesktop.DBus.ObjectManager</constant> interface. See
44 <ulink url="https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager">
45 org.freedesktop.DBus.ObjectManager</ulink> for more information.</para>
46
47 <para>To implement the <function>InterfacesAdded</function> and
48 <function>InterfacesRemoved</function> signals of the
49 <constant>org.freedesktop.DBus.ObjectManager</constant> interface, call
50 <citerefentry><refentrytitle>sd_bus_emit_interfaces_added</refentrytitle><manvolnum>3</manvolnum></citerefentry> and
51 <citerefentry><refentrytitle>sd_bus_emit_interfaces_removed</refentrytitle><manvolnum>3</manvolnum></citerefentry>
52 whenever interfaces are added or removed from the sub-tree, respectively.</para>
53
54 <para>When <function>sd_bus_add_object_manager()</function> succeeds, a slot is created
55 internally. If the output parameter <replaceable>slot</replaceable> is <constant>NULL</constant>,
56 a "floating" slot object is created, see
57 <citerefentry><refentrytitle>sd_bus_slot_set_floating</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
58 Otherwise, a pointer to the slot object is returned. In that case, the reference to the slot
59 object should be dropped when the object manager is not needed anymore, see
60 <citerefentry><refentrytitle>sd_bus_slot_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
61 </para>
62 </refsect1>
63
64 <refsect1>
65 <title>Return Value</title>
66
67 <para>On success, <function>sd_bus_add_object_manager()</function> returns a non-negative
68 integer. On failure, it returns a negative errno-style error code.</para>
69
70 <refsect2>
71 <title>Errors</title>
72
73 <para>Returned errors may indicate the following problems:</para>
74
75 <variablelist>
76 <varlistentry>
77 <term><constant>-EINVAL</constant></term>
78
79 <listitem><para>One of the required parameters is <constant>NULL</constant> or
80 <parameter>path</parameter> is not a valid object path.
81 </para></listitem>
82 </varlistentry>
83
84 <varlistentry>
85 <term><constant>-ENOPKG</constant></term>
86
87 <listitem><para>The bus cannot be resolved.</para></listitem>
88 </varlistentry>
89
90 <varlistentry>
91 <term><constant>-ECHILD</constant></term>
92
93 <listitem><para>The bus was created in a different process.</para></listitem>
94 </varlistentry>
95
96 <varlistentry>
97 <term><constant>-ENOMEM</constant></term>
98
99 <listitem><para>Memory allocation failed.</para></listitem>
100 </varlistentry>
101 </variablelist>
102 </refsect2>
103 </refsect1>
104
105 <xi:include href="libsystemd-pkgconfig.xml" />
106
107 <refsect1>
108 <title>See Also</title>
109
110 <para>
111 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
112 <citerefentry><refentrytitle>busctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
113 <citerefentry><refentrytitle>sd_bus_add_object_vtable</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
114 <citerefentry><refentrytitle>sd_bus_emit_interfaces_added</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
115 <citerefentry><refentrytitle>sd_bus_slot_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>
116 </para>
117 </refsect1>
118 </refentry>