mirror of
https://github.com/termux-pacman/termux-packages.git
synced 2025-12-26 13:40:22 +00:00
40 lines
991 B
Diff
40 lines
991 B
Diff
diff -uNr psmisc/src/killall.c psmisc.mod/src/killall.c
|
|
--- psmisc/src/killall.c 2022-03-18 06:47:48.712425525 +0800
|
|
+++ psmisc.mod/src/killall.c 2022-08-04 00:04:01.358949441 +0800
|
|
@@ -46,6 +46,10 @@
|
|
#include <ctype.h>
|
|
#include <assert.h>
|
|
|
|
+#ifdef __ANDROID__
|
|
+#include <sys/sysinfo.h>
|
|
+#endif
|
|
+
|
|
#ifdef WITH_SELINUX
|
|
#include <dlfcn.h>
|
|
#include <selinux/selinux.h>
|
|
@@ -135,6 +139,16 @@
|
|
static double
|
|
uptime()
|
|
{
|
|
+#ifdef __ANDROID__
|
|
+ /* Android does not allow read access to /proc/uptime */
|
|
+ struct sysinfo system_information;
|
|
+ if (sysinfo(&system_information) == 0) {
|
|
+ return (double) system_information.uptime;
|
|
+ } else {
|
|
+ fprintf(stderr, "pstree: error obtaining uptime from sysinfo\n");
|
|
+ exit(1);
|
|
+ }
|
|
+#else
|
|
char * savelocale;
|
|
char buf[2048];
|
|
FILE* file;
|
|
@@ -147,6 +161,7 @@
|
|
fclose(file);
|
|
setlocale(LC_NUMERIC,savelocale);
|
|
return atof(buf);
|
|
+#endif
|
|
}
|
|
|
|
/* process age from jiffies to seconds via uptime */
|