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+ -->
6 <refentry id=
"sd_bus_set_description" xmlns:
xi=
"http://www.w3.org/2001/XInclude">
9 <title>sd_bus_set_description
</title>
10 <productname>systemd
</productname>
14 <refentrytitle>sd_bus_set_description
</refentrytitle>
15 <manvolnum>3</manvolnum>
19 <refname>sd_bus_set_description
</refname>
20 <refname>sd_bus_get_description
</refname>
21 <refname>sd_bus_set_anonymous
</refname>
22 <refname>sd_bus_is_anonymous
</refname>
23 <refname>sd_bus_set_trusted
</refname>
24 <refname>sd_bus_is_trusted
</refname>
25 <refname>sd_bus_set_allow_interactive_authorization
</refname>
26 <refname>sd_bus_get_allow_interactive_authorization
</refname>
28 <refpurpose>Set or query properties of a bus object
</refpurpose>
33 <funcsynopsisinfo>#include
<systemd/sd-bus.h
></funcsynopsisinfo>
36 <funcdef>int
<function>sd_bus_set_description
</function></funcdef>
37 <paramdef>sd_bus *
<parameter>bus
</parameter></paramdef>
38 <paramdef>const char *
<parameter>description
</parameter></paramdef>
42 <funcdef>int
<function>sd_bus_get_description
</function></funcdef>
43 <paramdef>sd_bus *
<parameter>bus
</parameter></paramdef>
44 <paramdef>const char **
<parameter>description
</parameter></paramdef>
48 <funcdef>int
<function>sd_bus_set_anonymous
</function></funcdef>
49 <paramdef>sd_bus *
<parameter>bus
</parameter></paramdef>
50 <paramdef>int
<parameter>b
</parameter></paramdef>
54 <funcdef>int
<function>sd_bus_is_anonymous
</function></funcdef>
55 <paramdef>sd_bus *
<parameter>bus
</parameter></paramdef>
59 <funcdef>int
<function>sd_bus_set_trusted
</function></funcdef>
60 <paramdef>sd_bus *
<parameter>bus
</parameter></paramdef>
61 <paramdef>int
<parameter>b
</parameter></paramdef>
65 <funcdef>int
<function>sd_bus_is_trusted
</function></funcdef>
66 <paramdef>sd_bus *
<parameter>bus
</parameter></paramdef>
70 <funcdef>int
<function>sd_bus_set_allow_interactive_authorization
</function></funcdef>
71 <paramdef>sd_bus *
<parameter>bus
</parameter></paramdef>
72 <paramdef>int
<parameter>b
</parameter></paramdef>
76 <funcdef>int
<function>sd_bus_get_allow_interactive_authorization
</function></funcdef>
77 <paramdef>sd_bus *
<parameter>bus
</parameter></paramdef>
83 <title>Description
</title>
85 <para><function>sd_bus_set_description()
</function> sets the description string that is used in
86 logging to the specified string. The string is copied internally and freed when the bus object
87 is deallocated. The
<parameter>description
</parameter> argument may be
88 <constant>NULL
</constant>, in which case the description is unset. This function must be called
89 before the bus is started.
</para>
91 <para><function>sd_bus_get_description()
</function> returns a description string in
92 <parameter>description
</parameter>. This string may have been previously set with
93 <function>sd_bus_set_description()
</function> or
94 <citerefentry><refentrytitle>sd_bus_open_with_description
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
95 or similar. If not set this way, a default string like
<literal>system
</literal> or
96 <literal>user
</literal> will be returned for the system or user buses, and
97 <constant>NULL
</constant> otherwise.
</para>
99 <para><function>sd_bus_set_anonymous()
</function> enables or disables
"anonymous authentication",
100 i.e. lack of authentication, of the bus peer. This function must be called before the bus is
102 <ulink url=
"view-source:https://dbus.freedesktop.org/doc/dbus-specification.html#auth-mechanisms">
103 Authentication Mechanisms
</ulink> section of the D-Bus specification for details.
</para>
105 <para><function>sd_bus_is_anonymous()
</function> returns true if the bus connection allows
106 anonymous authentication (in the sense described in previous paragraph).
</para>
108 <para><function>sd_bus_set_trusted()
</function> sets the
"trusted" state on the
109 <parameter>bus
</parameter> object. If true, all connections on the bus are trusted and access to
110 all privileged and unprivileged methods is granted. This function must be called before the bus
113 <para><function>sd_bus_is_trusted()
</function> returns true if the bus connection is trusted (in
114 the sense described in previous paragraph).
</para>
116 <para><function>sd_bus_set_allow_interactive_authorization()
</function> enables or disables
117 interactive authorization for method calls. If true, messages are marked with the
118 <constant>ALLOW_INTERACTIVE_AUTHORIZATION
</constant> flag specified by the
119 <ulink url=
"view-source:https://dbus.freedesktop.org/doc/dbus-specification.html">D-Bus
</ulink>
120 specification, informing the receiving side that the caller is prepared to wait for interactive
121 authorization, which might take a considerable time to complete. If this flag is set, the user
122 may be queried for passwords or confirmation via
123 <ulink url=
"http://www.freedesktop.org/wiki/Software/polkit">polkit
</ulink> or a similar
126 <para><function>sd_bus_get_allow_interactive_authorization()
</function> returns true if
127 interactive authorization is allowed and false if not.
</para>
131 <title>Return Value
</title>
133 <para>On success, these functions return a non-negative integer. On failure, they return a
134 negative errno-style error code.
</para>
137 <title>Errors
</title>
139 <para>Returned errors may indicate the following problems:
</para>
143 <term><constant>-EINVAL
</constant></term>
145 <listitem><para>An argument is invalid.
</para></listitem>
149 <term><constant>-ENOPKG
</constant></term>
151 <listitem><para>The bus cannot be resolved.
</para></listitem>
155 <term><constant>-EPERM
</constant></term>
157 <listitem><para>The bus has already been started.
</para></listitem>
161 <term><constant>-ECHILD
</constant></term>
163 <listitem><para>The bus was created in a different process.
</para></listitem>
167 <term><constant>-ENOMEM
</constant></term>
169 <listitem><para>Memory allocation failed.
</para></listitem>
176 <xi:include href=
"libsystemd-pkgconfig.xml" />
179 <title>See Also
</title>
182 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
183 <citerefentry><refentrytitle>sd-bus
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
184 <citerefentry><refentrytitle>sd_bus_default_user
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
185 <citerefentry><refentrytitle>sd_bus_default_system
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
186 <citerefentry><refentrytitle>sd_bus_open_user
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
187 <citerefentry><refentrytitle>sd_bus_open_system
</refentrytitle><manvolnum>3</manvolnum></citerefentry>