SD_BUS_ME...SIGNATURE(3)

πŸ’… SD_BUS_ME...SIGNATURE β€” query bus message signature πŸŽ€

okay bestie, this is part of the sd-bus crew (that's the systemd D-Bus library, iykyk), and it's literally just three little functions that tell you what a message's signature is. no cap, that's it. let's go ✨


🌸 SYNOPSIS 🌸

#include <systemd/sd-bus.h>

const char* sd_bus_message_get_signature(sd_bus_message *message,
                                         int complete);

int sd_bus_message_is_empty(sd_bus_message *message);

int sd_bus_message_has_signature(sd_bus_message *message,
                                 const char *signature);

πŸ¦‹ DESCRIPTION πŸ¦‹

sd_bus_message_get_signature()

so this one returns the signature of message. but here's the tea: if complete is true, you get the signature of the whole entire message back. if it's not true, you just get the signature of the currently open container. that's the whole mood. πŸ’…

sd_bus_message_is_empty()

returns true if the message is empty β€” which lowkey just means its signature is empty. simple as that. 🫢

sd_bus_message_has_signature()

returns true if the signature of message matches the signature you handed it. and yes, signature is allowed to be NULL β€” that gets treated exactly like an empty string, which means it's literally the same as calling sd_bus_message_is_empty(). iconic behaviour, honestly. ✨


⭐ RETURN VALUE ⭐

when it works, sd_bus_message_get_signature() gives you the signature β€” and NULL if something went wrong. 😭

the other two? they return 0 or a positive integer on success. if they fail, you get a negative errno-style error code. that's the vibe check failing, bestie. πŸ’€

πŸ™ˆ Errors

the errors you might get handed are giving:

  • -EINVAL β€” the message parameter is NULL. yeah. that happened.
  • NULL β€” the message parameter is NULL. (yes it's listed again, yes I'm telling you again, we don't gatekeep) πŸ”₯

πŸ‘‘ NOTES πŸ‘‘

  • everything described here lives in a shared library, so you can compile against it and link it up using the libsystemd pkg-config(1) file. πŸŽ€
  • all the functions on this page are thread-agnostic, and only a single thread may operate on a given object at any given time. different threads can access the same object at different times though. and multiple independent objects? those can totally be used from different threads in parallel. slay. 🌈
  • the code described here uses getenv(3), which is declared to be not multi-thread-safe. translation: whatever's calling these functions must not call setenv(3) from a parallel thread. you're recommended to only do setenv() calls in an early phase of your program, back when no other threads have been started yet. do not skip this part, fr fr. ⚠️

πŸ’œ HISTORY πŸ’œ

sd_bus_message_get_signature(), sd_bus_message_is_empty(), and sd_bus_message_has_signature() all showed up in version 240. glow-up era. 🌸


🧚 SEE ALSO 🧚

systemd(1), sd-bus(3), sd_bus_message_new(3)


okay that's the whole page, bestie β€” you're officially signature-literate πŸ’– and yeah, this is systemd 261.3, dated SD_BUS_ME...SIGNATURE(3) at the bottom of the original. periodt. πŸ’…πŸŽ€

πŸ“¦ where this page comes from