Class SolarisOSProcess

All Implemented Interfaces:
OSProcess

public abstract class SolarisOSProcess extends AbstractProcOSProcess
Abstract base for Solaris OSProcess. The /proc parsing, command-line/env memoization, thread enumeration, and field assignment are shared (via AbstractProcOSProcess); concrete subclasses (JNA/FFM) provide the queryArgsEnv read, the self-process rlimit read, and the OSThread factory.
  • Constructor Details

    • SolarisOSProcess

      protected SolarisOSProcess(int pid)
  • Method Details

    • getPsInfo

      protected SolarisPsInfo getPsInfo()
      Returns the memoized psinfo for this process, for subclasses that need its arg/env offset pointers.
      Returns:
      the parsed SolarisPsInfo, or null if it could not be read
    • queryCommandlineEnvironment

      protected Pair<List<String>, Map<String,String>> queryCommandlineEnvironment()
      Description copied from class: AbstractProcOSProcess
      Reads this process's argument list and environment.
      Specified by:
      queryCommandlineEnvironment in class AbstractProcOSProcess
      Returns:
      a pair of (arg list, env map); either may be empty if it cannot be read
    • getMinorFaults

      public long getMinorFaults()
      Description copied from interface: OSProcess
      Gets the number of minor (soft) faults the process has made which have not required loading a memory page from disk. Sometimes called reclaims.

      On Windows, this includes the total of major and minor faults.

      Not available on AIX.

      Returns:
      minor page faults (reclaims).
    • getMajorFaults

      public long getMajorFaults()
      Description copied from interface: OSProcess
      Gets the number of major (hard) faults the process has made which have required loading a memory page from disk.

      Windows does not distinguish major and minor faults at the process level, so this value returns 0 and major faults are included in OSProcess.getMinorFaults().

      Not available on AIX.

      Returns:
      major page faults.
    • getVoluntaryContextSwitches

      public long getVoluntaryContextSwitches()
      Description copied from interface: OSProcess
      The number of voluntary context switches the process has made. A voluntary context switch occurs when a process gives up the CPU before its time slice expires (e.g., waiting for I/O).

      For the current process, getrusage(RUSAGE_SELF) is used on supported POSIX platforms, which aggregates across all threads. For other processes, platform-specific sources are used (/proc/[pid]/status on Linux, ps on FreeBSD/OpenBSD, /proc/[pid]/usage on Solaris). On macOS, the split is only available for the current process; for other processes this returns 0.

      Returns:
      voluntary context switches if available, 0 otherwise.
    • getInvoluntaryContextSwitches

      public long getInvoluntaryContextSwitches()
      Description copied from interface: OSProcess
      The number of involuntary context switches the process has made. An involuntary context switch occurs when the scheduler preempts the process (e.g., time slice expired).

      For the current process, getrusage(RUSAGE_SELF) is used on supported POSIX platforms, which aggregates across all threads. For other processes, platform-specific sources are used (/proc/[pid]/status on Linux, ps on FreeBSD/OpenBSD, /proc/[pid]/usage on Solaris). On macOS, the split is only available for the current process; for other processes this returns 0.

      Returns:
      involuntary context switches if available, 0 otherwise.
    • 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.

      Returns:
      a bit vector in which each bit represents the processors that a process is allowed to run on.
    • updateAttributes

      public boolean updateAttributes()
      Description copied from interface: OSProcess
      Attempts to update process attributes. Returns false if the update fails, which will occur if the process no longer exists.
      Returns:
      true if the update was successful, false if the update failed. In addition, on a failed update the process state will be changed to OSProcess.State.INVALID.
    • getStateFromOutput

      public static OSProcess.State getStateFromOutput(char stateValue)
      Returns Enum STATE for the state value obtained from status string of thread/process.
      Parameters:
      stateValue - state value from the status string
      Returns:
      The state
    • getProcessOpenFileLimit

      protected static long getProcessOpenFileLimit(long processId, int index)
      Parses the soft or hard open-file limit for another process from plimit.
      Parameters:
      processId - the process ID
      index - 1 for the soft limit, 2 for the hard limit
      Returns:
      the limit, or -1 if unavailable
    • queryArgsEnv

      protected abstract Pair<List<String>, Map<String,String>> queryArgsEnv()
      Reads this process's argument list and environment.
      Returns:
      a pair of (arg list, env map); either may be empty if it cannot be read