SD_HWDB_NEW(3)
πΈ NAME πΈ
Okay bestie, welcome to the sd_hwdb_new(3) page β iconic manual name, no notes π
. This one covers sd_hwdb_new, sd_hwdb_new_from_path, sd_hwdb_ref, and sd_hwdb_unref: they create a new hwdb object and create or destroy references to it. Periodt.
β¨ SYNOPSIS β¨
#include <systemd/sd-hwdb.h>
int sd_hwdb_new(sd_hwdb **hwdb);
int sd_hwdb_new_from_path(const char *path, sd_hwdb **hwdb);
sd_hwdb* sd_hwdb_ref(sd_hwdb *hwdb);
sd_hwdb* sd_hwdb_unref(sd_hwdb *hwdb);
π DESCRIPTION π
So sd_hwdb_new() creates a new hwdb object so you can access the binary hwdb database. Upon initialization, the file containing the binary representation of the hardware database is located and opened, and the new object is returned in hwdb. Slay.
sd_hwdb_new_from_path() is the one where you get to specify the path from which the binary hardware database should be opened. Very βI know exactly what I wantβ energy π.
The hwdb object is reference counted, bestie. sd_hwdb_ref() and sd_hwdb_unref() may be used to get a new reference or destroy an existing reference to an object. The caller must dispose of the reference acquired with sd_hwdb_new() by calling sd_hwdb_unref() when done with the object. Do not leave that reference hanging, okay? π
Use sd_hwdb_seek(3), sd_hwdb_get(3), and sd_hwdb_enumerate(3) to access entries.
π RETURN VALUE π
On success, sd_hwdb_new() and sd_hwdb_new_from_path() return a non-negative integer. On failure, a negative errno-style error code is returned. Classic.
sd_hwdb_ref() always returns the argument.
sd_hwdb_unref() always returns NULL.
π Errors
Returned errors may indicate the following problems:
-ENOENTβ The binary hardware database file could not be located. Seesystemd-hwdb(8)for more information. π«Ά Added in version 246.-EINVALβ The located binary hardware database file is in an incompatible format. π«Ά Added in version 246.-ENOMEMβ Memory allocation failed. π«Ά 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.
β οΈ 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. No chaotic parallelsetenv()energy, bestie π.
π HISTORY π
sd_hwdb_new(), sd_hwdb_ref(), and sd_hwdb_unref() were added in version 246.
sd_hwdb_new_from_path() was added in version 252.
π SEE ALSO π
Later, bestie π
β this was SD_HWDB_NEW(3) from systemd 261.3, signed off with love and zero missing details. π«Άβ¨
π¦ 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