Movatterモバイル変換


[0]ホーム

URL:


man7.org > Linux >man-pages

Linux/UNIX system programming training


sd_bus_set_address(3) — Linux manual page

NAME |SYNOPSIS |DESCRIPTION |RETURN VALUE |NOTES |HISTORY |SEE ALSO |COLOPHON

SD_BUS_SET_ADDRESS(3)       sd_bus_set_addressSD_BUS_SET_ADDRESS(3)

NAME        top

       sd_bus_set_address, sd_bus_get_address, sd_bus_set_exec - Set or       query the address of the bus connection

SYNOPSIS        top

#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        top

sd_bus_set_address()configures a list of addresses of bus brokers       to try to connect to from a subsequentsd_bus_start(3) 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 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.family may be eitheripv4oripv6.       •   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.machine is 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, parameterguid is an identifier of the remote peer,       in the syntax accepted bysd_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 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).sd_bus_get_address()returns any previously set addresses. In       addition to being explicitly set bysd_bus_set_address(), the       address will also be set automatically bysd_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.       Ifargv isNULL, the given executable is spawned without any extra       arguments.

RETURN VALUE        top

       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 parametersbus oraddress areNULL.           Added in version 246.-ENOPKG           The bus objectbus could not be resolved.           Added in version 246.-EPERM           The input parameterbus is 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 objectbus was created in a different process.           Added in version 246.-ENODATA           The bus objectbus has no address configured.           Added in version 246.

NOTES        top

       Functions described here are available as a shared library, which       can be compiled against and linked to with thelibsystemd pkg-config(1) file.       The code described here usesgetenv(3), which is declared to be       not multi-thread-safe. This means that the code calling the       functions described here must not callsetenv(3) from a parallel       thread. It is recommended to only do calls tosetenv()from an       early phase of the program when no other threads have been       started.

HISTORY        top

sd_bus_set_address(),sd_bus_get_address(), andsd_bus_set_exec()       were added in version 246.

SEE ALSO        top

systemd(1),sd-bus(3),sd_bus_new(3),sd_bus_start(3),systemd-machined.service(8),machinectl(1)

COLOPHON        top

       This page is part of thesystemd (systemd system and service       manager) project.  Information about the project can be found at       ⟨http://www.freedesktop.org/wiki/Software/systemd⟩.  If you have a       bug report for this manual page, see       ⟨http://www.freedesktop.org/wiki/Software/systemd/#bugreports⟩.       This page was obtained from the project's upstream Git repository       ⟨https://github.com/systemd/systemd.git⟩ on 2025-08-11.  (At that       time, the date of the most recent commit that was found in the       repository was 2025-08-11.)  If you discover any rendering       problems in this HTML version of the page, or you believe there is       a better or more up-to-date source for the page, or you have       corrections or improvements to the information in this COLOPHON       (which isnot part of the original manual page), send a mail to       man-pages@man7.orgsystemd 258~rc2SD_BUS_SET_ADDRESS(3)

Pages that refer to this page:systemd-stdio-bridge(1)sd-bus(3)sd_bus_default(3)sd_bus_new(3)sd_bus_set_server(3)sd_bus_start(3)systemd.directives(7)systemd.index(7)



HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface.

For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere.

Hosting byjambit GmbH.

Cover of TLPI


[8]ページ先頭

©2009-2025 Movatter.jp