java.lang.Object
com.aoindustries.aoserv.daemon.posix.PosixProcess
com.aoindustries.aoserv.daemon.posix.linux.LinuxProcess

public class LinuxProcess extends PosixProcess
A PosixProcess represents a process running on any POSIX machine.
Author:
AO Industries, Inc.
  • Constructor Details

    • LinuxProcess

      public LinuxProcess(int pid)
      Constructs a Linux process given its process ID.
  • Method Details

    • getGid

      public int getGid() throws IOException
      Determines the group ID of the currently running process. The GID is considered the group owner of the file in the /proc directory. If the process is not running, a FileNotFoundException is thrown.
      Specified by:
      getGid in class PosixProcess
      Throws:
      IOException
    • getUid

      public int getUid() throws IOException
      Determines the user ID of the currently running process. The UID is considered the owner of the file in the /proc directory. If the process is not running, a FileNotFoundException is thrown.
      Specified by:
      getUid in class PosixProcess
      Throws:
      IOException
    • isRunning

      public boolean isRunning() throws IOException
      Determines if the process is currently running. The process is considered running if a directory exists in /proc.
      Specified by:
      isRunning in class PosixProcess
      Throws:
      IOException
    • getCmdline

      public String[] getCmdline() throws IOException
      Gets the command line from /proc/pid/cmdline, split on null bytes.
      Throws:
      IOException
    • getStatus

      public Map<String,String> getStatus() throws IOException
      Gets the status from /proc/pid/status. The colon (:) is removed from the field names.
      Throws:
      IOException
      See Also:
    • getStatus

      public String getStatus(String name) throws IOException
      Gets one field of the status from /proc/pid/status. The colon (:) is removed from the field names.
      Returns:
      the corresponding value or null if not found
      Throws:
      IOException
      See Also: