Movatterモバイル変換


[0]ホーム

URL:


man7.org > Linux >man-pages

Linux/UNIX system programming training


sd_bus_set_server(3) — Linux manual page

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

SD_BUS_SET_SERVER(3)        sd_bus_set_serverSD_BUS_SET_SERVER(3)

NAME        top

       sd_bus_set_server, sd_bus_is_server, sd_bus_get_bus_id,       sd_bus_set_bus_client, sd_bus_is_bus_client, sd_bus_set_monitor,       sd_bus_is_monitor - Configure connection mode for a bus object

SYNOPSIS        top

#include <systemd/sd-bus.h>int sd_bus_set_server(sd_bus *bus, intb, sd_id128_tid);int sd_bus_is_server(sd_bus *bus);int sd_bus_get_bus_id(sd_bus *bus, sd_id128_t *id);int sd_bus_set_bus_client(sd_bus *bus, intb);int sd_bus_is_bus_client(sd_bus *bus);int sd_bus_set_monitor(sd_bus *bus, intb);int sd_bus_is_monitor(sd_bus *bus);

DESCRIPTION        top

sd_bus_set_server()configures the bus object as a server for       direct D-Bus connections.b enables/disables the server mode. If       zero, the server mode is disabled. Otherwise, the server mode is       enabled. Configuring a bus object as a server is required to allow       establishing direct connections between two peers without going       via the D-Bus daemon.id must contain a 128-bit integer id for       the server. If clients add a guid field to their D-Bus address       string, the server id must match this guid or the D-Bus       authentication handshake will fail. If no specific id is defined       for the server,sd_id128_randomize(3) can be used to generate a       random id instead.sd_bus_is_server()returns whether the server mode is enabled for       the given bus object.sd_bus_get_bus_id()stores the D-Bus server id configured usingsd_bus_set_server()(for server bus objects) or received during       D-Bus authentication (for client bus objects) inid.sd_bus_set_bus_client()configures the bus object as a D-Bus       daemon client.b enables/disables the client mode. If zero, the       client mode is disabled and the bus object should connect directly       to a D-Bus server. Otherwise, the client mode is enabled and the       bus object should connect to a D-Bus daemon. When connecting to an       existing bus using any of the functions in thesd_bus_open(3)       family of functions or any of the functions in thesd_bus_default(3) family of functions, the bus object is       automatically configured as a bus client. However, when connecting       to a D-Bus daemon by callingsd_bus_set_address(3) followed bysd_bus_start(3), the bus object should be manually configured as a       bus client usingsd_bus_set_bus_client(). By default, a bus object       is not configured as a D-Bus daemon client.sd_bus_is_bus_client()returns whether the client mode is       enabled/disabled for the given bus object.sd_bus_set_monitor()configures the bus object as a D-Bus monitor       object.b enables/disables the monitor mode. If zero, the monitor       mode is disabled. If non-zero, the monitor mode is enabled. When       the monitor mode is enabled, no messages may be sent via the bus       object and it may not expose any objects on the bus. To start       monitoring messages, call theorg.freedesktop.DBus.Monitoring.BecomeMonitormethod of the D-Bus       daemon and pass a list of matches indicating which messages to       intercept. SeeThe D-Bus specification[1] for more information.sd_bus_is_monitor()returns whether the monitor mode is       enabled/disabled for the given bus object.

RETURN VALUE        top

       On success,sd_bus_set_server(),sd_bus_get_bus_id(),sd_bus_set_bus_client()andsd_bus_set_monitor()return a       non-negative integer. On failure, they return a negative       errno-style error code.sd_bus_is_server(),sd_bus_is_bus_client()andsd_bus_is_monitor()       return a positive integer when the server or client mode is       enabled, respectively. Otherwise, they return zero.Errors       Returned errors may indicate the following problems:-ECHILD           The bus connection has been created in a different process,           library or module instance.           Added in version 246.-EPERM           The bus connection has already been started.           Added in version 246.-ENOPKG           The bus cannot be resolved.           Added in version 246.-EINVAL           A required parameter wasNULLorb was zero andid did not           equalSD_ID128_NULL.           Added in version 246.-ENOTCONN           The bus is not connected.           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_server(),sd_bus_is_server(),sd_bus_get_bus_id(),sd_bus_set_bus_client(),sd_bus_is_bus_client(),sd_bus_set_monitor(), andsd_bus_is_monitor()were added in       version 246.

SEE ALSO        top

systemd(1),sd-bus(3)

NOTES        top

        1. The D-Bus specificationhttps://dbus.freedesktop.org/doc/dbus-specification.html#bus-messages-become-monitor

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_SERVER(3)

Pages that refer to this page:sd-bus(3)sd_bus_add_match(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