Package com.sun.jna.platform.linux
Class Udev.UdevContext
java.lang.Object
com.sun.jna.PointerType
com.sun.jna.platform.linux.Udev.UdevContext
- All Implemented Interfaces:
NativeMapped
- Enclosing interface:
- Udev
All functions require a libudev context to operate. This context can be
created via
Udev.udev_new()
. 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 for
providing suitable locking if they intend to use it from multiple threads.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeviceNewFromSyspath
(String syspath) Creates a udev device object based on information found in/sys
, annotated with properties from the udev-internal device database.Create a udev enumerate object.ref()
Acquire a further reference to this object.void
unref()
Drop a reference to this object.Methods inherited from class com.sun.jna.PointerType
equals, fromNative, getPointer, hashCode, nativeType, setPointer, toNative, toString
-
Constructor Details
-
UdevContext
public UdevContext()
-
-
Method Details
-
ref
Acquire a further reference to this object.- Returns:
- this object, unmodified.
-
unref
public void unref()Drop a reference to this object. Once the reference count hits 0, the context object is destroyed and freed. -
enumerateNew
Create a udev enumerate object. Initially, the reference count of the enumerate object is 1.- Returns:
- On success, returns the allocated enumerator. On failure, NULL is returned.
-
deviceNewFromSyspath
Creates a udev device object based on information found in/sys
, annotated with properties from the udev-internal device database. Initially, the reference count of the device is 1.- Parameters:
syspath
- The path of the device in/sys
.- Returns:
- the allocated udev device. On failure, NULL is returned, and
errno
is set appropriately.
-