Class PsInfo

java.lang.Object
oshi.driver.common.unix.solaris.PsInfo

@ThreadSafe public final class PsInfo extends Object
Shared utility to parse the pure-Java parts of Solaris /proc/<pid>/psinfo, /proc/<pid>/lwp/<tid>/lwpsinfo, and /proc/<pid>/usage.

The argument/environment reads differ between implementations and live in the JNA (oshi.driver.unix.solaris.PsInfoJNA, via pread on /proc/<pid>/as) and FFM (oshi.driver.unix.solaris.PsInfoFFM, via pargs) drivers respectively.

  • Method Details

    • queryPsInfo

      public static SolarisPsInfo queryPsInfo(int pid)
      Reads /proc/<pid>/psinfo.
      Parameters:
      pid - the process ID
      Returns:
      populated SolarisPsInfo, or null if the file isn't readable
    • queryLwpsInfo

      public static SolarisLwpsInfo queryLwpsInfo(int pid, int tid)
      Reads /proc/<pid>/lwp/<tid>/lwpsinfo.
      Parameters:
      pid - the process ID
      tid - the thread ID (lwpid)
      Returns:
      populated SolarisLwpsInfo, or null if not readable
    • queryPrUsage

      public static SolarisPrUsage queryPrUsage(int pid)
      Reads /proc/<pid>/usage.
      Parameters:
      pid - the process ID
      Returns:
      populated SolarisPrUsage, or null if not readable
    • queryPrUsage

      public static SolarisPrUsage queryPrUsage(int pid, int tid)
      Reads /proc/<pid>/lwp/<tid>/usage.
      Parameters:
      pid - the process ID
      tid - the thread ID
      Returns:
      populated SolarisPrUsage, or null if not readable
    • bytesToString

      public static String bytesToString(byte[] bytes)
      Trims a NUL-terminated byte array to a UTF-8 String.
      Parameters:
      bytes - the buffer
      Returns:
      the trimmed String