NAME |SYNOPSIS |DESCRIPTION |RETURN VALUE |NOTES |HISTORY |SEE ALSO |COLOPHON | |
SD_BUS_EMIT_SIGNAL(3) sd_bus_emit_signalSD_BUS_EMIT_SIGNAL(3)sd_bus_emit_signal, sd_bus_emit_signalv, sd_bus_emit_signal_to, sd_bus_emit_signal_tov, sd_bus_emit_interfaces_added, sd_bus_emit_interfaces_added_strv, sd_bus_emit_interfaces_removed, sd_bus_emit_interfaces_removed_strv, sd_bus_emit_properties_changed, sd_bus_emit_properties_changed_strv, sd_bus_emit_object_added, sd_bus_emit_object_removed - Convenience functions for emitting (standard) D-Bus signals
#include <systemd/sd-bus-vtable.h>int sd_bus_emit_signal(sd_bus *bus, const char *path,const char *interface, const char *member,const char *types, ...);int sd_bus_emit_signalv(sd_bus *bus, const char *path,const char *interface, const char *member,const char *types, va_listap);int sd_bus_emit_signal_to(sd_bus *bus, const char *destination,const char *path, const char *interface,const char *member, const char *types,...);int sd_bus_emit_signal_tov(sd_bus *bus, const char *destination,const char *path,const char *interface,const char *member, const char *types,va_listap);int sd_bus_emit_interfaces_added(sd_bus *bus, const char *path,const char *interface, ...);int sd_bus_emit_interfaces_added_strv(sd_bus *bus,const char *path,char **interfaces);int sd_bus_emit_interfaces_removed(sd_bus *bus, const char *path,const char *interface, ...);int sd_bus_emit_interfaces_removed_strv(sd_bus *bus,const char *path,char **interfaces);int sd_bus_emit_properties_changed(sd_bus *bus, const char *path,const char *interface,const char *name, ...);int sd_bus_emit_properties_changed_strv(sd_bus *bus,const char *path,const char *interface,char **names);int sd_bus_emit_object_added(sd_bus *bus, const char *path);int sd_bus_emit_object_removed(sd_bus *bus, const char *path);
sd_bus_emit_signal()is a convenience function for initializing a bus message object and emitting the corresponding D-Bus signal. It combines thesd_bus_message_new_signal(3),sd_bus_message_append(3) andsd_bus_send(3) functions into a single function call.sd_bus_emit_signalv()is equivalent tosd_bus_message_append(), except that it is called with a "va_list" instead of a variable number of arguments.sd_bus_emit_signal_to()andsd_bus_emit_signal_tov()are identical tosd_bus_emit_signal()andsd_bus_emit_signalv(), except that they can emit the signal to a single destination. Givedestination asNULLto broadcast the signal.sd_bus_emit_interfaces_added()andsd_bus_emit_interfaces_removed()are used to implement theInterfacesAddedandInterfacesRemovedsignals of theorg.freedesktop.DBus.ObjectManagerinterface. They take a path whose interfaces have been modified as an argument and a variable list of interfaces that have been added or removed, respectively. The final argument passed tosd_bus_emit_interfaces_added()andsd_bus_emit_interfaces_removed()must beNULL. This allows both functions to safely determine the number of passed interface arguments.sd_bus_emit_interfaces_added_strv()andsd_bus_emit_interfaces_removed_strv()are identical to their respective counterparts but both take the list of interfaces as a single argument instead of a variable number of arguments.sd_bus_emit_properties_changed()is used to implement thePropertiesChangedsignal of theorg.freedesktop.DBus.Properties interface. It takes an object path, interface and a variable list of property names as its arguments. The final argument passed tosd_bus_emit_properties_changed()must beNULL. This allows it to safely determine the number of passed property names.sd_bus_emit_properties_changed_strv()is identical tosd_bus_emit_properties_changed()but takes the list of property names as a single argument instead of a variable number of arguments.sd_bus_emit_object_added()andsd_bus_emit_object_removed()are convenience functions for emitting theInterfacesAddedorInterfacesRemovedsignals for all interfaces registered on a specific object path, respectively. This includes any parent fallback vtables if they are not overridden by a more applicable child vtable. It also includes all the standard D-Bus interfaces implemented by sd-bus itself on any registered object. Note thatsd_bus_emit_interfaces_added(),sd_bus_emit_interfaces_removed(),sd_bus_emit_object_added()andsd_bus_emit_object_removed()require an object manager to have been registered on the given object path or one of its parent object paths usingsd_bus_add_object_manager(3).
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 One of the required parameters isNULLor invalid. A reserved D-Bus interface was passed as theinterface parameter.-ENOPKG The bus cannot be resolved.-ECHILD The bus was created in a different process, library or module instance.-ENOMEM Memory allocation failed.-ESRCH One ofsd_bus_emit_interfaces_added(),sd_bus_emit_interfaces_removed(),sd_bus_emit_object_added() orsd_bus_emit_object_removed()was called on an object without an object manager registered on its own object path or one of its parent object paths. See the man pages ofsd_bus_message_new_signal(3),sd_bus_message_append(3) andsd_bus_send(3) for more possible errors.
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.
sd_bus_emit_signal(),sd_bus_emit_interfaces_added(),sd_bus_emit_interfaces_added_strv(),sd_bus_emit_interfaces_removed(),sd_bus_emit_interfaces_removed_strv(),sd_bus_emit_properties_changed(),sd_bus_emit_properties_changed_strv(), were added in version 221.sd_bus_emit_object_added(), andsd_bus_emit_object_removed()were added in version 222.sd_bus_emit_signalv()was added in version 246.sd_bus_emit_signal_to()andsd_bus_emit_signal_tov()were added in version 253.
sd-bus(3),busctl(1),sd_bus_message_new_signal(3),sd_bus_message_append(3),sd_bus_send(3),sd_bus_call_method(3)
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_EMIT_SIGNAL(3)Pages that refer to this page:sd-bus(3), sd_bus_add_object(3), sd_bus_add_object_manager(3), sd_bus_call_method(3), sd_bus_message_new_signal(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. | ![]() |