Class Udev.UdevContext

java.lang.Object
com.sun.jna.PointerType
com.sun.jna.platform.linux.Udev.UdevContext
All Implemented Interfaces:
NativeMapped
Enclosing interface:
Udev

public static class Udev.UdevContext extends PointerType
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 Details

    • UdevContext

      public UdevContext()
  • Method Details

    • ref

      public Udev.UdevContext 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

      public Udev.UdevEnumerate 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

      public Udev.UdevDevice deviceNewFromSyspath(String syspath)
      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.