man-pages/man3/libudev.3.html
2021-03-31 01:06:50 +01:00

119 lines
3.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of LIBUDEV</TITLE>
</HEAD><BODY>
<H1>LIBUDEV</H1>
Section: libudev (3)<BR>Updated: <BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
libudev - API for enumerating and introspecting local devices
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<P>
<B>
</B><PRE>
#include &lt;<A HREF="file:///usr/include/libudev.h">libudev.h</A>&gt;
</PRE>
<DL COMPACT>
<DT id="1">
<B>pkg-config --cflags --libs libudev</B>
</DL>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
<DD>libudev.h
provides APIs to introspect and enumerate devices on the local system.
<P>
All functions require a libudev context to operate. This context can be create via
<B><A HREF="/cgi-bin/man/man2html?3+udev_new">udev_new</A></B>(3). It is used to track library state and link objects together. No global state is used by libudev, everything is always linked to a udev context.
<P>
All functions listed here are thread-agnostic and only a single specific thread may operate on a given object during its entire lifetime. It's safe to allocate multiple independent objects and use each from a specific thread in parallel. However, it's not safe to allocate such an object in one thread, and operate or free it from any other, even if locking is used to ensure these threads don't operate on it at the very same time.
<P>
To introspect a local device on a system, a udev device object can be created via
<B><A HREF="/cgi-bin/man/man2html?3+udev_device_new_from_syspath">udev_device_new_from_syspath</A></B>(3)
and friends. The device object allows one to query current state, read and write attributes and lookup properties of the device in question.
<P>
To enumerate local devices on the system, an enumeration object can be created via
<B><A HREF="/cgi-bin/man/man2html?3+udev_enumerate_new">udev_enumerate_new</A></B>(3).
<P>
To monitor the local system for hotplugged or unplugged devices, a monitor can be created via
<B><A HREF="/cgi-bin/man/man2html?3+udev_monitor_new_from_netlink">udev_monitor_new_from_netlink</A></B>(3).
<P>
Whenever libudev returns a list of objects, the
<B><A HREF="/cgi-bin/man/man2html?3+udev_list_entry">udev_list_entry</A></B>(3)
API should be used to iterate, access and modify those lists.
<P>
Furthermore, libudev also exports legacy APIs that should not be used by new software (and as such are not documented as part of this manual). This includes the hardware database known as
<B>udev_hwdb</B>
(please use the new
<B><A HREF="/cgi-bin/man/man2html?3+sd-hwdb">sd-hwdb</A></B>(3)
API instead) and the
<B>udev_queue</B>
object to query the udev daemon (which should not be used by new software at all).
<A NAME="lbAE">&nbsp;</A>
<H2>SEE ALSO</H2>
<P>
<B><A HREF="/cgi-bin/man/man2html?3+udev_new">udev_new</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+udev_device_new_from_syspath">udev_device_new_from_syspath</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+udev_enumerate_new">udev_enumerate_new</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+udev_monitor_new_from_netlink">udev_monitor_new_from_netlink</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+udev_list_entry">udev_list_entry</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?1+systemd">systemd</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?3+sd-device">sd-device</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd-hwdb">sd-hwdb</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?1+pkg-config">pkg-config</A></B>(1)
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="2"><A HREF="#lbAB">NAME</A><DD>
<DT id="3"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="4"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="5"><A HREF="#lbAE">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:47 GMT, March 31, 2021
</BODY>
</HTML>