SD_BUS_SE...TED_SIGNAL(3)
π SD_BUS_SE...TED_SIGNAL(3) β the one where your bus connection finally says hi π
Okay bestie, so this is from the sd_bus_set_connected_signal manual, and it's literally all about controlling whether your bus connection emits a cute little local "Connected()" signal when it's fully ready. No cap, it's giving "finally arrived" energy. π
β¨ NAME β¨
sd_bus_set_connected_signal, sd_bus_get_connected_signal β control emission of the local connection establishment signal on bus connections. Yes, that's the whole vibe. π
πΈ SYNOPSIS πΈ
#include <systemd/sd-bus.h>
int sd_bus_set_connected_signal(sd_bus *bus, int b);
int sd_bus_get_connected_signal(sd_bus *bus);
π¦ DESCRIPTION π¦
So sd_bus_set_connected_signal() is the main character here. It lets you control whether a local, synthetic Connected() signal message gets generated and enqueued for dispatching when the connection is fully established. If the b parameter is zero, the message is not generated (and yes, that's the default), otherwise it is generated. It's literally that simple. β¨
Then you've got sd_bus_get_connected_signal(), which is the nosy bestie β it queries whether this feature is enabled. It returns zero if not, positive otherwise. Slay. π
The Connected() signal message is generated from the "org.freedesktop.DBus.Local" service and interface, and the "/org/freedesktop/DBus/Local" object path. Use sd_bus_match_signal_async(3) to match on this signal, iykyk. π₯
This message is particularly useful on slow transports where connections take a long time to be established β especially when sd_bus_set_watch_bind(3) is used. The signal is generated when sd_bus_is_ready(3) returns positive for the first time. Periodt. β
And here's the tea: the Connected() signal corresponds with the Disconnected() signal that is synthesized locally when the connection is terminated. But the latter is generated unconditionally, unlike the former, which needs to be enabled explicitly before it is generated, with sd_bus_set_connected_signal(). Not me explaining the whole family tree, but here we are. π
π RETURN VALUE π
On success, these functions return 0 or a positive integer. On failure, they return a negative errno-style error code. That's the standard slay. π«Ά
π Errors π
Returned errors may indicate the following problems:
-ECHILDβ the bus connection has been created in a different process, library or module instance. Rude, but okay. π
π 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. Iconic. π
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. So like, share the object, don't fight over it. π§
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. Fr fr, don't test it. π
π HISTORY π
sd_bus_set_connected_signal() and sd_bus_get_connected_signal() were added in version 237. Vintage but still cute. π
β SEE ALSO β
systemd(1), sd-bus(3), sd_bus_match_signal_async(3), sd_bus_set_watch_bind(3), sd_bus_is_ready(3)
That's the whole page, bestie. This little gem comes from systemd 261.3 (yes, the manpage footer said so), and it's all yours. Now go enable that Connected() signal and live your best bus life. πΈππ¦
π¦ 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