FreeBSD Bugzilla – Attachment 191210 Details for
Bug 225232
[MAINTAINER] sysutils/htop: Merge patches from upstream
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
htop 2.1.0
sysutils_htop.patch (text/plain), 96.12 KB, created by
Hung-Yi Chen
on 2018-03-05 03:58:49 UTC
(
hide
)
Description:
htop 2.1.0
Filename:
MIME Type:
Creator:
Hung-Yi Chen
Created:
2018-03-05 03:58:49 UTC
Size:
96.12 KB
patch
obsolete
>Index: sysutils/htop/Makefile >=================================================================== >--- sysutils/htop/Makefile (revision 459194) >+++ sysutils/htop/Makefile (working copy) >@@ -3,6 +3,7 @@ > > PORTNAME= htop > PORTVERSION= 2.0.2 >+PORTREVISION= 1 > CATEGORIES= sysutils > > MAINTAINER= gaod@hychen.org >@@ -15,9 +16,10 @@ > LIBS+= -lexecinfo > > CONFIGURE_ARGS= --enable-unicode >-USES= autoreconf libtool ncurses >+USES= autoreconf libtool ncurses python:2.7,build shebangfix > USE_GITHUB= yes > GH_ACCOUNT= hishamhm >+SHEBANG_FILES= scripts/MakeHeader.py > PLIST_FILES= bin/htop \ > man/man1/htop.1.gz \ > share/applications/htop.desktop \ >Index: sysutils/htop/files/patch-Action.c >=================================================================== >--- sysutils/htop/files/patch-Action.c (nonexistent) >+++ sysutils/htop/files/patch-Action.c (working copy) >@@ -0,0 +1,43 @@ >+--- Action.c.orig 2018-01-17 02:13:00.581511000 +0800 >++++ Action.c 2018-01-17 03:18:10.503362000 +0800 >+@@ -142,7 +142,7 @@ >+ pid_t ppid = parent->pid; >+ for (int i = 0; i < Panel_size(panel); i++) { >+ Process* p = (Process*) Panel_get(panel, i); >+- if (!p->tag && p->ppid == ppid) { >++ if (!p->tag && Process_isChildOf(p, ppid)) { >+ tagAllChildren(panel, p); >+ } >+ } >+@@ -381,7 +381,7 @@ >+ return HTOP_REFRESH | HTOP_REDRAW_BAR; >+ } >+ >+-static struct { const char* key; const char* info; } helpLeft[] = { >++static const struct { const char* key; const char* info; } helpLeft[] = { >+ { .key = " Arrows: ", .info = "scroll process list" }, >+ { .key = " Digits: ", .info = "incremental PID search" }, >+ { .key = " F3 /: ", .info = "incremental name search" }, >+@@ -395,11 +395,11 @@ >+ { .key = " F6 + -: ", .info = "expand/collapse tree" }, >+ { .key = " P M T: ", .info = "sort by CPU%, MEM% or TIME" }, >+ { .key = " I: ", .info = "invert sort order" }, >+- { .key = " F6 >: ", .info = "select sort column" }, >++ { .key = " F6 > .: ", .info = "select sort column" }, >+ { .key = NULL, .info = NULL } >+ }; >+ >+-static struct { const char* key; const char* info; } helpRight[] = { >++static const struct { const char* key; const char* info; } helpRight[] = { >+ { .key = " Space: ", .info = "tag process" }, >+ { .key = " c: ", .info = "tag process and its children" }, >+ { .key = " U: ", .info = "untag all processes" }, >+@@ -414,7 +414,7 @@ >+ { .key = " l: ", .info = "list open files with lsof" }, >+ { .key = " s: ", .info = "trace syscalls with strace" }, >+ { .key = " ", .info = "" }, >+- { .key = " F2 S: ", .info = "setup" }, >++ { .key = " F2 C S: ", .info = "setup" }, >+ { .key = " F1 h: ", .info = "show this help screen" }, >+ { .key = " F10 q: ", .info = "quit" }, >+ { .key = NULL, .info = NULL } > >Property changes on: sysutils/htop/files/patch-Action.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-AffinityPanel.c >=================================================================== >--- sysutils/htop/files/patch-AffinityPanel.c (nonexistent) >+++ sysutils/htop/files/patch-AffinityPanel.c (working copy) >@@ -0,0 +1,11 @@ >+--- AffinityPanel.c.orig 2018-01-17 02:53:40.133350000 +0800 >++++ AffinityPanel.c 2018-01-17 02:53:51.453663000 +0800 >+@@ -52,7 +52,7 @@ >+ int curCpu = 0; >+ for (int i = 0; i < pl->cpuCount; i++) { >+ char number[10]; >+- snprintf(number, 9, "%d", Settings_cpuId(pl->settings, i)); >++ xSnprintf(number, 9, "%d", Settings_cpuId(pl->settings, i)); >+ bool mode; >+ if (curCpu < affinity->used && affinity->cpus[curCpu] == i) { >+ mode = true; > >Property changes on: sysutils/htop/files/patch-AffinityPanel.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-AvailableColumnsPanel.c >=================================================================== >--- sysutils/htop/files/patch-AvailableColumnsPanel.c (nonexistent) >+++ sysutils/htop/files/patch-AvailableColumnsPanel.c (working copy) >@@ -0,0 +1,20 @@ >+--- AvailableColumnsPanel.c.orig 2018-01-17 02:27:39.324359000 +0800 >++++ AvailableColumnsPanel.c 2018-01-17 02:54:25.008472000 +0800 >+@@ -26,7 +26,7 @@ >+ >+ }*/ >+ >+-static const char* AvailableColumnsFunctions[] = {" ", " ", " ", " ", "Add ", " ", " ", " ", " ", "Done ", NULL}; >++static const char* const AvailableColumnsFunctions[] = {" ", " ", " ", " ", "Add ", " ", " ", " ", " ", "Done ", NULL}; >+ >+ static void AvailableColumnsPanel_delete(Object* object) { >+ Panel* super = (Panel*) object; >+@@ -81,7 +81,7 @@ >+ for (int i = 1; i < Platform_numberOfFields; i++) { >+ if (i != COMM && Process_fields[i].description) { >+ char description[256]; >+- snprintf(description, sizeof(description), "%s - %s", Process_fields[i].name, Process_fields[i].description); >++ xSnprintf(description, sizeof(description), "%s - %s", Process_fields[i].name, Process_fields[i].description); >+ Panel_add(super, (Object*) ListItem_new(description, i)); >+ } >+ } > >Property changes on: sysutils/htop/files/patch-AvailableColumnsPanel.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-AvailableMetersPanel.c >=================================================================== >--- sysutils/htop/files/patch-AvailableMetersPanel.c (nonexistent) >+++ sysutils/htop/files/patch-AvailableMetersPanel.c (working copy) >@@ -0,0 +1,11 @@ >+--- AvailableMetersPanel.c.orig 2018-01-17 02:54:40.714904000 +0800 >++++ AvailableMetersPanel.c 2018-01-17 02:54:53.533751000 +0800 >+@@ -127,7 +127,7 @@ >+ Panel_add(super, (Object*) ListItem_new("CPU average", 0)); >+ for (int i = 1; i <= cpus; i++) { >+ char buffer[50]; >+- snprintf(buffer, 50, "%s %d", type->uiName, i); >++ xSnprintf(buffer, 50, "%s %d", type->uiName, i); >+ Panel_add(super, (Object*) ListItem_new(buffer, i)); >+ } >+ } else { > >Property changes on: sysutils/htop/files/patch-AvailableMetersPanel.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-BatteryMeter.c >=================================================================== >--- sysutils/htop/files/patch-BatteryMeter.c (nonexistent) >+++ sysutils/htop/files/patch-BatteryMeter.c (working copy) >@@ -0,0 +1,26 @@ >+--- BatteryMeter.c.orig 2018-01-17 02:56:48.542038000 +0800 >++++ BatteryMeter.c 2018-01-17 02:57:28.097399000 +0800 >+@@ -40,7 +40,7 @@ >+ >+ if (percent == -1) { >+ this->values[0] = 0; >+- snprintf(buffer, len, "n/a"); >++ xSnprintf(buffer, len, "n/a"); >+ return; >+ } >+ >+@@ -58,11 +58,11 @@ >+ } >+ >+ if (isOnAC == AC_PRESENT) { >+- snprintf(buffer, len, onAcText, percent); >++ xSnprintf(buffer, len, onAcText, percent); >+ } else if (isOnAC == AC_ABSENT) { >+- snprintf(buffer, len, onBatteryText, percent); >++ xSnprintf(buffer, len, onBatteryText, percent); >+ } else { >+- snprintf(buffer, len, unknownText, percent); >++ xSnprintf(buffer, len, unknownText, percent); >+ } >+ >+ return; > >Property changes on: sysutils/htop/files/patch-BatteryMeter.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-CPUMeter.c >=================================================================== >--- sysutils/htop/files/patch-CPUMeter.c (nonexistent) >+++ sysutils/htop/files/patch-CPUMeter.c (working copy) >@@ -0,0 +1,82 @@ >+--- CPUMeter.c.orig 2016-07-22 04:12:45.000000000 +0800 >++++ CPUMeter.c 2018-01-17 03:30:33.049766000 +0800 >+@@ -48,7 +48,7 @@ >+ int cpu = this->param; >+ if (this->pl->cpuCount > 1) { >+ char caption[10]; >+- sprintf(caption, "%-3d", Settings_cpuId(this->pl->settings, cpu - 1)); >++ xSnprintf(caption, sizeof(caption), "%-3d", Settings_cpuId(this->pl->settings, cpu - 1)); >+ Meter_setCaption(this, caption); >+ } >+ if (this->param == 0) >+@@ -58,12 +58,12 @@ >+ static void CPUMeter_updateValues(Meter* this, char* buffer, int size) { >+ int cpu = this->param; >+ if (cpu > this->pl->cpuCount) { >+- snprintf(buffer, size, "absent"); >++ xSnprintf(buffer, size, "absent"); >+ return; >+ } >+ memset(this->values, 0, sizeof(double) * CPU_METER_ITEMCOUNT); >+ double percent = Platform_setCPUValues(this, cpu); >+- snprintf(buffer, size, "%5.1f%%", percent); >++ xSnprintf(buffer, size, "%5.1f%%", percent); >+ } >+ >+ static void CPUMeter_display(Object* cast, RichString* out) { >+@@ -74,44 +74,44 @@ >+ RichString_append(out, CRT_colors[METER_TEXT], "absent"); >+ return; >+ } >+- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_NORMAL]); >++ xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_NORMAL]); >+ RichString_append(out, CRT_colors[METER_TEXT], ":"); >+ RichString_append(out, CRT_colors[CPU_NORMAL], buffer); >+ if (this->pl->settings->detailedCPUTime) { >+- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_KERNEL]); >++ xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_KERNEL]); >+ RichString_append(out, CRT_colors[METER_TEXT], "sy:"); >+ RichString_append(out, CRT_colors[CPU_KERNEL], buffer); >+- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_NICE]); >++ xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_NICE]); >+ RichString_append(out, CRT_colors[METER_TEXT], "ni:"); >+ RichString_append(out, CRT_colors[CPU_NICE_TEXT], buffer); >+- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_IRQ]); >++ xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_IRQ]); >+ RichString_append(out, CRT_colors[METER_TEXT], "hi:"); >+ RichString_append(out, CRT_colors[CPU_IRQ], buffer); >+- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_SOFTIRQ]); >++ xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_SOFTIRQ]); >+ RichString_append(out, CRT_colors[METER_TEXT], "si:"); >+ RichString_append(out, CRT_colors[CPU_SOFTIRQ], buffer); >+ if (this->values[CPU_METER_STEAL]) { >+- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_STEAL]); >++ xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_STEAL]); >+ RichString_append(out, CRT_colors[METER_TEXT], "st:"); >+ RichString_append(out, CRT_colors[CPU_STEAL], buffer); >+ } >+ if (this->values[CPU_METER_GUEST]) { >+- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_GUEST]); >++ xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_GUEST]); >+ RichString_append(out, CRT_colors[METER_TEXT], "gu:"); >+ RichString_append(out, CRT_colors[CPU_GUEST], buffer); >+ } >+- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_IOWAIT]); >++ xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_IOWAIT]); >+ RichString_append(out, CRT_colors[METER_TEXT], "wa:"); >+ RichString_append(out, CRT_colors[CPU_IOWAIT], buffer); >+ } else { >+- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_KERNEL]); >++ xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_KERNEL]); >+ RichString_append(out, CRT_colors[METER_TEXT], "sys:"); >+ RichString_append(out, CRT_colors[CPU_KERNEL], buffer); >+- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_NICE]); >++ xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_NICE]); >+ RichString_append(out, CRT_colors[METER_TEXT], "low:"); >+ RichString_append(out, CRT_colors[CPU_NICE_TEXT], buffer); >+ if (this->values[CPU_METER_IRQ]) { >+- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_IRQ]); >++ xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_IRQ]); >+ RichString_append(out, CRT_colors[METER_TEXT], "vir:"); >+ RichString_append(out, CRT_colors[CPU_GUEST], buffer); >+ } > >Property changes on: sysutils/htop/files/patch-CPUMeter.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-CRT.c >=================================================================== >--- sysutils/htop/files/patch-CRT.c (nonexistent) >+++ sysutils/htop/files/patch-CRT.c (working copy) >@@ -0,0 +1,154 @@ >+--- CRT.c.orig 2018-01-17 02:18:48.395218000 +0800 >++++ CRT.c 2018-01-17 02:43:53.562847000 +0800 >+@@ -5,6 +5,7 @@ >+ in the source distribution for its full text. >+ */ >+ >++#include "config.h" >+ #include "CRT.h" >+ >+ #include "StringUtils.h" >+@@ -17,8 +18,14 @@ >+ #include <string.h> >+ #include <locale.h> >+ #include <langinfo.h> >++#if HAVE_SETUID_ENABLED >++#include <unistd.h> >++#include <sys/types.h> >++#endif >++ >++#define ColorIndex(i,j) ((7-i)*8+j) >+ >+-#define ColorPair(i,j) COLOR_PAIR((7-i)*8+j) >++#define ColorPair(i,j) COLOR_PAIR(ColorIndex(i,j)) >+ >+ #define Black COLOR_BLACK >+ #define Red COLOR_RED >+@@ -29,6 +36,8 @@ >+ #define Cyan COLOR_CYAN >+ #define White COLOR_WHITE >+ >++#define ColorPairGrayBlack ColorPair(Magenta,Magenta) >++ >+ #define KEY_WHEELUP KEY_F(20) >+ #define KEY_WHEELDOWN KEY_F(21) >+ #define KEY_RECLICK KEY_F(22) >+@@ -183,7 +192,7 @@ >+ [LED_COLOR] = ColorPair(Green,Black), >+ [TASKS_RUNNING] = A_BOLD | ColorPair(Green,Black), >+ [PROCESS] = A_NORMAL, >+- [PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Black), >++ [PROCESS_SHADOW] = A_BOLD | ColorPairGrayBlack, >+ [PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Black), >+ [PROCESS_MEGABYTES] = ColorPair(Cyan,Black), >+ [PROCESS_BASENAME] = A_BOLD | ColorPair(Cyan,Black), >+@@ -195,7 +204,7 @@ >+ [PROCESS_THREAD] = ColorPair(Green,Black), >+ [PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Green,Black), >+ [BAR_BORDER] = A_BOLD, >+- [BAR_SHADOW] = A_BOLD | ColorPair(Black,Black), >++ [BAR_SHADOW] = A_BOLD | ColorPairGrayBlack, >+ [SWAP] = ColorPair(Red,Black), >+ [GRAPH_1] = A_BOLD | ColorPair(Cyan,Black), >+ [GRAPH_2] = ColorPair(Cyan,Black), >+@@ -301,7 +310,7 @@ >+ [LED_COLOR] = ColorPair(Green,White), >+ [TASKS_RUNNING] = ColorPair(Green,White), >+ [PROCESS] = ColorPair(Black,White), >+- [PROCESS_SHADOW] = A_BOLD | ColorPair(Black,White), >++ [PROCESS_SHADOW] = A_BOLD | ColorPairGrayBlack, >+ [PROCESS_TAG] = ColorPair(White,Blue), >+ [PROCESS_MEGABYTES] = ColorPair(Blue,White), >+ [PROCESS_BASENAME] = ColorPair(Blue,White), >+@@ -541,6 +550,48 @@ >+ exit(0); >+ } >+ >++#if HAVE_SETUID_ENABLED >++ >++static int CRT_euid = -1; >++ >++static int CRT_egid = -1; >++ >++#define DIE(msg) do { CRT_done(); fprintf(stderr, msg); exit(1); } while(0) >++ >++void CRT_dropPrivileges() { >++ CRT_egid = getegid(); >++ CRT_euid = geteuid(); >++ if (setegid(getgid()) == -1) { >++ DIE("Fatal error: failed dropping group privileges.\n"); >++ } >++ if (seteuid(getuid()) == -1) { >++ DIE("Fatal error: failed dropping user privileges.\n"); >++ } >++} >++ >++void CRT_restorePrivileges() { >++ if (CRT_egid == -1 || CRT_euid == -1) { >++ DIE("Fatal error: internal inconsistency.\n"); >++ } >++ if (setegid(CRT_egid) == -1) { >++ DIE("Fatal error: failed restoring group privileges.\n"); >++ } >++ if (seteuid(CRT_euid) == -1) { >++ DIE("Fatal error: failed restoring user privileges.\n"); >++ } >++} >++ >++#else >++ >++/* Turn setuid operations into NOPs */ >++ >++#ifndef CRT_dropPrivileges >++#define CRT_dropPrivileges() >++#define CRT_restorePrivileges() >++#endif >++ >++#endif >++ >+ // TODO: pass an instance of Settings instead. >+ >+ void CRT_init(int delay, int colorScheme) { >+@@ -555,7 +606,7 @@ >+ >+ for (int i = 0; i < LAST_COLORELEMENT; i++) { >+ unsigned int color = CRT_colorSchemes[COLORSCHEME_DEFAULT][i]; >+- CRT_colorSchemes[COLORSCHEME_BROKENGRAY][i] = color == (A_BOLD | ColorPair(Black,Black)) ? ColorPair(White,Black) : color; >++ CRT_colorSchemes[COLORSCHEME_BROKENGRAY][i] = color == (A_BOLD | ColorPairGrayBlack) ? ColorPair(White,Black) : color; >+ } >+ >+ halfdelay(CRT_delay); >+@@ -575,7 +626,7 @@ >+ CRT_scrollHAmount = 20; >+ else >+ CRT_scrollHAmount = 5; >+- if (String_eq(CRT_termType, "xterm") || String_eq(CRT_termType, "xterm-color") || String_eq(CRT_termType, "vt220")) { >++ if (String_startsWith(CRT_termType, "xterm") || String_eq(CRT_termType, "vt220")) { >+ define_key("\033[H", KEY_HOME); >+ define_key("\033[F", KEY_END); >+ define_key("\033[7~", KEY_HOME); >+@@ -664,12 +715,20 @@ >+ CRT_colorScheme = colorScheme; >+ if (colorScheme == COLORSCHEME_BLACKNIGHT) { >+ for (int i = 0; i < 8; i++) >+- for (int j = 0; j < 8; j++) >+- init_pair((7-i)*8+j, i, j); >++ for (int j = 0; j < 8; j++) { >++ if (ColorIndex(i,j) != ColorIndex(Magenta,Magenta)) { >++ init_pair(ColorIndex(i,j), i, j); >++ } >++ } >++ init_pair(ColorIndex(Magenta,Magenta), 8, 0); >+ } else { >+ for (int i = 0; i < 8; i++) >+- for (int j = 0; j < 8; j++) >+- init_pair((7-i)*8+j, i, (j==0?-1:j)); >++ for (int j = 0; j < 8; j++) { >++ if (ColorIndex(i,j) != ColorIndex(Magenta,Magenta)) { >++ init_pair(ColorIndex(i,j), i, (j==0?-1:j)); >++ } >++ } >++ init_pair(ColorIndex(Magenta,Magenta), 8, -1); >+ } >+ CRT_colors = CRT_colorSchemes[colorScheme]; >+ } > >Property changes on: sysutils/htop/files/patch-CRT.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-CRT.h >=================================================================== >--- sysutils/htop/files/patch-CRT.h (nonexistent) >+++ sysutils/htop/files/patch-CRT.h (working copy) >@@ -0,0 +1,51 @@ >+--- CRT.h.orig 2018-01-17 02:23:30.145464000 +0800 >++++ CRT.h 2018-01-17 02:45:07.234215000 +0800 >+@@ -9,7 +9,12 @@ >+ in the source distribution for its full text. >+ */ >+ >+-#define ColorPair(i,j) COLOR_PAIR((7-i)*8+j) >++#if HAVE_SETUID_ENABLED >++#endif >++ >++#define ColorIndex(i,j) ((7-i)*8+j) >++ >++#define ColorPair(i,j) COLOR_PAIR(ColorIndex(i,j)) >+ >+ #define Black COLOR_BLACK >+ #define Red COLOR_RED >+@@ -20,6 +25,8 @@ >+ #define Cyan COLOR_CYAN >+ #define White COLOR_WHITE >+ >++#define ColorPairGrayBlack ColorPair(Magenta,Magenta) >++ >+ #define KEY_WHEELUP KEY_F(20) >+ #define KEY_WHEELDOWN KEY_F(21) >+ #define KEY_RECLICK KEY_F(22) >+@@ -150,6 +157,25 @@ >+ >+ void *backtraceArray[128]; >+ >++#if HAVE_SETUID_ENABLED >++ >++#define DIE(msg) do { CRT_done(); fprintf(stderr, msg); exit(1); } while(0) >++ >++void CRT_dropPrivileges(); >++ >++void CRT_restorePrivileges(); >++ >++#else >++ >++/* Turn setuid operations into NOPs */ >++ >++#ifndef CRT_dropPrivileges >++#define CRT_dropPrivileges() >++#define CRT_restorePrivileges() >++#endif >++ >++#endif >++ >+ // TODO: pass an instance of Settings instead. >+ >+ void CRT_init(int delay, int colorScheme); > >Property changes on: sysutils/htop/files/patch-CRT.h >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-CategoriesPanel.c >=================================================================== >--- sysutils/htop/files/patch-CategoriesPanel.c (nonexistent) >+++ sysutils/htop/files/patch-CategoriesPanel.c (working copy) >@@ -0,0 +1,11 @@ >+--- CategoriesPanel.c.orig 2018-01-17 02:28:08.116398000 +0800 >++++ CategoriesPanel.c 2018-01-17 02:28:31.736158000 +0800 >+@@ -34,7 +34,7 @@ >+ >+ }*/ >+ >+-static const char* CategoriesFunctions[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done ", NULL}; >++static const char* const CategoriesFunctions[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done ", NULL}; >+ >+ static void CategoriesPanel_delete(Object* object) { >+ Panel* super = (Panel*) object; > >Property changes on: sysutils/htop/files/patch-CategoriesPanel.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-ColorsPanel.c >=================================================================== >--- sysutils/htop/files/patch-ColorsPanel.c (nonexistent) >+++ sysutils/htop/files/patch-ColorsPanel.c (working copy) >@@ -0,0 +1,14 @@ >+--- ColorsPanel.c.orig 2018-01-17 02:28:47.009382000 +0800 >++++ ColorsPanel.c 2018-01-17 02:29:08.185956000 +0800 >+@@ -34,9 +34,9 @@ >+ >+ }*/ >+ >+-static const char* ColorsFunctions[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done ", NULL}; >++static const char* const ColorsFunctions[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done ", NULL}; >+ >+-static const char* ColorSchemeNames[] = { >++static const char* const ColorSchemeNames[] = { >+ "Default", >+ "Monochromatic", >+ "Black on White", > >Property changes on: sysutils/htop/files/patch-ColorsPanel.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-ColumnsPanel.c >=================================================================== >--- sysutils/htop/files/patch-ColumnsPanel.c (nonexistent) >+++ sysutils/htop/files/patch-ColumnsPanel.c (working copy) >@@ -0,0 +1,11 @@ >+--- ColumnsPanel.c.orig 2018-01-17 02:29:30.687821000 +0800 >++++ ColumnsPanel.c 2018-01-17 02:29:43.683563000 +0800 >+@@ -29,7 +29,7 @@ >+ >+ }*/ >+ >+-static const char* ColumnsFunctions[] = {" ", " ", " ", " ", " ", " ", "MoveUp", "MoveDn", "Remove", "Done ", NULL}; >++static const char* const ColumnsFunctions[] = {" ", " ", " ", " ", " ", " ", "MoveUp", "MoveDn", "Remove", "Done ", NULL}; >+ >+ static void ColumnsPanel_delete(Object* object) { >+ Panel* super = (Panel*) object; > >Property changes on: sysutils/htop/files/patch-ColumnsPanel.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-DisplayOptionsPanel.c >=================================================================== >--- sysutils/htop/files/patch-DisplayOptionsPanel.c (nonexistent) >+++ sysutils/htop/files/patch-DisplayOptionsPanel.c (working copy) >@@ -0,0 +1,11 @@ >+--- DisplayOptionsPanel.c.orig 2018-01-17 02:29:58.241502000 +0800 >++++ DisplayOptionsPanel.c 2018-01-17 02:30:12.751443000 +0800 >+@@ -28,7 +28,7 @@ >+ >+ }*/ >+ >+-static const char* DisplayOptionsFunctions[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done ", NULL}; >++static const char* const DisplayOptionsFunctions[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done ", NULL}; >+ >+ static void DisplayOptionsPanel_delete(Object* object) { >+ Panel* super = (Panel*) object; > >Property changes on: sysutils/htop/files/patch-DisplayOptionsPanel.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-EnvScreen.c >=================================================================== >--- sysutils/htop/files/patch-EnvScreen.c (nonexistent) >+++ sysutils/htop/files/patch-EnvScreen.c (working copy) >@@ -0,0 +1,16 @@ >+--- EnvScreen.c.orig 2018-01-17 02:45:20.824325000 +0800 >++++ EnvScreen.c 2018-01-17 02:45:44.349693000 +0800 >+@@ -48,10 +48,9 @@ >+ >+ Panel_prune(panel); >+ >+- uid_t euid = geteuid(); >+- (void) seteuid(getuid()); >+- char *env = Platform_getProcessEnv(this->process->pid); >+- (void) seteuid(euid); >++ CRT_dropPrivileges(); >++ char* env = Platform_getProcessEnv(this->process->pid); >++ CRT_restorePrivileges(); >+ if (env) { >+ for (char *p = env; *p; p = strrchr(p, 0)+1) >+ InfoScreen_addLine(this, p); > >Property changes on: sysutils/htop/files/patch-EnvScreen.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-FunctionBar.c >=================================================================== >--- sysutils/htop/files/patch-FunctionBar.c (nonexistent) >+++ sysutils/htop/files/patch-FunctionBar.c (working copy) >@@ -0,0 +1,29 @@ >+--- FunctionBar.c.orig 2018-01-17 02:30:28.427114000 +0800 >++++ FunctionBar.c 2018-01-17 02:31:19.521679000 +0800 >+@@ -28,21 +28,21 @@ >+ >+ }*/ >+ >+-static const char* FunctionBar_FKeys[] = {"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", NULL}; >++static const char* const FunctionBar_FKeys[] = {"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", NULL}; >+ >+-static const char* FunctionBar_FLabels[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", NULL}; >++static const char* const FunctionBar_FLabels[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", NULL}; >+ >+ static int FunctionBar_FEvents[] = {KEY_F(1), KEY_F(2), KEY_F(3), KEY_F(4), KEY_F(5), KEY_F(6), KEY_F(7), KEY_F(8), KEY_F(9), KEY_F(10)}; >+ >+-static const char* FunctionBar_EnterEscKeys[] = {"Enter", "Esc", NULL}; >+-static int FunctionBar_EnterEscEvents[] = {13, 27}; >++static const char* const FunctionBar_EnterEscKeys[] = {"Enter", "Esc", NULL}; >++static const int FunctionBar_EnterEscEvents[] = {13, 27}; >+ >+ FunctionBar* FunctionBar_newEnterEsc(const char* enter, const char* esc) { >+ const char* functions[] = {enter, esc, NULL}; >+ return FunctionBar_new(functions, FunctionBar_EnterEscKeys, FunctionBar_EnterEscEvents); >+ } >+ >+-FunctionBar* FunctionBar_new(const char** functions, const char** keys, int* events) { >++FunctionBar* FunctionBar_new(const char* const* functions, const char* const* keys, const int* events) { >+ FunctionBar* this = xCalloc(1, sizeof(FunctionBar)); >+ this->functions = xCalloc(16, sizeof(char*)); >+ if (!functions) { > >Property changes on: sysutils/htop/files/patch-FunctionBar.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-FunctionBar.h >=================================================================== >--- sysutils/htop/files/patch-FunctionBar.h (nonexistent) >+++ sysutils/htop/files/patch-FunctionBar.h (working copy) >@@ -0,0 +1,11 @@ >+--- FunctionBar.h.orig 2018-01-17 02:31:36.029675000 +0800 >++++ FunctionBar.h 2018-01-17 02:31:48.125791000 +0800 >+@@ -24,7 +24,7 @@ >+ >+ FunctionBar* FunctionBar_newEnterEsc(const char* enter, const char* esc); >+ >+-FunctionBar* FunctionBar_new(const char** functions, const char** keys, int* events); >++FunctionBar* FunctionBar_new(const char* const* functions, const char* const* keys, const int* events); >+ >+ void FunctionBar_delete(FunctionBar* this); >+ > >Property changes on: sysutils/htop/files/patch-FunctionBar.h >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-Header.c >=================================================================== >--- sysutils/htop/files/patch-Header.c (nonexistent) >+++ sysutils/htop/files/patch-Header.c (working copy) >@@ -0,0 +1,23 @@ >+--- Header.c.orig 2018-01-17 02:59:49.751817000 +0800 >++++ Header.c 2018-01-17 03:00:08.421250000 +0800 >+@@ -91,9 +91,9 @@ >+ Meter* meter = (Meter*) Vector_get(vec, i); >+ char* name = xCalloc(64, sizeof(char)); >+ if (meter->param) { >+- snprintf(name, 63, "%s(%d)", As_Meter(meter)->name, meter->param); >++ xSnprintf(name, 63, "%s(%d)", As_Meter(meter)->name, meter->param); >+ } else { >+- snprintf(name, 63, "%s", As_Meter(meter)->name); >++ xSnprintf(name, 63, "%s", As_Meter(meter)->name); >+ } >+ colSettings->names[i] = name; >+ colSettings->modes[i] = meter->mode; >+@@ -155,7 +155,7 @@ >+ strncpy(name, Meter_name(meter), nameLen); >+ name[nameLen] = '\0'; >+ if (meter->param) >+- snprintf(name + nameLen, len - nameLen, "(%d)", meter->param); >++ xSnprintf(name + nameLen, len - nameLen, "(%d)", meter->param); >+ >+ return name; >+ } > >Property changes on: sysutils/htop/files/patch-Header.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-IncSet.c >=================================================================== >--- sysutils/htop/files/patch-IncSet.c (nonexistent) >+++ sysutils/htop/files/patch-IncSet.c (working copy) >@@ -0,0 +1,24 @@ >+--- IncSet.c.orig 2018-01-17 02:32:09.268551000 +0800 >++++ IncSet.c 2018-01-17 02:32:49.080123000 +0800 >+@@ -52,8 +52,8 @@ >+ mode->buffer[0] = 0; >+ } >+ >+-static const char* searchFunctions[] = {"Next ", "Cancel ", " Search: ", NULL}; >+-static const char* searchKeys[] = {"F3", "Esc", " "}; >++static const char* const searchFunctions[] = {"Next ", "Cancel ", " Search: ", NULL}; >++static const char* const searchKeys[] = {"F3", "Esc", " "}; >+ static int searchEvents[] = {KEY_F(3), 27, ERR}; >+ >+ static inline void IncMode_initSearch(IncMode* search) { >+@@ -62,8 +62,8 @@ >+ search->isFilter = false; >+ } >+ >+-static const char* filterFunctions[] = {"Done ", "Clear ", " Filter: ", NULL}; >+-static const char* filterKeys[] = {"Enter", "Esc", " "}; >++static const char* const filterFunctions[] = {"Done ", "Clear ", " Filter: ", NULL}; >++static const char* const filterKeys[] = {"Enter", "Esc", " "}; >+ static int filterEvents[] = {13, 27, ERR}; >+ >+ static inline void IncMode_initFilter(IncMode* filter) { > >Property changes on: sysutils/htop/files/patch-IncSet.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-InfoScreen.c >=================================================================== >--- sysutils/htop/files/patch-InfoScreen.c (nonexistent) >+++ sysutils/htop/files/patch-InfoScreen.c (working copy) >@@ -0,0 +1,14 @@ >+--- InfoScreen.c.orig 2018-01-17 02:33:04.195280000 +0800 >++++ InfoScreen.c 2018-01-17 02:33:21.833122000 +0800 >+@@ -50,9 +50,9 @@ >+ }; >+ }*/ >+ >+-static const char* InfoScreenFunctions[] = {"Search ", "Filter ", "Refresh", "Done ", NULL}; >++static const char* const InfoScreenFunctions[] = {"Search ", "Filter ", "Refresh", "Done ", NULL}; >+ >+-static const char* InfoScreenKeys[] = {"F3", "F4", "F5", "Esc"}; >++static const char* const InfoScreenKeys[] = {"F3", "F4", "F5", "Esc"}; >+ >+ static int InfoScreenEvents[] = {KEY_F(3), KEY_F(4), KEY_F(5), 27}; >+ > >Property changes on: sysutils/htop/files/patch-InfoScreen.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-ListItem.c >=================================================================== >--- sysutils/htop/files/patch-ListItem.c (nonexistent) >+++ sysutils/htop/files/patch-ListItem.c (working copy) >@@ -0,0 +1,11 @@ >+--- ListItem.c.orig 2018-01-17 03:00:25.275893000 +0800 >++++ ListItem.c 2018-01-17 03:00:36.630201000 +0800 >+@@ -39,7 +39,7 @@ >+ /* >+ int len = strlen(this->value)+1; >+ char buffer[len+1]; >+- snprintf(buffer, len, "%s", this->value); >++ xSnprintf(buffer, len, "%s", this->value); >+ */ >+ if (this->moving) { >+ RichString_write(out, CRT_colors[DEFAULT_COLOR], > >Property changes on: sysutils/htop/files/patch-ListItem.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-LoadAverageMeter.c >=================================================================== >--- sysutils/htop/files/patch-LoadAverageMeter.c (nonexistent) >+++ sysutils/htop/files/patch-LoadAverageMeter.c (working copy) >@@ -0,0 +1,40 @@ >+--- LoadAverageMeter.c.orig 2018-01-17 02:05:11.807928000 +0800 >++++ LoadAverageMeter.c 2018-01-17 03:01:05.674938000 +0800 >+@@ -22,17 +22,17 @@ >+ >+ static void LoadAverageMeter_updateValues(Meter* this, char* buffer, int size) { >+ Platform_getLoadAverage(&this->values[0], &this->values[1], &this->values[2]); >+- snprintf(buffer, size, "%.2f/%.2f/%.2f", this->values[0], this->values[1], this->values[2]); >++ xSnprintf(buffer, size, "%.2f/%.2f/%.2f", this->values[0], this->values[1], this->values[2]); >+ } >+ >+ static void LoadAverageMeter_display(Object* cast, RichString* out) { >+ Meter* this = (Meter*)cast; >+ char buffer[20]; >+- sprintf(buffer, "%.2f ", this->values[0]); >++ xSnprintf(buffer, sizeof(buffer), "%.2f ", this->values[0]); >+ RichString_write(out, CRT_colors[LOAD_AVERAGE_ONE], buffer); >+- sprintf(buffer, "%.2f ", this->values[1]); >++ xSnprintf(buffer, sizeof(buffer), "%.2f ", this->values[1]); >+ RichString_append(out, CRT_colors[LOAD_AVERAGE_FIVE], buffer); >+- sprintf(buffer, "%.2f ", this->values[2]); >++ xSnprintf(buffer, sizeof(buffer), "%.2f ", this->values[2]); >+ RichString_append(out, CRT_colors[LOAD_AVERAGE_FIFTEEN], buffer); >+ } >+ >+@@ -42,13 +42,13 @@ >+ if (this->values[0] > this->total) { >+ this->total = this->values[0]; >+ } >+- snprintf(buffer, size, "%.2f", this->values[0]); >++ xSnprintf(buffer, size, "%.2f", this->values[0]); >+ } >+ >+ static void LoadMeter_display(Object* cast, RichString* out) { >+ Meter* this = (Meter*)cast; >+ char buffer[20]; >+- sprintf(buffer, "%.2f ", ((Meter*)this)->values[0]); >++ xSnprintf(buffer, sizeof(buffer), "%.2f ", ((Meter*)this)->values[0]); >+ RichString_write(out, CRT_colors[LOAD], buffer); >+ } >+ > >Property changes on: sysutils/htop/files/patch-LoadAverageMeter.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-MainPanel.c >=================================================================== >--- sysutils/htop/files/patch-MainPanel.c (nonexistent) >+++ sysutils/htop/files/patch-MainPanel.c (working copy) >@@ -0,0 +1,30 @@ >+--- MainPanel.c.orig 2018-01-17 01:45:07.719577000 +0800 >++++ MainPanel.c 2018-01-17 02:34:00.711369000 +0800 >+@@ -31,7 +31,7 @@ >+ >+ }*/ >+ >+-static const char* MainFunctions[] = {"Help ", "Setup ", "Search", "Filter", "Tree ", "SortBy", "Nice -", "Nice +", "Kill ", "Quit ", NULL}; >++static const char* const MainFunctions[] = {"Help ", "Setup ", "Search", "Filter", "Tree ", "SortBy", "Nice -", "Nice +", "Kill ", "Quit ", NULL}; >+ >+ void MainPanel_updateTreeFunctions(MainPanel* this, bool mode) { >+ FunctionBar* bar = MainPanel_getFunctionBar(this); >+@@ -83,14 +83,14 @@ >+ result = HANDLED; >+ } else if (ch != ERR && this->inc->active) { >+ bool filterChanged = IncSet_handleKey(this->inc, ch, super, (IncMode_GetPanelValue) MainPanel_getValue, NULL); >+- if (this->inc->found) { >+- reaction |= Action_follow(this->state); >+- } >+ if (filterChanged) { >+ this->state->pl->incFilter = IncSet_filter(this->inc); >+ reaction = HTOP_REFRESH | HTOP_REDRAW_BAR; >+ } >+- reaction |= HTOP_KEEP_FOLLOWING; >++ if (this->inc->found) { >++ reaction |= Action_follow(this->state); >++ reaction |= HTOP_KEEP_FOLLOWING; >++ } >+ result = HANDLED; >+ } else if (ch == 27) { >+ return HANDLED; > >Property changes on: sysutils/htop/files/patch-MainPanel.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-Meter.c >=================================================================== >--- sysutils/htop/files/patch-Meter.c (nonexistent) >+++ sysutils/htop/files/patch-Meter.c (working copy) >@@ -0,0 +1,103 @@ >+--- Meter.c.orig 2018-01-17 01:44:17.289511000 +0800 >++++ Meter.c 2018-01-17 03:01:47.930033000 +0800 >+@@ -225,16 +225,16 @@ >+ ListItem* Meter_toListItem(Meter* this, bool moving) { >+ char mode[21]; >+ if (this->mode) >+- snprintf(mode, 20, " [%s]", Meter_modes[this->mode]->uiName); >++ xSnprintf(mode, 20, " [%s]", Meter_modes[this->mode]->uiName); >+ else >+ mode[0] = '\0'; >+ char number[11]; >+ if (this->param > 0) >+- snprintf(number, 10, " %d", this->param); >++ xSnprintf(number, 10, " %d", this->param); >+ else >+ number[0] = '\0'; >+ char buffer[51]; >+- snprintf(buffer, 50, "%s%s%s", Meter_uiName(this), number, mode); >++ xSnprintf(buffer, 50, "%s%s%s", Meter_uiName(this), number, mode); >+ ListItem* li = ListItem_new(buffer, 0); >+ li->moving = moving; >+ return li; >+@@ -260,7 +260,7 @@ >+ >+ /* ---------- BarMeterMode ---------- */ >+ >+-static char BarMeterMode_characters[] = "|#*@$%&."; >++static const char BarMeterMode_characters[] = "|#*@$%&."; >+ >+ static void BarMeterMode_draw(Meter* this, int x, int y, int w) { >+ char buffer[METER_BUFFER_LEN]; >+@@ -287,7 +287,7 @@ >+ >+ int blockSizes[10]; >+ >+- snprintf(bar, w + 1, "%*s", w, buffer); >++ xSnprintf(bar, w + 1, "%*s", w, buffer); >+ >+ // First draw in the bar[] buffer... >+ int offset = 0; >+@@ -336,7 +336,7 @@ >+ #ifdef HAVE_LIBNCURSESW >+ >+ #define PIXPERROW_UTF8 4 >+-static const char* GraphMeterMode_dotsUtf8[] = { >++static const char* const GraphMeterMode_dotsUtf8[] = { >+ /*00*/" ", /*01*/"â¢", /*02*/"⢠", /*03*/"⢰", /*04*/ "⢸", >+ /*10*/"â¡", /*11*/"â£", /*12*/"⣠", /*13*/"⣰", /*14*/ "⣸", >+ /*20*/"â¡", /*21*/"â£", /*22*/"⣤", /*23*/"⣴", /*24*/ "⣼", >+@@ -347,13 +347,13 @@ >+ #endif >+ >+ #define PIXPERROW_ASCII 2 >+-static const char* GraphMeterMode_dotsAscii[] = { >++static const char* const GraphMeterMode_dotsAscii[] = { >+ /*00*/" ", /*01*/".", /*02*/":", >+ /*10*/".", /*11*/".", /*12*/":", >+ /*20*/":", /*21*/":", /*22*/":" >+ }; >+ >+-static const char** GraphMeterMode_dots; >++static const char* const* GraphMeterMode_dots; >+ static int GraphMeterMode_pixPerRow; >+ >+ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) { >+@@ -406,8 +406,8 @@ >+ } >+ for (; i < nValues; i+=2, k++) { >+ int pix = GraphMeterMode_pixPerRow * GRAPH_HEIGHT; >+- int v1 = CLAMP(data->values[i] * pix, 1, pix); >+- int v2 = CLAMP(data->values[i+1] * pix, 1, pix); >++ int v1 = CLAMP((int) lround(data->values[i] * pix), 1, pix); >++ int v2 = CLAMP((int) lround(data->values[i+1] * pix), 1, pix); >+ >+ int colorIdx = GRAPH_1; >+ for (int line = 0; line < GRAPH_HEIGHT; line++) { >+@@ -424,7 +424,7 @@ >+ >+ /* ---------- LEDMeterMode ---------- */ >+ >+-static const char* LEDMeterMode_digitsAscii[] = { >++static const char* const LEDMeterMode_digitsAscii[] = { >+ " __ "," "," __ "," __ "," "," __ "," __ "," __ "," __ "," __ ", >+ "| |"," |"," __|"," __|","|__|","|__ ","|__ "," |","|__|","|__|", >+ "|__|"," |","|__ "," __|"," |"," __|","|__|"," |","|__|"," __|" >+@@ -432,7 +432,7 @@ >+ >+ #ifdef HAVE_LIBNCURSESW >+ >+-static const char* LEDMeterMode_digitsUtf8[] = { >++static const char* const LEDMeterMode_digitsUtf8[] = { >+ "ââââ"," â ","â¶âââ","â¶âââ","â· â·","ââââ´","ââââ´","â¶âââ","ââââ","ââââ", >+ "â â"," â ","ââââ"," âââ¤","ââââ¤","ââââ","ââââ"," â","ââââ¤","ââââ¤", >+ "ââââ"," âµ ","ââââ´","â¶âââ"," âµ","â¶âââ","ââââ"," âµ","ââââ"," âââ" >+@@ -440,7 +440,7 @@ >+ >+ #endif >+ >+-static const char** LEDMeterMode_digits; >++static const char* const* LEDMeterMode_digits; >+ >+ static void LEDMeterMode_drawDigit(int x, int y, int n) { >+ for (int i = 0; i < 3; i++) > >Property changes on: sysutils/htop/files/patch-Meter.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-MetersPanel.c >=================================================================== >--- sysutils/htop/files/patch-MetersPanel.c (nonexistent) >+++ sysutils/htop/files/patch-MetersPanel.c (working copy) >@@ -0,0 +1,29 @@ >+--- MetersPanel.c.orig 2018-01-17 02:16:54.622267000 +0800 >++++ MetersPanel.c 2018-01-17 02:36:57.554597000 +0800 >+@@ -31,13 +31,19 @@ >+ >+ }*/ >+ >+-static const char* MetersFunctions[] = {"Type ", "Move ", "Delete", "Done ", NULL}; >+-static const char* MetersKeys[] = {"Space", "Enter", "Del", "Esc"}; >+-static int MetersEvents[] = {' ', 13, KEY_DC, 27}; >+- >+-static const char* MetersMovingFunctions[] = {"Up ", "Down ", "Left ", "Right ", "Confirm", "Delete", "Done ", NULL}; >+-static const char* MetersMovingKeys[] = {"Up", "Dn", "Lt", "Rt", "Enter", "Del", "Esc"}; >+-static int MetersMovingEvents[] = {KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, 13, KEY_DC, 27}; >++// Note: In code the meters are known to have bar/text/graph "Modes", but in UI >++// we call them "Styles". >++static const char* const MetersFunctions[] = {"Style ", "Move ", " ", "Delete", "Done ", NULL}; >++static const char* const MetersKeys[] = {"Space", "Enter", " ", "Del", "F10"}; >++static int MetersEvents[] = {' ', 13, ERR, KEY_DC, KEY_F(10)}; >++ >++// We avoid UTF-8 arrows â â here as they might display full-width on Chinese >++// terminals, breaking our aligning. >++// In <http://unicode.org/reports/tr11/>, arrows (U+2019..U+2199) are >++// considered "Ambiguous characters". >++static const char* const MetersMovingFunctions[] = {"Style ", "Lock ", "Up ", "Down ", "Left ", "Right ", " ", "Delete", "Done ", NULL}; >++static const char* const MetersMovingKeys[] = {"Space", "Enter", "Up", "Dn", "<-", "->", " ", "Del", "F10"}; >++static int MetersMovingEvents[] = {' ', 13, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, ERR, KEY_DC, KEY_F(10)}; >+ static FunctionBar* Meters_movingBar = NULL; >+ >+ static void MetersPanel_delete(Object* object) { > >Property changes on: sysutils/htop/files/patch-MetersPanel.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-MetersPanel.h >=================================================================== >--- sysutils/htop/files/patch-MetersPanel.h (nonexistent) >+++ sysutils/htop/files/patch-MetersPanel.h (working copy) >@@ -0,0 +1,16 @@ >+--- MetersPanel.h.orig 2018-01-17 02:17:50.701053000 +0800 >++++ MetersPanel.h 2018-01-17 02:18:20.683585000 +0800 >+@@ -26,7 +26,12 @@ >+ bool moving; >+ }; >+ >+- >++// Note: In code the meters are known to have bar/text/graph "Modes", but in UI >++// we call them "Styles". >++// We avoid UTF-8 arrows â â here as they might display full-width on Chinese >++// terminals, breaking our aligning. >++// In <http://unicode.org/reports/tr11/>, arrows (U+2019..U+2199) are >++// considered "Ambiguous characters". >+ >+ void MetersPanel_setMoving(MetersPanel* this, bool moving); >+ > >Property changes on: sysutils/htop/files/patch-MetersPanel.h >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-OpenFilesScreen.c >=================================================================== >--- sysutils/htop/files/patch-OpenFilesScreen.c (nonexistent) >+++ sysutils/htop/files/patch-OpenFilesScreen.c (working copy) >@@ -0,0 +1,28 @@ >+--- OpenFilesScreen.c.orig 2018-01-17 01:59:26.253093000 +0800 >++++ OpenFilesScreen.c 2018-01-17 03:02:15.808338000 +0800 >+@@ -77,7 +77,7 @@ >+ >+ static OpenFiles_ProcessData* OpenFilesScreen_getProcessData(pid_t pid) { >+ char command[1025]; >+- snprintf(command, 1024, "lsof -P -p %d -F 2> /dev/null", pid); >++ xSnprintf(command, 1024, "lsof -P -p %d -F 2> /dev/null", pid); >+ FILE* fd = popen(command, "r"); >+ OpenFiles_ProcessData* pdata = xCalloc(1, sizeof(OpenFiles_ProcessData)); >+ OpenFiles_FileData* fdata = NULL; >+@@ -102,7 +102,6 @@ >+ fdata = nextFile; >+ item = &(fdata->data); >+ } >+- assert(cmd >= 0 && cmd <= 0xff); >+ item->data[cmd] = xStrdup(line + 1); >+ free(line); >+ } >+@@ -132,7 +131,7 @@ >+ int lenN = data['n'] ? strlen(data['n']) : 0; >+ int sizeEntry = 5 + 7 + 10 + 10 + 10 + lenN + 5 /*spaces*/ + 1 /*null*/; >+ char* entry = xMalloc(sizeEntry); >+- snprintf(entry, sizeEntry, "%5.5s %7.7s %10.10s %10.10s %10.10s %s", >++ xSnprintf(entry, sizeEntry, "%5.5s %7.7s %10.10s %10.10s %10.10s %s", >+ data['f'] ? data['f'] : "", >+ data['t'] ? data['t'] : "", >+ data['D'] ? data['D'] : "", > >Property changes on: sysutils/htop/files/patch-OpenFilesScreen.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-Panel.c >=================================================================== >--- sysutils/htop/files/patch-Panel.c (nonexistent) >+++ sysutils/htop/files/patch-Panel.c (working copy) >@@ -0,0 +1,18 @@ >+--- Panel.c.orig 2018-01-17 01:46:17.219692000 +0800 >++++ Panel.c 2018-01-17 01:46:55.968163000 +0800 >+@@ -407,12 +407,13 @@ >+ break; >+ case KEY_PPAGE: >+ this->selected -= (this->h - 1); >+- this->scrollV -= (this->h - 1); >++ this->scrollV = MAX(0, this->scrollV - this->h + 1); >+ this->needsRedraw = true; >+ break; >+ case KEY_NPAGE: >+ this->selected += (this->h - 1); >+- this->scrollV = MIN(MAX(0, Vector_size(this->items) - this->h), this->selected - this->h); >++ this->scrollV = MAX(0, MIN(Vector_size(this->items) - this->h, >++ this->scrollV + this->h - 1)); >+ this->needsRedraw = true; >+ break; >+ case KEY_WHEELUP: > >Property changes on: sysutils/htop/files/patch-Panel.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-Process.c >=================================================================== >--- sysutils/htop/files/patch-Process.c (nonexistent) >+++ sysutils/htop/files/patch-Process.c (working copy) >@@ -0,0 +1,207 @@ >+--- Process.c.orig 2018-01-17 01:54:30.580537000 +0800 >++++ Process.c 2018-01-17 03:18:28.502348000 +0800 >+@@ -18,6 +18,7 @@ >+ #include <sys/resource.h> >+ #include <sys/param.h> >+ #include <sys/stat.h> >++#include <sys/types.h> >+ #include <unistd.h> >+ #include <stdlib.h> >+ #include <signal.h> >+@@ -171,6 +172,7 @@ >+ >+ #define As_Process(this_) ((ProcessClass*)((this_)->super.klass)) >+ >++#define Process_isChildOf(process_, pid_) (process_->tgid == pid_ || (process_->tgid == process_->pid && process_->ppid == pid_)) >+ }*/ >+ >+ static int Process_getuid = -1; >+@@ -194,10 +196,10 @@ >+ assert(digits < 20); >+ for (int i = 0; Process_pidColumns[i].label; i++) { >+ assert(i < 20); >+- snprintf(Process_titleBuffer[i], 20, "%*s ", digits, Process_pidColumns[i].label); >++ xSnprintf(Process_titleBuffer[i], 20, "%*s ", digits, Process_pidColumns[i].label); >+ Process_fields[Process_pidColumns[i].id].title = Process_titleBuffer[i]; >+ } >+- sprintf(Process_pidFormat, "%%%dd ", digits); >++ xSnprintf(Process_pidFormat, sizeof(Process_pidFormat), "%%%dd ", digits); >+ } >+ >+ void Process_humanNumber(RichString* str, unsigned long number, bool coloring) { >+@@ -261,13 +263,16 @@ >+ processShadowColor = CRT_colors[PROCESS]; >+ } >+ >+- if (number > 10000000000) { >+- snprintf(buffer, 13, "%11lld ", number / 1000); >++ if ((long long) number == -1LL) { >++ int len = snprintf(buffer, 13, " no perm "); >++ RichString_appendn(str, CRT_colors[PROCESS_SHADOW], buffer, len); >++ } else if (number > 10000000000) { >++ xSnprintf(buffer, 13, "%11lld ", number / 1000); >+ RichString_appendn(str, largeNumberColor, buffer, 5); >+ RichString_appendn(str, processMegabytesColor, buffer+5, 3); >+ RichString_appendn(str, processColor, buffer+8, 4); >+ } else { >+- snprintf(buffer, 13, "%11llu ", number); >++ xSnprintf(buffer, 13, "%11llu ", number); >+ RichString_appendn(str, largeNumberColor, buffer, 2); >+ RichString_appendn(str, processMegabytesColor, buffer+2, 3); >+ RichString_appendn(str, processColor, buffer+5, 3); >+@@ -284,15 +289,15 @@ >+ int hundredths = totalHundredths - (totalSeconds * 100); >+ char buffer[11]; >+ if (hours >= 100) { >+- snprintf(buffer, 10, "%7lluh ", hours); >++ xSnprintf(buffer, 10, "%7lluh ", hours); >+ RichString_append(str, CRT_colors[LARGE_NUMBER], buffer); >+ } else { >+ if (hours) { >+- snprintf(buffer, 10, "%2lluh", hours); >++ xSnprintf(buffer, 10, "%2lluh", hours); >+ RichString_append(str, CRT_colors[LARGE_NUMBER], buffer); >+- snprintf(buffer, 10, "%02d:%02d ", minutes, seconds); >++ xSnprintf(buffer, 10, "%02d:%02d ", minutes, seconds); >+ } else { >+- snprintf(buffer, 10, "%2d:%02d.%02d ", minutes, seconds, hundredths); >++ xSnprintf(buffer, 10, "%2d:%02d.%02d ", minutes, seconds, hundredths); >+ } >+ RichString_append(str, CRT_colors[DEFAULT_COLOR], buffer); >+ } >+@@ -364,19 +369,19 @@ >+ switch (field) { >+ case PERCENT_CPU: { >+ if (this->percent_cpu > 999.9) { >+- snprintf(buffer, n, "%4d ", (unsigned int)this->percent_cpu); >++ xSnprintf(buffer, n, "%4d ", (unsigned int)this->percent_cpu); >+ } else if (this->percent_cpu > 99.9) { >+- snprintf(buffer, n, "%3d. ", (unsigned int)this->percent_cpu); >++ xSnprintf(buffer, n, "%3d. ", (unsigned int)this->percent_cpu); >+ } else { >+- snprintf(buffer, n, "%4.1f ", this->percent_cpu); >++ xSnprintf(buffer, n, "%4.1f ", this->percent_cpu); >+ } >+ break; >+ } >+ case PERCENT_MEM: { >+ if (this->percent_mem > 99.9) { >+- snprintf(buffer, n, "100. "); >++ xSnprintf(buffer, n, "100. "); >+ } else { >+- snprintf(buffer, n, "%4.1f ", this->percent_mem); >++ xSnprintf(buffer, n, "%4.1f ", this->percent_mem); >+ } >+ break; >+ } >+@@ -407,7 +412,7 @@ >+ n -= written; >+ } >+ const char* draw = CRT_treeStr[lastItem ? (this->settings->direction == 1 ? TREE_STR_BEND : TREE_STR_TEND) : TREE_STR_RTEE]; >+- snprintf(buf, n, "%s%s ", draw, this->showChildren ? CRT_treeStr[TREE_STR_SHUT] : CRT_treeStr[TREE_STR_OPEN] ); >++ xSnprintf(buf, n, "%s%s ", draw, this->showChildren ? CRT_treeStr[TREE_STR_SHUT] : CRT_treeStr[TREE_STR_OPEN] ); >+ RichString_append(str, CRT_colors[PROCESS_TREE], buffer); >+ Process_writeCommand(this, attr, baseattr, str); >+ return; >+@@ -418,28 +423,28 @@ >+ case M_RESIDENT: Process_humanNumber(str, this->m_resident * PAGE_SIZE_KB, coloring); return; >+ case M_SIZE: Process_humanNumber(str, this->m_size * PAGE_SIZE_KB, coloring); return; >+ case NICE: { >+- snprintf(buffer, n, "%3ld ", this->nice); >++ xSnprintf(buffer, n, "%3ld ", this->nice); >+ attr = this->nice < 0 ? CRT_colors[PROCESS_HIGH_PRIORITY] >+ : this->nice > 0 ? CRT_colors[PROCESS_LOW_PRIORITY] >+ : attr; >+ break; >+ } >+- case NLWP: snprintf(buffer, n, "%4ld ", this->nlwp); break; >+- case PGRP: snprintf(buffer, n, Process_pidFormat, this->pgrp); break; >+- case PID: snprintf(buffer, n, Process_pidFormat, this->pid); break; >+- case PPID: snprintf(buffer, n, Process_pidFormat, this->ppid); break; >++ case NLWP: xSnprintf(buffer, n, "%4ld ", this->nlwp); break; >++ case PGRP: xSnprintf(buffer, n, Process_pidFormat, this->pgrp); break; >++ case PID: xSnprintf(buffer, n, Process_pidFormat, this->pid); break; >++ case PPID: xSnprintf(buffer, n, Process_pidFormat, this->ppid); break; >+ case PRIORITY: { >+- if(this->priority == -100) >+- snprintf(buffer, n, " RT "); >++ if(this->priority <= -100) >++ xSnprintf(buffer, n, " RT "); >+ else >+- snprintf(buffer, n, "%3ld ", this->priority); >++ xSnprintf(buffer, n, "%3ld ", this->priority); >+ break; >+ } >+- case PROCESSOR: snprintf(buffer, n, "%3d ", Settings_cpuId(this->settings, this->processor)); break; >+- case SESSION: snprintf(buffer, n, Process_pidFormat, this->session); break; >+- case STARTTIME: snprintf(buffer, n, "%s", this->starttime_show); break; >++ case PROCESSOR: xSnprintf(buffer, n, "%3d ", Settings_cpuId(this->settings, this->processor)); break; >++ case SESSION: xSnprintf(buffer, n, Process_pidFormat, this->session); break; >++ case STARTTIME: xSnprintf(buffer, n, "%s", this->starttime_show); break; >+ case STATE: { >+- snprintf(buffer, n, "%c ", this->state); >++ xSnprintf(buffer, n, "%c ", this->state); >+ switch(this->state) { >+ case 'R': >+ attr = CRT_colors[PROCESS_R_STATE]; >+@@ -450,18 +455,18 @@ >+ } >+ break; >+ } >+- case ST_UID: snprintf(buffer, n, "%4d ", this->st_uid); break; >++ case ST_UID: xSnprintf(buffer, n, "%4d ", this->st_uid); break; >+ case TIME: Process_printTime(str, this->time); return; >+- case TGID: snprintf(buffer, n, Process_pidFormat, this->tgid); break; >+- case TPGID: snprintf(buffer, n, Process_pidFormat, this->tpgid); break; >+- case TTY_NR: snprintf(buffer, n, "%5u ", this->tty_nr); break; >++ case TGID: xSnprintf(buffer, n, Process_pidFormat, this->tgid); break; >++ case TPGID: xSnprintf(buffer, n, Process_pidFormat, this->tpgid); break; >++ case TTY_NR: xSnprintf(buffer, n, "%3u:%3u ", major(this->tty_nr), minor(this->tty_nr)); break; >+ case USER: { >+ if (Process_getuid != (int) this->st_uid) >+ attr = CRT_colors[PROCESS_SHADOW]; >+ if (this->user) { >+- snprintf(buffer, n, "%-9s ", this->user); >++ xSnprintf(buffer, n, "%-9s ", this->user); >+ } else { >+- snprintf(buffer, n, "%-9d ", this->st_uid); >++ xSnprintf(buffer, n, "%-9d ", this->st_uid); >+ } >+ if (buffer[9] != '\0') { >+ buffer[9] = ' '; >+@@ -470,7 +475,7 @@ >+ break; >+ } >+ default: >+- snprintf(buffer, n, "- "); >++ xSnprintf(buffer, n, "- "); >+ } >+ RichString_append(str, attr, buffer); >+ } >+@@ -518,11 +523,10 @@ >+ } >+ >+ bool Process_setPriority(Process* this, int priority) { >+- uid_t euid = geteuid(); >+- (void) seteuid(getuid()); >++ CRT_dropPrivileges(); >+ int old_prio = getpriority(PRIO_PROCESS, this->pid); >+ int err = setpriority(PRIO_PROCESS, this->pid, priority); >+- (void) seteuid(euid); >++ CRT_restorePrivileges(); >+ if (err == 0 && old_prio != getpriority(PRIO_PROCESS, this->pid)) { >+ this->nice = priority; >+ } >+@@ -534,10 +538,9 @@ >+ } >+ >+ void Process_sendSignal(Process* this, size_t sgn) { >+- uid_t euid = geteuid(); >+- (void) seteuid(getuid()); >++ CRT_dropPrivileges(); >+ kill(this->pid, (int) sgn); >+- (void) seteuid(euid); >++ CRT_restorePrivileges(); >+ } >+ >+ long Process_pidCompare(const void* v1, const void* v2) { > >Property changes on: sysutils/htop/files/patch-Process.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-Process.h >=================================================================== >--- sysutils/htop/files/patch-Process.h (nonexistent) >+++ sysutils/htop/files/patch-Process.h (working copy) >@@ -0,0 +1,10 @@ >+--- Process.h.orig 2018-01-17 03:18:43.594910000 +0800 >++++ Process.h 2018-01-17 03:18:57.241872000 +0800 >+@@ -151,6 +151,7 @@ >+ >+ #define As_Process(this_) ((ProcessClass*)((this_)->super.klass)) >+ >++#define Process_isChildOf(process_, pid_) (process_->tgid == pid_ || (process_->tgid == process_->pid && process_->ppid == pid_)) >+ >+ #define ONE_K 1024L >+ #define ONE_M (ONE_K * ONE_K) > >Property changes on: sysutils/htop/files/patch-Process.h >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-ProcessList.c >=================================================================== >--- sysutils/htop/files/patch-ProcessList.c (nonexistent) >+++ sysutils/htop/files/patch-ProcessList.c (working copy) >@@ -0,0 +1,74 @@ >+--- ProcessList.c.orig 2018-01-17 03:14:56.195331000 +0800 >++++ ProcessList.c 2018-01-17 03:19:21.422680000 +0800 >+@@ -173,7 +173,7 @@ >+ >+ for (int i = Vector_size(this->processes) - 1; i >= 0; i--) { >+ Process* process = (Process*) (Vector_get(this->processes, i)); >+- if (process->show && (process->tgid == pid || (process->tgid == process->pid && process->ppid == pid))) { >++ if (process->show && Process_isChildOf(process, pid)) { >+ process = (Process*) (Vector_take(this->processes, i)); >+ Vector_add(children, process); >+ } >+@@ -213,23 +213,46 @@ >+ // Restore settings >+ this->settings->sortKey = sortKey; >+ this->settings->direction = direction; >+- // Take PID 1 as root and add to the new listing >+ int vsize = Vector_size(this->processes); >+- Process* init = (Process*) (Vector_take(this->processes, 0)); >+- if (!init) return; >+- // This assertion crashes on hardened kernels. >+- // I wonder how well tree view works on those systems. >+- // assert(init->pid == 1); >+- init->indent = 0; >+- Vector_add(this->processes2, init); >+- // Recursively empty list >+- ProcessList_buildTree(this, init->pid, 0, 0, direction, true); >+- // Add leftovers >+- while (Vector_size(this->processes)) { >+- Process* p = (Process*) (Vector_take(this->processes, 0)); >+- p->indent = 0; >+- Vector_add(this->processes2, p); >+- ProcessList_buildTree(this, p->pid, 0, 0, direction, p->showChildren); >++ // Find all processes whose parent is not visible >++ int size; >++ while ((size = Vector_size(this->processes))) { >++ int i; >++ for (i = 0; i < size; i++) { >++ Process* process = (Process*)(Vector_get(this->processes, i)); >++ // Immediately consume not shown processes >++ if (!process->show) { >++ process = (Process*)(Vector_take(this->processes, i)); >++ process->indent = 0; >++ Vector_add(this->processes2, process); >++ ProcessList_buildTree(this, process->pid, 0, 0, direction, false); >++ break; >++ } >++ pid_t ppid = process->tgid == process->pid ? process->ppid : process->tgid; >++ // Bisect the process vector to find parent >++ int l = 0, r = size; >++ while (l < r) { >++ int c = (l + r) / 2; >++ pid_t pid = ((Process*)(Vector_get(this->processes, c)))->pid; >++ if (ppid == pid) { >++ break; >++ } else if (ppid < pid) { >++ r = c; >++ } else { >++ l = c + 1; >++ } >++ } >++ // If parent not found, then construct the tree with this root >++ if (l >= r) { >++ process = (Process*)(Vector_take(this->processes, i)); >++ process->indent = 0; >++ Vector_add(this->processes2, process); >++ ProcessList_buildTree(this, process->pid, 0, 0, direction, process->showChildren); >++ break; >++ } >++ } >++ // There should be no loop in the process tree >++ assert(i < size); >+ } >+ assert(Vector_size(this->processes2) == vsize); (void)vsize; >+ assert(Vector_size(this->processes) == 0); > >Property changes on: sysutils/htop/files/patch-ProcessList.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-Settings.c >=================================================================== >--- sysutils/htop/files/patch-Settings.c (nonexistent) >+++ sysutils/htop/files/patch-Settings.c (working copy) >@@ -0,0 +1,83 @@ >+--- Settings.c.orig 2018-01-17 02:38:27.802306000 +0800 >++++ Settings.c 2018-01-17 02:49:53.114523000 +0800 >+@@ -165,11 +165,10 @@ >+ >+ static bool Settings_read(Settings* this, const char* fileName) { >+ FILE* fd; >+- uid_t euid = geteuid(); >+ >+- (void) seteuid(getuid()); >++ CRT_dropPrivileges(); >+ fd = fopen(fileName, "r"); >+- (void) seteuid(euid); >++ CRT_restorePrivileges(); >+ if (!fd) >+ return false; >+ >+@@ -255,34 +254,40 @@ >+ >+ static void writeFields(FILE* fd, ProcessField* fields, const char* name) { >+ fprintf(fd, "%s=", name); >++ const char* sep = ""; >+ for (int i = 0; fields[i]; i++) { >+ // This "-1" is for compatibility with the older enum format. >+- fprintf(fd, "%d ", (int) fields[i]-1); >++ fprintf(fd, "%s%d", sep, (int) fields[i]-1); >++ sep = " "; >+ } >+ fprintf(fd, "\n"); >+ } >+ >+ static void writeMeters(Settings* this, FILE* fd, int column) { >++ const char* sep = ""; >+ for (int i = 0; i < this->columns[column].len; i++) { >+- fprintf(fd, "%s ", this->columns[column].names[i]); >++ fprintf(fd, "%s%s", sep, this->columns[column].names[i]); >++ sep = " "; >+ } >+ fprintf(fd, "\n"); >+ } >+ >+ static void writeMeterModes(Settings* this, FILE* fd, int column) { >++ const char* sep = ""; >+ for (int i = 0; i < this->columns[column].len; i++) { >+- fprintf(fd, "%d ", this->columns[column].modes[i]); >++ fprintf(fd, "%s%d", sep, this->columns[column].modes[i]); >++ sep = " "; >+ } >+ fprintf(fd, "\n"); >+ } >+ >+ bool Settings_write(Settings* this) { >+ FILE* fd; >+- uid_t euid = geteuid(); >+ >+- (void) seteuid(getuid()); >++ CRT_dropPrivileges(); >+ fd = fopen(this->filename, "w"); >+- (void) seteuid(euid); >++ CRT_restorePrivileges(); >++ >+ if (fd == NULL) { >+ return false; >+ } >+@@ -368,8 +373,8 @@ >+ htopDir = String_cat(home, "/.config/htop"); >+ } >+ legacyDotfile = String_cat(home, "/.htoprc"); >+- uid_t euid = geteuid(); >+- (void) seteuid(getuid()); >++ >++ CRT_dropPrivileges(); >+ (void) mkdir(configDir, 0700); >+ (void) mkdir(htopDir, 0700); >+ free(htopDir); >+@@ -382,7 +387,7 @@ >+ free(legacyDotfile); >+ legacyDotfile = NULL; >+ } >+- (void) seteuid(euid); >++ CRT_restorePrivileges(); >+ } >+ this->colorScheme = 0; >+ this->changed = false; > >Property changes on: sysutils/htop/files/patch-Settings.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-SignalsPanel.c >=================================================================== >--- sysutils/htop/files/patch-SignalsPanel.c (nonexistent) >+++ sysutils/htop/files/patch-SignalsPanel.c (working copy) >@@ -0,0 +1,31 @@ >+--- SignalsPanel.c.orig 2018-01-17 01:55:33.869022000 +0800 >++++ SignalsPanel.c 2018-01-17 03:06:20.265727000 +0800 >+@@ -31,13 +31,27 @@ >+ Panel* this = Panel_new(1, 1, 1, 1, true, Class(ListItem), FunctionBar_newEnterEsc("Send ", "Cancel ")); >+ const int defaultSignal = SIGTERM; >+ int defaultPosition = 15; >+- for(unsigned int i = 0; i < Platform_numberOfSignals; i++) { >++ unsigned int i; >++ for(int i = 0; i < Platform_numberOfSignals; i++) { >+ Panel_set(this, i, (Object*) ListItem_new(Platform_signals[i].name, Platform_signals[i].number)); >+ // signal 15 is not always the 15th signal in the table >+ if (Platform_signals[i].number == defaultSignal) { >+ defaultPosition = i; >+ } >+ } >++ #if (defined(SIGRTMIN) && defined(SIGRTMAX)) >++ if (SIGRTMAX - SIGRTMIN <= 100) { >++ static char buf[15]; >++ for (int sig = SIGRTMIN; sig <= SIGRTMAX; i++, sig++) { >++ int n = sig - SIGRTMIN; >++ xSnprintf(buf, 15, "%2d SIGRTMIN%-+3d", sig, n); >++ if (n == 0) { >++ buf[11] = '\0'; >++ } >++ Panel_set(this, i, (Object*) ListItem_new(buf, sig)); >++ } >++ } >++ #endif >+ Panel_setHeader(this, "Send signal:"); >+ Panel_setSelected(this, defaultPosition); >+ return this; > >Property changes on: sysutils/htop/files/patch-SignalsPanel.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-StringUtils.c >=================================================================== >--- sysutils/htop/files/patch-StringUtils.c (nonexistent) >+++ sysutils/htop/files/patch-StringUtils.c (working copy) >@@ -0,0 +1,29 @@ >+--- StringUtils.c.orig 2018-01-17 01:47:39.407076000 +0800 >++++ StringUtils.c 2018-01-17 01:51:44.982545000 +0800 >+@@ -17,10 +17,15 @@ >+ /*{ >+ #include <stdio.h> >+ >+-#define String_startsWith(s, match) (strstr((s), (match)) == (s)) >++#define String_startsWith(s, match) (strncmp((s),(match),strlen(match)) == 0) >+ #define String_contains_i(s1, s2) (strcasestr(s1, s2) != NULL) >+ }*/ >+ >++/* >++ * String_startsWith gives better performance if strlen(match) can be computed >++ * at compile time (e.g. when they are immutable string literals). :) >++ */ >++ >+ char* String_cat(const char* s1, const char* s2) { >+ int l1 = strlen(s1); >+ int l2 = strlen(s2); >+@@ -88,6 +93,9 @@ >+ } >+ >+ void String_freeArray(char** s) { >++ if (!s) { >++ return; >++ } >+ for (int i = 0; s[i] != NULL; i++) { >+ free(s[i]); >+ } > >Property changes on: sysutils/htop/files/patch-StringUtils.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-StringUtils.h >=================================================================== >--- sysutils/htop/files/patch-StringUtils.h (nonexistent) >+++ sysutils/htop/files/patch-StringUtils.h (working copy) >@@ -0,0 +1,18 @@ >+--- StringUtils.h.orig 2018-01-17 01:49:03.627994000 +0800 >++++ StringUtils.h 2018-01-17 01:49:59.251235000 +0800 >+@@ -11,9 +11,14 @@ >+ >+ #include <stdio.h> >+ >+-#define String_startsWith(s, match) (strstr((s), (match)) == (s)) >++#define String_startsWith(s, match) (strncmp((s),(match),strlen(match)) == 0) >+ #define String_contains_i(s1, s2) (strcasestr(s1, s2) != NULL) >+ >++/* >++ * String_startsWith gives better performance if strlen(match) can be computed >++ * at compile time (e.g. when they are immutable string literals). :) >++ */ >++ >+ char* String_cat(const char* s1, const char* s2); >+ >+ char* String_trim(const char* in); > >Property changes on: sysutils/htop/files/patch-StringUtils.h >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-TasksMeter.c >=================================================================== >--- sysutils/htop/files/patch-TasksMeter.c (nonexistent) >+++ sysutils/htop/files/patch-TasksMeter.c (working copy) >@@ -0,0 +1,42 @@ >+--- TasksMeter.c.orig 2018-01-17 02:06:38.125002000 +0800 >++++ TasksMeter.c 2018-01-17 03:07:07.512269000 +0800 >+@@ -30,7 +30,7 @@ >+ if (this->pl->settings->hideKernelThreads) { >+ this->values[0] = 0; >+ } >+- snprintf(buffer, len, "%d/%d", (int) this->values[3], (int) this->total); >++ xSnprintf(buffer, len, "%d/%d", (int) this->values[3], (int) this->total); >+ } >+ >+ static void TasksMeter_display(Object* cast, RichString* out) { >+@@ -40,7 +40,7 @@ >+ >+ int processes = (int) this->values[2]; >+ >+- sprintf(buffer, "%d", processes); >++ xSnprintf(buffer, sizeof(buffer), "%d", processes); >+ RichString_write(out, CRT_colors[METER_VALUE], buffer); >+ int threadValueColor = CRT_colors[METER_VALUE]; >+ int threadCaptionColor = CRT_colors[METER_TEXT]; >+@@ -50,18 +50,18 @@ >+ } >+ if (!settings->hideUserlandThreads) { >+ RichString_append(out, CRT_colors[METER_TEXT], ", "); >+- sprintf(buffer, "%d", (int)this->values[1]); >++ xSnprintf(buffer, sizeof(buffer), "%d", (int)this->values[1]); >+ RichString_append(out, threadValueColor, buffer); >+ RichString_append(out, threadCaptionColor, " thr"); >+ } >+ if (!settings->hideKernelThreads) { >+ RichString_append(out, CRT_colors[METER_TEXT], ", "); >+- sprintf(buffer, "%d", (int)this->values[0]); >++ xSnprintf(buffer, sizeof(buffer), "%d", (int)this->values[0]); >+ RichString_append(out, threadValueColor, buffer); >+ RichString_append(out, threadCaptionColor, " kthr"); >+ } >+ RichString_append(out, CRT_colors[METER_TEXT], "; "); >+- sprintf(buffer, "%d", (int)this->values[3]); >++ xSnprintf(buffer, sizeof(buffer), "%d", (int)this->values[3]); >+ RichString_append(out, CRT_colors[TASKS_RUNNING], buffer); >+ RichString_append(out, CRT_colors[METER_TEXT], " running"); >+ } > >Property changes on: sysutils/htop/files/patch-TasksMeter.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-TraceScreen.c >=================================================================== >--- sysutils/htop/files/patch-TraceScreen.c (nonexistent) >+++ sysutils/htop/files/patch-TraceScreen.c (working copy) >@@ -0,0 +1,43 @@ >+--- TraceScreen.c.orig 2018-01-17 02:07:43.495613000 +0800 >++++ TraceScreen.c 2018-01-17 03:08:08.481397000 +0800 >+@@ -22,6 +22,7 @@ >+ #include <stdbool.h> >+ #include <unistd.h> >+ #include <fcntl.h> >++#include <sys/time.h> >+ #include <sys/types.h> >+ #include <sys/wait.h> >+ #include <signal.h> >+@@ -42,9 +43,9 @@ >+ >+ }*/ >+ >+-static const char* TraceScreenFunctions[] = {"Search ", "Filter ", "AutoScroll ", "Stop Tracing ", "Done ", NULL}; >++static const char* const TraceScreenFunctions[] = {"Search ", "Filter ", "AutoScroll ", "Stop Tracing ", "Done ", NULL}; >+ >+-static const char* TraceScreenKeys[] = {"F3", "F4", "F8", "F9", "Esc"}; >++static const char* const TraceScreenKeys[] = {"F3", "F4", "F8", "F9", "Esc"}; >+ >+ static int TraceScreenEvents[] = {KEY_F(3), KEY_F(4), KEY_F(8), KEY_F(9), 27}; >+ >+@@ -90,16 +91,16 @@ >+ >+ bool TraceScreen_forkTracer(TraceScreen* this) { >+ char buffer[1001]; >+- int err = pipe(this->fdpair); >+- if (err == -1) return false; >++ int error = pipe(this->fdpair); >++ if (error == -1) return false; >+ this->child = fork(); >+ if (this->child == -1) return false; >+ if (this->child == 0) { >+- (void) seteuid(getuid()); >++ CRT_dropPrivileges(); >+ dup2(this->fdpair[1], STDERR_FILENO); >+ int ok = fcntl(this->fdpair[1], F_SETFL, O_NONBLOCK); >+ if (ok != -1) { >+- sprintf(buffer, "%d", this->super.process->pid); >++ xSnprintf(buffer, sizeof(buffer), "%d", this->super.process->pid); >+ execlp("strace", "strace", "-p", buffer, NULL); >+ } >+ const char* message = "Could not execute 'strace'. Please make sure it is available in your $PATH."; > >Property changes on: sysutils/htop/files/patch-TraceScreen.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-UptimeMeter.c >=================================================================== >--- sysutils/htop/files/patch-UptimeMeter.c (nonexistent) >+++ sysutils/htop/files/patch-UptimeMeter.c (working copy) >@@ -0,0 +1,34 @@ >+--- UptimeMeter.c.orig 2018-01-17 02:08:11.372761000 +0800 >++++ UptimeMeter.c 2018-01-17 03:08:58.209514000 +0800 >+@@ -20,7 +20,7 @@ >+ static void UptimeMeter_updateValues(Meter* this, char* buffer, int len) { >+ int totalseconds = Platform_getUptime(); >+ if (totalseconds == -1) { >+- snprintf(buffer, len, "(unknown)"); >++ xSnprintf(buffer, len, "(unknown)"); >+ return; >+ } >+ int seconds = totalseconds % 60; >+@@ -31,17 +31,17 @@ >+ if (days > this->total) { >+ this->total = days; >+ } >+- char daysbuf[15]; >++ char daysbuf[32]; >+ if (days > 100) { >+- sprintf(daysbuf, "%d days(!), ", days); >++ xSnprintf(daysbuf, sizeof(daysbuf), "%d days(!), ", days); >+ } else if (days > 1) { >+- sprintf(daysbuf, "%d days, ", days); >++ xSnprintf(daysbuf, sizeof(daysbuf), "%d days, ", days); >+ } else if (days == 1) { >+- sprintf(daysbuf, "1 day, "); >++ xSnprintf(daysbuf, sizeof(daysbuf), "1 day, "); >+ } else { >+ daysbuf[0] = '\0'; >+ } >+- snprintf(buffer, len, "%s%02d:%02d:%02d", daysbuf, hours, minutes, seconds); >++ xSnprintf(buffer, len, "%s%02d:%02d:%02d", daysbuf, hours, minutes, seconds); >+ } >+ >+ MeterClass UptimeMeter_class = { > >Property changes on: sysutils/htop/files/patch-UptimeMeter.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-XAlloc.c >=================================================================== >--- sysutils/htop/files/patch-XAlloc.c (nonexistent) >+++ sysutils/htop/files/patch-XAlloc.c (working copy) >@@ -0,0 +1,24 @@ >+--- XAlloc.c.orig 2018-01-17 03:09:14.682069000 +0800 >++++ XAlloc.c 2018-01-17 03:09:45.561807000 +0800 >+@@ -5,11 +5,11 @@ >+ #ifndef _GNU_SOURCE >+ #define _GNU_SOURCE >+ #endif >+-#include <err.h> >+ #include <stdlib.h> >+ #include <string.h> >+ >+ /*{ >++#include <err.h> >+ #include <assert.h> >+ #include <stdlib.h> >+ }*/ >+@@ -44,6 +44,8 @@ >+ return data; >+ } >+ >++#define xSnprintf(fmt, len, ...) do { int _l=len; int _n=snprintf(fmt, _l, __VA_ARGS__); if (!(_n > -1 && _n < _l)) { curs_set(1); endwin(); err(1, NULL); } } while(0) >++ >+ #undef xStrdup >+ #undef xStrdup_ >+ #ifdef NDEBUG > >Property changes on: sysutils/htop/files/patch-XAlloc.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-XAlloc.h >=================================================================== >--- sysutils/htop/files/patch-XAlloc.h (nonexistent) >+++ sysutils/htop/files/patch-XAlloc.h (working copy) >@@ -0,0 +1,19 @@ >+--- XAlloc.h.orig 2018-01-17 03:09:59.837795000 +0800 >++++ XAlloc.h 2018-01-17 03:10:32.180486000 +0800 >+@@ -7,6 +7,7 @@ >+ #define _GNU_SOURCE >+ #endif >+ >++#include <err.h> >+ #include <assert.h> >+ #include <stdlib.h> >+ >+@@ -16,6 +17,8 @@ >+ >+ void* xRealloc(void* ptr, size_t size); >+ >++#define xSnprintf(fmt, len, ...) do { int _l=len; int _n=snprintf(fmt, _l, __VA_ARGS__); if (!(_n > -1 && _n < _l)) { curs_set(1); endwin(); err(1, NULL); } } while(0) >++ >+ #undef xStrdup >+ #undef xStrdup_ >+ #ifdef NDEBUG > >Property changes on: sysutils/htop/files/patch-XAlloc.h >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-configure.ac >=================================================================== >--- sysutils/htop/files/patch-configure.ac (nonexistent) >+++ sysutils/htop/files/patch-configure.ac (working copy) >@@ -0,0 +1,32 @@ >+--- configure.ac.orig 2018-01-17 02:50:30.919198000 +0800 >++++ configure.ac 2018-01-17 03:20:06.328268000 +0800 >+@@ -2,7 +2,6 @@ >+ # Process this file with autoconf to produce a configure script. >+ >+ AC_PREREQ(2.65) >+-LT_PREREQ([2.4.2]) >+ AC_INIT([htop],[2.0.2],[hisham@gobolinux.org]) >+ >+ SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}" >+@@ -26,8 +25,6 @@ >+ # Required by hwloc scripts >+ AC_USE_SYSTEM_EXTENSIONS >+ >+-LT_INIT([disable-shared static]) >+- >+ # Checks for platform. >+ # ---------------------------------------------------------------------- >+ case "$target_os" in >+@@ -249,6 +246,12 @@ >+ AC_CHECK_HEADERS([hwloc.h],[:], [missing_headers="$missing_headers $ac_header"]) >+ fi >+ >++AC_ARG_ENABLE(setuid, [AS_HELP_STRING([--enable-setuid], [enable setuid support for platforms that need it])],, enable_setuid="no") >++if test "x$enable_setuid" = xyes >++then >++ AC_DEFINE(HAVE_SETUID_ENABLED, 1, [Define if setuid support should be enabled.]) >++fi >++ >+ # Bail out on errors. >+ # ---------------------------------------------------------------------- >+ if test ! -z "$missing_libraries"; then > >Property changes on: sysutils/htop/files/patch-configure.ac >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-freebsd__FreeBSDCRT.c >=================================================================== >--- sysutils/htop/files/patch-freebsd__FreeBSDCRT.c (nonexistent) >+++ sysutils/htop/files/patch-freebsd__FreeBSDCRT.c (working copy) >@@ -0,0 +1,32 @@ >+--- freebsd/FreeBSDCRT.c.orig 2018-01-17 03:34:43.741989000 +0800 >++++ freebsd/FreeBSDCRT.c 2018-01-17 03:35:31.892102000 +0800 >+@@ -9,13 +9,26 @@ >+ #include "CRT.h" >+ #include <stdio.h> >+ #include <stdlib.h> >++#ifdef HAVE_EXECINFO_H >++#include <execinfo.h> >++#endif >+ >+ void CRT_handleSIGSEGV(int sgn) { >+ (void) sgn; >+ CRT_done(); >+- fprintf(stderr, "\n\nhtop " VERSION " aborting.\n"); >+- fprintf(stderr, "\nUnfortunately, you seem to be using an unsupported platform!"); >+- fprintf(stderr, "\nPlease contact your platform package maintainer!\n\n"); >++ fprintf(stderr, "\n\nhtop " VERSION " aborting. Please report bug at http://hisham.hm/htop\n"); >++ #ifdef HAVE_EXECINFO_H >++ size_t size = backtrace(backtraceArray, sizeof(backtraceArray) / sizeof(void *)); >++ fprintf(stderr, "\n Please include in your report the following backtrace: \n"); >++ backtrace_symbols_fd(backtraceArray, size, 2); >++ fprintf(stderr, "\nAdditionally, in order to make the above backtrace useful,"); >++ fprintf(stderr, "\nplease also run the following command to generate a disassembly of your binary:"); >++ fprintf(stderr, "\n\n objdump -d `which htop` > ~/htop.objdump"); >++ fprintf(stderr, "\n\nand then attach the file ~/htop.objdump to your bug report."); >++ fprintf(stderr, "\n\nThank you for helping to improve htop!\n\n"); >++ #else >++ fprintf(stderr, "\nPlease contact FreeBSD package maintainer!\n\n"); >++ #endif >+ abort(); >+ } >+ > >Property changes on: sysutils/htop/files/patch-freebsd__FreeBSDCRT.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-freebsd__FreeBSDCRT.h >=================================================================== >--- sysutils/htop/files/patch-freebsd__FreeBSDCRT.h (nonexistent) >+++ sysutils/htop/files/patch-freebsd__FreeBSDCRT.h (working copy) >@@ -0,0 +1,12 @@ >+--- freebsd/FreeBSDCRT.h.orig 2018-01-17 03:35:55.489304000 +0800 >++++ freebsd/FreeBSDCRT.h 2018-01-17 03:36:12.385351000 +0800 >+@@ -9,6 +9,9 @@ >+ in the source distribution for its full text. >+ */ >+ >++#ifdef HAVE_EXECINFO_H >++#endif >++ >+ void CRT_handleSIGSEGV(int sgn); >+ >+ > >Property changes on: sysutils/htop/files/patch-freebsd__FreeBSDCRT.h >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-freebsd__FreeBSDProcess.c >=================================================================== >--- sysutils/htop/files/patch-freebsd__FreeBSDProcess.c (nonexistent) >+++ sysutils/htop/files/patch-freebsd__FreeBSDProcess.c (working copy) >@@ -0,0 +1,34 @@ >+--- freebsd/FreeBSDProcess.c.orig 2018-01-17 02:01:23.746071000 +0800 >++++ freebsd/FreeBSDProcess.c 2018-01-17 03:11:22.464126000 +0800 >+@@ -61,8 +61,8 @@ >+ [STATE] = { .name = "STATE", .title = "S ", .description = "Process state (S sleeping, R running, D disk, Z zombie, T traced, W paging)", .flags = 0, }, >+ [PPID] = { .name = "PPID", .title = " PPID ", .description = "Parent process ID", .flags = 0, }, >+ [PGRP] = { .name = "PGRP", .title = " PGRP ", .description = "Process group ID", .flags = 0, }, >+- [SESSION] = { .name = "SESSION", .title = " SESN ", .description = "Process's session ID", .flags = 0, }, >+- [TTY_NR] = { .name = "TTY_NR", .title = " TTY ", .description = "Controlling terminal", .flags = 0, }, >++ [SESSION] = { .name = "SESSION", .title = " SID ", .description = "Process's session ID", .flags = 0, }, >++ [TTY_NR] = { .name = "TTY_NR", .title = " TTY ", .description = "Controlling terminal", .flags = 0, }, >+ [TPGID] = { .name = "TPGID", .title = " TPGID ", .description = "Process ID of the fg process group of the controlling terminal", .flags = 0, }, >+ [MINFLT] = { .name = "MINFLT", .title = " MINFLT ", .description = "Number of minor faults which have not required loading a memory page from disk", .flags = 0, }, >+ [MAJFLT] = { .name = "MAJFLT", .title = " MAJFLT ", .description = "Number of major faults which have required loading a memory page from disk", .flags = 0, }, >+@@ -92,7 +92,7 @@ >+ { .id = TPGID, .label = "TPGID" }, >+ { .id = TGID, .label = "TGID" }, >+ { .id = PGRP, .label = "PGRP" }, >+- { .id = SESSION, .label = "SESN" }, >++ { .id = SESSION, .label = "SID" }, >+ { .id = 0, .label = NULL }, >+ }; >+ >+@@ -117,9 +117,9 @@ >+ int n = sizeof(buffer) - 1; >+ switch ((int) field) { >+ // add FreeBSD-specific fields here >+- case JID: snprintf(buffer, n, Process_pidFormat, fp->jid); break; >++ case JID: xSnprintf(buffer, n, Process_pidFormat, fp->jid); break; >+ case JAIL:{ >+- snprintf(buffer, n, "%-11s ", fp->jname); break; >++ xSnprintf(buffer, n, "%-11s ", fp->jname); break; >+ if (buffer[11] != '\0') { >+ buffer[11] = ' '; >+ buffer[12] = '\0'; > >Property changes on: sysutils/htop/files/patch-freebsd__FreeBSDProcess.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c >=================================================================== >--- sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c (nonexistent) >+++ sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c (working copy) >@@ -0,0 +1,19 @@ >+--- freebsd/FreeBSDProcessList.c.orig 2016-07-22 04:12:45.000000000 +0800 >++++ freebsd/FreeBSDProcessList.c 2018-01-17 03:32:10.420406000 +0800 >+@@ -398,7 +398,7 @@ >+ jid = jail_get(jiov, 6, 0); >+ if (jid < 0) { >+ if (!jail_errmsg[0]) >+- snprintf(jail_errmsg, JAIL_ERRMSGLEN, "jail_get: %s", strerror(errno)); >++ xSnprintf(jail_errmsg, JAIL_ERRMSGLEN, "jail_get: %s", strerror(errno)); >+ return NULL; >+ } else if (jid == kproc->ki_jid) { >+ jname = xStrdup(jnamebuf); >+@@ -482,7 +482,6 @@ >+ // from FreeBSD source /src/usr.bin/top/machine.c >+ proc->m_size = kproc->ki_size / 1024 / pageSizeKb; >+ proc->m_resident = kproc->ki_rssize; >+- proc->percent_mem = (proc->m_resident * PAGE_SIZE_KB) / (double)(this->totalMem) * 100.0; >+ proc->nlwp = kproc->ki_numthreads; >+ proc->time = (kproc->ki_runtime + 5000) / 10000; >+ > >Property changes on: sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-freebsd__Platform.c >=================================================================== >--- sysutils/htop/files/patch-freebsd__Platform.c (nonexistent) >+++ sysutils/htop/files/patch-freebsd__Platform.c (working copy) >@@ -0,0 +1,20 @@ >+--- freebsd/Platform.c.orig 2018-01-17 01:52:20.062230000 +0800 >++++ freebsd/Platform.c 2018-01-17 01:52:49.637588000 +0800 >+@@ -43,7 +43,7 @@ >+ >+ int Platform_numberOfFields = LAST_PROCESSFIELD; >+ >+-SignalItem Platform_signals[] = { >++const SignalItem Platform_signals[] = { >+ { .name = " 0 Cancel", .number = 0 }, >+ { .name = " 1 SIGHUP", .number = 1 }, >+ { .name = " 2 SIGINT", .number = 2 }, >+@@ -80,7 +80,7 @@ >+ { .name = "33 SIGLIBRT", .number = 33 }, >+ }; >+ >+-unsigned int Platform_numberOfSignals = sizeof(Platform_signals)/sizeof(SignalItem); >++const unsigned int Platform_numberOfSignals = sizeof(Platform_signals)/sizeof(SignalItem); >+ >+ void Platform_setBindings(Htop_Action* keys) { >+ (void) keys; > >Property changes on: sysutils/htop/files/patch-freebsd__Platform.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-freebsd__Platform.h >=================================================================== >--- sysutils/htop/files/patch-freebsd__Platform.h (nonexistent) >+++ sysutils/htop/files/patch-freebsd__Platform.h (working copy) >@@ -0,0 +1,14 @@ >+--- freebsd/Platform.h.orig 2018-01-17 01:53:07.196304000 +0800 >++++ freebsd/Platform.h 2018-01-17 01:53:29.415835000 +0800 >+@@ -24,9 +24,9 @@ >+ >+ extern int Platform_numberOfFields; >+ >+-extern SignalItem Platform_signals[]; >++const extern SignalItem Platform_signals[]; >+ >+-extern unsigned int Platform_numberOfSignals; >++const extern unsigned int Platform_numberOfSignals; >+ >+ void Platform_setBindings(Htop_Action* keys); >+ > >Property changes on: sysutils/htop/files/patch-freebsd__Platform.h >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-htop.1.in >=================================================================== >--- sysutils/htop/files/patch-htop.1.in (nonexistent) >+++ sysutils/htop/files/patch-htop.1.in (working copy) >@@ -0,0 +1,11 @@ >+--- htop.1.in.orig 2018-01-17 02:10:17.117935000 +0800 >++++ htop.1.in 2018-01-17 02:10:26.605171000 +0800 >+@@ -217,7 +217,7 @@ >+ .B PGRP >+ The process's group ID. >+ .TP >+-.B SESSION (SESN) >++.B SESSION (SID) >+ The process's session ID. >+ .TP >+ .B TTY_NR (TTY) > >Property changes on: sysutils/htop/files/patch-htop.1.in >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sysutils/htop/files/patch-scripts__MakeHeader.py >=================================================================== >--- sysutils/htop/files/patch-scripts__MakeHeader.py (nonexistent) >+++ sysutils/htop/files/patch-scripts__MakeHeader.py (working copy) >@@ -0,0 +1,115 @@ >+--- scripts/MakeHeader.py.orig 2018-01-17 03:13:36.980691000 +0800 >++++ scripts/MakeHeader.py 2018-01-17 03:13:41.657914000 +0800 >+@@ -1,6 +1,12 @@ >+ #!/usr/bin/env python >+- >+ import os, sys, string >++try: >++ from cStringIO import StringIO >++except ImportError: >++ try: >++ from StringIO import StringIO >++ except ImportError: >++ from io import StringIO >+ >+ ANY=1 >+ COPY=2 >+@@ -13,23 +19,15 @@ >+ file = open(sys.argv[1]) >+ name = sys.argv[1][:-2] >+ >+-out = open(name + ".h", "w") >+-class writer: >+- def __init__(self, file): >+- self.file = file >+- def write(self, text): >+- self.file.write(text + "\n") >+-out = writer(out) >+- >+-print("Generating "+name+".h") >++out = StringIO() >+ >+ selfheader = '#include "' + name + '.h"' >+ >+-out.write( "/* Do not edit this file. It was automatically generated. */" ) >+-out.write( "" ) >++out.write( "/* Do not edit this file. It was automatically generated. */\n" ) >++out.write( "\n" ) >+ >+-out.write( "#ifndef HEADER_" + os.path.basename(name) ) >+-out.write( "#define HEADER_" + os.path.basename(name) ) >++out.write( "#ifndef HEADER_" + os.path.basename(name) + "\n") >++out.write( "#define HEADER_" + os.path.basename(name) + "\n") >+ is_blank = False >+ for line in file.readlines(): >+ line = line[:-1] >+@@ -41,7 +39,7 @@ >+ elif line.find("#include") == 0: >+ pass >+ elif line.find("htop - ") == 0 and line[-2:] == ".c": >+- out.write(line[:-2] + ".h") >++ out.write(line[:-2] + ".h\n") >+ elif line.find("static ") != -1: >+ if line[-1] == "{": >+ state = SKIP >+@@ -52,31 +50,31 @@ >+ static = 0 >+ equals = line.find(" = ") >+ if line[-3:] == "= {": >+- out.write( "extern " + line[:-4] + ";" ) >++ out.write( "extern " + line[:-4] + ";\n" ) >+ state = SKIP >+ elif equals != -1: >+- out.write("extern " + line[:equals] + ";" ) >++ out.write("extern " + line[:equals] + ";\n" ) >+ elif line.startswith("typedef struct"): >+ state = SKIP >+ elif line[-1] == "{": >+- out.write( line[:-2].replace("inline", "extern") + ";" ) >++ out.write( line[:-2].replace("inline", "extern") + ";\n" ) >+ state = SKIP >+ else: >+- out.write( line ) >++ out.write( line + "\n") >+ is_blank = False >+ elif line == "": >+ if not is_blank: >+- out.write( line ) >++ out.write( line + "\n") >+ is_blank = True >+ else: >+- out.write( line ) >++ out.write( line + "\n") >+ is_blank = False >+ elif state == COPY: >+ is_blank = False >+ if line == "}*/": >+ state = ANY >+ else: >+- out.write( line ) >++ out.write( line + "\n") >+ elif state == SKIP: >+ is_blank = False >+ if len(line) >= 1 and line[0] == "}": >+@@ -89,5 +87,19 @@ >+ is_blank = False >+ state = ANY >+ >+-out.write( "" ) >+-out.write( "#endif" ) >++out.write( "\n" ) >++out.write( "#endif\n" ) >++ >++# only write a new .h file if something changed. >++# This prevents a lot of recompilation during development >++out.seek(0) >++try: >++ with open(name + ".h", "r") as orig: >++ origcontents = orig.readlines() >++except: >++ origcontents = "" >++if origcontents != out.readlines(): >++ with open(name + ".h", "w") as new: >++ print("Writing "+name+".h") >++ new.write(out.getvalue()) >++out.close() > >Property changes on: sysutils/htop/files/patch-scripts__MakeHeader.py >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 225232
:
189810
| 191210 |
191211