mirror of
https://github.com/openjdk/jdk.git
synced 2026-06-06 02:33:12 +00:00
8184808: (process) isAlive should use pid for validity, not /proc/pid
Reviewed-by: stuefe, xiaofeya
This commit is contained in:
parent
9d44112c17
commit
5165b80762
@ -662,6 +662,11 @@ pid_t unix_getParentPidAndTimings(JNIEnv *env, pid_t pid,
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Validate the pid before returning the info in case /proc/pid is racy
|
||||
if (kill(pid, 0) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*totalTime = psinfo.pr_time.tv_sec * 1000000000L + psinfo.pr_time.tv_nsec;
|
||||
|
||||
*startTime = psinfo.pr_start.tv_sec * (jlong)1000 +
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user