| 1 |
'\" t |
| 2 |
.TH "SD_BUS_START" "3" "" "systemd 261~rc3" "sd_bus_start" |
| 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_start \- Initiate a bus connection to the D\-bus broker daemon |
| 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_start('u |
| 32 |
.BI "int sd_bus_start(sd_bus\ *" "bus" ");" |
| 33 |
.SH "DESCRIPTION" |
| 34 |
.PP |
| 35 |
\fBsd_bus_start()\fR |
| 36 |
connects an existing bus connection object to the D\-Bus broker daemon, usually |
| 37 |
\fBdbus-daemon\fR(1) |
| 38 |
or |
| 39 |
\fBdbus-broker\fR(1)\&. The mechanism to use for the connection must be configured before the call to |
| 40 |
\fBsd_bus_start()\fR, using one of |
| 41 |
\fBsd_bus_set_address\fR(3), |
| 42 |
\fBsd_bus_set_fd\fR(3), or |
| 43 |
\fBsd_bus_set_exec\fR(3)\&. |
| 44 |
\fBsd_bus_start()\fR |
| 45 |
will open the connection socket or spawn the executable as needed, and asynchronously start a |
| 46 |
\fBorg\&.freedesktop\&.DBus\&.Hello()\fR |
| 47 |
call\&. The answer to the Hello call will be processed later from |
| 48 |
\fBsd_bus_process\fR(3)\&. If opening of the connection or queuing of the asynchronous call fail, the connection will be closed with |
| 49 |
\fBsd_bus_close\fR(3)\&. |
| 50 |
.PP |
| 51 |
In most cases, it is better to use |
| 52 |
\fBsd_bus_default_user\fR(3), |
| 53 |
\fBsd_bus_default_system\fR(3) |
| 54 |
or related calls instead of the more low\-level |
| 55 |
\fBsd_bus_new()\fR |
| 56 |
and |
| 57 |
\fBsd_bus_start()\fR\&. The higher\-level functions not only allocate a bus object but also start the connection to a well\-known bus in a single function call\&. |
| 58 |
.SH "RETURN VALUE" |
| 59 |
.PP |
| 60 |
On success, this function returns a non\-negative integer\&. On failure, it returns a negative errno\-style error code\&. |
| 61 |
.SS "Errors" |
| 62 |
.PP |
| 63 |
\fB\-EINVAL\fR |
| 64 |
.RS 4 |
| 65 |
The input parameter |
| 66 |
\fIbus\fR |
| 67 |
is |
| 68 |
\fBNULL\fR\&. |
| 69 |
.sp |
| 70 |
Added in version 246\&. |
| 71 |
.RE |
| 72 |
.PP |
| 73 |
\fB\-ENOPKG\fR |
| 74 |
.RS 4 |
| 75 |
Bus object |
| 76 |
\fIbus\fR |
| 77 |
could not be resolved\&. |
| 78 |
.sp |
| 79 |
Added in version 246\&. |
| 80 |
.RE |
| 81 |
.PP |
| 82 |
\fB\-EPERM\fR |
| 83 |
.RS 4 |
| 84 |
The input parameter |
| 85 |
\fIbus\fR |
| 86 |
is in a wrong state (\fBsd_bus_start()\fR |
| 87 |
may only be called once on a newly\-created bus object)\&. |
| 88 |
.sp |
| 89 |
Added in version 246\&. |
| 90 |
.RE |
| 91 |
.PP |
| 92 |
\fB\-ECHILD\fR |
| 93 |
.RS 4 |
| 94 |
The bus object |
| 95 |
\fIbus\fR |
| 96 |
was created in a different process\&. |
| 97 |
.sp |
| 98 |
Added in version 246\&. |
| 99 |
.RE |
| 100 |
.PP |
| 101 |
In addition, other connection\-related errors may be returned\&. See |
| 102 |
\fBsd_bus_send\fR(3)\&. |
| 103 |
.SH "NOTES" |
| 104 |
.PP |
| 105 |
Functions described here are available as a shared library, which can be compiled against and linked to with the |
| 106 |
\fBlibsystemd\fR\ \&\fBpkg-config\fR(1) |
| 107 |
file\&. |
| 108 |
.PP |
| 109 |
The code described here uses |
| 110 |
\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 |
| 111 |
\fBsetenv\fR(3) |
| 112 |
from a parallel thread\&. It is recommended to only do calls to |
| 113 |
\fBsetenv()\fR |
| 114 |
from an early phase of the program when no other threads have been started\&. |
| 115 |
.SH "HISTORY" |
| 116 |
.PP |
| 117 |
\fBsd_bus_start()\fR |
| 118 |
was added in version 246\&. |
| 119 |
.SH "SEE ALSO" |
| 120 |
.PP |
| 121 |
\fBsystemd\fR(1), \fBsd-bus\fR(3), \fBsd_bus_default\fR(3), \fBsd_bus_call_async\fR(3) |