fix(main/procps): Migrate from executable name to argv0 (#18198)

See https://github.com/termux/termux-exec/pull/24
This commit is contained in:
termux-pacman-bot
2023-10-08 18:31:13 +00:00
parent 292c53ac01
commit 42b404f207
2 changed files with 20 additions and 1 deletions

View File

@@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Utilities that give information about processes using th
TERMUX_PKG_LICENSE="LGPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=3.3.17
TERMUX_PKG_REVISION=4
TERMUX_PKG_REVISION=5
TERMUX_PKG_SRCURL=https://sourceforge.net/projects/procps-ng/files/Production/procps-ng-$TERMUX_PKG_VERSION.tar.xz
TERMUX_PKG_SHA256=4518b3e7aafd34ec07d0063d250fd474999b20b200218c3ae56f5d2113f141b4
TERMUX_PKG_DEPENDS="ncurses"

View File

@@ -0,0 +1,19 @@
diff -u -r ../orig-src/proc/readproc.c ./proc/readproc.c
--- ../orig-src/proc/readproc.c 2023-10-08 11:10:27.966080673 +0000
+++ ./proc/readproc.c 2023-10-08 11:57:27.196890251 +0000
@@ -1017,6 +1017,15 @@
p->wchan = (KLONG)~0ull;
}
+ // Termux patch to use argv0 instead of executable name,
+ // since that will soon (at time of writing) always be
+ // /system/bin/linker64.
+ char** cmdline_vec = file2strvec(path, "cmdline");
+ if (cmdline_vec) {
+ snprintf(p->cmd, sizeof(p->cmd), "%s", cmdline_vec[0]);
+ free(*cmdline_vec);
+ }
+
/* some number->text resolving which is time consuming */
if (flags & PROC_FILLUSR){
memcpy(p->euser, pwcache_get_user(p->euid), sizeof p->euser);