NAME |SYNOPSIS |DESCRIPTION |RETURN VALUE |NOTES |HISTORY |SEE ALSO |COLOPHON | |
SD_BUS_ERROR_ADD_MAP(3) sd_bus_error_add_mapSD_BUS_ERROR_ADD_MAP(3)sd_bus_error_add_map, sd_bus_error_map, SD_BUS_ERROR_MAP, SD_BUS_ERROR_END - Additional sd-dbus error mappings
#include <systemd/sd-bus.h>typedef struct {const char *name;int code;...} sd_bus_error_map;SD_BUS_ERROR_MAP(name,code)SD_BUS_ERROR_MAP_ENDint sd_bus_error_add_map(const sd_bus_error_map *map);Thesd_bus_error_add_map()call may be used to register additional mappings for converting D-Bus errors to Linuxerrno-style errors. The mappings defined with this call are consulted by calls such assd_bus_error_set(3) orsd_bus_error_get_errno(3). By default, a number of generic, standardized mappings are known, as documented insd-bus-errors(3). Use this call to add further, application-specific mappings. The function takes a pointer to an array of sd_bus_error_map structures. A reference to the specified array is added to the lookup tables for error mappings. Note that the structure is not copied, and that it is hence essential that the array stays available and constant during the entire remaining runtime of the process. The mapping array should be put together with a series ofSD_BUS_ERROR_MAP()macro invocations that take a literal name string and a (positive)errno-style error number. The last entry of the array should be an invocation of theSD_BUS_ERROR_MAP_END macro. The array should not be put together without use of these two macros. Note that the call is idempotent: it is safe to invoke it multiple times with the parameter, which will only add the passed mapping array once. Note that the memory allocated by this call is not intended to be freed during the lifetime of the process. It should not be freed explicitly.
sd_bus_error_add_map()returns a positive value when the new array was added to the lookup tables. It returns zero when the same array was already added before. On error, a negativeerrno-style error code is returned. See below for known error codes.Errors Returned errors may indicate the following problems:-EINVAL The specified mapping array is invalid.-ENOMEM Memory allocation failed.
Functions described here are available as a shared library, which can be compiled against and linked to with thelibsystemd pkg-config(1) file. The code described here usesgetenv(3), which is declared to be not multi-thread-safe. This means that 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.
sd_bus_error_add_map()was added in version 221.
systemd(1),sd-bus(3),sd_bus_error(3),sd-bus-errors(3),errno(3),strerror_r(3)
This page is part of thesystemd (systemd system and service manager) project. Information about the project can be found at ⟨http://www.freedesktop.org/wiki/Software/systemd⟩. If you have a bug report for this manual page, see ⟨http://www.freedesktop.org/wiki/Software/systemd/#bugreports⟩. This page was obtained from the project's upstream Git repository ⟨https://github.com/systemd/systemd.git⟩ on 2025-08-11. (At that time, the date of the most recent commit that was found in the repository was 2025-08-11.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which isnot part of the original manual page), send a mail to man-pages@man7.orgsystemd 258~rc2SD_BUS_ERROR_ADD_MAP(3)Pages that refer to this page:sd-bus(3), sd_bus_error(3), sd_bus_message_get_type(3), systemd.directives(7), systemd.index(7)
HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface. For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere. Hosting byjambit GmbH. | ![]() |