SD_BUS_SLOT_GET_BUS(3)

πŸ’… NAME πŸ’…

Okay bestie, welcome to the SD_BUS_SLOT_GET_BUS(3) page β€” manual name sd_bus_slot_get_bus β€” starring sd_bus_slot_get_bus, sd_bus_slot_get_current_handler, sd_bus_slot_get_current_message, and sd_bus_slot_get_current_userdata. It’s literally the β€œquery information attached to a bus slot object” squad, and yes, they ate. πŸ’–


🌸 SYNOPSIS 🌸

#include <systemd/sd-bus.h>

typedef int (*sd_bus_message_handler_t)(sd_bus_message *m,
                                        void *userdata,
                                        sd_bus_error *ret_error);

sd_bus *sd_bus_slot_get_bus(sd_bus_slot *slot);

sd_bus_message_handler_t
                                                         sd_bus_slot_get_current_handler(sd_bus_slot *slot);

sd_bus_message *sd_bus_slot_get_current_message(sd_bus_slot *slot);

void *sd_bus_slot_get_current_userdata(sd_bus_slot *slot);

πŸ¦‹ DESCRIPTION πŸ¦‹

sd_bus_slot_get_bus() returns the bus object that message slot is attached to. It’s giving β€œwho’s your bus bestie?” and honestly, iconic. ✨

sd_bus_slot_get_current_handler(), sd_bus_slot_get_current_message(), and sd_bus_slot_get_current_userdata() return the current handler, message, and userdata respectively of the bus slot is attached to if we’re currently executing the callback associated with slot. Basically: when the callback is happening, these let you peek at the current cast and crew. πŸŽ€


πŸ‘‘ RETURN VALUE πŸ‘‘

sd_bus_slot_get_bus() always returns the bus object. No cap. 🫢

On success, sd_bus_slot_get_current_handler(), sd_bus_slot_get_current_message(), and sd_bus_slot_get_current_userdata() return the requested object. On failure, they return NULL. πŸ’€


🌈 NOTES 🌈

These functions described here are available as a shared library, which can be compiled against and linked to with the libsystemd pkg-config(1) file. Slay, link it properly. πŸ”₯

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. That’s the thread lore, bestie. 🧚

⚠️ The code described here uses getenv(3), which is declared to be not multi-thread-safe. This means that 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. Please don’t do a chaotic parallel setenv(), I’m begging. 😭

⭐ HISTORY ⭐

sd_bus_slot_get_bus(), sd_bus_slot_get_current_handler(), sd_bus_slot_get_current_message(), and sd_bus_slot_get_current_userdata() were added in version 246. A little vintage, a little legendary. πŸ’œ


πŸ’– SEE ALSO πŸ’–

systemd(1), sd-bus(3)


Signing off from the SD_BUS_SLOT_GET_BUS(3) page under systemd 261.3 β€” that’s the source/version in the footer, and there’s no date shown in it, so I’m not inventing one, periodt. Stay cozy, query those slots, and hydrate. πŸ“πŸ’…βœ¨

πŸ“¦ where this page comes from