'\" t .TH "LIBUDEV" "3" "" "systemd 247" "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 .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\&. .PP All functions listed here are thread\-agnostic and only a single specific thread may operate on a given object during its entire lifetime\&. It\*(Aqs safe to allocate multiple independent objects and use each from a specific thread in parallel\&. However, it\*(Aqs 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\*(Aqt operate on it at the very same time\&. .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 one 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)