diff --git a/packages/procps/Makefile.in.patch b/packages/procps/Makefile.in.patch index 0d3ccabd1..38d68a08a 100644 --- a/packages/procps/Makefile.in.patch +++ b/packages/procps/Makefile.in.patch @@ -1,18 +1,18 @@ Bionic lacks strverscmp as well. -diff -u -r ../procps-ng-3.3.12/Makefile.in ./Makefile.in ---- ../procps-ng-3.3.12/Makefile.in 2016-07-10 01:32:11.170237828 -0400 -+++ ./Makefile.in 2016-08-14 18:07:17.324636393 -0400 -@@ -112,7 +112,7 @@ +diff -u -r ../procps-ng-3.3.14/Makefile.in ./Makefile.in +--- ../procps-ng-3.3.14/Makefile.in 2018-04-10 11:40:19.331497997 +0000 ++++ ./Makefile.in 2018-05-19 00:15:36.379445979 +0000 +@@ -136,7 +136,7 @@ @WITH_NCURSES_TRUE@ watch.1 \ @WITH_NCURSES_TRUE@ top/top.1 --@CYGWIN_TRUE@@WITH_NCURSES_TRUE@am__append_10 = lib/strverscmp.c -+@WITH_NCURSES_TRUE@am__append_10 = lib/strverscmp.c - @BUILD_SKILL_TRUE@am__append_11 = \ - @BUILD_SKILL_TRUE@ skill \ - @BUILD_SKILL_TRUE@ snice -@@ -308,8 +308,8 @@ +-@CYGWIN_TRUE@@WITH_NCURSES_TRUE@am__append_18 = lib/strverscmp.c ++@WITH_NCURSES_TRUE@am__append_18 = lib/strverscmp.c + @CYGWIN_FALSE@@WITH_NCURSES_TRUE@am__append_19 = \ + @CYGWIN_FALSE@@WITH_NCURSES_TRUE@ slabtop.1 + +@@ -356,8 +356,8 @@ tload_DEPENDENCIES = ./proc/libprocps.la $(am__DEPENDENCIES_2) am__top_top_SOURCES_DIST = top/top.h top/top.c top/top_nls.h \ top/top_nls.c lib/fileutils.c lib/strverscmp.c diff --git a/packages/procps/build.sh b/packages/procps/build.sh index de8c0005d..54a36a92f 100644 --- a/packages/procps/build.sh +++ b/packages/procps/build.sh @@ -1,9 +1,8 @@ TERMUX_PKG_HOMEPAGE=https://packages.debian.org/sid/procps TERMUX_PKG_DESCRIPTION="Utilities that give information about processes using the /proc filesystem" -TERMUX_PKG_VERSION=3.3.12 -TERMUX_PKG_REVISION=1 +TERMUX_PKG_VERSION=3.3.14 +TERMUX_PKG_SHA256=5eda0253999b7d786e690edfa73301b3113c7a67058478866e98e9ff6736726c TERMUX_PKG_SRCURL=https://downloads.sourceforge.net/project/procps-ng/Production/procps-ng-${TERMUX_PKG_VERSION}.tar.xz -TERMUX_PKG_SHA256=6ed65ab86318f37904e8f9014415a098bec5bc53653e5d9ab404f95ca5e1a7d4 TERMUX_PKG_BUILD_IN_SRC=yes # error.h and stdio_ext.h in unified headers does # not provide any functionality prior to android-23: diff --git a/packages/procps/sysinfo.c.patch b/packages/procps/proc-sysinfo.c.patch similarity index 77% rename from packages/procps/sysinfo.c.patch rename to packages/procps/proc-sysinfo.c.patch index 35eb3d8f5..ba09be183 100644 --- a/packages/procps/sysinfo.c.patch +++ b/packages/procps/proc-sysinfo.c.patch @@ -1,13 +1,17 @@ -diff -u -r ../procps-ng-3.3.9/proc/sysinfo.c ./proc/sysinfo.c ---- ../procps-ng-3.3.9/proc/sysinfo.c 2013-09-11 13:57:56.000000000 +0200 -+++ ./proc/sysinfo.c 2014-07-06 08:35:27.678833325 +0200 -@@ -86,19 +86,27 @@ +diff -u -r ../procps-ng-3.3.14/proc/sysinfo.c ./proc/sysinfo.c +--- ../procps-ng-3.3.14/proc/sysinfo.c 2018-03-03 07:11:55.690869414 +0000 ++++ ./proc/sysinfo.c 2018-05-19 00:26:13.944186699 +0000 +@@ -103,19 +103,31 @@ /***********************************************************************/ int uptime(double *restrict uptime_secs, double *restrict idle_secs) { double up=0, idle=0; +#ifndef __ANDROID__ char *savelocale; +#endif ++ ++ if (uptime_fd == -1 && (uptime_fd = open(UPTIME_FILE, O_RDONLY)) == -1) { ++ return 0; ++ } FILE_TO_BUF(UPTIME_FILE,uptime_fd); +#ifndef __ANDROID__ @@ -29,7 +33,15 @@ diff -u -r ../procps-ng-3.3.9/proc/sysinfo.c ./proc/sysinfo.c SET_IF_DESIRED(uptime_secs, up); SET_IF_DESIRED(idle_secs, idle); return up; /* assume never be zero seconds in practice */ -@@ -174,7 +182,9 @@ +@@ -132,6 +144,7 @@ + /* /proc/stat can get very large on multi-CPU systems so we + can't use FILE_TO_BUF */ + if (!(f = fopen(STAT_FILE, "r"))) { ++ return 0; + fputs(BAD_OPEN_MESSAGE, stderr); + fflush(NULL); + _exit(102); +@@ -191,7 +204,9 @@ double up_1, up_2, seconds; unsigned long long jiffies; unsigned h; @@ -39,7 +51,7 @@ diff -u -r ../procps-ng-3.3.9/proc/sysinfo.c ./proc/sysinfo.c long hz; #ifdef _SC_CLK_TCK -@@ -185,8 +195,10 @@ +@@ -202,8 +217,10 @@ #endif wait_j = hirq_j = sirq_j = stol_j = 0; @@ -50,7 +62,7 @@ diff -u -r ../procps-ng-3.3.9/proc/sysinfo.c ./proc/sysinfo.c do{ FILE_TO_BUF(UPTIME_FILE,uptime_fd); sscanf(buf, "%lf", &up_1); /* uptime(&up_1, NULL); */ -@@ -195,8 +207,10 @@ +@@ -212,8 +229,10 @@ FILE_TO_BUF(UPTIME_FILE,uptime_fd); sscanf(buf, "%lf", &up_2); /* uptime(&up_2, NULL); */ } while((long long)( (up_2-up_1)*1000.0/up_1 )); /* want under 0.1% error */ @@ -61,13 +73,17 @@ diff -u -r ../procps-ng-3.3.9/proc/sysinfo.c ./proc/sysinfo.c jiffies = user_j + nice_j + sys_j + other_j + wait_j + hirq_j + sirq_j + stol_j ; seconds = (up_1 + up_2) / 2; h = (unsigned)( (double)jiffies/seconds/smp_num_cpus ); -@@ -363,18 +377,26 @@ +@@ -443,18 +462,30 @@ /***********************************************************************/ void loadavg(double *restrict av1, double *restrict av5, double *restrict av15) { double avg_1=0, avg_5=0, avg_15=0; +#ifndef __ANDROID__ char *savelocale; +#endif ++ ++ if (loadavg_fd == -1 && (loadavg_fd = open(LOADAVG_FILE, O_RDONLY)) == -1) { ++ return; ++ } FILE_TO_BUF(LOADAVG_FILE,loadavg_fd); +#ifndef __ANDROID__ diff --git a/packages/procps/procio.c.patch b/packages/procps/procio.c.patch new file mode 100644 index 000000000..16b4543a9 --- /dev/null +++ b/packages/procps/procio.c.patch @@ -0,0 +1,33 @@ +diff -u -r ../procps-ng-3.3.14/procio.c ./procio.c +--- ../procps-ng-3.3.14/procio.c 2018-04-10 13:26:34.695269068 +0200 ++++ ./procio.c 2018-05-19 03:03:48.858822656 +0200 +@@ -46,6 +46,7 @@ + static ssize_t proc_write(void *, const char *, size_t); + static int proc_close(void *); + ++#ifndef __ANDROID__ + __extension__ + static cookie_io_functions_t procio = { + .read = proc_read, +@@ -53,9 +54,13 @@ + .seek = NULL, + .close = proc_close, + }; ++#endif + + FILE *fprocopen(const char *path, const char *mode) + { ++#ifdef __ANDROID__ ++ return fopen(path, mode); ++#else + pcookie_t *cookie = NULL; + FILE *handle = NULL; + mode_t flags = 0; +@@ -144,6 +149,7 @@ + } + out: + return handle; ++#endif + } + + static diff --git a/packages/procps/sysctl.c.patch b/packages/procps/sysctl.c.patch index 39f6deb98..cda146b43 100644 --- a/packages/procps/sysctl.c.patch +++ b/packages/procps/sysctl.c.patch @@ -1,6 +1,6 @@ -diff -u -r ../procps-ng-3.3.11/sysctl.c ./sysctl.c ---- ../procps-ng-3.3.11/sysctl.c 2015-08-09 01:54:54.306117153 -0400 -+++ ./sysctl.c 2016-01-03 21:27:00.921667943 -0500 +diff -u -r ../procps-ng-3.3.14/sysctl.c ./sysctl.c +--- ../procps-ng-3.3.14/sysctl.c 2018-03-12 01:59:52.530805100 +0000 ++++ ./sysctl.c 2018-05-19 00:31:52.228321968 +0000 @@ -29,7 +29,9 @@ #include #include @@ -12,30 +12,21 @@ diff -u -r ../procps-ng-3.3.11/sysctl.c ./sysctl.c #include #include #include -@@ -491,6 +493,9 @@ +@@ -507,6 +509,9 @@ */ static int Preload(const char *restrict const filename) { +#ifdef __ANDROID__ + return -1; +#else - char oneline[LINELEN]; - char buffer[LINELEN]; FILE *fp; -@@ -567,6 +572,7 @@ - fclose(fp); + char *t; + int n = 0; +@@ -596,6 +601,7 @@ } + out: return rc; +#endif } struct pair { -@@ -816,7 +822,7 @@ - program_invocation_short_name); - - for ( ; *argv; argv++) { -- if (WriteMode || index(*argv, '=')) -+ if (WriteMode || strchr(*argv, '=')) - ReturnCode += WriteSetting(*argv); - else - ReturnCode += ReadSetting(*argv); diff --git a/packages/procps/top-top.c.patch b/packages/procps/top-top.c.patch new file mode 100644 index 000000000..b9b90f8f4 --- /dev/null +++ b/packages/procps/top-top.c.patch @@ -0,0 +1,59 @@ +Ignore Permission denied in several places. + +On some Androids many of proc files can't actually be opened. So ignore +when opening fails and go on. + +diff -u -r ../procps-ng-3.3.14/top/top.c ./top/top.c +--- ../procps-ng-3.3.14/top/top.c 2018-03-03 07:11:55.698869268 +0000 ++++ ./top/top.c 2018-05-19 00:20:58.203786150 +0000 +@@ -2558,7 +2558,7 @@ + (sorry Linux, but you'll have to close it for us) */ + if (!fp) { + if (!(fp = fopen("/proc/stat", "r"))) +- error_exit(fmtmk(N_fmt(FAIL_statopn_fmt), strerror(errno))); ++ return; + /* note: we allocate one more CPU_t via totSLOT than 'cpus' so that a + slot can hold tics representing the /proc/stat cpu summary */ + Cpu_tics = alloc_c(totSLOT * sizeof(CPU_t)); +@@ -4106,7 +4106,7 @@ + tmptty.c_cc[VERASE] = *key_backspace; + #ifdef TERMIOS_ONLY + if (-1 == tcsetattr(STDIN_FILENO, TCSAFLUSH, &tmptty)) +- error_exit(fmtmk(N_fmt(FAIL_tty_set_fmt), strerror(errno))); ++ {} + tcgetattr(STDIN_FILENO, &Tty_tweaked); + #endif + // lastly, a nearly raw mode for unsolicited single keystrokes +@@ -4114,7 +4114,7 @@ + tmptty.c_cc[VMIN] = 1; + tmptty.c_cc[VTIME] = 0; + if (-1 == tcsetattr(STDIN_FILENO, TCSAFLUSH, &tmptty)) +- error_exit(fmtmk(N_fmt(FAIL_tty_set_fmt), strerror(errno))); ++ {} + tcgetattr(STDIN_FILENO, &Tty_raw); + + #ifndef OFF_STDIOLBF +@@ -5444,7 +5444,7 @@ + + if (!Numa_node_tot) goto numa_nope; + +- if (CHKw(w, View_CPUNOD)) { ++ if (Cpu_tics && CHKw(w, View_CPUNOD)) { + if (Numa_node_sel < 0) { + // display the 1st /proc/stat line, then the nodes (if room) + summary_hlp(&Cpu_tics[smp_num_cpus], N_txt(WORD_allcpus_txt)); +@@ -5479,12 +5479,12 @@ + } + } else + numa_nope: +- if (CHKw(w, View_CPUSUM)) { ++ if (Cpu_tics && CHKw(w, View_CPUSUM)) { + // display just the 1st /proc/stat line + summary_hlp(&Cpu_tics[Cpu_faux_tot], N_txt(WORD_allcpus_txt)); + Msg_row += 1; + +- } else { ++ } else if (Cpu_tics) { + // display each cpu's states separately, screen height permitting... + for (i = 0; i < Cpu_faux_tot; i++) { + snprintf(tmp, sizeof(tmp), N_fmt(WORD_eachcpu_fmt), Cpu_tics[i].id); diff --git a/packages/procps/z01_eaccess.patch b/packages/procps/z01_eaccess.patch deleted file mode 100644 index 70aaf45f0..000000000 --- a/packages/procps/z01_eaccess.patch +++ /dev/null @@ -1,92 +0,0 @@ -Ignore Permission denied in several places. - -On some Androids many of proc files can't actually be opened. So ignore -when opening fails and go on. - -diff '--exclude=config.log' -ur src-orig/proc/sysinfo.c src/proc/sysinfo.c ---- src-orig/proc/sysinfo.c 2017-08-26 23:22:50.704748922 +0200 -+++ src/proc/sysinfo.c 2017-08-27 00:08:52.482479053 +0200 -@@ -97,6 +97,10 @@ - char *savelocale; - #endif - -+ if (uptime_fd == -1 && (uptime_fd = open(UPTIME_FILE, O_RDONLY)) == -1) { -+ return 0; -+ } -+ - FILE_TO_BUF(UPTIME_FILE,uptime_fd); - #ifndef __ANDROID__ - savelocale = strdup(setlocale(LC_NUMERIC, NULL)); -@@ -130,6 +136,7 @@ - /* /proc/stat can get very large on multi-CPU systems so we - can't use FILE_TO_BUF */ - if (!(f = fopen(STAT_FILE, "r"))) { -+ return 0; - fputs(BAD_OPEN_MESSAGE, stderr); - fflush(NULL); - _exit(102); -@@ -389,6 +401,10 @@ - char *savelocale; - #endif - -+ if (loadavg_fd == -1 && (loadavg_fd = open(LOADAVG_FILE, O_RDONLY)) == -1) { -+ return; -+ } -+ - FILE_TO_BUF(LOADAVG_FILE,loadavg_fd); - #ifndef __ANDROID__ - savelocale = strdup(setlocale(LC_NUMERIC, NULL)); -diff '--exclude=config.log' -ur src-orig/top/top.c src/top/top.c ---- src-orig/top/top.c 2017-08-26 23:22:50.708748956 +0200 -+++ src/top/top.c 2017-08-27 00:13:34.416643298 +0200 -@@ -2379,7 +2379,7 @@ - (sorry Linux, but you'll have to close it for us) */ - if (!fp) { - if (!(fp = fopen("/proc/stat", "r"))) -- error_exit(fmtmk(N_fmt(FAIL_statopn_fmt), strerror(errno))); -+ return NULL; - /* note: we allocate one more CPU_t via totSLOT than 'cpus' so that a - slot can hold tics representing the /proc/stat cpu summary */ - cpus = alloc_c(totSLOT * sizeof(CPU_t)); -@@ -3814,7 +3814,7 @@ - tmptty.c_cc[VERASE] = *key_backspace; - #ifdef TERMIOS_ONLY - if (-1 == tcsetattr(STDIN_FILENO, TCSAFLUSH, &tmptty)) -- error_exit(fmtmk(N_fmt(FAIL_tty_set_fmt), strerror(errno))); -+ {} - tcgetattr(STDIN_FILENO, &Tty_tweaked); - #endif - // lastly, a nearly raw mode for unsolicited single keystrokes -@@ -3822,7 +3822,7 @@ - tmptty.c_cc[VMIN] = 1; - tmptty.c_cc[VTIME] = 0; - if (-1 == tcsetattr(STDIN_FILENO, TCSAFLUSH, &tmptty)) -- error_exit(fmtmk(N_fmt(FAIL_tty_set_fmt), strerror(errno))); -+ {} - tcgetattr(STDIN_FILENO, &Tty_raw); - - #ifndef OFF_STDIOLBF -@@ -5155,7 +5155,7 @@ - #ifndef NUMA_DISABLE - if (!Numa_node_tot) goto numa_nope; - -- if (CHKw(w, View_CPUNOD)) { -+ if (smpcpu && CHKw(w, View_CPUNOD)) { - if (Numa_node_sel < 0) { - // display the 1st /proc/stat line, then the nodes (if room) - summary_hlp(&smpcpu[smp_num_cpus], N_txt(WORD_allcpus_txt)); -@@ -5191,12 +5191,12 @@ - } else - numa_nope: - #endif -- if (CHKw(w, View_CPUSUM)) { -+ if (smpcpu && CHKw(w, View_CPUSUM)) { - // display just the 1st /proc/stat line - summary_hlp(&smpcpu[Cpu_faux_tot], N_txt(WORD_allcpus_txt)); - Msg_row += 1; - -- } else { -+ } else if (smpcpu) { - // display each cpu's states separately, screen height permitting... - for (i = 0; i < Cpu_faux_tot; i++) { - snprintf(tmp, sizeof(tmp), N_fmt(WORD_eachcpu_fmt), smpcpu[i].id);