1LIBUDEV(3)                          libudev                         LIBUDEV(3)
2
3
4

NAME

6       libudev - API for enumerating and introspecting local devices
7

SYNOPSIS

9       #include <libudev.h>
10
11       pkg-config --cflags --libs libudev
12

DESCRIPTION

14       libudev.h provides APIs to introspect and enumerate devices on the
15       local system.
16
17       All functions require a libudev context to operate. This context can be
18       create via udev_new(3). It is used to track library state and link
19       objects together. No global state is used by libudev, everything is
20       always linked to a udev context.
21
22       All functions listed here are thread-agnostic and only a single
23       specific thread may operate on a given object during its entire
24       lifetime. It's safe to allocate multiple independent objects and use
25       each from a specific thread in parallel. However, it's not safe to
26       allocate such an object in one thread, and operate or free it from any
27       other, even if locking is used to ensure these threads don't operate on
28       it at the very same time.
29
30       To introspect a local device on a system, a udev device object can be
31       created via udev_device_new_from_syspath(3) and friends. The device
32       object allows one to query current state, read and write attributes and
33       lookup properties of the device in question.
34
35       To enumerate local devices on the system, an enumeration object can be
36       created via udev_enumerate_new(3).
37
38       To monitor the local system for hotplugged or unplugged devices, a
39       monitor can be created via udev_monitor_new_from_netlink(3).
40
41       Whenever libudev returns a list of objects, the udev_list_entry(3) API
42       should be used to iterate, access and modify those lists.
43
44       Furthermore, libudev also exports legacy APIs that should not be used
45       by new software (and as such are not documented as part of this
46       manual). This includes the hardware database known as udev_hwdb (please
47       use the new sd-hwdb(3) API instead) and the udev_queue object to query
48       the udev daemon (which should not be used by new software at all).
49

SEE ALSO

51       udev_new(3), udev_device_new_from_syspath(3), udev_enumerate_new(3),
52       udev_monitor_new_from_netlink(3), udev_list_entry(3), systemd(1), sd-
53       device(3), sd-hwdb(3), pkg-config(1)
54
55
56
57systemd 241                                                         LIBUDEV(3)
Impressum