aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2023-02-26 12:51:58 +0100
committerDaniel Lange <DLange@git.local>2023-02-26 12:51:58 +0100
commit735e67c8af4b5004619dad7cc8bf2d5a198790f1 (patch)
tree2e27b2951f096b501301ee8ea221de96cda71cc9
parent7d999d009f103a2458b729a9fa8b36f34e087079 (diff)
downloaddebian_htop-735e67c8af4b5004619dad7cc8bf2d5a198790f1.tar.gz
debian_htop-735e67c8af4b5004619dad7cc8bf2d5a198790f1.tar.bz2
debian_htop-735e67c8af4b5004619dad7cc8bf2d5a198790f1.zip
Backport patch to remove the LXC special case for CPU handlingdebian/3.2.2-2
Upstream 11318b5ef6de6b2f80186a888cd5477e0ff167bb
-rw-r--r--debian/changelog6
-rw-r--r--debian/patches/001_remove_lxc_special_handling.patch70
-rw-r--r--debian/patches/series1
3 files changed, 77 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index d691d7b..5e05ba9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+htop (3.2.2-2) unstable; urgency=medium
+
+ * Remove LXC special handling for CPUs
+
+ -- Daniel Lange <DLange@debian.org> Sun, 26 Feb 2023 12:50:00 +0100
+
htop (3.2.2-1) unstable; urgency=medium
* Import upstream 3.2.2 release
diff --git a/debian/patches/001_remove_lxc_special_handling.patch b/debian/patches/001_remove_lxc_special_handling.patch
new file mode 100644
index 0000000..40b6077
--- /dev/null
+++ b/debian/patches/001_remove_lxc_special_handling.patch
@@ -0,0 +1,70 @@
+commit 11318b5ef6de6b2f80186a888cd5477e0ff167bb
+Author: Daniel Lange <DLange@git.local>
+Date: Sat Feb 25 14:12:45 2023 +0100
+
+ Remove LXC special handling for the CPU count
+
+ LXC shows the real host CPU ids but can be limited in configuration
+ as to which cores are used. Still the sysfs files are visible and the
+ CPUs (stay) marked online. We will need to parse
+ /sys/devices/system/cpu/online to follow LXC's logic.
+ Revert for now until we can come up with a better handling of the LXC hacks.
+
+ Cf. issue #1195
+ Essentially reverting 33973f7e and 0d53245c (#993, #995)
+
+Index: debian_htop/linux/LinuxProcessList.c
+===================================================================
+--- debian_htop.orig/linux/LinuxProcessList.c
++++ debian_htop/linux/LinuxProcessList.c
+@@ -167,28 +167,6 @@ static void LinuxProcessList_initNetlink
+
+ #endif
+
+-static unsigned int scanAvailableCPUsFromCPUinfo(LinuxProcessList* this) {
+- FILE* file = fopen(PROCCPUINFOFILE, "r");
+- if (file == NULL)
+- return this->super.existingCPUs;
+-
+- unsigned int availableCPUs = 0;
+-
+- while (!feof(file)) {
+- char buffer[PROC_LINE_LENGTH];
+-
+- if (fgets(buffer, PROC_LINE_LENGTH, file) == NULL)
+- break;
+-
+- if (String_startsWith(buffer, "processor"))
+- availableCPUs++;
+- }
+-
+- fclose(file);
+-
+- return availableCPUs ? availableCPUs : 1;
+-}
+-
+ static void LinuxProcessList_updateCPUcount(ProcessList* super) {
+ /* Similar to get_nprocs_conf(3) / _SC_NPROCESSORS_CONF
+ * https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/getsysstats.c;hb=HEAD
+@@ -263,12 +241,6 @@ static void LinuxProcessList_updateCPUco
+ if (existing < 1)
+ return;
+
+- if (Running_containerized) {
+- /* LXC munges /proc/cpuinfo but not the /sys/devices/system/cpu/ files,
+- * so limit the visible CPUs to what the guest has been configured to see: */
+- currExisting = active = scanAvailableCPUsFromCPUinfo(this);
+- }
+-
+ #ifdef HAVE_SENSORS_SENSORS_H
+ /* When started with offline CPUs, libsensors does not monitor those,
+ * even when they become online. */
+@@ -277,7 +249,7 @@ static void LinuxProcessList_updateCPUco
+ #endif
+
+ super->activeCPUs = active;
+- assert(Running_containerized || (existing == currExisting));
++ assert(existing == currExisting);
+ super->existingCPUs = currExisting;
+ }
+
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..4fd518f
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+001_remove_lxc_special_handling.patch

© 2014-2024 Faster IT GmbH | imprint | privacy policy