NAME |SYNOPSIS |DESCRIPTION |RETURN VALUE |NOTES |HISTORY |SEE ALSO |COLOPHON | |
SD_BUS_SET_PROPERTY(3) sd_bus_set_propertySD_BUS_SET_PROPERTY(3)sd_bus_set_property, sd_bus_set_propertyv, sd_bus_get_property, sd_bus_get_property_trivial, sd_bus_get_property_string, sd_bus_get_property_strv - Set or query D-Bus service properties
#include <systemd/sd-bus.h>int sd_bus_set_property(sd_bus *bus, const char *destination,const char *path, const char *interface,const char *member,sd_bus_error *ret_error, const char *type,...);int sd_bus_set_propertyv(sd_bus *bus, const char *destination,const char *path, const char *interface,const char *member,sd_bus_error *ret_error,const char *type, va_listap);int sd_bus_get_property(sd_bus *bus, const char *destination,const char *path, const char *interface,const char *member,sd_bus_error *ret_error,sd_bus_message **reply, const char *type);int sd_bus_get_property_trivial(sd_bus *bus,const char *destination,const char *path,const char *interface,const char *member,sd_bus_error *ret_error,chartype, void *ret_ptr);int sd_bus_get_property_string(sd_bus *bus,const char *destination,const char *path,const char *interface,const char *member,sd_bus_error *ret_error,char **ret);int sd_bus_get_property_strv(sd_bus *bus, const char *destination,const char *path,const char *interface,const char *member,sd_bus_error *ret_error,char ***ret);
These functions set or query D-Bus properties. D-Bus properties are service fields exposed via theorg.freedesktop.DBus.Properties interface. Under the hood, these functions call methods of theorg.freedesktop.DBus.Propertiesinterface and as a result their semantics are similar tosd_bus_call_method(3).sd_bus_set_property()sets a D-Bus property. If setting the property fails or an internal error occurs, an error is returned and an extended description of the error is optionally stored inret_error if it is notNULL.type and the arguments that follow it describe the new value of the property and must follow the format described insd_bus_message_append(3).sd_bus_set_propertyv()is equivalent tosd_bus_set_property(), except that it is called with a "va_list" instead of a variable number of arguments.sd_bus_get_property()queries a D-Bus property. If retrieving the property fails or an internal error occurs, an error is returned and an extended description of the error is optionally stored inret_error if it is notNULL. On success, the property is stored inreply.type describes the property type and must follow the format described insd_bus_message_append(3).sd_bus_get_property_trivial(),sd_bus_get_property_string()andsd_bus_get_property_strv()are shorthands forsd_bus_get_property()that are used to query basic, string and string vector properties respectively. The caller is responsible for freeing the string and string vector results stored inret bysd_bus_get_property_string()andsd_bus_get_property_strv().
On success, these functions return a non-negative integer. On failure, they return a negative errno-style error code.Errors See thesd_bus_call_method(3) man page for a list of 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_set_property(),sd_bus_set_propertyv(),sd_bus_get_property(),sd_bus_get_property_trivial(),sd_bus_get_property_string(), andsd_bus_get_property_strv()were added in version 246.
systemd(1),sd-bus(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_SET_PROPERTY(3)Pages that refer to this page:sd-bus(3), sd_bus_call_method(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. | ![]() |