Class NetBsdOperatingSystem

All Implemented Interfaces:
OperatingSystem

@ThreadSafe public class NetBsdOperatingSystem extends BsdOperatingSystem
NetBsd is a free and open-source Unix-like operating system descended from the Berkeley Software Distribution (BSD), which was based on Research Unix.

The cross-BSD-common pieces live in BsdOperatingSystem; NetBSD has no native-access split, so this single class also provides the ps process enumeration, the text-parsed boot time, the current-thread factory, and the sysctl version / file-system / network queries.

  • Constructor Details

    • NetBsdOperatingSystem

      public NetBsdOperatingSystem()
  • Method Details

    • queryFamilyVersionInfo

      public Pair<String, OperatingSystem.OSVersionInfo> queryFamilyVersionInfo()
      Description copied from class: AbstractOperatingSystem
      Queries the OS family and version info.
      Specified by:
      queryFamilyVersionInfo in class AbstractOperatingSystem
      Returns:
      a pair of family string and OS version info
    • getFileSystem

      public FileSystem getFileSystem()
      Description copied from interface: OperatingSystem
      Instantiates a FileSystem object.
      Returns:
      A FileSystem object.
    • getInternetProtocolStats

      public InternetProtocolStats getInternetProtocolStats()
      Description copied from interface: OperatingSystem
      Instantiates a InternetProtocolStats object.
      Returns:
      a InternetProtocolStats object.
    • getNetworkParams

      public NetworkParams getNetworkParams()
      Description copied from interface: OperatingSystem
      Instantiates a NetworkParams object.
      Returns:
      A NetworkParams object.
    • 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
    • getProcessId

      public int getProcessId()
      Description copied from interface: OperatingSystem
      Gets the current process ID (PID).
      Returns:
      the Process ID of the current process
    • getThreadId

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

      Thread IDs on macOS are not correlated with any other Operating System output.

      Returns:
      the Thread ID of the current thread if known, 0 otherwise.
    • 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.
    • queryBootTime

      protected long queryBootTime()
      Description copied from class: BsdOperatingSystem
      Queries the system boot time in seconds since the epoch.
      Specified by:
      queryBootTime in class BsdOperatingSystem
      Returns:
      the boot time in seconds