Class DragonFlyBsdOperatingSystem

All Implemented Interfaces:
OperatingSystem

@ThreadSafe public abstract class DragonFlyBsdOperatingSystem extends BsdOperatingSystem
Abstract base shared by the DragonFly BSD OperatingSystem implementations (JNA and FFM). The cross-BSD-common pieces live in BsdOperatingSystem; this layer adds the DragonFly ps process enumeration (which filters out the kernel threads that report a negative PID) and the current-thread factory. The native bits (the OSProcess/FileSystem/NetworkParams/InternetProtocolStats factories, getpid/lwp_gettid, sysctl version and boot-time queries, and who sessions) are provided by the JNA and FFM subclasses.
  • Constructor Details

    • DragonFlyBsdOperatingSystem

      public DragonFlyBsdOperatingSystem()
  • Method Details

    • getProcessListFromPS

      protected List<OSProcess> getProcessListFromPS(int pid)
      Description copied from class: BsdOperatingSystem
      Enumerates processes (or a single process when pid >= 0) via the platform's ps command.
      Specified by:
      getProcessListFromPS in class BsdOperatingSystem
      Parameters:
      pid - the process ID, or -1 for all processes
      Returns:
      the process list
    • getCurrentThread

      public OSThread getCurrentThread()
      Description copied from interface: OperatingSystem
      Makes a best effort to get the current thread. May not be useful in a multithreaded environment. The thread returned may have been short lived and no longer exist.

      On macOS, returns the oldest thread in the calling process.

      Returns:
      the current thread if known; an invalid thread otherwise.
    • createProcess

      protected abstract OSProcess createProcess(int pid, Map<BsdPsKeyword, String> psMap)
      Creates a backend-specific OSProcess from a parsed ps row.
      Parameters:
      pid - the process ID
      psMap - the parsed ps columns for this process
      Returns:
      a new OSProcess