1SD_HWDB_NEW(3)                    sd_hwdb_new                   SD_HWDB_NEW(3)
2
3
4

NAME

6       sd_hwdb_new, sd_hwdb_new_from_path, sd_hwdb_ref, sd_hwdb_unref - Create
7       a new hwdb object and create or destroy references to it
8

SYNOPSIS

10       #include <systemd/sd-hwdb.h>
11
12       int sd_hwdb_new(sd_hwdb **hwdb);
13
14       int sd_hwdb_new_from_path(const char *path, sd_hwdb **hwdb);
15
16       sd_hwdb* sd_hwdb_ref(sd_hwdb *hwdb);
17
18       sd_hwdb* sd_hwdb_unref(sd_hwdb *hwdb);
19

DESCRIPTION

21       sd_hwdb_new() creates a new hwdb object to access the binary hwdb
22       database. Upon initialization, the file containing the binary
23       representation of the hardware database is located and opened. The new
24       object is returned in hwdb.
25
26       sd_hwdb_new_from_path() may be used to specify the path from which the
27       binary hardware database should be opened.
28
29       The hwdb object is reference counted.  sd_hwdb_ref() and
30       sd_hwdb_unref() may be used to get a new reference or destroy an
31       existing reference to an object. The caller must dispose of the
32       reference acquired with sd_hwdb_new() by calling sd_hwdb_unref() when
33       done with the object.
34
35       Use sd_hwdb_seek(3), sd_hwdb_get(3), and sd_hwdb_enumerate(3) to access
36       entries.
37

RETURN VALUE

39       On success, sd_hwdb_new() and sd_hwdb_new_from_path() return a
40       non-negative integer. On failure, a negative errno-style error code is
41       returned.
42
43       sd_hwdb_ref() always returns the argument.
44
45       sd_hwdb_unref() always returns NULL.
46
47   Errors
48       Returned errors may indicate the following problems:
49
50       -ENOENT
51           The binary hardware database file could not be located. See
52           systemd-hwdb(8) for more information.
53
54       -EINVAL
55           The located binary hardware database file is in an incompatible
56           format.
57
58       -ENOMEM
59           Memory allocation failed.
60

NOTES

62       Functions described here are available as a shared library, which can
63       be compiled against and linked to with the libsystemd pkg-config(1)
64       file.
65
66       The code described here uses getenv(3), which is declared to be not
67       multi-thread-safe. This means that the code calling the functions
68       described here must not call setenv(3) from a parallel thread. It is
69       recommended to only do calls to setenv() from an early phase of the
70       program when no other threads have been started.
71

SEE ALSO

73       systemd(1), systemd-udevd.service(8), sd-hwdb(3), systemd-hwdb(3)
74
75
76
77systemd 254                                                     SD_HWDB_NEW(3)
Impressum