SD_VARLINK_SET_DESCRIPTION(3)
π NAME
okay so bestie, welcome to the group chat for sd_varlink_set_description and sd_varlink_get_description β the two functions that let you set or query the description of a Varlink connection object. that's it, that's the whole vibe β¨
π SYNOPSIS
#include <systemd/sd-varlink.h>
int sd_varlink_set_description(sd_varlink *link,
const char *description);
const char* sd_varlink_get_description(sd_varlink *link);
like, look at them. immaculate. no notes. π«Ά
πΈ DESCRIPTION
so sd_varlink_set_description() sets the description string β the one that gets used in logging β to whatever string you pass in. it's giving "name tag for your connection." π·οΈ the string is copied internally and freed when the Varlink connection object is deallocated, so you don't have to babysit it, she's independent now π
the description argument may be NULL, and in that case the description is unset. poof. gone. π
then there's sd_varlink_get_description() β she returns a description string for the specified Varlink connection. this string may have been previously set with sd_varlink_set_description(). but if it wasn't set that way, a default string or NULL may be returned β it lowkey depends on how the connection was allocated and set up. so like, don't assume, okay? π
β RETURN VALUE
- On success,
sd_varlink_set_description()returns a non-negative integer. slay. π - On failure, it returns a negative errno-style error code. not slay. π
sd_varlink_get_description()returns eitherNULLor a pointer to the description string.
π¦ Errors
the errors it might throw at you are these, and they're literally:
-EINVALβ an argument is invalid. bestie something you passed in is not it π-ENOMEMβ memory allocation failed. the malloc said no π«
π₯ NOTES
the functions described here are available as a shared library, which can be compiled against and linked to with the libsystemd pkg-config(1) file. standard systemd girlie behavior, you know the drill β¨
β οΈ okay important thing: 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. like, do it before the party starts, not mid-party. periodt. π
π HISTORY
sd_varlink_set_description()was added in version 257.sd_varlink_get_description()was added in version 258.
generational glow-up honestly π
π SEE ALSO
go read those, iykyk π
anyway bestie that's the whole page β brought to you by systemd 259.10, the version that made this all possible π mwah, go forth and describe your varlinks responsibly β¨π¦
π¦ where this page comes from
- fedora 44: systemd-devel 259.10-1.fc44 Β· LGPL-2.1-or-later AND MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms