1SD_BUS_START(3) sd_bus_start SD_BUS_START(3)
2
3
4
6 sd_bus_start - Initiate a bus connection to the D-bus broker daemon
7
9 #include <systemd/sd-bus.h>
10
11 int sd_bus_start(sd_bus *bus);
12
14 sd_bus_start() connects an existing bus connection object to the D-Bus
15 broker daemon, usually dbus-daemon(1) or dbus-broker(1). The mechanism
16 to use for the connection must be configured before the call to
17 sd_bus_start(), using one of sd_bus_set_address(3), sd_bus_set_fd(3),
18 or sd_bus_set_exec(3). sd_bus_start() will open the connection socket
19 or spawn the executable as needed, and asynchronously start a
20 org.freedesktop.DBus.Hello() call. The answer to the Hello call will be
21 processed later from sd_bus_process(3). If opening of the connection or
22 queuing of the asynchronous call fail, the connection will be closed
23 with sd_bus_close(3).
24
25 In most cases, it is better to use sd_bus_default_user(3),
26 sd_bus_default_system(3) or related calls instead of the more low-level
27 sd_bus_new() and sd_bus_start(). The higher-level functions not only
28 allocate a bus object but also start the connection to a well-known bus
29 in a single function call.
30
32 On success, this function returns a non-negative integer. On failure,
33 it returns a negative errno-style error code.
34
35 Errors
36 -EINVAL
37 The input parameter bus is NULL.
38
39 -ENOPKG
40 Bus object bus could not be resolved.
41
42 -EPERM
43 The input parameter bus is in a wrong state (sd_bus_start() may
44 only be called once on a newly-created bus object).
45
46 -ECHILD
47 The bus object bus was created in a different process.
48
49 In addition, other connection-related errors may be returned. See
50 sd_bus_send(3).
51
53 Functions described here are available as a shared library, which can
54 be compiled against and linked to with the libsystemd pkg-config(1)
55 file.
56
57 The code described here uses getenv(3), which is declared to be not
58 multi-thread-safe. This means that the code calling the functions
59 described here must not call setenv(3) from a parallel thread. It is
60 recommended to only do calls to setenv() from an early phase of the
61 program when no other threads have been started.
62
64 systemd(1), sd-bus(3), sd_bus_default(3), sd_bus_call_async(3)
65
66
67
68systemd 254 SD_BUS_START(3)