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 πŸ’€)

  1. 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