1SD_BUS_SET_DESCRIPTION(3) sd_bus_set_description SD_BUS_SET_DESCRIPTION(3)
2
3
4
6 sd_bus_set_description, sd_bus_get_description, sd_bus_set_anonymous,
7 sd_bus_is_anonymous, sd_bus_set_trusted, sd_bus_is_trusted,
8 sd_bus_set_allow_interactive_authorization,
9 sd_bus_get_allow_interactive_authorization, sd_bus_get_scope,
10 sd_bus_get_tid, sd_bus_get_unique_name - Set or query properties of a
11 bus object
12
14 #include <systemd/sd-bus.h>
15
16 int sd_bus_set_description(sd_bus *bus, const char *description);
17
18 int sd_bus_get_description(sd_bus *bus, const char **description);
19
20 int sd_bus_set_anonymous(sd_bus *bus, int b);
21
22 int sd_bus_is_anonymous(sd_bus *bus);
23
24 int sd_bus_set_trusted(sd_bus *bus, int b);
25
26 int sd_bus_is_trusted(sd_bus *bus);
27
28 int sd_bus_set_allow_interactive_authorization(sd_bus *bus, int b);
29
30 int sd_bus_get_allow_interactive_authorization(sd_bus *bus);
31
32 int sd_bus_get_scope(sd_bus *bus, const char **scope);
33
34 int sd_bus_get_tid(sd_bus *bus, pid_t *tid);
35
36 int sd_bus_get_unique_name(sd_bus *bus, const char **unique);
37
39 sd_bus_set_description() sets the description string that is used in
40 logging to the specified string. The string is copied internally and
41 freed when the bus object is deallocated. The description argument may
42 be NULL, in which case the description is unset. This function must be
43 called before the bus is started.
44
45 sd_bus_get_description() returns a description string in description.
46 This string may have been previously set with sd_bus_set_description()
47 or sd_bus_open_with_description(3) or similar. If not set this way, a
48 default string like "system" or "user" will be returned for the system
49 or user buses, and -ENXIO otherwise.
50
51 sd_bus_set_anonymous() enables or disables "anonymous authentication",
52 i.e. lack of authentication, of the bus peer. This function must be
53 called before the bus is started. See the Authentication Mechanisms[1]
54 section of the D-Bus specification for details.
55
56 sd_bus_is_anonymous() returns true if the bus connection allows
57 anonymous authentication (in the sense described in previous
58 paragraph).
59
60 sd_bus_set_trusted() sets the "trusted" state on the bus object. If
61 true, all connections on the bus are trusted and access to all
62 privileged and unprivileged methods is granted. This function must be
63 called before the bus is started.
64
65 sd_bus_is_trusted() returns true if the bus connection is trusted (in
66 the sense described in previous paragraph).
67
68 sd_bus_set_allow_interactive_authorization() enables or disables
69 interactive authorization for method calls. If true, messages are
70 marked with the ALLOW_INTERACTIVE_AUTHORIZATION flag specified by the
71 D-Bus[2] specification, informing the receiving side that the caller is
72 prepared to wait for interactive authorization, which might take a
73 considerable time to complete. If this flag is set, the user may be
74 queried for passwords or confirmation via polkit[3] or a similar
75 framework.
76
77 sd_bus_get_allow_interactive_authorization() returns true if
78 interactive authorization is allowed and false if not.
79
80 sd_bus_get_scope() stores the scope of the given bus object in scope.
81 The scope of the system bus is "system". The scope of a user session
82 bus is "user". If the given bus object is not the system or a user
83 session bus, sd_bus_get_scope() returns an error.
84
85 sd_bus_get_tid() stores the kernel thread id of the thread associated
86 with the given bus object in tid. If bus is a default bus object
87 obtained by calling one of the functions of the sd_bus_default(3)
88 family of functions, it stores the thread id of the thread the bus
89 object was created in. Otherwise, if the bus object is attached to an
90 event loop, it stores the thread id of the thread the event loop object
91 was created in. If bus is not a default bus object and is not attached
92 to an event loop, sd_bus_get_tid() returns an error.
93
94 sd_bus_get_unique_name() stores the unique name of the bus object on
95 the bus in unique. See The D-Bus specification[4] for more information
96 on bus names. Note that the caller does not own the string stored in
97 unique and should not free it.
98
100 On success, these functions return a non-negative integer. On failure,
101 they return a negative errno-style error code.
102
103 Errors
104 Returned errors may indicate the following problems:
105
106 -EINVAL
107 An argument is invalid.
108
109 -ENOPKG
110 The bus cannot be resolved.
111
112 -EPERM
113 The bus has already been started.
114
115 -ECHILD
116 The bus was created in a different process, library or module
117 instance.
118
119 -ENOMEM
120 Memory allocation failed.
121
122 -ENODATA
123 The bus object passed to sd_bus_get_scope() was not a system or
124 user session bus.
125
126 -ENXIO
127 The bus object passed to sd_bus_get_tid() was not a default bus
128 object and is not attached to an event loop.
129
130 The bus object passed to sd_bus_get_description() did not have a
131 description.
132
134 Functions described here are available as a shared library, which can
135 be compiled against and linked to with the libsystemd pkg-config(1)
136 file.
137
138 The code described here uses getenv(3), which is declared to be not
139 multi-thread-safe. This means that the code calling the functions
140 described here must not call setenv(3) from a parallel thread. It is
141 recommended to only do calls to setenv() from an early phase of the
142 program when no other threads have been started.
143
145 systemd(1), sd-bus(3), sd_bus_default_user(3),
146 sd_bus_default_system(3), sd_bus_open_user(3), sd_bus_open_system(3)
147
149 1. Authentication Mechanisms
150 view-source:https://dbus.freedesktop.org/doc/dbus-specification.html#auth-mechanisms
151
152 2. D-Bus
153 view-source:https://dbus.freedesktop.org/doc/dbus-specification.html
154
155 3. polkit
156 https://www.freedesktop.org/wiki/Software/polkit
157
158 4. The D-Bus specification
159 https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus
160
161
162
163systemd 254 SD_BUS_SET_DESCRIPTION(3)