sd_bus_set_addresssystemdsd_bus_set_address3sd_bus_set_addresssd_bus_get_addresssd_bus_set_execSet or query the address of the bus connection#include <systemd/sd-bus.h>int sd_bus_set_addresssd_bus *busconst char *addressint sd_bus_get_addresssd_bus *busconst char **addressint sd_bus_set_execsd_bus *busconst char *pathchar *const *argvDescriptionsd_bus_set_address() configures a list of addresses of bus brokers to try to
connect to from a subsequent
sd_bus_start3 call.
The argument is a ;-separated list of addresses to try. Each item must be one of the
following:
A unix socket address specified as
unix:guid=guid,path=path or
unix:guid=guid,abstract=path.
Exactly one of the path= and abstract= keys must be present,
while guid= is optional.A TCP socket address specified as
tcp:[guid=guid,][host=host][,port=port][,family=family].
One or both of the host= and port= keys must be present, while
the rest is optional. family may be either or
.An executable to spawn specified as
unixexec:guid=guid,path=path,argv1=argument,argv2=argument,....
The path= key must be present, while guid= is optional.A machine (container) to connect to specified as
x-machine-unix:guid=guid,machine=machine,pid=pid.
Exactly one of the machine= and pid= keys must be present,
while guid= is optional. machine is the name of a local
container. See
machinectl1 for
more information about the "machine" concept. machine=.host may be used to specify
the host machine. A connection to the standard system bus socket inside of the specified machine will
be created.In all cases, parameter guid is an identifier of the remote peer, in the
syntax accepted by
sd_id128_from_string3.
If specified, the identifier returned by the peer after the connection is established will be checked and
the connection will be rejected in case of a mismatch.Note that the addresses passed to sd_bus_set_address() may not be verified
immediately. If they are invalid, an error may be returned e.g. from a subsequent call to
sd_bus_start3.
sd_bus_get_address() returns any previously set addresses. In addition to
being explicitly set by sd_bus_set_address(), the address will also be set
automatically by
sd_bus_open3 and
similar calls, based on environment variables or built-in defaults.sd_bus_set_exec() is a shorthand function for setting a
unixexec address that spawns the given executable with the given arguments.
If argv is NULL, the given executable is spawned
without any extra arguments.Return ValueOn success, these functions return a non-negative integer. On failure, they return a negative
errno-style error code.ErrorsReturned errors may indicate the following problems:-EINVALThe input parameters bus or address are NULL.
-ENOPKGThe bus object bus could not be resolved.-EPERMThe input parameter bus is in a wrong state
(sd_bus_set_address() may only be called once on a newly-created bus object).-ECHILDThe bus object bus was created in a different
process.-ENODATAThe bus object bus has no address configured.Historysd_bus_set_address(),
sd_bus_get_address(), and
sd_bus_set_exec() were added in version 246.See Alsosystemd1sd-bus3sd_bus_new3sd_bus_start3systemd-machined.service8machinectl1