SD_BUS_SET_ADDRESS(3)
π NAME π
The page is SD_BUS_SET_ADDRESS(3), and the manual name folded in near the top is sd_bus_set_address β hiii bestie, this is the bus-address page β¨ The trio on the marquee: sd_bus_set_address, sd_bus_get_address, and sd_bus_set_exec, and their whole thing is to set or query the address of the bus connection. Periodt.
β¨ SYNOPSIS β¨
#include <systemd/sd-bus.h>
int sd_bus_set_address(sd_bus *bus, const char *address);
int sd_bus_get_address(sd_bus *bus, const char **address);
int sd_bus_set_exec(sd_bus *bus, const char *path, char *const *argv);
π DESCRIPTION π
sd_bus_set_address() configures a list of addresses of bus brokers to try to connect to from a subsequent sd_bus_start(3) call. The argument is a ";"-separated list of addresses to try. Each item must be one of these, no cap:
- A unix socket address specified as
"unix:guid=guid,path=path"or"unix:guid=guid,abstract=path". Exactly one of thepath=andabstract=keys must be present, whileguid=is optional. - A TCP socket address specified as
"tcp:[guid=guid,][host=host][,port=port][,family=family]". One or both of thehost=andport=keys must be present, while the rest is optional.familymay be eitheripv4oripv6.
Note: connections over TCP are made without encryption. Thus, this mode should only be used in specific situations where integrity and confidentiality of the connection is not necessary or is ensured through some other means. For local connections, "unix:" connections should be used instead. π
- An executable to spawn specified as
"unixexec:guid=guid,path=path,argv1=argument,argv2=argument,...". Thepath=key must be present, whileguid=is optional. - A machine (container) to connect to specified as
"x-machine-unix:guid=guid,machine=machine,pid=pid". Exactly one of themachine=andpid=keys must be present, whileguid=is optional.machineis the name of a local container. Seemachinectl(1)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_string(3). 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: the addresses passed tosd_bus_set_address()might not be verified immediately. If they are invalid, an error may be returned e.g. from a subsequent call tosd_bus_start(3). So donβt expect instant vibe-checking, okay? π
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_open(3) 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. Slay, shorthand. π«Ά
πΈ RETURN VALUE πΈ
On success, these functions return a non-negative integer. On failure, they return a negative errno-style error code.
π Errors π
Returned errors may indicate the following problems:
-EINVALβ The input parametersbusoraddressareNULL. Added in version 246.-ENOPKGβ The bus objectbuscould not be resolved. Added in version 246.-EPERMβ The input parameterbusis in a wrong state (sd_bus_set_address()may only be called once on a newly-created bus object). Added in version 246.-ECHILDβ The bus objectbuswas created in a different process. Added in version 246.-ENODATAβ The bus objectbushas no address configured. Added in version 246.
π¦ NOTES π¦
Functions described here are available as a shared library, which can be compiled against and linked to with the libsystemd pkg-config(1) file.
All functions listed here are thread-agnostic and only a single thread may operate on a given object at any given time. Different threads may access the same object at different times. Multiple independent objects may be used from different threads in parallel. Thatβs the thread tea.
The code described here uses getenv(3), which is declared to be not multi-thread-safe. This means that the code calling the functions described here must not call setenv(3) from a parallel thread. It is recommended to only do calls to setenv() from an early phase of the program when no other threads have been started. π§
π HISTORY π
sd_bus_set_address(), sd_bus_get_address(), and sd_bus_set_exec() were added in version 246.
π SEE ALSO π
systemd(1), sd-bus(3), sd_bus_new(3), sd_bus_start(3), systemd-machined.service(8), machinectl(1)
Cute sign-off time: the footer says source/version systemd 261.3 and the page tag SD_BUS_SET_ADDRESS(3), and the date slot isnβt separately printed in this footer β so thatβs the whole footer tea, bestie π
π«Άπ
π¦ where this page comes from
- ubuntu stonking: libsystemd-dev 261.3-0ubuntu3 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms