8346880: [aix] java/lang/ProcessHandle/InfoTest.java still fails: "reported cputime less than expected"

Reviewed-by: mdoerr, clanger, mbaesken
This commit is contained in:
Joachim Kern 2025-01-09 14:24:12 +00:00
parent 9c72dedd07
commit f9b11332ec

View File

@ -162,7 +162,24 @@ jint os_getChildren(JNIEnv *env, jlong jpid, jlongArray jarray,
}
pid_t os_getParentPidAndTimings(JNIEnv *env, pid_t pid, jlong *total, jlong *start) {
return unix_getParentPidAndTimings(env, pid, total, start);
pid_t the_pid = pid;
struct procentry64 ProcessBuffer;
if (getprocs64(&ProcessBuffer, sizeof(ProcessBuffer), NULL, sizeof(struct fdsinfo64), &the_pid, 1) <= 0) {
return -1;
}
// Validate the pid before returning the info
if (kill(pid, 0) < 0) {
return -1;
}
*total = ((ProcessBuffer.pi_ru.ru_utime.tv_sec + ProcessBuffer.pi_ru.ru_stime.tv_sec) * 1000000000L) +
((ProcessBuffer.pi_ru.ru_utime.tv_usec + ProcessBuffer.pi_ru.ru_stime.tv_usec));
*start = ProcessBuffer.pi_start * (jlong)1000;
return (pid_t) ProcessBuffer.pi_ppid;
}
void os_getCmdlineAndUserInfo(JNIEnv *env, jobject jinfo, pid_t pid) {