Class NetBsdOSProcess

All Implemented Interfaces:
OSProcess

@ThreadSafe public class NetBsdOSProcess extends BsdOSProcess
OSProcess implementation
  • Field Details

    • PS_KEYWORDS

      public static final List<BsdPsKeyword> PS_KEYWORDS
      Ordered ps columns queried for each process. Shared by NetBsdOSProcess and the NetBSD OperatingSystem so the column list and parsing stay in lockstep. ARGS must remain last.
    • PS_COMMAND_ARGS

      public static final String PS_COMMAND_ARGS
  • Constructor Details

  • Method Details

    • psKeywords

      protected List<BsdPsKeyword> psKeywords()
      Description copied from class: BsdOSProcess
      Returns this platform's ordered ps column keys, used both to build the ps command and to parse its output positionally.
      Specified by:
      psKeywords in class BsdOSProcess
      Returns:
      the ordered column keys
    • psCommandArgs

      protected String psCommandArgs()
      Description copied from class: BsdOSProcess
      Returns the comma-separated ps -o column list for this platform, derived from BsdOSProcess.psKeywords().
      Specified by:
      psCommandArgs in class BsdOSProcess
      Returns:
      the ps column argument
    • queryArguments

      protected List<String> queryArguments()
      Description copied from class: BsdOSProcess
      Queries this process's argument list.
      Specified by:
      queryArguments in class BsdOSProcess
      Returns:
      the arguments, or an empty list if unavailable
    • queryEnvironmentVariables

      protected Map<String,String> queryEnvironmentVariables()
      Description copied from class: BsdOSProcess
      Queries this process's environment variables.
      Specified by:
      queryEnvironmentVariables in class BsdOSProcess
      Returns:
      the environment map, or an empty map if unavailable
    • getCurrentWorkingDirectory

      public String getCurrentWorkingDirectory()
      Description copied from interface: OSProcess
      Makes a best effort attempt to obtain the current working directory for the process.
      Returns:
      the process current working directory.
    • getOpenFiles

      public long getOpenFiles()
      Description copied from interface: OSProcess
      Gets the number of open file handles (or network connections) that belongs to the process.

      On FreeBSD and Solaris, this value is only populated if information for a single process id is requested.

      Returns:
      open files or -1 if unknown or not supported
    • getSoftOpenFileLimit

      public long getSoftOpenFileLimit()
      Description copied from interface: OSProcess
      Gets the soft limit for open file handles (or network connections) of the given process.

      Retrieving the soft limit for processes other than the calling process is only supported on Linux, FreeBsd and Solaris.

      Returns:
      the soft open file limit for the process if available. Returns -1 if the calling process is not the same as this OSProcess instance and the underlying operating system does not support retrieving the soft limit for other processes.
    • getHardOpenFileLimit

      public long getHardOpenFileLimit()
      Description copied from interface: OSProcess
      Gets the hard limit for open file handles (or network connections) that belong to the given process.

      Retrieving the hard limit for processes other than the calling process is only supported on Linux, FreeBsd and Solaris.

      Returns:
      the hard open file limit for the process if available. Returns -1 if the calling process is not the same as this OSProcess instance and the underlying operating system does not support retrieving the hard limit for other processes.
    • queryBitness

      protected int queryBitness()
      Description copied from class: BsdOSProcess
      Queries this process's bitness (32 or 64), or 0 if unknown.
      Specified by:
      queryBitness in class BsdOSProcess
      Returns:
      the bitness
    • getAffinityMask

      public long getAffinityMask()
      Description copied from interface: OSProcess
      Gets the process affinity mask for this process.

      On Windows systems with more than 64 processors, if the threads of the calling process are in a single processor group, returns the process affinity mask for that group (which may be zero if the specified process is running in a different group). If the calling process contains threads in multiple groups, returns zero.

      Because macOS does not export interfaces that identify processors or control thread placement, explicit thread to processor binding is not supported and this method will return a bitmask of all logical processors.

      If the Operating System fails to retrieve an affinity mask (e.g., the process has terminated), returns zero.

      Specified by:
      getAffinityMask in interface OSProcess
      Overrides:
      getAffinityMask in class BsdOSProcess
      Returns:
      a bit vector in which each bit represents the processors that a process is allowed to run on.
    • getThreadDetails

      public List<OSThread> getThreadDetails()
      Description copied from interface: OSProcess
      Retrieves the threads of the process and their details.

      The amount of returned information is operating-system dependent and may incur some latency.

      Returns:
      a list of threads
    • updateThreadCount

      protected void updateThreadCount()
      Description copied from class: BsdOSProcess
      Populates AbstractOSProcess.threadCount for platforms whose ps output lacks an nlwp column. The default is a no-op (the count is taken from the nlwp column); OpenBSD and NetBSD override this with a separate ps query.
      Overrides:
      updateThreadCount in class BsdOSProcess