SD_BUS_MESSAGE_APPEND_STRV(3)
π NAME
sd_bus_message_append_strv β attach an array of strings to a message, bestie β¨
β¨ SYNOPSIS
#include <systemd/sd-bus.h>
int sd_bus_message_append_strv(sd_bus_message *m, char **l);
π«Ά DESCRIPTION
Okay so here's the tea π β the sd_bus_message_append() function can be used to append an array of strings to message m, and it literally just does the thing for you.
The parameter l shall point to a NULL-terminated array of pointers to NUL-terminated strings. Yes, that's a lot of NULLs, no I'm not joking π. Every single string has to satisfy the exact same constraints as the ones described for the "s" type over in sd_bus_message_append_basic(3) β so go read that, iykyk.
The memory pointed at by p and the contents of the strings themselves are copied into the memory area containing the message, and they may be changed after this call π (so like, do whatever you want with your original buffers afterward, she's got her own copy now, main character energy).
Heads up: the signature of the l parameter is to be treated as const char *const *, and the contents will not be modified. Not even a little. Hands off π
π RETURN VALUE
On success, this call returns 0 or a positive integer π (either way you're slaying). On failure, a negative errno-style error code is returned π
πΈ Errors
Returned errors may indicate the following problems β vibe check them fr fr:
-EINVALβ the specified parameter is invalid π«-EPERMβ the message has been sealed π (like, locked, gone, it's giving "no entry")-ESTALEβ the message is in an invalid state π-ENXIOβ the message cannot be appended to π-ENOMEMβ memory allocation failed π΅βπ« (the computer simply 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. Love that for us π«Ά
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 yes, parallelism is fine, just not on the same object at the same moment, okay? π
The code described here uses getenv(3), which is declared to be not multi-thread-safe π. Which means: 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 π
β like, do your setup era first, then let the threads out to play.
π SEE ALSO
systemd(1), sd-bus(3), sd_bus_message_append(3), sd_bus_message_append_array(3), The D-Bus specification [1] π₯
β NOTES (yeah, again β it's the footnote one π)
- The D-Bus specification β https://dbus.freedesktop.org/doc/dbus-specification.html π
And that's the whole page, bestie π§β¨ this one's from systemd 261.3 and its date stamp is SD_BUS_MESβ¦PPEND_STRV(3) β go forth and append those strings, you absolute icon ππ
π¦ 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