htop: since v3.0.0 it can't work without /proc/stat, add a proper error description why and what to do

This commit is contained in:
Leonid Pliushch 2020-08-29 11:58:04 +03:00
parent ab326d4cea
commit 819f92fefd
3 changed files with 22 additions and 18 deletions

View File

@ -2,6 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://htop.dev/
TERMUX_PKG_DESCRIPTION="Interactive process viewer for Linux" TERMUX_PKG_DESCRIPTION="Interactive process viewer for Linux"
TERMUX_PKG_LICENSE="GPL-2.0" TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_VERSION=3.0.0 TERMUX_PKG_VERSION=3.0.0
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://github.com/htop-dev/htop/archive/${TERMUX_PKG_VERSION}/htop-${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SRCURL=https://github.com/htop-dev/htop/archive/${TERMUX_PKG_VERSION}/htop-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=1c0661f0ae5f4e2874da250b60cd515e4ac4c041583221adfe95f10e18d1a4e6 TERMUX_PKG_SHA256=1c0661f0ae5f4e2874da250b60cd515e4ac4c041583221adfe95f10e18d1a4e6
# htop checks setlocale() return value for UTF-8 support, so use libandroid-support. # htop checks setlocale() return value for UTF-8 support, so use libandroid-support.

View File

@ -16,24 +16,6 @@ diff -uNr htop-2.1.0/linux/LinuxProcessList.c htop-2.1.0.mod/linux/LinuxProcessL
/*{ /*{
#include "ProcessList.h" #include "ProcessList.h"
@@ -241,7 +249,7 @@
// Update CPU count:
FILE* file = fopen(PROCSTATFILE, "r");
if (file == NULL) {
- CRT_fatalError("Cannot open " PROCSTATFILE);
+ return pl;
}
char buffer[PROC_LINE_LENGTH + 1];
int cpus = -1;
@@ -966,7 +974,7 @@
FILE* file = fopen(PROCSTATFILE, "r");
if (file == NULL) {
- CRT_fatalError("Cannot open " PROCSTATFILE);
+ return 0;
}
int cpus = this->super.cpuCount;
assert(cpus > 0);
diff -uNr htop-2.1.0/Process.c htop-2.1.0.mod/Process.c diff -uNr htop-2.1.0/Process.c htop-2.1.0.mod/Process.c
--- htop-2.1.0/Process.c 2018-02-04 20:57:13.000000000 +0200 --- htop-2.1.0/Process.c 2018-02-04 20:57:13.000000000 +0200
+++ htop-2.1.0.mod/Process.c 2018-03-05 17:59:16.522983619 +0200 +++ htop-2.1.0.mod/Process.c 2018-03-05 17:59:16.522983619 +0200

View File

@ -0,0 +1,21 @@
diff -uNr htop-3.0.0/linux/LinuxProcessList.c htop-3.0.0.mod/linux/LinuxProcessList.c
--- htop-3.0.0/linux/LinuxProcessList.c 2020-08-27 02:36:56.000000000 +0300
+++ htop-3.0.0.mod/linux/LinuxProcessList.c 2020-08-29 11:55:19.994514529 +0300
@@ -265,7 +265,7 @@
// Update CPU count:
file = fopen(PROCSTATFILE, "r");
if (file == NULL) {
- CRT_fatalError("Cannot open " PROCSTATFILE);
+ CRT_fatalError("Cannot open '/proc/stat'.\nOn Android 8 and higher access to this file is restricted by SELinux.\nRoot your device and/or install Lineage OS in order to get 'htop' working properly.\n");
}
int cpus = 0;
do {
@@ -1127,7 +1127,7 @@
FILE* file = fopen(PROCSTATFILE, "r");
if (file == NULL) {
- CRT_fatalError("Cannot open " PROCSTATFILE);
+ CRT_fatalError("Cannot open '/proc/stat'.\nOn Android 8 and higher access to this file is restricted by SELinux.\nRoot your device and/or install Lineage OS in order to get 'htop' working properly.\n");
}
int cpus = this->super.cpuCount;
assert(cpus > 0);