| 1 |
'\" t |
| 2 |
.TH "SD_BUS_ADD_OBJECT_MANAGER" "3" "" "systemd 261~rc3" "sd_bus_add_object_manager" |
| 3 |
.\" ----------------------------------------------------------------- |
| 4 |
.\" * Define some portability stuff |
| 5 |
.\" ----------------------------------------------------------------- |
| 6 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 7 |
.\" http://bugs.debian.org/507673 |
| 8 |
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html |
| 9 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 10 |
.ie \n(.g .ds Aq \(aq |
| 11 |
.el .ds Aq ' |
| 12 |
.\" ----------------------------------------------------------------- |
| 13 |
.\" * set default formatting |
| 14 |
.\" ----------------------------------------------------------------- |
| 15 |
.\" disable hyphenation |
| 16 |
.nh |
| 17 |
.\" disable justification (adjust text to left margin only) |
| 18 |
.ad l |
| 19 |
.\" ----------------------------------------------------------------- |
| 20 |
.\" * MAIN CONTENT STARTS HERE * |
| 21 |
.\" ----------------------------------------------------------------- |
| 22 |
.SH "NAME" |
| 23 |
sd_bus_add_object_manager \- Add a D\-Bus object manager for a D\-Bus object sub\-tree |
| 24 |
.SH "SYNOPSIS" |
| 25 |
.sp |
| 26 |
.ft B |
| 27 |
.nf |
| 28 |
#include <systemd/sd\-bus\&.h> |
| 29 |
.fi |
| 30 |
.ft |
| 31 |
.HP \w'int\ sd_bus_add_object_manager('u |
| 32 |
.BI "int sd_bus_add_object_manager(sd_bus\ *" "bus" ", sd_bus_slot\ **" "slot" ", const\ char\ *" "path" ");" |
| 33 |
.SH "DESCRIPTION" |
| 34 |
.PP |
| 35 |
\fBsd_bus_add_object_manager()\fR |
| 36 |
installs a handler for the given path that implements the |
| 37 |
\fBGetManagedObjects()\fR |
| 38 |
method of the |
| 39 |
\fBorg\&.freedesktop\&.DBus\&.ObjectManager\fR |
| 40 |
interface\&. See |
| 41 |
\m[blue]\fBorg\&.freedesktop\&.DBus\&.ObjectManager\fR\m[]\&\s-2\u[1]\d\s+2 |
| 42 |
for more information\&. |
| 43 |
.PP |
| 44 |
To implement the |
| 45 |
\fBInterfacesAdded\fR |
| 46 |
and |
| 47 |
\fBInterfacesRemoved\fR |
| 48 |
signals of the |
| 49 |
\fBorg\&.freedesktop\&.DBus\&.ObjectManager\fR |
| 50 |
interface, call |
| 51 |
\fBsd_bus_emit_interfaces_added\fR(3) |
| 52 |
and |
| 53 |
\fBsd_bus_emit_interfaces_removed\fR(3) |
| 54 |
whenever interfaces are added or removed from the sub\-tree, respectively\&. |
| 55 |
.PP |
| 56 |
When |
| 57 |
\fBsd_bus_add_object_manager()\fR |
| 58 |
succeeds, a slot is created internally\&. If the output parameter |
| 59 |
\fIslot\fR |
| 60 |
is |
| 61 |
\fBNULL\fR, a "floating" slot object is created, see |
| 62 |
\fBsd_bus_slot_set_floating\fR(3)\&. Otherwise, a pointer to the slot object is returned\&. In that case, the reference to the slot object should be dropped when the object manager is not needed anymore, see |
| 63 |
\fBsd_bus_slot_unref\fR(3)\&. |
| 64 |
.SH "RETURN VALUE" |
| 65 |
.PP |
| 66 |
On success, |
| 67 |
\fBsd_bus_add_object_manager()\fR |
| 68 |
returns a non\-negative integer\&. On failure, it returns a negative errno\-style error code\&. |
| 69 |
.SS "Errors" |
| 70 |
.PP |
| 71 |
Returned errors may indicate the following problems: |
| 72 |
.PP |
| 73 |
\fB\-EINVAL\fR |
| 74 |
.RS 4 |
| 75 |
One of the required parameters is |
| 76 |
\fBNULL\fR |
| 77 |
or |
| 78 |
\fIpath\fR |
| 79 |
is not a valid object path\&. |
| 80 |
.RE |
| 81 |
.PP |
| 82 |
\fB\-ENOPKG\fR |
| 83 |
.RS 4 |
| 84 |
The bus cannot be resolved\&. |
| 85 |
.RE |
| 86 |
.PP |
| 87 |
\fB\-ECHILD\fR |
| 88 |
.RS 4 |
| 89 |
The bus was created in a different process, library or module instance\&. |
| 90 |
.RE |
| 91 |
.PP |
| 92 |
\fB\-ENOMEM\fR |
| 93 |
.RS 4 |
| 94 |
Memory allocation failed\&. |
| 95 |
.RE |
| 96 |
.SH "NOTES" |
| 97 |
.PP |
| 98 |
Functions described here are available as a shared library, which can be compiled against and linked to with the |
| 99 |
\fBlibsystemd\fR\ \&\fBpkg-config\fR(1) |
| 100 |
file\&. |
| 101 |
.PP |
| 102 |
The code described here uses |
| 103 |
\fBgetenv\fR(3), which is declared to be not multi\-thread\-safe\&. This means that the code calling the functions described here must not call |
| 104 |
\fBsetenv\fR(3) |
| 105 |
from a parallel thread\&. It is recommended to only do calls to |
| 106 |
\fBsetenv()\fR |
| 107 |
from an early phase of the program when no other threads have been started\&. |
| 108 |
.SH "HISTORY" |
| 109 |
.PP |
| 110 |
\fBsd_bus_add_object_manager()\fR |
| 111 |
was added in version 221\&. |
| 112 |
.SH "SEE ALSO" |
| 113 |
.PP |
| 114 |
\fBsd-bus\fR(3), \fBbusctl\fR(1), \fBsd_bus_add_object_vtable\fR(3), \fBsd_bus_emit_interfaces_added\fR(3), \fBsd_bus_slot_unref\fR(3) |
| 115 |
.SH "NOTES" |
| 116 |
.IP " 1." 4 |
| 117 |
org.freedesktop.DBus.ObjectManager |
| 118 |
.RS 4 |
| 119 |
\%https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager |
| 120 |
.RE |