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