]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/libudev.xml
travis: add more ASan options
[thirdparty/systemd.git] / man / libudev.xml
CommitLineData
06255d6f 1<?xml version='1.0'?> <!--*-nxml-*-->
3a54a157 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
06255d6f
DH
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4<!ENTITY % entities SYSTEM "custom-entities.ent" >
5%entities;
6]>
0307f791 7<!-- SPDX-License-Identifier: LGPL-2.1+ -->
06255d6f
DH
8
9<refentry id="libudev"
10 xmlns:xi="http://www.w3.org/2001/XInclude">
11
12 <refentryinfo>
13 <title>libudev</title>
14 <productname>systemd</productname>
06255d6f
DH
15 </refentryinfo>
16
17 <refmeta>
18 <refentrytitle>libudev</refentrytitle>
19 <manvolnum>3</manvolnum>
20 </refmeta>
21
22 <refnamediv>
23 <refname>libudev</refname>
24 <refpurpose>API for enumerating and introspecting local devices</refpurpose>
25 </refnamediv>
26
27 <refsynopsisdiv>
28 <funcsynopsis>
29 <funcsynopsisinfo>#include &lt;libudev.h&gt;</funcsynopsisinfo>
30 </funcsynopsis>
31
32 <cmdsynopsis>
33 <command>pkg-config --cflags --libs libudev</command>
34 </cmdsynopsis>
35 </refsynopsisdiv>
36
37 <refsect1>
38 <title>Description</title>
39
40 <para><filename>libudev.h</filename> provides APIs to introspect
41 and enumerate devices on the local system.</para>
42
43 <para>All functions require a libudev context to operate. This
44 context can be create via
45 <citerefentry><refentrytitle>udev_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
46 It is used to track library state and link objects together. No
47 global state is used by libudev, everything is always linked to
64a7ef8b
LP
48 a udev context.</para>
49
50 <xi:include href="threads-aware.xml" xpointer="strict"/>
06255d6f
DH
51
52 <para>To introspect a local device on a system, a udev device
53 object can be created via
54 <citerefentry><refentrytitle>udev_device_new_from_syspath</refentrytitle><manvolnum>3</manvolnum></citerefentry>
595bfe7d 55 and friends. The device object allows one to query current state,
06255d6f
DH
56 read and write attributes and lookup properties of the device in
57 question.</para>
58
59 <para>To enumerate local devices on the system, an enumeration
60 object can be created via
61 <citerefentry><refentrytitle>udev_enumerate_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
62
63 <para>To monitor the local system for hotplugged or unplugged
64 devices, a monitor can be created via
65 <citerefentry><refentrytitle>udev_monitor_new_from_netlink</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
66
67 <para>Whenever libudev returns a list of objects, the
68 <citerefentry><refentrytitle>udev_list_entry</refentrytitle><manvolnum>3</manvolnum></citerefentry>
69 API should be used to iterate, access and modify those lists.</para>
70
71 <para>Furthermore, libudev also exports legacy APIs that should
72 not be used by new software (and as such are not documented as
b938cb90 73 part of this manual). This includes the hardware database known
06255d6f
DH
74 as <constant>udev_hwdb</constant> (please use the new
75 <citerefentry><refentrytitle>sd-hwdb</refentrytitle><manvolnum>3</manvolnum></citerefentry>
76 API instead) and the <constant>udev_queue</constant> object to
b938cb90 77 query the udev daemon (which should not be used by new software
06255d6f
DH
78 at all).</para>
79 </refsect1>
80
81 <refsect1>
82 <title>See Also</title>
83 <para>
84 <citerefentry><refentrytitle>udev_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
85 <citerefentry><refentrytitle>udev_device_new_from_syspath</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
86 <citerefentry><refentrytitle>udev_enumerate_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
87 <citerefentry><refentrytitle>udev_monitor_new_from_netlink</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
88 <citerefentry><refentrytitle>udev_list_entry</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
89 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
90 <citerefentry><refentrytitle>sd-device</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
91 <citerefentry><refentrytitle>sd-hwdb</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
92 <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
93 </para>
94 </refsect1>
95
96</refentry>