SD_BUS_CAN_SEND(3)

πŸ’… SD_BUS_CAN_SEND(3) πŸ’…

okay so bestie, welcome to sd_bus_can_send β€” that's the page you're on, from the sd_bus_can_send corner of the systemd manuals, and it's literally the "can I send this tho?" function. tiny page, big vibes, let's go ✨


🌸 NAME 🌸

sd_bus_can_send β€” check which types can be sent over a bus object πŸ¦‹


✨ SYNOPSIS ✨

#include <systemd/sd-bus.h>

int sd_bus_can_send(sd_bus *bus, char type);

πŸŽ€ DESCRIPTION πŸŽ€

so sd_bus_can_send() is mostly used for checking if file descriptor passing is available on the given bus. that's the main character use case, fr fr πŸ’…

type can be any of the SD_BUS_TYPE constants. any of them. it's giving "pick your fighter" 🌈


πŸ’– RETURN VALUE πŸ’–

ngl the return value here is doing a whole three-ways thing:

  • on failure, sd_bus_can_send() returns a negative errno-style error code 😭
  • if values of the given type can be sent over the given bus, it returns a positive integer β€” slay βœ…
  • otherwise, it returns zero β€” nope, not today πŸ™ˆ

πŸ’€ Errors πŸ’€

returned errors may indicate the following problems:

  • -ENOPKG β€” the bus object bus could not be resolved. it's lost in the void, bestie 🫠
  • -ENOTCONN β€” the input parameter bus is NULL or the bus is not connected. no connection, no conversation πŸ“΅
  • -ECHILD β€” the bus object bus was created in a different process. not your bus, not your problem, it's not gonna talk to you 🚫

🧚 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. link it, love it, pkg-config it πŸ”—

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 like… share the object, don't share the object at the same time, ykwim? ⭐
⚠️ 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. like, do your environment stuff first, before the party starts πŸŽ‰ lowkey important, no cap.

πŸ‘‘ HISTORY πŸ‘‘

sd_bus_can_send() was added in version 221. an icon, a legend, a moment 🌟


πŸ”₯ SEE ALSO πŸ”₯


and that's the whole page, bestie 🫢 β€” brought to you by systemd 261.3, which is literally the source of this whole manual page moment. go forth and vibe check your bus types πŸ’œπŸ’…βœ¨

πŸ“¦ where this page comes from