Package oshi.driver.unix.aix
Class PsInfo
java.lang.Object
oshi.driver.unix.aix.PsInfo
Utility to query /proc/psinfo
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static long
conditionallyReadBufferFromStartOfPage
(int fd, com.sun.jna.Memory buffer, com.sun.jna.platform.unix.LibCAPI.size_t bufSize, long bufStart, long addr) Reads the page containing addr into buffer, unless the buffer already contains that page (as indicated by the bufStart address), in which case nothing is changed.private static long
getOffsetFromBuffer
(com.sun.jna.Memory buffer, long offset, long increment) queryArgsEnv
(int pid, AixLibc.AixPsInfo psinfo) Read the argument and environment strings from process address spacequeryArgsEnvAddrs
(int pid, AixLibc.AixPsInfo psinfo) Reads the pr_argc, pr_argv, and pr_envp fields from /proc/pid/psinfostatic AixLibc.AixLwpsInfo
queryLwpsInfo
(int pid, int tid) Reads /proc/pid/lwp/tid/lwpsinfo and returns data in a structurestatic AixLibc.AixPsInfo
queryPsInfo
(int pid) Reads /proc/pid/psinfo and returns data in a structure
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
LIBC
-
PAGE_SIZE
private static final long PAGE_SIZE- See Also:
-
-
Constructor Details
-
PsInfo
private PsInfo()
-
-
Method Details
-
queryPsInfo
Reads /proc/pid/psinfo and returns data in a structure- Parameters:
pid
- The process ID- Returns:
- A structure containing information for the requested process
-
queryLwpsInfo
Reads /proc/pid/lwp/tid/lwpsinfo and returns data in a structure- Parameters:
pid
- The process IDtid
- The thread ID (lwpid)- Returns:
- A structure containing information for the requested thread
-
queryArgsEnvAddrs
Reads the pr_argc, pr_argv, and pr_envp fields from /proc/pid/psinfo- Parameters:
pid
- The process IDpsinfo
- A populatedAixLibc.AixPsInfo
structure containing the offset pointers for these fields- Returns:
- A triplet containing the argc, argv, and envp values, or null if unable to read
-
queryArgsEnv
Read the argument and environment strings from process address space- Parameters:
pid
- the process idpsinfo
- A populatedAixLibc.AixPsInfo
structure containing the offset pointers for these fields- Returns:
- A pair containing a list of the arguments and a map of environment variables
-
conditionallyReadBufferFromStartOfPage
private static long conditionallyReadBufferFromStartOfPage(int fd, com.sun.jna.Memory buffer, com.sun.jna.platform.unix.LibCAPI.size_t bufSize, long bufStart, long addr) Reads the page containing addr into buffer, unless the buffer already contains that page (as indicated by the bufStart address), in which case nothing is changed.- Parameters:
fd
- The file descriptor for the address spacebuffer
- An allocated buffer, possibly with data reread from bufStartbufSize
- The size of the bufferbufStart
- The start of data currently in bufStart, or 0 if uninitializedaddr
- THe address whose page to read into the buffer- Returns:
- The new starting pointer for the buffer
-
getOffsetFromBuffer
private static long getOffsetFromBuffer(com.sun.jna.Memory buffer, long offset, long increment)
-