SD_BUS_ME...NEW_SIGNAL(3)
π SD_BUS_ME...NEW_SIGNAL(3) β sd_bus_message_new_signal π
okay bestie, welcome to the sd_bus_message_new_signal manual page β manual name folded in right here: sd_bus_message_new_signal. We're making D-Bus signal messages, and the vibe is very βsend it and donβt wait for a reply.β π
π NAME π
sd_bus_message_new_signal(), sd_bus_message_new_signal_to() β Create a signal message. Thatβs the whole name section, and it ate. β¨
β¨ SYNOPSIS β¨
#include <systemd/sd-bus.h>
int sd_bus_message_new_signal(sd_bus *bus, sd_bus_message **m,
const char *path, const char *interface,
const char *member);
int sd_bus_message_new_signal_to(sd_bus *bus, sd_bus_message **m,
const char *destination,
const char *path,
const char *interface,
const char *member);
πΈ DESCRIPTION πΈ
The sd_bus_message_new_signal() function creates a new bus message object that encapsulates a D-Bus signal, and returns it in the m output parameter. The signal will be sent to path path, on the interface interface, member member. When this message is sent, no reply is expected. See sd_bus_message_new_method_call(3) for a short description of the meaning of the path, interface, and member parameters. π¦
sd_bus_message_new_signal_to() is a shorthand for creating a new bus message to a specific destination. Its behavior is similar to calling sd_bus_message_new_signal() followed by calling sd_bus_message_set_destination(3). Itβs giving βsame signal energy, but with a destination attached.β π«Ά
π RETURN VALUE π
This function returns 0 if the message object was successfully created, and a negative errno-style error code otherwise. π
π Errors π
Returned errors may indicate the following problems:
-EINVALβ The output parametermisNULL. Thepathparameter is not a valid D-Bus path ("/an/object/path"), theinterfaceparameter is not a valid D-Bus interface name ("an.interface.name"), or thememberparameter is not a valid D-Bus member ("Name").-ENOTCONNβ The bus parameterbusisNULLor the bus is not connected.-ENOMEMβ Memory allocation failed. π
π§ 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. π
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. π
π§ͺ EXAMPLES π§ͺ
π Example 1. Send a simple signal π
/* SPDX-License-Identifier: MIT-0 */
#include <systemd/sd-bus.h>
#define _cleanup_(f) __attribute__((cleanup(f)))
int send_unit_files_changed(sd_bus *bus) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *message = NULL;
int r;
r = sd_bus_message_new_signal(bus, &message,
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"UnitFilesChanged");
if (r < 0)
return r;
return sd_bus_send(bus, message, NULL);
}
This function in systemd sources is used to emit the "UnitFilesChanged" signal when the unit files have been changed. Literally main character signal behavior. π
π SEE ALSO π
okay thatβs the whole page, bestie. cute sign-off from the footer: source/version is systemd 261.3, and no date is listed on this page. go make some iconic signals πβ¨ periodt β¨π
π¦ 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