0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-05-29 01:22:57 +00:00
Files
termux-packages/packages/openjdk-17/0029-os-linux-add-getloadavg-implementation-for-android.patch
Robert Kirkman 4b5aa04efa bump(main/openjdk-17): 17.0.15
- fixes https://github.com/termux/termux-packages/issues/24527

- enable `littlecms`

- change `TERMUX_PKG_SRCURL` to match the same format as `openjdk-21`

- enable auto update

- add `--with-vendor-name="Termux"` and strip extra version strings like `openjdk-21`

- enable `TERMUX_PKG_MAKE_PROCESSES`

- remove directory before installation to fix building the same architecture twice in the same docker container

- some patches are present in the new upstream repository or are unnecessary

- some patches copied from `openjdk-21` because the code associated with them appeared in the new upstream repository
2025-05-07 07:29:19 +03:00

38 lines
1.1 KiB
Diff

From 5ac1dc92c8abd3289bd40da1b4e4793019e8a64b Mon Sep 17 00:00:00 2001
From: Henrik Grimler <grimler@termux.dev>
Date: Sun, 5 Feb 2023 09:14:50 +0100
Subject: [PATCH] os: linux: add getloadavg implementation for android
---
src/hotspot/os/linux/os_linux.cpp | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp
index e815b0afd7c1..06a5d0bf8245 100644
--- a/src/hotspot/os/linux/os_linux.cpp
+++ b/src/hotspot/os/linux/os_linux.cpp
@@ -5234,7 +5234,20 @@ bool os::is_thread_cpu_time_supported() {
// Linux doesn't yet have a (official) notion of processor sets,
// so just return the system wide load average.
int os::loadavg(double loadavg[], int nelem) {
+#if defined(__ANDROID__) && __ANDROID_API__ < 29
+ if (nelem < 0) return -1;
+ if (nelem > 3) nelem = 3;
+
+ struct sysinfo si;
+ if (sysinfo(&si) == -1) return -1;
+
+ for (int i = 0; i < nelem; ++i) {
+ loadavg[i] = (double)(si.loads[i]) / (double)(1 << SI_LOAD_SHIFT);
+ }
+ return nelem;
+#else
return ::getloadavg(loadavg, nelem);
+#endif
}
void os::pause() {
--
2.44.0