| 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.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 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 |
|
| 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.</para></listitem> |
| 81 |
</varlistentry> |
| 82 |
|
| 83 |
<varlistentry> |
| 84 |
<term><constant>-ENOPKG</constant></term> |
| 85 |
|
| 86 |
<listitem><para>The bus cannot be resolved.</para></listitem> |
| 87 |
</varlistentry> |
| 88 |
|
| 89 |
<varlistentry> |
| 90 |
<term><constant>-ECHILD</constant></term> |
| 91 |
|
| 92 |
<listitem><para>The bus was created in a different process, library or module instance.</para></listitem> |
| 93 |
</varlistentry> |
| 94 |
|
| 95 |
<varlistentry> |
| 96 |
<term><constant>-ENOMEM</constant></term> |
| 97 |
|
| 98 |
<listitem><para>Memory allocation failed.</para></listitem> |
| 99 |
</varlistentry> |
| 100 |
</variablelist> |
| 101 |
</refsect2> |
| 102 |
</refsect1> |
| 103 |
|
| 104 |
<xi:include href="libsystemd-pkgconfig.xml" /> |
| 105 |
|
| 106 |
<refsect1> |
| 107 |
<title>History</title> |
| 108 |
<para><function>sd_bus_add_object_manager()</function> was added in version 221.</para> |
| 109 |
</refsect1> |
| 110 |
|
| 111 |
<refsect1> |
| 112 |
<title>See Also</title> |
| 113 |
|
| 114 |
<para><simplelist type="inline"> |
| 115 |
<member><citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 116 |
<member><citerefentry><refentrytitle>busctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 117 |
<member><citerefentry><refentrytitle>sd_bus_add_object_vtable</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 118 |
<member><citerefentry><refentrytitle>sd_bus_emit_interfaces_added</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 119 |
<member><citerefentry><refentrytitle>sd_bus_slot_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 120 |
</simplelist></para> |
| 121 |
</refsect1> |
| 122 |
</refentry> |