Class LinuxProcess
java.lang.Object
com.aoindustries.aoserv.daemon.posix.PosixProcess
com.aoindustries.aoserv.daemon.posix.linux.LinuxProcess
A
PosixProcess
represents a process
running on any POSIX machine.- Author:
- AO Industries, Inc.
-
Field Summary
Fields inherited from class com.aoindustries.aoserv.daemon.posix.PosixProcess
pid
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionString[]
Gets the command line from/proc/pid/cmdline
, split on null bytes.int
getGid()
Determines the group ID of the currently running process.Gets the status from/proc/pid/status
.Gets one field of the status from/proc/pid/status
.int
getUid()
Determines the user ID of the currently running process.boolean
Determines if the process is currently running.Methods inherited from class com.aoindustries.aoserv.daemon.posix.PosixProcess
killProc, signal
-
Constructor Details
-
LinuxProcess
public LinuxProcess(int pid) Constructs a Linux process given its process ID.
-
-
Method Details
-
getGid
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 classPosixProcess
- Throws:
IOException
-
getUid
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 classPosixProcess
- Throws:
IOException
-
isRunning
Determines if the process is currently running. The process is considered running if a directory exists in /proc.- Specified by:
isRunning
in classPosixProcess
- Throws:
IOException
-
getCmdline
Gets the command line from/proc/pid/cmdline
, split on null bytes.- Throws:
IOException
-
getStatus
Gets the status from/proc/pid/status
. The colon (:) is removed from the field names.- Throws:
IOException
- See Also:
-
getStatus
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:
-