Class WindowsOSProcessJNA

All Implemented Interfaces:
OSProcess

@ThreadSafe public class WindowsOSProcessJNA extends WindowsOSProcess
JNA-based Windows OS process implementation.
  • Constructor Details

  • Method Details

    • 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.
    • updateAttributes

      protected boolean updateAttributes(ProcessPerfCounterBlock pcb, WtsInfo wts)
      Description copied from class: WindowsOSProcess
      Updates process attributes from performance counter and WTS data, then performs native-specific updates. Subclasses should call super.updateAttributes(pcb, wts) and then perform native handle-based updates.
      Overrides:
      updateAttributes in class WindowsOSProcess
      Parameters:
      pcb - Performance counter block for this process, or null if unavailable
      wts - WTS info for this process, or null if unavailable
      Returns:
      true if the process is valid after the update
    • createOSThread

      protected OSThread createOSThread(int pid, int tid, String procName, ThreadPerfCounterBlock pcb)
      Description copied from class: WindowsOSProcess
      Creates a platform-specific OS thread instance.
      Specified by:
      createOSThread in class WindowsOSProcess
      Parameters:
      pid - the owning process ID
      tid - the thread ID
      procName - the process name
      pcb - the thread performance counter block
      Returns:
      a new OSThread instance
    • queryMatchingThreads

      protected Map<Integer, ThreadPerfCounterBlock> queryMatchingThreads(Set<Integer> pids)
      Description copied from class: WindowsOSProcess
      Queries thread performance data matching the given process IDs.
      Specified by:
      queryMatchingThreads in class WindowsOSProcess
      Parameters:
      pids - the set of process IDs to match
      Returns:
      a map of thread ID to thread performance counter block
    • queryCommandLine

      protected String queryCommandLine()
      Description copied from class: WindowsOSProcess
      Queries the command line for this process.
      Specified by:
      queryCommandLine in class WindowsOSProcess
      Returns:
      the command line string
    • queryArguments

      protected List<String> queryArguments()
      Description copied from class: WindowsOSProcess
      Queries the argument list for this process.
      Specified by:
      queryArguments in class WindowsOSProcess
      Returns:
      the list of arguments
    • queryUserInfo

      protected Pair<String,String> queryUserInfo()
      Description copied from class: WindowsOSProcess
      Queries user account information for this process.
      Specified by:
      queryUserInfo in class WindowsOSProcess
      Returns:
      a pair of (account name, SID string)
    • queryGroupInfo

      protected Pair<String,String> queryGroupInfo()
      Description copied from class: WindowsOSProcess
      Queries group account information for this process.
      Specified by:
      queryGroupInfo in class WindowsOSProcess
      Returns:
      a pair of (group name, SID string)
    • queryCwdCommandlineEnvironment

      protected Triplet<String, String, Map<String,String>> queryCwdCommandlineEnvironment()
      Description copied from class: WindowsOSProcess
      Queries the current working directory, command line, and environment variables from process memory.
      Specified by:
      queryCwdCommandlineEnvironment in class WindowsOSProcess
      Returns:
      a triplet of (cwd, commandLine, environmentVariables)