SD_BUS_SET_PROPERTY(3)
π
SD_BUS_SET_PROPERTY(3) β the sd_bus_set_property girlies
okay so bestie, welcome to the sd_bus_set_property manual page, aka your lil' group chat with D-Bus properties. pull up a chair, grab a boba, we're getting into it π
β¨ NAME β¨
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. literally the whole friend group π«Ά
πΈ SYNOPSIS πΈ
#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_list ap);
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, char type,
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);
π¦ DESCRIPTION π¦
so these functions set or query D-Bus properties. and like β what is a D-Bus property? it's a service field exposed via the org.freedesktop.DBus.Properties interface. under the hood, these functions call methods of the org.freedesktop.DBus.Properties interface, and as a result their semantics are similar to those of sd_bus_call_method(3). iykyk β¨
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_errorif it is notNULL.typeand the arguments that follow it describe the new value of the property and must follow the format described insd_bus_message_append(3). no cap, follow the format.sd_bus_set_propertyv()β equivalent tosd_bus_set_property(), except that it is called with a"va_list"instead of a variable number of arguments. same energy, different vibes.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_errorif it is notNULL. on success, the property is stored inreply.typedescribes the property type and must follow the format described insd_bus_message_append(3). slay.sd_bus_get_property_trivial(),sd_bus_get_property_string()andsd_bus_get_property_strv()β these are shorthands forsd_bus_get_property()used to query basic, string and string vector properties respectively. and bestie, listen β the caller is responsible for freeing the string and string vector results stored inretbysd_bus_get_property_string()andsd_bus_get_property_strv(). that's your mess to clean up, not ours π
π₯ RETURN VALUE π₯
on success, these functions return a non-negative integer. on failure, they return a negative errno-style error code. that's it, that's the vibe check. π
π Errors
see the sd_bus_call_method(3) man page for a list of possible errors. we're not gonna list 'em all here, go read the other one, it eats.
π NOTES π
- functions described here are available as a shared library, which can be compiled against and linked to with the
libsystemdpkg-config(1)file. cute, convenient, 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 politely, bestie π«Ά
β οΈ 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. do NOT be messy about this one, fr fr.
π HISTORY π
sd_bus_set_property(), sd_bus_set_propertyv(), sd_bus_get_property(), sd_bus_get_property_trivial(), sd_bus_get_property_string(), and sd_bus_get_property_strv() were added in version 246. glow-up era β¨
π SEE ALSO π
systemd(1), sd-bus(3), sd_bus_call_method(3)
and that's the page, bestie!! mwah π this lil' number is brought to you by systemd 261.3 β the source/version flex β and it's dated with love under the SD_BUS_SET_PROPERTY(3) banner. go forth and set those properties. 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