Skip to content

Commit

Permalink
JDK-8339487
Browse files Browse the repository at this point in the history
  • Loading branch information
MBaesken committed Sep 3, 2024
1 parent ad40a12 commit a9cd3b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jint os_getChildren(JNIEnv *env, jlong jpid, jlongArray jarray,
// Get buffer size needed to read all processes
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0};
if (sysctl(mib, 4, NULL, &bufSize, NULL, 0) < 0) {
JNU_ThrowByNameWithLastError(env,
JNU_ThrowByNameWithMessageAndLastError(env,
"java/lang/RuntimeException", "sysctl failed");
return -1;
}
Expand All @@ -114,8 +114,8 @@ jint os_getChildren(JNIEnv *env, jlong jpid, jlongArray jarray,

// Read process info for all processes
if (sysctl(mib, 4, buffer, &bufSize, NULL, 0) < 0) {
JNU_ThrowByNameWithLastError(env,
"java/lang/RuntimeException", "sysctl failed");
JNU_ThrowByNameWithMessageAndLastError(env,
"java/lang/RuntimeException", "sysctl failed to get info about all processes");
free(buffer);
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ jint unix_getChildren(JNIEnv *env, jlong jpid, jlongArray jarray,
* position integer as a filename.
*/
if ((dir = opendir("/proc")) == NULL) {
JNU_ThrowByNameWithLastError(env,
JNU_ThrowByNameWithMessageAndLastError(env,
"java/lang/RuntimeException", "Unable to open /proc");
return -1;
}
Expand Down

0 comments on commit a9cd3b2

Please sign in to comment.