table of contents
SD_BUS_SET_ADDRESS(3) | sd_bus_set_address | SD_BUS_SET_ADDRESS(3) |
NAME¶
sd_bus_set_address, sd_bus_get_address, sd_bus_set_exec - Set or query the address of the bus connection
SYNOPSIS¶
#include <elogind/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 the following:
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 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_start(3).
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.
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
-ENOPKG
-EPERM
-ECHILD
-ENODATA
NOTES¶
These APIs are implemented as a shared library, which can be compiled and linked to with the libelogind pkg-config(1) file.
SEE ALSO¶
elogind(1), sd-bus(3), sd_bus_new(3), sd_bus_start(3), elogind-machined.service(8), machinectl(1)
elogind 246.9.1 |