]>
Commit | Line | Data |
---|---|---|
e762fa03 DDM |
1 | <?xml version='1.0'?> <!--*-nxml-*--> |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" | |
eea10b26 | 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
db9ecf05 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
e762fa03 DDM |
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 <systemd/sd-bus.h></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 | ||
7f3daf15 | 54 | <para>When <function>sd_bus_add_object_manager()</function> succeeds, a slot is created |
e762fa03 DDM |
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. | |
ec07c3c8 AK |
81 | </para> |
82 | ||
83 | <xi:include href="version-info.xml" xpointer="v246"/></listitem> | |
e762fa03 DDM |
84 | </varlistentry> |
85 | ||
86 | <varlistentry> | |
87 | <term><constant>-ENOPKG</constant></term> | |
88 | ||
ec07c3c8 AK |
89 | <listitem><para>The bus cannot be resolved.</para> |
90 | ||
91 | <xi:include href="version-info.xml" xpointer="v246"/></listitem> | |
e762fa03 DDM |
92 | </varlistentry> |
93 | ||
94 | <varlistentry> | |
95 | <term><constant>-ECHILD</constant></term> | |
96 | ||
ec07c3c8 AK |
97 | <listitem><para>The bus was created in a different process, library or module instance.</para> |
98 | ||
99 | <xi:include href="version-info.xml" xpointer="v246"/></listitem> | |
e762fa03 DDM |
100 | </varlistentry> |
101 | ||
102 | <varlistentry> | |
103 | <term><constant>-ENOMEM</constant></term> | |
104 | ||
ec07c3c8 AK |
105 | <listitem><para>Memory allocation failed.</para> |
106 | ||
107 | <xi:include href="version-info.xml" xpointer="v246"/></listitem> | |
e762fa03 DDM |
108 | </varlistentry> |
109 | </variablelist> | |
110 | </refsect2> | |
111 | </refsect1> | |
112 | ||
113 | <xi:include href="libsystemd-pkgconfig.xml" /> | |
114 | ||
69106f47 AK |
115 | <refsect1> |
116 | <title>History</title> | |
117 | <para><function>sd_bus_add_object_manager()</function> was added in version 246.</para> | |
118 | </refsect1> | |
119 | ||
e762fa03 DDM |
120 | <refsect1> |
121 | <title>See Also</title> | |
122 | ||
13a69c12 DT |
123 | <para><simplelist type="inline"> |
124 | <member><citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> | |
125 | <member><citerefentry><refentrytitle>busctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> | |
126 | <member><citerefentry><refentrytitle>sd_bus_add_object_vtable</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> | |
127 | <member><citerefentry><refentrytitle>sd_bus_emit_interfaces_added</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> | |
128 | <member><citerefentry><refentrytitle>sd_bus_slot_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> | |
129 | </simplelist></para> | |
e762fa03 DDM |
130 | </refsect1> |
131 | </refentry> |