From e225c7b0ded89bc7e96781f1f604107754761f13 Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Mon, 12 Dec 2022 19:15:38 +0100 Subject: [PATCH] Ports: Add missing include and update renamed function in OpenJDK patch --- ...-java.base-Enable-java.lang.Process-on-serenity.patch | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Ports/OpenJDK/patches/0008-java.base-Enable-java.lang.Process-on-serenity.patch b/Ports/OpenJDK/patches/0008-java.base-Enable-java.lang.Process-on-serenity.patch index bb31b85bb8..fd77cb1cda 100644 --- a/Ports/OpenJDK/patches/0008-java.base-Enable-java.lang.Process-on-serenity.patch +++ b/Ports/OpenJDK/patches/0008-java.base-Enable-java.lang.Process-on-serenity.patch @@ -50,7 +50,7 @@ new file mode 100644 index 0000000000000000000000000000000000000000..cc0c08cb85a682d66a00f6b48ad2871f83b5e719 --- /dev/null +++ b/src/java.base/serenity/native/libjava/ProcessHandleImpl_serenity.cpp -@@ -0,0 +1,164 @@ +@@ -0,0 +1,165 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -90,6 +90,7 @@ index 0000000000000000000000000000000000000000..cc0c08cb85a682d66a00f6b48ad2871f +#include +#include +#include ++#include +#include +#include + @@ -121,7 +122,7 @@ index 0000000000000000000000000000000000000000..cc0c08cb85a682d66a00f6b48ad2871f + +pid_t os_getParentPidAndTimings(JNIEnv *env, pid_t pid, jlong *total, jlong *start) { + auto maybe_stats = Core::ProcessStatisticsReader::get_all(proc_all); -+ if (!maybe_stats.has_value()) { ++ if (maybe_stats.is_error()) { + JNU_ThrowByNameWithLastError(env, + "java/lang/RuntimeException", "ProcessStatisticsReader::get_all failed"); + return -1; @@ -168,7 +169,7 @@ index 0000000000000000000000000000000000000000..cc0c08cb85a682d66a00f6b48ad2871f + +void os_getCmdlineAndUserInfo(JNIEnv *env, jobject jinfo, pid_t pid) { + auto maybe_stats = Core::ProcessStatisticsReader::get_all(proc_all); -+ if (!maybe_stats.has_value()) { ++ if (maybe_stats.is_error()) { + JNU_ThrowByNameWithLastError(env, + "java/lang/RuntimeException", "ProcessStatisticsReader::get_all failed"); + return; @@ -189,7 +190,7 @@ index 0000000000000000000000000000000000000000..cc0c08cb85a682d66a00f6b48ad2871f + JNU_CHECK_EXCEPTION(env); + + auto cmdline_file = JAVA_TRY(Core::Stream::File::open(DeprecatedString::formatted("/proc/{}/cmdline", pid), Core::Stream::OpenMode::Read), "Unable to open /proc/pid/cmdline"sv); -+ auto contents = JAVA_TRY(cmdline_file->read_all(), "Unable to read /proc/pid/cmdline"sv); ++ auto contents = JAVA_TRY(cmdline_file->read_until_eof(), "Unable to read /proc/pid/cmdline"sv); + auto cmdline = JAVA_TRY(JsonValue::from_string(contents), "Invalid JSON in /proc/pid/cmdline"sv); + + if (!cmdline.is_array())