systemd/man/libudev.3
2015-06-22 17:16:03 +02:00

73 lines
3.0 KiB
Groff

'\" t
.TH "LIBUDEV" "3" "" "systemd 221" "libudev"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
libudev \- API for enumerating and introspecting local devices
.SH "SYNOPSIS"
.sp
.ft B
.nf
#include <libudev\&.h>
.fi
.ft
.HP \w'\fBpkg\-config\ \-\-cflags\ \-\-libs\ libudev\fR\ 'u
\fBpkg\-config \-\-cflags \-\-libs libudev\fR
.SH "DESCRIPTION"
.PP
libudev\&.h
provides APIs to introspect and enumerate devices on the local system\&.
.PP
All functions require a libudev context to operate\&. This context can be create via
\fBudev_new\fR(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\&. Furthermore, multiple different udev contexts can be used in parallel by multiple threads\&. However, a single context must not be accessed by multiple threads in parallel\&. The caller is responsible of providing suitable locking if they intend to use it from multiple threads\&.
.PP
To introspect a local device on a system, a udev device object can be created via
\fBudev_device_new_from_syspath\fR(3)
and friends\&. The device object allows to query current state, read and write attributes and lookup properties of the device in question\&.
.PP
To enumerate local devices on the system, an enumeration object can be created via
\fBudev_enumerate_new\fR(3)\&.
.PP
To monitor the local system for hotplugged or unplugged devices, a monitor can be created via
\fBudev_monitor_new_from_netlink\fR(3)\&.
.PP
Whenever libudev returns a list of objects, the
\fBudev_list_entry\fR(3)
API should be used to iterate, access and modify those lists\&.
.PP
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
\fBudev_hwdb\fR
(please use the new
\fBsd-hwdb\fR(3)
API instead) and the
\fBudev_queue\fR
object to query the udev\-daemon (which should not be used by new software at all)\&.
.SH "SEE ALSO"
.PP
\fBudev_new\fR(3),
\fBudev_device_new_from_syspath\fR(3),
\fBudev_enumerate_new\fR(3),
\fBudev_monitor_new_from_netlink\fR(3),
\fBudev_list_entry\fR(3),
\fBsystemd\fR(1),
\fBsd-device\fR(3),
\fBsd-hwdb\fR(3),
\fBpkg-config\fR(1)