SD_BUS_SET_METHOD_CALL_TIMEOUT(3)

πŸ’… sd_bus_set_method_call_timeout, sd_bus_get_method_call_timeout β€” section 3 of the systemd manual, bestie

okay so real talk, this is the SD_BUS_GET_METHOD_CALL_TIMEOUT(3) page and it's genuinely so useful β€” it's all about the default D-Bus method call timeout on a bus object. two functions, one vibe: set it or read it. let's go 🫢


✨ NAME ✨

sd_bus_set_method_call_timeout, sd_bus_get_method_call_timeout β€” set or query the default D-Bus method call timeout of a bus object. that's it, that's the whole personality πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <systemd/sd-bus.h>

int sd_bus_set_method_call_timeout(sd_bus *bus, uint64_t usec);

int sd_bus_get_method_call_timeout(sd_bus *bus, uint64_t *ret);

πŸŽ€ DESCRIPTION πŸŽ€

sd_bus_set_method_call_timeout() sets the default D-Bus method call timeout of bus to usec microseconds. slay, you're in charge now ✨

sd_bus_get_method_call_timeout() queries the default D-Bus method call timeout of bus. and here's where it gets kinda dramatic, so pay attention bestie:

  • if no method call timeout was set using sd_bus_set_method_call_timeout(), the timeout is read from the $SYSTEMD_BUS_TIMEOUT environment variable πŸ‘€
  • if that environment variable is unset, or does not contain a valid timeout, the implementation falls back to a predefined method call timeout of 25 seconds πŸ•
⚠️ heads up! $SYSTEMD_BUS_TIMEOUT is read once and cached, so callers should not rely on being able to change the default method call timeout at runtime by changing the value of $SYSTEMD_BUS_TIMEOUT. no cap, it will not work. instead, call sd_bus_set_method_call_timeout() to change the default method call timeout. periodt πŸ’€

πŸ”₯ RETURN VALUE πŸ”₯

on success, these functions return a non-negative integer. on failure, they return a negative errno-style error code. classic.

😭 Errors

returned errors may indicate the following problems:

  • -EINVAL β€” the parameters bus or ret are NULL. πŸ™ˆ

Added in version 246.

  • -ENOPKG β€” bus object bus could not be resolved. 😭

Added in version 246.


🌸 NOTES 🌸

  • functions described here are available as a shared library, which can be compiled against and linked to with the libsystemd pkg-config(1) file. iykyk 🧚
  • 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 politely 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. no parallel setenv shenanigans, ok? πŸ™…β€β™€οΈ

πŸ‘‘ HISTORY πŸ‘‘

sd_bus_set_method_call_timeout() and sd_bus_get_method_call_timeout() were added in version 246. iconic behavior honestly ⭐


🌈 SEE ALSO 🌈

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


and that's the whole page, bestie πŸ’– this one's from systemd 261.3 β€” go forth and set your timeouts responsibly, mwah πŸŽ€πŸ¦‹πŸ’…

πŸ“¦ where this page comes from