SD_BUS_MEMBER_NAME_IS_VALID(3)
π SD_BUS_INTERFACE_NAME_IS_VALID π
okay so bestie, welcome to the sd_bus_interface_name_is_valid(3) page β like, this is the sd_bus_interface_name_is_valid family of functions from the systemd man pages, and honestly it's giving "tiny vibe-check helpers that save you from embarrassing typos in your D-Bus strings" π¦ ngl it's kind of iconic in a quiet way.
β¨ NAME β¨
sd_bus_interface_name_is_valid, sd_bus_service_name_is_valid, sd_bus_member_name_is_valid, sd_bus_object_path_is_valid β check if a string is a valid bus name or object path π like, are you actually a real name or are you lying to me
πΈ SYNOPSIS πΈ
#include <systemd/sd-bus.h>
int sd_bus_interface_name_is_valid(const char* p);
int sd_bus_service_name_is_valid(const char* p);
int sd_bus_member_name_is_valid(const char* p);
int sd_bus_object_path_is_valid(const char* p);
yes bestie, four whole functions, all taking const char* p, all returning int. copy them exactly, don't get creative with the types π
π DESCRIPTION π
so sd_bus_interface_name_is_valid() checks whether a given string p is a syntactically valid bus interface name. lowkey the whole squad works the same way:
sd_bus_service_name_is_valid()β checks if the argument is a valid bus service namesd_bus_member_name_is_valid()β checks if the argument is a valid bus interface member namesd_bus_object_path_is_valid()β checks if the argument is a valid bus object path
and what do they actually do? they generally check that only allowed characters are used β and that the length of the string is within limits π like a little bouncer at the club door of D-Bus, checking your ID and also that you're not too tall. periodt.
β RETURN VALUE β
1β slay, the argument is a valid interface / service / member name or object path π0β nope, it is not π
and if the argument is NULL? an error is returned. not cute, but like, fair.
π₯Ί Errors
returned errors may indicate the following problems, bestie:
-EINVALβ thepparameter isNULL. that's it. that's the error. it's giving "you forgot to pass anything" π
π§ 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. iconic linking behaviour, no notes.
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, and multiple independent objects may be used from different threads in parallel. so like⦠share the toy, but not at the exact same moment, iykyk.
β οΈ okay this part actually matters, don't skip it: the code described here usesgetenv(3), which is declared to be not multi-thread-safe π¨ that means the code calling the functions described here must not callsetenv(3)from a parallel thread. it is recommended to only do calls tosetenv()from an early phase of the program when no other threads have been started. fr fr, do your env stuff first and get it over with π
π HISTORY π
sd_bus_interface_name_is_valid(), sd_bus_service_name_is_valid(), sd_bus_member_name_is_valid(), and sd_bus_object_path_is_valid() were added in version 246. a little vintage moment for the girlies who appreciate a stable API π
π SEE ALSO π
and that's the page bestie π that was systemd 261.3, dated SD_BUS_IN..._IS_VALID(3) β go forth and validate your bus strings, you're gonna do amazing π¦β¨π
π¦ where this page comes from
- ubuntu stonking: libsystemd-dev 261.3-0ubuntu3 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms