FreeBSD Bugzilla – Attachment 191211 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), 93.76 KB, created by
Hung-Yi Chen
on 2018-03-05 04:00:32 UTC
(
hide
)
Description:
htop 2.1.0
Filename:
MIME Type:
Creator:
Hung-Yi Chen
Created:
2018-03-05 04:00:32 UTC
Size:
93.76 KB
patch
obsolete
>Index: sysutils/htop/Makefile >=================================================================== >--- sysutils/htop/Makefile (revision 463616) >+++ sysutils/htop/Makefile (working copy) >@@ -2,7 +2,7 @@ > # $FreeBSD$ > > PORTNAME= htop >-PORTVERSION= 2.0.2 >+PORTVERSION= 2.1.0 > CATEGORIES= sysutils > > MAINTAINER= gaod@hychen.org >@@ -15,9 +15,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/distinfo >=================================================================== >--- sysutils/htop/distinfo (revision 463616) >+++ sysutils/htop/distinfo (working copy) >@@ -1,3 +1,3 @@ >-TIMESTAMP = 1469166026 >-SHA256 (hishamhm-htop-2.0.2_GH0.tar.gz) = 1e93e6743dddad254fac2ad0d83b00a82173c75ecbd6ef6f7d55da690eb64b92 >-SIZE (hishamhm-htop-2.0.2_GH0.tar.gz) = 146391 >+TIMESTAMP = 1520218632 >+SHA256 (hishamhm-htop-2.1.0_GH0.tar.gz) = cf2d7eeb396608eaa080816365eebcd144a5b9be44b710b602e947daabcb27d7 >+SIZE (hishamhm-htop-2.1.0_GH0.tar.gz) = 160373 >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,37 @@ >+--- Action.c.orig 2018-02-05 03:13:55.000000000 +0800 >++++ Action.c 2018-03-05 11:06:07.073400000 +0800 >+@@ -115,7 +115,7 @@ >+ >+ static bool changePriority(MainPanel* panel, int delta) { >+ bool anyTagged; >+- bool ok = MainPanel_foreachProcess(panel, (MainPanel_ForeachProcessFn) Process_changePriorityBy, delta, &anyTagged); >++ bool ok = MainPanel_foreachProcess(panel, (MainPanel_ForeachProcessFn) Process_changePriorityBy, (Arg){ .i = delta }, &anyTagged); >+ if (!ok) >+ beep(); >+ return anyTagged; >+@@ -185,6 +185,7 @@ >+ // ---------------------------------------- >+ >+ static Htop_Reaction actionResize(State* st) { >++ clear(); >+ Panel_resize(st->panel, COLS, LINES-(st->panel->y)-1); >+ return HTOP_REDRAW_BAR; >+ } >+@@ -284,7 +285,7 @@ >+ void* set = Action_pickFromVector(st, affinityPanel, 15); >+ if (set) { >+ Affinity* affinity = AffinityPanel_getAffinity(affinityPanel, st->pl); >+- bool ok = MainPanel_foreachProcess((MainPanel*)panel, (MainPanel_ForeachProcessFn) Affinity_set, (size_t) affinity, NULL); >++ bool ok = MainPanel_foreachProcess((MainPanel*)panel, (MainPanel_ForeachProcessFn) Affinity_set, (Arg){ .v = affinity }, NULL); >+ if (!ok) beep(); >+ Affinity_delete(affinity); >+ } >+@@ -301,7 +302,7 @@ >+ Panel_setHeader(st->panel, "Sending..."); >+ Panel_draw(st->panel, true); >+ refresh(); >+- MainPanel_foreachProcess((MainPanel*)st->panel, (MainPanel_ForeachProcessFn) Process_sendSignal, (size_t) sgn->key, NULL); >++ MainPanel_foreachProcess((MainPanel*)st->panel, (MainPanel_ForeachProcessFn) Process_sendSignal, (Arg){ .i = sgn->key }, NULL); >+ napms(500); >+ } >+ } > >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-CONTRIBUTING.md >=================================================================== >--- sysutils/htop/files/patch-CONTRIBUTING.md (nonexistent) >+++ sysutils/htop/files/patch-CONTRIBUTING.md (working copy) >@@ -0,0 +1,59 @@ >+--- /dev/null 2018-03-05 11:11:00.000000000 +0800 >++++ CONTRIBUTING.md 2018-03-05 11:13:08.923198000 +0800 >+@@ -0,0 +1,56 @@ >++ >++Contributing Guide >++================== >++ >++Hello, and thank you so much for taking your time to contribute in any way to >++htop! There are many ways to contribute, and I'll try to list them below. The >++support from the free software community has been amazing over the years and >++it is the number one thing that keeps me going, maintaining and improving >++something that started as a tiny pet project back in 2004 and that nowadays is >++a piece of software used all over the world, in both reality [and >++fiction!](http://hisham.hm/htop/index.php?page=sightings). Cheers! >++ >++-- Hisham Muhammad >++ >++Bug Reports >++----------- >++ >++Bug reports should be posted in the [Github issue >++tracker](http://github.com/hishamhm/htop/issues). (I reply to them all, but I >++usually do it in batches! :) ) Bug reports are extremely important since it's >++impossible for me to test htop in every possible system, distribution and >++scenario. Your feedback is what keeps the tool stable and always improving! >++Thank you! >++ >++Pull Requests >++------------- >++ >++Code contributions are most welcome! Just [fork the >++repo](http://github.com/hishamhm/htop) and send a [pull >++request](https://github.com/hishamhm/htop/pulls). Help is especially >++appreciated for support of platforms other than Linux. If proposing new >++features, please be mindful that htop is a system tool that needs to keep a >++small footprint and perform well on systems under stress -- so unfortunately I >++can't accept every new feature proposed, as I need to keep the tool slim and >++maintainable. Great ideas backed by a PR are always carefully considered for >++inclusion, though! Also, PRs containing bug fixes and portability tweaks are a >++no-brainer, please send those in! >++ >++Feature Requests >++---------------- >++ >++Back when htop was hosted in SourceForge, there used to be separate Bug >++Tracker and Feature Request pages. These go all lumped together under "Issues" >++in Github, which is a bit confusing. For this reason, I close Feature Requests >++and file them with the [`feature >++request`](https://github.com/hishamhm/htop/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22feature+request%22+) >++label, where they remain accessible, but not mixed with actual bug reports. >++This doesn't mean I'm dismissing or ignoring feature requests right away! It's >++just an organizational issue (with Github, really!). >++ >++Donations >++--------- >++ >++If you like htop, feel free to [buy the author a >++beer](http://hisham.hm/htop/index.php?page=donate). :-) >++ > >Property changes on: sysutils/htop/files/patch-CONTRIBUTING.md >___________________________________________________________________ >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,49 @@ >+--- CRT.c.orig 2018-03-05 10:59:24.996770000 +0800 >++++ CRT.c 2018-03-05 11:01:12.784473000 +0800 >+@@ -37,6 +37,7 @@ >+ #define White COLOR_WHITE >+ >+ #define ColorPairGrayBlack ColorPair(Magenta,Magenta) >++#define ColorIndexGrayBlack ColorIndex(Magenta,Magenta) >+ >+ #define KEY_WHEELUP KEY_F(20) >+ #define KEY_WHEELDOWN KEY_F(21) >+@@ -713,22 +714,23 @@ >+ >+ void CRT_setColors(int colorScheme) { >+ CRT_colorScheme = colorScheme; >+- if (colorScheme == COLORSCHEME_BLACKNIGHT) { >+- for (int i = 0; i < 8; i++) >+- 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++) { >+- if (ColorIndex(i,j) != ColorIndex(Magenta,Magenta)) { >+- init_pair(ColorIndex(i,j), i, (j==0?-1:j)); >+- } >++ >++ for (int i = 0; i < 8; i++) { >++ for (int j = 0; j < 8; j++) { >++ if (ColorIndex(i,j) != ColorPairGrayBlack) { >++ int bg = (colorScheme != COLORSCHEME_BLACKNIGHT) >++ ? (j==0 ? -1 : j) >++ : j; >++ init_pair(ColorIndex(i,j), i, bg); >+ } >+- init_pair(ColorIndex(Magenta,Magenta), 8, -1); >++ } >+ } >++ >++ int grayBlackFg = COLORS > 8 ? 8 : 0; >++ int grayBlackBg = (colorScheme != COLORSCHEME_BLACKNIGHT) >++ ? -1 >++ : 0; >++ init_pair(ColorIndexGrayBlack, grayBlackFg, grayBlackBg); >++ >+ 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,10 @@ >+--- CRT.h.orig 2018-03-05 11:00:37.596623000 +0800 >++++ CRT.h 2018-03-05 11:01:10.893218000 +0800 >+@@ -26,6 +26,7 @@ >+ #define White COLOR_WHITE >+ >+ #define ColorPairGrayBlack ColorPair(Magenta,Magenta) >++#define ColorIndexGrayBlack ColorIndex(Magenta,Magenta) >+ >+ #define KEY_WHEELUP KEY_F(20) >+ #define KEY_WHEELDOWN KEY_F(21) > >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-ChangeLog >=================================================================== >--- sysutils/htop/files/patch-ChangeLog (nonexistent) >+++ sysutils/htop/files/patch-ChangeLog (working copy) >@@ -0,0 +1,24 @@ >+--- ChangeLog.orig 2018-02-05 03:13:55.000000000 +0800 >++++ ChangeLog 2018-03-05 11:05:08.115687000 +0800 >+@@ -1,3 +1,21 @@ >++What's new in version 2.1.1 >++ >++* Check for pkg-config when building with --enable-delayacct >++ (thanks to @florian2833z for the report) >++* Use CFLAGS from ncurses*-config if present >++ (thanks to Michael Klein) >++* Fix build failure in Glibc 2.28 >++ (thanks to Kang-Che Sung) >++* BUGFIX: fix behavior of SYSCR column >++ (thanks to Marc Kleine-Budde) >++* BUGFIX: preserve LDFLAGS when building >++ (thanks to Lance Frederickson for the report) >++* BUGFIX: fix issue with small terminals >++ (thanks to Daniel Elf for the report) >++* BUGFIX: fix crash with particular keycodes >++ (thanks to Wellington Torrejais da Silva for the report) >++* BUGFIX: fix terminal color issues >++ (thanks to Kang-Che Sung for the report) >+ >+ What's new in version 2.1.0 >+ > >Property changes on: sysutils/htop/files/patch-ChangeLog >___________________________________________________________________ >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,10 @@ >+--- ColorsPanel.c.orig 2018-02-05 03:13:55.000000000 +0800 >++++ ColorsPanel.c 2018-03-05 11:01:43.510773000 +0800 >+@@ -78,6 +78,7 @@ >+ this->settings->changed = true; >+ const Header* header = this->scr->header; >+ CRT_setColors(mark); >++ clear(); >+ Panel* menu = (Panel*) Vector_get(this->scr->panels, 0); >+ Header_draw(header); >+ RichString_setAttr(&(super->header), CRT_colors[PANEL_HEADER_FOCUS]); > >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-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-02-05 03:13:55.000000000 +0800 >++++ InfoScreen.c 2018-03-05 11:07:24.022419000 +0800 >+@@ -115,8 +115,9 @@ >+ >+ Panel_draw(panel, true); >+ >+- if (this->inc->active) >+- move(LINES-1, CRT_cursorX); >++ if (this->inc->active) { >++ (void) move(LINES-1, CRT_cursorX); >++ } >+ set_escdelay(25); >+ int ch = getch(); >+ > >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-MainPanel.c >=================================================================== >--- sysutils/htop/files/patch-MainPanel.c (nonexistent) >+++ sysutils/htop/files/patch-MainPanel.c (working copy) >@@ -0,0 +1,25 @@ >+--- MainPanel.c.orig 2018-02-05 03:13:55.000000000 +0800 >++++ MainPanel.c 2018-03-05 11:27:36.539220000 +0800 >+@@ -25,7 +25,12 @@ >+ pid_t pidSearch; >+ } MainPanel; >+ >+-typedef bool(*MainPanel_ForeachProcessFn)(Process*, size_t); >++typedef union { >++ int i; >++ void* v; >++} Arg; >++ >++typedef bool(*MainPanel_ForeachProcessFn)(Process*, Arg); >+ >+ #define MainPanel_getFunctionBar(this_) (((Panel*)(this_))->defaultBar) >+ >+@@ -148,7 +153,7 @@ >+ return ""; >+ } >+ >+-bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, size_t arg, bool* wasAnyTagged) { >++bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, Arg arg, bool* wasAnyTagged) { >+ Panel* super = (Panel*) this; >+ bool ok = true; >+ bool anyTagged = false; > >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-MainPanel.h >=================================================================== >--- sysutils/htop/files/patch-MainPanel.h (nonexistent) >+++ sysutils/htop/files/patch-MainPanel.h (working copy) >@@ -0,0 +1,25 @@ >+--- MainPanel.h.orig 2018-02-05 03:13:55.000000000 +0800 >++++ MainPanel.h 2018-03-05 11:07:59.661694000 +0800 >+@@ -21,7 +21,12 @@ >+ pid_t pidSearch; >+ } MainPanel; >+ >+-typedef bool(*MainPanel_ForeachProcessFn)(Process*, size_t); >++typedef union { >++ int i; >++ void* v; >++} Arg; >++ >++typedef bool(*MainPanel_ForeachProcessFn)(Process*, Arg); >+ >+ #define MainPanel_getFunctionBar(this_) (((Panel*)(this_))->defaultBar) >+ >+@@ -34,7 +39,7 @@ >+ >+ const char* MainPanel_getValue(MainPanel* this, int i); >+ >+-bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, size_t arg, bool* wasAnyTagged); >++bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, Arg arg, bool* wasAnyTagged); >+ >+ extern PanelClass MainPanel_class; >+ > >Property changes on: sysutils/htop/files/patch-MainPanel.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-Makefile.am >=================================================================== >--- sysutils/htop/files/patch-Makefile.am (nonexistent) >+++ sysutils/htop/files/patch-Makefile.am (working copy) >@@ -0,0 +1,27 @@ >+--- Makefile.am.orig 2018-02-05 03:13:55.000000000 +0800 >++++ Makefile.am 2018-03-05 11:52:10.558173000 +0800 >+@@ -46,6 +46,7 @@ >+ endif >+ >+ if HTOP_FREEBSD >++htop_LDFLAGS += -lexecinfo >+ myhtopplatsources = freebsd/Platform.c freebsd/FreeBSDProcessList.c \ >+ freebsd/FreeBSDProcess.c freebsd/FreeBSDCRT.c freebsd/Battery.c >+ >+@@ -79,6 +80,16 @@ >+ darwin/DarwinProcessList.h darwin/DarwinCRT.h darwin/Battery.h >+ endif >+ >++if HTOP_SOLARIS >++myhtopplatsources = solaris/Platform.c \ >++solaris/SolarisProcess.c solaris/SolarisProcessList.c \ >++solaris/SolarisCRT.c solaris/Battery.c >++ >++myhtopplatheaders = solaris/Platform.h \ >++solaris/SolarisProcess.h solaris/SolarisProcessList.h \ >++solaris/SolarisCRT.h solaris/Battery.h >++endif >++ >+ if HTOP_UNSUPPORTED >+ myhtopplatsources = unsupported/Platform.c \ >+ unsupported/UnsupportedProcess.c unsupported/UnsupportedProcessList.c \ > >Property changes on: sysutils/htop/files/patch-Makefile.am >___________________________________________________________________ >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,29 @@ >+--- Meter.c.orig 2018-02-05 03:13:55.000000000 +0800 >++++ Meter.c 2018-03-05 11:04:39.091484000 +0800 >+@@ -287,7 +287,7 @@ >+ >+ int blockSizes[10]; >+ >+- xSnprintf(bar, w + 1, "%*s", w, buffer); >++ xSnprintf(bar, w + 1, "%*.*s", w, w, buffer); >+ >+ // First draw in the bar[] buffer... >+ int offset = 0; >+@@ -359,7 +359,7 @@ >+ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) { >+ >+ if (!this->drawData) this->drawData = xCalloc(1, sizeof(GraphData)); >+- GraphData* data = (GraphData*) this->drawData; >++ GraphData* data = (GraphData*) this->drawData; >+ const int nValues = METER_BUFFER_LEN; >+ >+ #ifdef HAVE_LIBNCURSESW >+@@ -404,7 +404,7 @@ >+ k = -i/2; >+ i = 0; >+ } >+- for (; i < nValues; i+=2, k++) { >++ for (; i < nValues - 1; i+=2, k++) { >+ int pix = GraphMeterMode_pixPerRow * GRAPH_HEIGHT; >+ int v1 = CLAMP((int) lround(data->values[i] * pix), 1, pix); >+ int v2 = CLAMP((int) lround(data->values[i+1] * pix), 1, pix); > >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-OpenFilesScreen.c >=================================================================== >--- sysutils/htop/files/patch-OpenFilesScreen.c (nonexistent) >+++ sysutils/htop/files/patch-OpenFilesScreen.c (working copy) >@@ -0,0 +1,11 @@ >+--- OpenFilesScreen.c.orig 2018-02-05 03:13:55.000000000 +0800 >++++ OpenFilesScreen.c 2018-03-05 11:08:13.784686000 +0800 >+@@ -130,7 +130,7 @@ >+ char** data = fdata->data.data; >+ int lenN = data['n'] ? strlen(data['n']) : 0; >+ int sizeEntry = 5 + 7 + 10 + 10 + 10 + lenN + 5 /*spaces*/ + 1 /*null*/; >+- char* entry = xMalloc(sizeEntry); >++ char entry[sizeEntry]; >+ xSnprintf(entry, sizeEntry, "%5.5s %7.7s %10.10s %10.10s %10.10s %s", >+ data['f'] ? data['f'] : "", >+ data['t'] ? data['t'] : "", > >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,11 @@ >+--- Panel.c.orig 2018-02-05 03:13:55.000000000 +0800 >++++ Panel.c 2018-03-05 11:03:51.586008000 +0800 >+@@ -469,7 +469,7 @@ >+ this->eventHandlerState = xCalloc(100, sizeof(char)); >+ char* buffer = this->eventHandlerState; >+ >+- if (ch < 255 && isalnum(ch)) { >++ if (ch > 0 && ch < 255 && isalnum(ch)) { >+ int len = strlen(buffer); >+ if (len < 99) { >+ buffer[len] = ch; > >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,29 @@ >+--- Process.c.orig 2018-02-05 03:13:55.000000000 +0800 >++++ Process.c 2018-03-05 11:08:26.770965000 +0800 >+@@ -28,6 +28,12 @@ >+ #include <time.h> >+ #include <assert.h> >+ #include <math.h> >++#ifdef MAJOR_IN_MKDEV >++#include <sys/mkdev.h> >++#elif defined(MAJOR_IN_SYSMACROS) || \ >++ (defined(HAVE_SYS_SYSMACROS_H) && HAVE_SYS_SYSMACROS_H) >++#include <sys/sysmacros.h> >++#endif >+ >+ #ifdef __ANDROID__ >+ #define SYS_ioprio_get __NR_ioprio_get >+@@ -536,11 +542,11 @@ >+ return (err == 0); >+ } >+ >+-bool Process_changePriorityBy(Process* this, size_t delta) { >++bool Process_changePriorityBy(Process* this, int delta) { >+ return Process_setPriority(this, this->nice + delta); >+ } >+ >+-void Process_sendSignal(Process* this, size_t sgn) { >++void Process_sendSignal(Process* this, int sgn) { >+ CRT_dropPrivileges(); >+ kill(this->pid, (int) sgn); >+ CRT_restorePrivileges(); > >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,26 @@ >+--- Process.h.orig 2018-02-05 03:13:55.000000000 +0800 >++++ Process.h 2018-03-05 11:08:38.286638000 +0800 >+@@ -9,6 +9,11 @@ >+ in the source distribution for its full text. >+ */ >+ >++#ifdef MAJOR_IN_MKDEV >++#elif defined(MAJOR_IN_SYSMACROS) || \ >++ (defined(HAVE_SYS_SYSMACROS_H) && HAVE_SYS_SYSMACROS_H) >++#endif >++ >+ #ifdef __ANDROID__ >+ #define SYS_ioprio_get __NR_ioprio_get >+ #define SYS_ioprio_set __NR_ioprio_set >+@@ -190,9 +195,9 @@ >+ >+ bool Process_setPriority(Process* this, int priority); >+ >+-bool Process_changePriorityBy(Process* this, size_t delta); >++bool Process_changePriorityBy(Process* this, int delta); >+ >+-void Process_sendSignal(Process* this, size_t sgn); >++void Process_sendSignal(Process* this, int sgn); >+ >+ long Process_pidCompare(const void* v1, const void* v2); >+ > >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-RichString.c >=================================================================== >--- sysutils/htop/files/patch-RichString.c (nonexistent) >+++ sysutils/htop/files/patch-RichString.c (working copy) >@@ -0,0 +1,29 @@ >+--- RichString.c.orig 2018-02-05 03:13:55.000000000 +0800 >++++ RichString.c 2018-03-05 11:11:38.646296000 +0800 >+@@ -63,6 +63,10 @@ >+ >+ }*/ >+ >++#ifndef CLAMP >++#define CLAMP(x,low,high) (((x)>(high))?(high):(((x)<(low))?(low):(x))) >++#endif >++ >+ #define charBytes(n) (sizeof(CharType) * (n)) >+ >+ static void RichString_extendLen(RichString* this, int len) { >+@@ -103,6 +107,7 @@ >+ >+ inline void RichString_setAttrn(RichString* this, int attrs, int start, int finish) { >+ cchar_t* ch = this->chptr + start; >++ finish = CLAMP(finish, 0, this->chlen - 1); >+ for (int i = start; i <= finish; i++) { >+ ch->attr = attrs; >+ ch++; >+@@ -132,6 +137,7 @@ >+ >+ void RichString_setAttrn(RichString* this, int attrs, int start, int finish) { >+ chtype* ch = this->chptr + start; >++ finish = CLAMP(finish, 0, this->chlen - 1); >+ for (int i = start; i <= finish; i++) { >+ *ch = (*ch & 0xff) | attrs; >+ ch++; > >Property changes on: sysutils/htop/files/patch-RichString.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-RichString.h >=================================================================== >--- sysutils/htop/files/patch-RichString.h (nonexistent) >+++ sysutils/htop/files/patch-RichString.h (working copy) >@@ -0,0 +1,13 @@ >+--- RichString.h.orig 2018-02-05 03:13:55.000000000 +0800 >++++ RichString.h 2018-03-05 11:11:53.173786000 +0800 >+@@ -59,6 +59,10 @@ >+ } RichString; >+ >+ >++#ifndef CLAMP >++#define CLAMP(x,low,high) (((x)>(high))?(high):(((x)<(low))?(low):(x))) >++#endif >++ >+ #define charBytes(n) (sizeof(CharType) * (n)) >+ >+ #define RichString_setLen(this, len) do{ if(len < RICHSTRING_MAXLEN && this->chlen < RICHSTRING_MAXLEN) { RichString_setChar(this,len,0); this->chlen=len; } else RichString_extendLen(this,len); }while(0) > >Property changes on: sysutils/htop/files/patch-RichString.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-Settings.c >=================================================================== >--- sysutils/htop/files/patch-Settings.c (nonexistent) >+++ sysutils/htop/files/patch-Settings.c (working copy) >@@ -0,0 +1,110 @@ >+--- Settings.c.orig 2018-02-05 03:13:55.000000000 +0800 >++++ Settings.c 2018-03-05 11:10:14.268124000 +0800 >+@@ -172,7 +172,8 @@ >+ if (!fd) >+ return false; >+ >+- bool readMeters = false; >++ bool didReadMeters = false; >++ bool didReadFields = false; >+ for (;;) { >+ char* line = String_readLine(fd); >+ if (!line) { >+@@ -187,6 +188,7 @@ >+ } >+ if (String_eq(option[0], "fields")) { >+ readFields(this->fields, &(this->flags), option[1]); >++ didReadFields = true; >+ } else if (String_eq(option[0], "sort_key")) { >+ // This "+1" is for compatibility with the older enum format. >+ this->sortKey = atoi(option[1]) + 1; >+@@ -232,24 +234,24 @@ >+ if (this->colorScheme < 0 || this->colorScheme >= LAST_COLORSCHEME) this->colorScheme = 0; >+ } else if (String_eq(option[0], "left_meters")) { >+ Settings_readMeters(this, option[1], 0); >+- readMeters = true; >++ didReadMeters = true; >+ } else if (String_eq(option[0], "right_meters")) { >+ Settings_readMeters(this, option[1], 1); >+- readMeters = true; >++ didReadMeters = true; >+ } else if (String_eq(option[0], "left_meter_modes")) { >+ Settings_readMeterModes(this, option[1], 0); >+- readMeters = true; >++ didReadMeters = true; >+ } else if (String_eq(option[0], "right_meter_modes")) { >+ Settings_readMeterModes(this, option[1], 1); >+- readMeters = true; >++ didReadMeters = true; >+ } >+ String_freeArray(option); >+ } >+ fclose(fd); >+- if (!readMeters) { >++ if (!didReadMeters) { >+ Settings_defaultMeters(this); >+ } >+- return true; >++ return didReadFields; >+ } >+ >+ static void writeFields(FILE* fd, ProcessField* fields, const char* name) { >+@@ -380,10 +382,8 @@ >+ free(htopDir); >+ free(configDir); >+ struct stat st; >+- if (lstat(legacyDotfile, &st) != 0) { >+- st.st_mode = 0; >+- } >+- if (access(legacyDotfile, R_OK) != 0 || S_ISLNK(st.st_mode)) { >++ int err = lstat(legacyDotfile, &st); >++ if (err || S_ISLNK(st.st_mode)) { >+ free(legacyDotfile); >+ legacyDotfile = NULL; >+ } >+@@ -392,28 +392,33 @@ >+ this->colorScheme = 0; >+ this->changed = false; >+ this->delay = DEFAULT_DELAY; >+- bool ok = Settings_read(this, legacyDotfile ? legacyDotfile : this->filename); >+- if (ok) { >+- if (legacyDotfile) { >++ bool ok = false; >++ if (legacyDotfile) { >++ ok = Settings_read(this, legacyDotfile); >++ if (ok) { >+ // Transition to new location and delete old configuration file >+ if (Settings_write(this)) >+ unlink(legacyDotfile); >+ } >+- } else { >++ free(legacyDotfile); >++ } >++ if (!ok) { >++ ok = Settings_read(this, this->filename); >++ } >++ if (!ok) { >+ this->changed = true; >+ // TODO: how to get SYSCONFDIR correctly through Autoconf? >+ char* systemSettings = String_cat(SYSCONFDIR, "/htoprc"); >+ ok = Settings_read(this, systemSettings); >+ free(systemSettings); >+- if (!ok) { >+- Settings_defaultMeters(this); >+- this->hideKernelThreads = true; >+- this->highlightMegabytes = true; >+- this->highlightThreads = true; >+- this->headerMargin = true; >+- } >+ } >+- free(legacyDotfile); >++ if (!ok) { >++ Settings_defaultMeters(this); >++ this->hideKernelThreads = true; >++ this->highlightMegabytes = true; >++ this->highlightThreads = true; >++ this->headerMargin = true; >++ } >+ return this; >+ } >+ > >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-TraceScreen.c >=================================================================== >--- sysutils/htop/files/patch-TraceScreen.c (nonexistent) >+++ sysutils/htop/files/patch-TraceScreen.c (working copy) >@@ -0,0 +1,12 @@ >+--- TraceScreen.c.orig 2018-02-05 03:13:55.000000000 +0800 >++++ TraceScreen.c 2018-03-05 11:08:52.936617000 +0800 >+@@ -108,7 +108,8 @@ >+ (void) written; >+ exit(1); >+ } >+- fcntl(this->fdpair[0], F_SETFL, O_NONBLOCK); >++ int ok = fcntl(this->fdpair[0], F_SETFL, O_NONBLOCK); >++ if (ok == -1) return false; >+ this->strace = fdopen(this->fdpair[0], "r"); >+ this->fd_strace = fileno(this->strace); >+ return true; > >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-Vector.c >=================================================================== >--- sysutils/htop/files/patch-Vector.c (nonexistent) >+++ sysutils/htop/files/patch-Vector.c (working copy) >@@ -0,0 +1,22 @@ >+--- Vector.c.orig 2018-02-05 03:13:55.000000000 +0800 >++++ Vector.c 2018-03-05 11:04:17.096232000 +0800 >+@@ -284,11 +284,19 @@ >+ >+ #endif >+ >++#ifdef DEBUG >++ >+ inline int Vector_size(Vector* this) { >+ assert(Vector_isConsistent(this)); >+ return this->items; >+ } >+ >++#else >++ >++#define Vector_size(v_) ((v_)->items) >++ >++#endif >++ >+ /* >+ >+ static void Vector_merge(Vector* this, Vector* v2) { > >Property changes on: sysutils/htop/files/patch-Vector.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-Vector.h >=================================================================== >--- sysutils/htop/files/patch-Vector.h (nonexistent) >+++ sysutils/htop/files/patch-Vector.h (working copy) >@@ -0,0 +1,19 @@ >+--- Vector.h.orig 2018-02-05 03:13:55.000000000 +0800 >++++ Vector.h 2018-03-05 11:04:20.553919000 +0800 >+@@ -70,8 +70,16 @@ >+ >+ #endif >+ >++#ifdef DEBUG >++ >+ extern int Vector_size(Vector* this); >+ >++#else >++ >++#define Vector_size(v_) ((v_)->items) >++ >++#endif >++ >+ /* >+ >+ */ > >Property changes on: sysutils/htop/files/patch-Vector.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,96 @@ >+--- configure.ac.orig 2018-02-05 03:13:55.000000000 +0800 >++++ configure.ac 2018-03-05 11:02:09.548040000 +0800 >+@@ -43,6 +43,9 @@ >+ darwin*) >+ my_htop_platform=darwin >+ ;; >++solaris*) >++ my_htop_platform=solaris >++ ;; >+ *) >+ my_htop_platform=unsupported >+ ;; >+@@ -61,6 +64,16 @@ >+ ]) >+ AC_CHECK_HEADERS([execinfo.h],[:],[:]) >+ >++AC_HEADER_MAJOR >++dnl glibc 2.25 deprecates 'major' and 'minor' in <sys/types.h> and requires to >++dnl include <sys/sysmacros.h>. However the logic in AC_HEADER_MAJOR has not yet >++dnl been updated in Autoconf 2.69, so use a workaround: >++m4_version_prereq([2.70], [], >++[if test "x$ac_cv_header_sys_mkdev_h" = xno; then >++ AC_CHECK_HEADER(sys/sysmacros.h, [AC_DEFINE(MAJOR_IN_SYSMACROS, 1, >++ [Define to 1 if `major', `minor', and `makedev' are declared in <sys/sysmacros.h>.])]) >++fi]) >++ >+ # Checks for typedefs, structures, and compiler characteristics. >+ # ---------------------------------------------------------------------- >+ AC_HEADER_STDBOOL >+@@ -154,20 +167,26 @@ >+ [ >+ if test ! -z "m4_toupper($HTOP_[$1]_CONFIG_SCRIPT)"; then >+ # to be used to set the path to ncurses*-config when cross-compiling >+- htop_config_script=$(m4_toupper($HTOP_[$1]_CONFIG_SCRIPT) --libs 2> /dev/null) >++ htop_config_script_libs=$(m4_toupper($HTOP_[$1]_CONFIG_SCRIPT) --libs 2> /dev/null) >++ htop_config_script_cflags=$(m4_toupper($HTOP_[$1]_CONFIG_SCRIPT) --cflags 2> /dev/null) >+ else >+- htop_config_script=$([$4] --libs 2> /dev/null) >++ htop_config_script_libs=$([$4] --libs 2> /dev/null) >++ htop_config_script_cflags=$([$4] --cflags 2> /dev/null) >+ fi >+ htop_script_success=no >+ htop_save_LDFLAGS="$LDFLAGS" >+- if test ! "x$htop_config_script" = x; then >+- LDFLAGS="$htop_config_script $LDFLAGS" >++ htop_save_CFLAGS="$CFLAGS" >++ if test ! "x$htop_config_script_libs" = x; then >++ LDFLAGS="$htop_config_script_libs $LDFLAGS" >++ CFLAGS="$htop_config_script_cflags $CFLAGS" >+ AC_CHECK_LIB([$1], [$2], [ >+ AC_DEFINE([$3], 1, [The library is present.]) >+- LIBS="$htop_config_script $LIBS " >++ LIBS="$htop_config_script_libs $LIBS " >+ htop_script_success=yes >+- ], []) >+- LDFLAGS="$save_LDFLAGS" >++ ], [ >++ CFLAGS="$htop_save_CFLAGS" >++ ]) >++ LDFLAGS="$htop_save_LDFLAGS" >+ fi >+ if test "x$htop_script_success" = xno; then >+ [$5] >+@@ -222,6 +241,10 @@ >+ AC_CHECK_LIB([kvm], [kvm_open], [], [missing_libraries="$missing_libraries libkvm"]) >+ fi >+ >++if test "$my_htop_platform" = "solaris"; then >++ AC_CHECK_LIB([kstat], [kstat_open], [], [missing_libraries="$missing_libraries libkstat"]) >++fi >++ >+ AC_ARG_ENABLE(linux_affinity, [AS_HELP_STRING([--enable-linux-affinity], [enable Linux sched_setaffinity and sched_getaffinity for affinity support, disables hwloc])], ,enable_linux_affinity="yes") >+ if test "x$enable_linux_affinity" = xyes -a "x$cross_compiling" = xno; then >+ AC_MSG_CHECKING([for usable sched_setaffinity]) >+@@ -259,10 +282,11 @@ >+ AC_ARG_ENABLE(delayacct, [AS_HELP_STRING([--enable-delayacct], [enable linux delay accounting])],, enable_delayacct="no") >+ if test "x$enable_delayacct" = xyes >+ then >++ PKG_PROG_PKG_CONFIG() >+ PKG_CHECK_MODULES(LIBNL3, libnl-3.0, [], [missing_libraries="$missing_libraries libnl-3"]) >+ PKG_CHECK_MODULES(LIBNL3GENL, libnl-genl-3.0, [], [missing_libraries="$missing_libraries libnl-genl-3"]) >+- CFLAGS+=" $LIBNL3_CFLAGS $LIBNL3GENL_CFLAGS" >+- LIBS+=" $LIBNL3_LIBS $LIBNL3GENL_LIBS" >++ CFLAGS="$CFLAGS $LIBNL3_CFLAGS $LIBNL3GENL_CFLAGS" >++ LIBS="$LIBS $LIBNL3_LIBS $LIBNL3GENL_LIBS" >+ AC_DEFINE(HAVE_DELAYACCT, 1, [Define if delay accounting support should be enabled.]) >+ fi >+ >+@@ -285,6 +309,7 @@ >+ AM_CONDITIONAL([HTOP_DRAGONFLYBSD], [test "$my_htop_platform" = dragonflybsd]) >+ AM_CONDITIONAL([HTOP_OPENBSD], [test "$my_htop_platform" = openbsd]) >+ AM_CONDITIONAL([HTOP_DARWIN], [test "$my_htop_platform" = darwin]) >++AM_CONDITIONAL([HTOP_SOLARIS], [test "$my_htop_platform" = solaris]) >+ AM_CONDITIONAL([HTOP_UNSUPPORTED], [test "$my_htop_platform" = unsupported]) >+ AC_SUBST(my_htop_platform) >+ AC_CONFIG_FILES([Makefile htop.1]) > >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-03-05 11:52:38.475619000 +0800 >++++ freebsd/FreeBSDCRT.c 2018-03-05 11:53:13.818888000 +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,13 @@ >+--- freebsd/FreeBSDCRT.h.orig 2018-03-05 11:53:21.418988000 +0800 >++++ freebsd/FreeBSDCRT.h 2018-03-05 11:53:35.166531000 +0800 >+@@ -9,7 +9,9 @@ >+ in the source distribution for its full text. >+ */ >+ >++#ifdef HAVE_EXECINFO_H >++#endif >++ >+ void CRT_handleSIGSEGV(int sgn); >+ >+- >+ #endif > >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-linux__Battery.c >=================================================================== >--- sysutils/htop/files/patch-linux__Battery.c (nonexistent) >+++ sysutils/htop/files/patch-linux__Battery.c (working copy) >@@ -0,0 +1,20 @@ >+--- linux/Battery.c.orig 2018-02-05 03:13:55.000000000 +0800 >++++ linux/Battery.c 2018-03-05 11:06:56.578089000 +0800 >+@@ -110,16 +110,13 @@ >+ char statePath[50]; >+ xSnprintf((char *) statePath, sizeof statePath, "%s/%s/state", power_supplyPath, entryName); >+ FILE* file = fopen(statePath, "r"); >+- >+ if (!file) { >+ isOn = AC_ERROR; >+ continue; >+ } >+- >+ char* line = String_readLine(file); >+- if (!line) continue; >+- >+ fclose(file); >++ if (!line) continue; >+ >+ const char *isOnline = String_getToken(line, 2); >+ free(line); > >Property changes on: sysutils/htop/files/patch-linux__Battery.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-linux__LinuxProcessList.c >=================================================================== >--- sysutils/htop/files/patch-linux__LinuxProcessList.c (nonexistent) >+++ sysutils/htop/files/patch-linux__LinuxProcessList.c (working copy) >@@ -0,0 +1,86 @@ >+--- linux/LinuxProcessList.c.orig 2018-02-05 03:13:55.000000000 +0800 >++++ linux/LinuxProcessList.c 2018-03-05 11:05:44.767498000 +0800 >+@@ -26,6 +26,12 @@ >+ #include <assert.h> >+ #include <sys/types.h> >+ #include <fcntl.h> >++#ifdef MAJOR_IN_MKDEV >++#include <sys/mkdev.h> >++#elif defined(MAJOR_IN_SYSMACROS) || \ >++ (defined(HAVE_SYS_SYSMACROS_H) && HAVE_SYS_SYSMACROS_H) >++#include <sys/sysmacros.h> >++#endif >+ >+ #ifdef HAVE_DELAYACCT >+ #include <netlink/attr.h> >+@@ -436,7 +442,7 @@ >+ } >+ break; >+ case 's': >+- if (line[5] == 'r' && strncmp(line+1, "yscr: ", 6) == 0) { >++ if (line[4] == 'r' && strncmp(line+1, "yscr: ", 6) == 0) { >+ process->io_syscr = strtoull(line+7, NULL, 10); >+ } else if (strncmp(line+1, "yscw: ", 6) == 0) { >+ process->io_syscw = strtoull(line+7, NULL, 10); >+@@ -595,36 +601,36 @@ >+ >+ static int handleNetlinkMsg(struct nl_msg *nlmsg, void *linuxProcess) { >+ struct nlmsghdr *nlhdr; >+- struct nlattr *nlattrs[TASKSTATS_TYPE_MAX + 1]; >+- struct nlattr *nlattr; >+- struct taskstats *stats; >+- int rem; >+- unsigned long long int timeDelta; >+- LinuxProcess* lp = (LinuxProcess*) linuxProcess; >++ struct nlattr *nlattrs[TASKSTATS_TYPE_MAX + 1]; >++ struct nlattr *nlattr; >++ struct taskstats *stats; >++ int rem; >++ unsigned long long int timeDelta; >++ LinuxProcess* lp = (LinuxProcess*) linuxProcess; >+ >+- nlhdr = nlmsg_hdr(nlmsg); >++ nlhdr = nlmsg_hdr(nlmsg); >+ >+ if (genlmsg_parse(nlhdr, 0, nlattrs, TASKSTATS_TYPE_MAX, NULL) < 0) { >+ return NL_SKIP; >+- } >++ } >+ >+- if ((nlattr = nlattrs[TASKSTATS_TYPE_AGGR_PID]) || (nlattr = nlattrs[TASKSTATS_TYPE_NULL])) { >+- stats = nla_data(nla_next(nla_data(nlattr), &rem)); >+- assert(lp->super.pid == stats->ac_pid); >+- timeDelta = (stats->ac_etime*1000 - lp->delay_read_time); >+- #define BOUNDS(x) isnan(x) ? 0.0 : (x > 100) ? 100.0 : x; >+- #define DELTAPERC(x,y) BOUNDS((float) (x - y) / timeDelta * 100); >+- lp->cpu_delay_percent = DELTAPERC(stats->cpu_delay_total, lp->cpu_delay_total); >+- lp->blkio_delay_percent = DELTAPERC(stats->blkio_delay_total, lp->blkio_delay_total); >+- lp->swapin_delay_percent = DELTAPERC(stats->swapin_delay_total, lp->swapin_delay_total); >+- #undef DELTAPERC >+- #undef BOUNDS >+- lp->swapin_delay_total = stats->swapin_delay_total; >+- lp->blkio_delay_total = stats->blkio_delay_total; >+- lp->cpu_delay_total = stats->cpu_delay_total; >+- lp->delay_read_time = stats->ac_etime*1000; >+- } >+- return NL_OK; >++ if ((nlattr = nlattrs[TASKSTATS_TYPE_AGGR_PID]) || (nlattr = nlattrs[TASKSTATS_TYPE_NULL])) { >++ stats = nla_data(nla_next(nla_data(nlattr), &rem)); >++ assert(lp->super.pid == stats->ac_pid); >++ timeDelta = (stats->ac_etime*1000 - lp->delay_read_time); >++ #define BOUNDS(x) isnan(x) ? 0.0 : (x > 100) ? 100.0 : x; >++ #define DELTAPERC(x,y) BOUNDS((float) (x - y) / timeDelta * 100); >++ lp->cpu_delay_percent = DELTAPERC(stats->cpu_delay_total, lp->cpu_delay_total); >++ lp->blkio_delay_percent = DELTAPERC(stats->blkio_delay_total, lp->blkio_delay_total); >++ lp->swapin_delay_percent = DELTAPERC(stats->swapin_delay_total, lp->swapin_delay_total); >++ #undef DELTAPERC >++ #undef BOUNDS >++ lp->swapin_delay_total = stats->swapin_delay_total; >++ lp->blkio_delay_total = stats->blkio_delay_total; >++ lp->cpu_delay_total = stats->cpu_delay_total; >++ lp->delay_read_time = stats->ac_etime*1000; >++ } >++ return NL_OK; >+ } >+ >+ static void LinuxProcessList_readDelayAcctData(LinuxProcessList* this, LinuxProcess* process) { > >Property changes on: sysutils/htop/files/patch-linux__LinuxProcessList.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-linux__LinuxProcessList.h >=================================================================== >--- sysutils/htop/files/patch-linux__LinuxProcessList.h (nonexistent) >+++ sysutils/htop/files/patch-linux__LinuxProcessList.h (working copy) >@@ -0,0 +1,14 @@ >+--- linux/LinuxProcessList.h.orig 2018-02-05 03:13:55.000000000 +0800 >++++ linux/LinuxProcessList.h 2018-03-05 11:12:31.037178000 +0800 >+@@ -9,6 +9,11 @@ >+ in the source distribution for its full text. >+ */ >+ >++#ifdef MAJOR_IN_MKDEV >++#elif defined(MAJOR_IN_SYSMACROS) || \ >++ (defined(HAVE_SYS_SYSMACROS_H) && HAVE_SYS_SYSMACROS_H) >++#endif >++ >+ #ifdef HAVE_DELAYACCT >+ #endif >+ > >Property changes on: sysutils/htop/files/patch-linux__LinuxProcessList.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-linux__Platform.c >=================================================================== >--- sysutils/htop/files/patch-linux__Platform.c (nonexistent) >+++ sysutils/htop/files/patch-linux__Platform.c (working copy) >@@ -0,0 +1,11 @@ >+--- linux/Platform.c.orig 2018-02-05 03:13:55.000000000 +0800 >++++ linux/Platform.c 2018-03-05 11:09:12.273644000 +0800 >+@@ -96,7 +96,7 @@ >+ void* set = Action_pickFromVector(st, ioprioPanel, 21); >+ if (set) { >+ IOPriority ioprio = IOPriorityPanel_getIOPriority(ioprioPanel); >+- bool ok = MainPanel_foreachProcess((MainPanel*)panel, (MainPanel_ForeachProcessFn) LinuxProcess_setIOPriority, (size_t) ioprio, NULL); >++ bool ok = MainPanel_foreachProcess((MainPanel*)panel, (MainPanel_ForeachProcessFn) LinuxProcess_setIOPriority, (Arg){ .i = ioprio }, NULL); >+ if (!ok) >+ beep(); >+ } > >Property changes on: sysutils/htop/files/patch-linux__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-solaris__Battery.c >=================================================================== >--- sysutils/htop/files/patch-solaris__Battery.c (nonexistent) >+++ sysutils/htop/files/patch-solaris__Battery.c (working copy) >@@ -0,0 +1,11 @@ >+--- /dev/null 2018-03-05 11:11:00.000000000 +0800 >++++ solaris/Battery.c 2018-03-05 11:15:52.015358000 +0800 >+@@ -0,0 +1,8 @@ >++ >++#include "BatteryMeter.h" >++ >++void Battery_getData(double* level, ACPresence* isOnAC) { >++ *level = -1; >++ *isOnAC = AC_ERROR; >++} >++ > >Property changes on: sysutils/htop/files/patch-solaris__Battery.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-solaris__Battery.h >=================================================================== >--- sysutils/htop/files/patch-solaris__Battery.h (nonexistent) >+++ sysutils/htop/files/patch-solaris__Battery.h (working copy) >@@ -0,0 +1,12 @@ >+--- /dev/null 2018-03-05 11:22:00.000000000 +0800 >++++ solaris/Battery.h 2018-03-05 11:15:52.015379000 +0800 >+@@ -0,0 +1,9 @@ >++/* Do not edit this file. It was automatically generated. */ >++ >++#ifndef HEADER_Battery >++#define HEADER_Battery >++ >++void Battery_getData(double* level, ACPresence* isOnAC); >++ >++ >++#endif > >Property changes on: sysutils/htop/files/patch-solaris__Battery.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-solaris__Platform.c >=================================================================== >--- sysutils/htop/files/patch-solaris__Platform.c (nonexistent) >+++ sysutils/htop/files/patch-solaris__Platform.c (working copy) >@@ -0,0 +1,217 @@ >+--- /dev/null 2018-03-05 11:22:00.000000000 +0800 >++++ solaris/Platform.c 2018-03-05 11:15:52.015400000 +0800 >+@@ -0,0 +1,214 @@ >++/* >++htop - solaris/Platform.c >++(C) 2014 Hisham H. Muhammad >++(C) 2015 David C. Hunt >++(C) 2017 Guy M. Broome >++Released under the GNU GPL, see the COPYING file >++in the source distribution for its full text. >++*/ >++ >++#include "Platform.h" >++#include "Meter.h" >++#include "CPUMeter.h" >++#include "MemoryMeter.h" >++#include "SwapMeter.h" >++#include "TasksMeter.h" >++#include "LoadAverageMeter.h" >++#include "ClockMeter.h" >++#include "HostnameMeter.h" >++#include "UptimeMeter.h" >++#include "SolarisProcess.h" >++#include "SolarisProcessList.h" >++ >++#include <sys/types.h> >++#include <sys/time.h> >++#include <sys/resource.h> >++#include <utmpx.h> >++#include <sys/loadavg.h> >++#include <string.h> >++#include <kstat.h> >++#include <time.h> >++#include <math.h> >++#include <sys/var.h> >++ >++/*{ >++#include "Action.h" >++#include "BatteryMeter.h" >++#include "SignalsPanel.h" >++#include <sys/mkdev.h> >++ >++extern ProcessFieldData Process_fields[]; >++typedef struct var kvar_t; >++ >++}*/ >++ >++double plat_loadavg[3] = {0}; >++ >++const SignalItem Platform_signals[] = { >++ { .name = " 0 Cancel", .number = 0 }, >++ { .name = " 1 SIGHUP", .number = 1 }, >++ { .name = " 2 SIGINT", .number = 2 }, >++ { .name = " 3 SIGQUIT", .number = 3 }, >++ { .name = " 4 SIGILL", .number = 4 }, >++ { .name = " 5 SIGTRAP", .number = 5 }, >++ { .name = " 6 SIGABRT/IOT", .number = 6 }, >++ { .name = " 7 SIGEMT", .number = 7 }, >++ { .name = " 8 SIGFPE", .number = 8 }, >++ { .name = " 9 SIGKILL", .number = 9 }, >++ { .name = "10 SIGBUS", .number = 10 }, >++ { .name = "11 SIGSEGV", .number = 11 }, >++ { .name = "12 SIGSYS", .number = 12 }, >++ { .name = "13 SIGPIPE", .number = 13 }, >++ { .name = "14 SIGALRM", .number = 14 }, >++ { .name = "15 SIGTERM", .number = 15 }, >++ { .name = "16 SIGUSR1", .number = 16 }, >++ { .name = "17 SIGUSR2", .number = 17 }, >++ { .name = "18 SIGCHLD/CLD", .number = 18 }, >++ { .name = "19 SIGPWR", .number = 19 }, >++ { .name = "20 SIGWINCH", .number = 20 }, >++ { .name = "21 SIGURG", .number = 21 }, >++ { .name = "22 SIGPOLL/IO", .number = 22 }, >++ { .name = "23 SIGSTOP", .number = 23 }, >++ { .name = "24 SIGTSTP", .number = 24 }, >++ { .name = "25 SIGCONT", .number = 25 }, >++ { .name = "26 SIGTTIN", .number = 26 }, >++ { .name = "27 SIGTTOU", .number = 27 }, >++ { .name = "28 SIGVTALRM", .number = 28 }, >++ { .name = "29 SIGPROF", .number = 29 }, >++ { .name = "30 SIGXCPU", .number = 30 }, >++ { .name = "31 SIGXFSZ", .number = 31 }, >++ { .name = "32 SIGWAITING", .number = 32 }, >++ { .name = "33 SIGLWP", .number = 33 }, >++ { .name = "34 SIGFREEZE", .number = 34 }, >++ { .name = "35 SIGTHAW", .number = 35 }, >++ { .name = "36 SIGCANCEL", .number = 36 }, >++ { .name = "37 SIGLOST", .number = 37 }, >++ { .name = "38 SIGXRES", .number = 38 }, >++ { .name = "39 SIGJVM1", .number = 39 }, >++ { .name = "40 SIGJVM2", .number = 40 }, >++ { .name = "41 SIGINFO", .number = 41 }, >++}; >++ >++const unsigned int Platform_numberOfSignals = sizeof(Platform_signals)/sizeof(SignalItem); >++ >++ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_SIZE, M_RESIDENT, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 }; >++ >++MeterClass* Platform_meterTypes[] = { >++ &CPUMeter_class, >++ &ClockMeter_class, >++ &LoadAverageMeter_class, >++ &LoadMeter_class, >++ &MemoryMeter_class, >++ &SwapMeter_class, >++ &TasksMeter_class, >++ &BatteryMeter_class, >++ &HostnameMeter_class, >++ &UptimeMeter_class, >++ &AllCPUsMeter_class, >++ &AllCPUs2Meter_class, >++ &LeftCPUsMeter_class, >++ &RightCPUsMeter_class, >++ &LeftCPUs2Meter_class, >++ &RightCPUs2Meter_class, >++ &BlankMeter_class, >++ NULL >++}; >++ >++void Platform_setBindings(Htop_Action* keys) { >++ (void) keys; >++} >++ >++int Platform_numberOfFields = LAST_PROCESSFIELD; >++ >++extern char Process_pidFormat[20]; >++ >++int Platform_getUptime() { >++ int boot_time = 0; >++ int curr_time = time(NULL); >++ struct utmpx * ent; >++ >++ while (( ent = getutxent() )) { >++ if ( !strcmp("system boot", ent->ut_line )) { >++ boot_time = ent->ut_tv.tv_sec; >++ } >++ } >++ >++ endutxent(); >++ >++ return (curr_time-boot_time); >++} >++ >++void Platform_getLoadAverage(double* one, double* five, double* fifteen) { >++ getloadavg( plat_loadavg, 3 ); >++ *one = plat_loadavg[LOADAVG_1MIN]; >++ *five = plat_loadavg[LOADAVG_5MIN]; >++ *fifteen = plat_loadavg[LOADAVG_15MIN]; >++} >++ >++int Platform_getMaxPid() { >++ kstat_ctl_t *kc = NULL; >++ kstat_t *kshandle = NULL; >++ kvar_t *ksvar = NULL; >++ int vproc = 32778; // Reasonable Solaris default >++ kc = kstat_open(); >++ if (kc != NULL) { kshandle = kstat_lookup(kc,"unix",0,"var"); } >++ if (kshandle != NULL) { kstat_read(kc,kshandle,NULL); } >++ ksvar = kshandle->ks_data; >++ if (ksvar->v_proc > 0 ) { >++ vproc = ksvar->v_proc; >++ } >++ if (kc != NULL) { kstat_close(kc); } >++ return vproc; >++} >++ >++double Platform_setCPUValues(Meter* this, int cpu) { >++ SolarisProcessList* spl = (SolarisProcessList*) this->pl; >++ int cpus = this->pl->cpuCount; >++ CPUData* cpuData = NULL; >++ >++ if (cpus == 1) { >++ // single CPU box has everything in spl->cpus[0] >++ cpuData = &(spl->cpus[0]); >++ } else { >++ cpuData = &(spl->cpus[cpu]); >++ } >++ >++ double percent; >++ double* v = this->values; >++ >++ v[CPU_METER_NICE] = cpuData->nicePercent; >++ v[CPU_METER_NORMAL] = cpuData->userPercent; >++ if (this->pl->settings->detailedCPUTime) { >++ v[CPU_METER_KERNEL] = cpuData->systemPercent; >++ v[CPU_METER_IRQ] = cpuData->irqPercent; >++ Meter_setItems(this, 4); >++ percent = v[0]+v[1]+v[2]+v[3]; >++ } else { >++ v[2] = cpuData->systemAllPercent; >++ Meter_setItems(this, 3); >++ percent = v[0]+v[1]+v[2]; >++ } >++ >++ percent = CLAMP(percent, 0.0, 100.0); >++ if (isnan(percent)) percent = 0.0; >++ return percent; >++} >++ >++void Platform_setMemoryValues(Meter* this) { >++ ProcessList* pl = (ProcessList*) this->pl; >++ this->total = pl->totalMem; >++ this->values[0] = pl->usedMem; >++ this->values[1] = pl->buffersMem; >++ this->values[2] = pl->cachedMem; >++} >++ >++void Platform_setSwapValues(Meter* this) { >++ ProcessList* pl = (ProcessList*) this->pl; >++ this->total = pl->totalSwap; >++ this->values[0] = pl->usedSwap; >++} >++ >++char* Platform_getProcessEnv(pid_t pid) { >++ (void) pid; >++ return NULL; >++} > >Property changes on: sysutils/htop/files/patch-solaris__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-solaris__Platform.h >=================================================================== >--- sysutils/htop/files/patch-solaris__Platform.h (nonexistent) >+++ sysutils/htop/files/patch-solaris__Platform.h (working copy) >@@ -0,0 +1,56 @@ >+--- /dev/null 2018-03-05 11:22:00.000000000 +0800 >++++ solaris/Platform.h 2018-03-05 11:15:52.015419000 +0800 >+@@ -0,0 +1,53 @@ >++/* Do not edit this file. It was automatically generated. */ >++ >++#ifndef HEADER_Platform >++#define HEADER_Platform >++/* >++htop - solaris/Platform.h >++(C) 2014 Hisham H. Muhammad >++(C) 2015 David C. Hunt >++(C) 2017 Guy M. Broome >++Released under the GNU GPL, see the COPYING file >++in the source distribution for its full text. >++*/ >++ >++#include "Action.h" >++#include "BatteryMeter.h" >++#include "SignalsPanel.h" >++#include <sys/mkdev.h> >++ >++extern ProcessFieldData Process_fields[]; >++typedef struct var kvar_t; >++ >++ >++extern double plat_loadavg[3]; >++ >++extern const SignalItem Platform_signals[]; >++ >++extern const unsigned int Platform_numberOfSignals; >++ >++extern ProcessField Platform_defaultFields[]; >++ >++extern MeterClass* Platform_meterTypes[]; >++ >++void Platform_setBindings(Htop_Action* keys); >++ >++extern int Platform_numberOfFields; >++ >++extern char Process_pidFormat[20]; >++ >++int Platform_getUptime(); >++ >++void Platform_getLoadAverage(double* one, double* five, double* fifteen); >++ >++int Platform_getMaxPid(); >++ >++double Platform_setCPUValues(Meter* this, int cpu); >++ >++void Platform_setMemoryValues(Meter* this); >++ >++void Platform_setSwapValues(Meter* this); >++ >++char* Platform_getProcessEnv(pid_t pid); >++ >++#endif > >Property changes on: sysutils/htop/files/patch-solaris__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-solaris__SolarisCRT.c >=================================================================== >--- sysutils/htop/files/patch-solaris__SolarisCRT.c (nonexistent) >+++ sysutils/htop/files/patch-solaris__SolarisCRT.c (working copy) >@@ -0,0 +1,24 @@ >+--- /dev/null 2018-03-05 11:22:00.000000000 +0800 >++++ solaris/SolarisCRT.c 2018-03-05 11:15:52.015436000 +0800 >+@@ -0,0 +1,21 @@ >++/* >++htop - SolarisCRT.c >++(C) 2014 Hisham H. Muhammad >++Released under the GNU GPL, see the COPYING file >++in the source distribution for its full text. >++*/ >++ >++#include "config.h" >++#include "CRT.h" >++#include <stdio.h> >++#include <stdlib.h> >++ >++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"); >++ abort(); >++} >++ > >Property changes on: sysutils/htop/files/patch-solaris__SolarisCRT.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-solaris__SolarisCRT.h >=================================================================== >--- sysutils/htop/files/patch-solaris__SolarisCRT.h (nonexistent) >+++ sysutils/htop/files/patch-solaris__SolarisCRT.h (working copy) >@@ -0,0 +1,18 @@ >+--- /dev/null 2018-03-05 11:22:00.000000000 +0800 >++++ solaris/SolarisCRT.h 2018-03-05 11:15:52.015454000 +0800 >+@@ -0,0 +1,15 @@ >++/* Do not edit this file. It was automatically generated. */ >++ >++#ifndef HEADER_SolarisCRT >++#define HEADER_SolarisCRT >++/* >++htop - SolarisCRT.h >++(C) 2014 Hisham H. Muhammad >++Released under the GNU GPL, see the COPYING file >++in the source distribution for its full text. >++*/ >++ >++void CRT_handleSIGSEGV(int sgn); >++ >++ >++#endif > >Property changes on: sysutils/htop/files/patch-solaris__SolarisCRT.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-solaris__SolarisProcess.c >=================================================================== >--- sysutils/htop/files/patch-solaris__SolarisProcess.c (nonexistent) >+++ sysutils/htop/files/patch-solaris__SolarisProcess.c (working copy) >@@ -0,0 +1,196 @@ >+--- /dev/null 2018-03-05 11:22:00.000000000 +0800 >++++ solaris/SolarisProcess.c 2018-03-05 11:15:52.015474000 +0800 >+@@ -0,0 +1,193 @@ >++/* >++htop - SolarisProcess.c >++(C) 2015 Hisham H. Muhammad >++(C) 2017 Guy M. Broome >++Released under the GNU GPL, see the COPYING file >++in the source distribution for its full text. >++*/ >++ >++#include "Process.h" >++#include "ProcessList.h" >++#include "SolarisProcess.h" >++#include "Platform.h" >++#include "CRT.h" >++ >++#include <stdlib.h> >++#include <string.h> >++#include <unistd.h> >++#include <sys/syscall.h> >++ >++/*{ >++#include "Settings.h" >++#include <zone.h> >++ >++typedef enum SolarisProcessFields { >++ // Add platform-specific fields here, with ids >= 100 >++ ZONEID = 100, >++ ZONE = 101, >++ PROJID = 102, >++ TASKID = 103, >++ POOLID = 104, >++ CONTID = 105, >++ LAST_PROCESSFIELD = 106, >++} SolarisProcessField; >++ >++ >++typedef struct SolarisProcess_ { >++ Process super; >++ int kernel; >++ zoneid_t zoneid; >++ char zname[ZONENAME_MAX+1]; >++ taskid_t taskid; >++ projid_t projid; >++ poolid_t poolid; >++ ctid_t contid; >++} SolarisProcess; >++ >++ >++#ifndef Process_isKernelThread >++#define Process_isKernelThread(_process) (_process->kernel == 1) >++#endif >++ >++#ifndef Process_isUserlandThread >++#define Process_isUserlandThread(_process) (_process->pid != _process->tgid) >++#endif >++ >++}*/ >++ >++ProcessClass SolarisProcess_class = { >++ .super = { >++ .extends = Class(Process), >++ .display = Process_display, >++ .delete = Process_delete, >++ .compare = SolarisProcess_compare >++ }, >++ .writeField = (Process_WriteField) SolarisProcess_writeField, >++}; >++ >++ProcessFieldData Process_fields[] = { >++ [0] = { .name = "", .title = NULL, .description = NULL, .flags = 0, }, >++ [PID] = { .name = "PID", .title = " PID ", .description = "Process/thread ID", .flags = 0, }, >++ [COMM] = { .name = "Command", .title = "Command ", .description = "Command line", .flags = 0, }, >++ [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 = " 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, }, >++ [PRIORITY] = { .name = "PRIORITY", .title = "PRI ", .description = "Kernel's internal priority for the process", .flags = 0, }, >++ [NICE] = { .name = "NICE", .title = " NI ", .description = "Nice value (the higher the value, the more it lets other processes take priority)", .flags = 0, }, >++ [STARTTIME] = { .name = "STARTTIME", .title = "START ", .description = "Time the process was started", .flags = 0, }, >++ [PROCESSOR] = { .name = "PROCESSOR", .title = "CPU ", .description = "Id of the CPU the process last executed on", .flags = 0, }, >++ [M_SIZE] = { .name = "M_SIZE", .title = " VIRT ", .description = "Total program size in virtual memory", .flags = 0, }, >++ [M_RESIDENT] = { .name = "M_RESIDENT", .title = " RES ", .description = "Resident set size, size of the text and data sections, plus stack usage", .flags = 0, }, >++ [ST_UID] = { .name = "ST_UID", .title = " UID ", .description = "User ID of the process owner", .flags = 0, }, >++ [PERCENT_CPU] = { .name = "PERCENT_CPU", .title = "CPU% ", .description = "Percentage of the CPU time the process used in the last sampling", .flags = 0, }, >++ [PERCENT_MEM] = { .name = "PERCENT_MEM", .title = "MEM% ", .description = "Percentage of the memory the process is using, based on resident memory size", .flags = 0, }, >++ [USER] = { .name = "USER", .title = "USER ", .description = "Username of the process owner (or user ID if name cannot be determined)", .flags = 0, }, >++ [TIME] = { .name = "TIME", .title = " TIME+ ", .description = "Total time the process has spent in user and system time", .flags = 0, }, >++ [NLWP] = { .name = "NLWP", .title = "NLWP ", .description = "Number of threads in the process", .flags = 0, }, >++ [TGID] = { .name = "TGID", .title = " TGID ", .description = "Thread group ID (i.e. process ID)", .flags = 0, }, >++ [ZONEID] = { .name = "ZONEID", .title = " ZONEID ", .description = "Zone ID", .flags = 0, }, >++ [ZONE] = { .name = "ZONE", .title = "ZONE ", .description = "Zone name", .flags = 0, }, >++ [PROJID] = { .name = "PROJID", .title = " PRJID ", .description = "Project ID", .flags = 0, }, >++ [TASKID] = { .name = "TASKID", .title = " TSKID ", .description = "Task ID", .flags = 0, }, >++ [POOLID] = { .name = "POOLID", .title = " POLID ", .description = "Pool ID", .flags = 0, }, >++ [CONTID] = { .name = "CONTID", .title = " CNTID ", .description = "Contract ID", .flags = 0, }, >++ [LAST_PROCESSFIELD] = { .name = "*** report bug! ***", .title = NULL, .description = NULL, .flags = 0, }, >++}; >++ >++ProcessPidColumn Process_pidColumns[] = { >++ { .id = ZONEID, .label = "ZONEID" }, >++ { .id = TASKID, .label = "TSKID" }, >++ { .id = PROJID, .label = "PRJID" }, >++ { .id = POOLID, .label = "POLID" }, >++ { .id = CONTID, .label = "CNTID" }, >++ { .id = PID, .label = "PID" }, >++ { .id = PPID, .label = "PPID" }, >++ { .id = TPGID, .label = "TPGID" }, >++ { .id = TGID, .label = "TGID" }, >++ { .id = PGRP, .label = "PGRP" }, >++ { .id = SESSION, .label = "SID" }, >++ { .id = 0, .label = NULL }, >++}; >++ >++SolarisProcess* SolarisProcess_new(Settings* settings) { >++ SolarisProcess* this = xCalloc(1, sizeof(SolarisProcess)); >++ Object_setClass(this, Class(SolarisProcess)); >++ Process_init(&this->super, settings); >++ return this; >++} >++ >++void Process_delete(Object* cast) { >++ SolarisProcess* this = (SolarisProcess*) cast; >++ Process_done((Process*)cast); >++ free(this->zname); >++ free(this); >++} >++ >++void SolarisProcess_writeField(Process* this, RichString* str, ProcessField field) { >++ SolarisProcess* sp = (SolarisProcess*) this; >++ char buffer[256]; buffer[255] = '\0'; >++ int attr = CRT_colors[DEFAULT_COLOR]; >++ int n = sizeof(buffer) - 1; >++ switch ((int) field) { >++ // add Solaris-specific fields here >++ case ZONEID: xSnprintf(buffer, n, Process_pidFormat, sp->zoneid); break; >++ case PROJID: xSnprintf(buffer, n, Process_pidFormat, sp->projid); break; >++ case TASKID: xSnprintf(buffer, n, Process_pidFormat, sp->taskid); break; >++ case POOLID: xSnprintf(buffer, n, Process_pidFormat, sp->poolid); break; >++ case CONTID: xSnprintf(buffer, n, Process_pidFormat, sp->contid); break; >++ case ZONE:{ >++ xSnprintf(buffer, n, "%-*s ", ZONENAME_MAX/4, sp->zname); break; >++ if (buffer[ZONENAME_MAX/4] != '\0') { >++ buffer[ZONENAME_MAX/4] = ' '; >++ buffer[(ZONENAME_MAX/4)+1] = '\0'; >++ } >++ break; >++ } >++ default: >++ Process_writeField(this, str, field); >++ return; >++ } >++ RichString_append(str, attr, buffer); >++} >++ >++long SolarisProcess_compare(const void* v1, const void* v2) { >++ SolarisProcess *p1, *p2; >++ Settings* settings = ((Process*)v1)->settings; >++ if (settings->direction == 1) { >++ p1 = (SolarisProcess*)v1; >++ p2 = (SolarisProcess*)v2; >++ } else { >++ p2 = (SolarisProcess*)v1; >++ p1 = (SolarisProcess*)v2; >++ } >++ switch ((int) settings->sortKey) { >++ case ZONEID: >++ return (p1->zoneid - p2->zoneid); >++ case PROJID: >++ return (p1->projid - p2->projid); >++ case TASKID: >++ return (p1->taskid - p2->taskid); >++ case POOLID: >++ return (p1->poolid - p2->poolid); >++ case CONTID: >++ return (p1->contid - p2->contid); >++ case ZONE: >++ return strcmp(p1->zname ? p1->zname : "global", p2->zname ? p2->zname : "global"); >++ default: >++ return Process_compare(v1, v2); >++ } >++} >++ >++bool Process_isThread(Process* this) { >++ SolarisProcess* fp = (SolarisProcess*) this; >++ >++ if (fp->kernel == 1 ) >++ return 1; >++ else >++ return 0; >++} > >Property changes on: sysutils/htop/files/patch-solaris__SolarisProcess.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-solaris__SolarisProcess.h >=================================================================== >--- sysutils/htop/files/patch-solaris__SolarisProcess.h (nonexistent) >+++ sysutils/htop/files/patch-solaris__SolarisProcess.h (working copy) >@@ -0,0 +1,68 @@ >+--- /dev/null 2018-03-05 11:22:00.000000000 +0800 >++++ solaris/SolarisProcess.h 2018-03-05 11:15:52.015492000 +0800 >+@@ -0,0 +1,65 @@ >++/* Do not edit this file. It was automatically generated. */ >++ >++#ifndef HEADER_SolarisProcess >++#define HEADER_SolarisProcess >++/* >++htop - SolarisProcess.h >++(C) 2015 Hisham H. Muhammad >++(C) 2017 Guy M. Broome >++Released under the GNU GPL, see the COPYING file >++in the source distribution for its full text. >++*/ >++ >++#include "Settings.h" >++#include <zone.h> >++ >++typedef enum SolarisProcessFields { >++ // Add platform-specific fields here, with ids >= 100 >++ ZONEID = 100, >++ ZONE = 101, >++ PROJID = 102, >++ TASKID = 103, >++ POOLID = 104, >++ CONTID = 105, >++ LAST_PROCESSFIELD = 106, >++} SolarisProcessField; >++ >++ >++typedef struct SolarisProcess_ { >++ Process super; >++ int kernel; >++ zoneid_t zoneid; >++ char zname[ZONENAME_MAX+1]; >++ taskid_t taskid; >++ projid_t projid; >++ poolid_t poolid; >++ ctid_t contid; >++} SolarisProcess; >++ >++ >++#ifndef Process_isKernelThread >++#define Process_isKernelThread(_process) (_process->kernel == 1) >++#endif >++ >++#ifndef Process_isUserlandThread >++#define Process_isUserlandThread(_process) (_process->pid != _process->tgid) >++#endif >++ >++ >++extern ProcessClass SolarisProcess_class; >++ >++extern ProcessFieldData Process_fields[]; >++ >++extern ProcessPidColumn Process_pidColumns[]; >++ >++SolarisProcess* SolarisProcess_new(Settings* settings); >++ >++void Process_delete(Object* cast); >++ >++void SolarisProcess_writeField(Process* this, RichString* str, ProcessField field); >++ >++long SolarisProcess_compare(const void* v1, const void* v2); >++ >++bool Process_isThread(Process* this); >++ >++#endif > >Property changes on: sysutils/htop/files/patch-solaris__SolarisProcess.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-solaris__SolarisProcessList.c >=================================================================== >--- sysutils/htop/files/patch-solaris__SolarisProcessList.c (nonexistent) >+++ sysutils/htop/files/patch-solaris__SolarisProcessList.c (working copy) >@@ -0,0 +1,413 @@ >+--- /dev/null 2018-03-05 11:22:00.000000000 +0800 >++++ solaris/SolarisProcessList.c 2018-03-05 11:15:52.015514000 +0800 >+@@ -0,0 +1,410 @@ >++/* >++htop - SolarisProcessList.c >++(C) 2014 Hisham H. Muhammad >++(C) 2017 Guy M. Broome >++Released under the GNU GPL, see the COPYING file >++in the source distribution for its full text. >++*/ >++ >++#include "ProcessList.h" >++#include "SolarisProcessList.h" >++#include "SolarisProcess.h" >++ >++#include <unistd.h> >++#include <stdlib.h> >++#include <sys/types.h> >++#include <sys/user.h> >++#include <err.h> >++#include <fcntl.h> >++#include <limits.h> >++#include <string.h> >++#include <procfs.h> >++#include <errno.h> >++#include <pwd.h> >++#include <dirent.h> >++#include <math.h> >++#include <time.h> >++ >++#define MAXCMDLINE 255 >++ >++/*{ >++ >++#include <kstat.h> >++#include <sys/param.h> >++#include <sys/zone.h> >++#include <sys/uio.h> >++#include <sys/resource.h> >++#include <sys/sysconf.h> >++#include <sys/sysinfo.h> >++#include <sys/swap.h> >++ >++#define ZONE_ERRMSGLEN 1024 >++char zone_errmsg[ZONE_ERRMSGLEN]; >++ >++typedef struct CPUData_ { >++ double userPercent; >++ double nicePercent; >++ double systemPercent; >++ double irqPercent; >++ double idlePercent; >++ double systemAllPercent; >++ uint64_t luser; >++ uint64_t lkrnl; >++ uint64_t lintr; >++ uint64_t lidle; >++} CPUData; >++ >++typedef struct SolarisProcessList_ { >++ ProcessList super; >++ kstat_ctl_t* kd; >++ CPUData* cpus; >++} SolarisProcessList; >++ >++}*/ >++ >++static void setCommand(Process* process, const char* command, int len) { >++ if (process->comm && process->commLen >= len) { >++ strncpy(process->comm, command, len + 1); >++ } else { >++ free(process->comm); >++ process->comm = xStrdup(command); >++ } >++ process->commLen = len; >++} >++ >++static void setZoneName(kstat_ctl_t* kd, SolarisProcess* sproc) { >++ if ( sproc->zoneid == 0 ) { >++ strncpy( sproc->zname, "global ", 11); >++ } else if ( kd == NULL ) { >++ strncpy( sproc->zname, "unknown ", 11); >++ } else { >++ kstat_t* ks = kstat_lookup( kd, "zones", sproc->zoneid, NULL ); >++ strncpy( sproc->zname, ks->ks_name, strlen(ks->ks_name) ); >++ } >++} >++ >++ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId) { >++ SolarisProcessList* spl = xCalloc(1, sizeof(SolarisProcessList)); >++ ProcessList* pl = (ProcessList*) spl; >++ ProcessList_init(pl, Class(SolarisProcess), usersTable, pidWhiteList, userId); >++ >++ spl->kd = kstat_open(); >++ >++ pl->cpuCount = sysconf(_SC_NPROCESSORS_ONLN); >++ >++ if (pl->cpuCount == 1 ) { >++ spl->cpus = xRealloc(spl->cpus, sizeof(CPUData)); >++ } else { >++ spl->cpus = xRealloc(spl->cpus, (pl->cpuCount + 1) * sizeof(CPUData)); >++ } >++ >++ return pl; >++} >++ >++static inline void SolarisProcessList_scanCPUTime(ProcessList* pl) { >++ const SolarisProcessList* spl = (SolarisProcessList*) pl; >++ int cpus = pl->cpuCount; >++ kstat_t *cpuinfo = NULL; >++ int kchain = 0; >++ kstat_named_t *idletime = NULL; >++ kstat_named_t *intrtime = NULL; >++ kstat_named_t *krnltime = NULL; >++ kstat_named_t *usertime = NULL; >++ double idlebuf = 0; >++ double intrbuf = 0; >++ double krnlbuf = 0; >++ double userbuf = 0; >++ uint64_t totaltime = 0; >++ int arrskip = 0; >++ >++ assert(cpus > 0); >++ >++ if (cpus > 1) { >++ // Store values for the stats loop one extra element up in the array >++ // to leave room for the average to be calculated afterwards >++ arrskip++; >++ } >++ >++ // Calculate per-CPU statistics first >++ for (int i = 0; i < cpus; i++) { >++ if (spl->kd != NULL) { cpuinfo = kstat_lookup(spl->kd,"cpu",i,"sys"); } >++ if (cpuinfo != NULL) { kchain = kstat_read(spl->kd,cpuinfo,NULL); } >++ if (kchain != -1 ) { >++ idletime = kstat_data_lookup(cpuinfo,"cpu_nsec_idle"); >++ intrtime = kstat_data_lookup(cpuinfo,"cpu_nsec_intr"); >++ krnltime = kstat_data_lookup(cpuinfo,"cpu_nsec_kernel"); >++ usertime = kstat_data_lookup(cpuinfo,"cpu_nsec_user"); >++ } >++ >++ assert( (idletime != NULL) && (intrtime != NULL) >++ && (krnltime != NULL) && (usertime != NULL) ); >++ >++ CPUData* cpuData = &(spl->cpus[i+arrskip]); >++ totaltime = (idletime->value.ui64 - cpuData->lidle) >++ + (intrtime->value.ui64 - cpuData->lintr) >++ + (krnltime->value.ui64 - cpuData->lkrnl) >++ + (usertime->value.ui64 - cpuData->luser); >++ // Calculate percentages of deltas since last reading >++ cpuData->userPercent = ((usertime->value.ui64 - cpuData->luser) / (double)totaltime) * 100.0; >++ cpuData->nicePercent = (double)0.0; // Not implemented on Solaris >++ cpuData->systemPercent = ((krnltime->value.ui64 - cpuData->lkrnl) / (double)totaltime) * 100.0; >++ cpuData->irqPercent = ((intrtime->value.ui64 - cpuData->lintr) / (double)totaltime) * 100.0; >++ cpuData->systemAllPercent = cpuData->systemPercent + cpuData->irqPercent; >++ cpuData->idlePercent = ((idletime->value.ui64 - cpuData->lidle) / (double)totaltime) * 100.0; >++ // Store current values to use for the next round of deltas >++ cpuData->luser = usertime->value.ui64; >++ cpuData->lkrnl = krnltime->value.ui64; >++ cpuData->lintr = intrtime->value.ui64; >++ cpuData->lidle = idletime->value.ui64; >++ // Accumulate the current percentages into buffers for later average calculation >++ if (cpus > 1) { >++ userbuf += cpuData->userPercent; >++ krnlbuf += cpuData->systemPercent; >++ intrbuf += cpuData->irqPercent; >++ idlebuf += cpuData->idlePercent; >++ } >++ } >++ >++ if (cpus > 1) { >++ CPUData* cpuData = &(spl->cpus[0]); >++ cpuData->userPercent = userbuf / cpus; >++ cpuData->nicePercent = (double)0.0; // Not implemented on Solaris >++ cpuData->systemPercent = krnlbuf / cpus; >++ cpuData->irqPercent = intrbuf / cpus; >++ cpuData->systemAllPercent = cpuData->systemPercent + cpuData->irqPercent; >++ cpuData->idlePercent = idlebuf / cpus; >++ } >++} >++ >++static inline void SolarisProcessList_scanMemoryInfo(ProcessList* pl) { >++ SolarisProcessList* spl = (SolarisProcessList*) pl; >++ kstat_t *meminfo = NULL; >++ int ksrphyserr = 0; >++ kstat_named_t *totalmem_pgs = NULL; >++ kstat_named_t *lockedmem_pgs = NULL; >++ kstat_named_t *pages = NULL; >++ struct swaptable *sl = NULL; >++ struct swapent *swapdev = NULL; >++ uint64_t totalswap = 0; >++ uint64_t totalfree = 0; >++ int nswap = 0; >++ char *spath = NULL; >++ // PAGE_SIZE is a macro to a function call. >++ // Since we use it so much in here, go ahead copy >++ // the value locally. >++ int pgsiz = PAGE_SIZE; >++ >++ // Part 1 - physical memory >++ if (spl->kd != NULL) { meminfo = kstat_lookup(spl->kd,"unix",0,"system_pages"); } >++ if (meminfo != NULL) { ksrphyserr = kstat_read(spl->kd,meminfo,NULL); } >++ if (ksrphyserr != -1) { >++ totalmem_pgs = kstat_data_lookup( meminfo, "physmem" ); >++ lockedmem_pgs = kstat_data_lookup( meminfo, "pageslocked" ); >++ pages = kstat_data_lookup( meminfo, "pagestotal" ); >++ >++ pl->totalMem = ((totalmem_pgs->value.ui64)/1024) * pgsiz; >++ pl->usedMem = ((lockedmem_pgs->value.ui64)/1024) * pgsiz; >++ // Not sure how to implement this on Solaris - suggestions welcome! >++ pl->cachedMem = 0; >++ // Not really "buffers" but the best Solaris analogue that I can find to >++ // "memory in use but not by programs or the kernel itself" >++ pl->buffersMem = (((totalmem_pgs->value.ui64)/1024) - (pages->value.ui64)/1024) * pgsiz; >++ } else { >++ // Fall back to basic sysconf if kstat isn't working >++ pl->totalMem = sysconf(_SC_PHYS_PAGES) * pgsiz; >++ pl->buffersMem = 0; >++ pl->cachedMem = 0; >++ pl->usedMem = pl->totalMem - (sysconf(_SC_AVPHYS_PAGES) * pgsiz); >++ } >++ >++ // Part 2 - swap >++ nswap = swapctl(SC_GETNSWP, NULL); >++ if (nswap > 0) { sl = malloc(nswap * sizeof(swapent_t) + sizeof(int)); } >++ if (sl != NULL) { spath = malloc( nswap * MAXPATHLEN ); } >++ if (spath != NULL) { >++ swapdev = sl->swt_ent; >++ for (int i = 0; i < nswap; i++, swapdev++) { >++ swapdev->ste_path = spath; >++ spath += MAXPATHLEN; >++ } >++ sl->swt_n = nswap; >++ } >++ nswap = swapctl(SC_LIST, sl); >++ if (nswap > 0) { >++ swapdev = sl->swt_ent; >++ for (int i = 0; i < nswap; i++, swapdev++) { >++ totalswap += swapdev->ste_pages; >++ totalfree += swapdev->ste_free; >++ free(swapdev->ste_path); >++ } >++ free(sl); >++ } >++ pl->totalSwap = (totalswap * pgsiz)/1024; >++ pl->usedSwap = pl->totalSwap - ((totalfree * pgsiz)/1024); >++} >++ >++void ProcessList_delete(ProcessList* this) { >++ const SolarisProcessList* spl = (SolarisProcessList*) this; >++ if (spl->kd) kstat_close(spl->kd); >++ free(spl->cpus); >++ ProcessList_done(this); >++ free(this); >++} >++ >++void ProcessList_goThroughEntries(ProcessList* this) { >++ SolarisProcessList* spl = (SolarisProcessList*) this; >++ Settings* settings = this->settings; >++ bool hideKernelThreads = settings->hideKernelThreads; >++ bool hideUserlandThreads = settings->hideUserlandThreads; >++ DIR* dir = NULL; >++ struct dirent* entry = NULL; >++ char* name = NULL; >++ int pid; >++ bool preExisting = false; >++ Process* proc = NULL; >++ Process* parent = NULL; >++ SolarisProcess* sproc = NULL; >++ psinfo_t _psinfo; >++ pstatus_t _pstatus; >++ prusage_t _prusage; >++ char filename[MAX_NAME+1]; >++ FILE *fp = NULL; >++ uint64_t addRunning = 0; >++ uint64_t addTotal = 0; >++ struct timeval tv; >++ struct tm date; >++ >++ gettimeofday(&tv, NULL); >++ >++ // If these fail, then the relevant metrics will simply display as zero >++ SolarisProcessList_scanCPUTime(this); >++ SolarisProcessList_scanMemoryInfo(this); >++ >++ dir = opendir(PROCDIR); >++ if (!dir) return; // Is proc mounted? >++ while ((entry = readdir(dir)) != NULL) { >++ addRunning = 0; >++ addTotal = 0; >++ name = entry->d_name; >++ pid = atoi(name); >++ proc = ProcessList_getProcess(this, pid, &preExisting, (Process_New) SolarisProcess_new); >++ proc->tgid = parent ? parent->pid : pid; >++ sproc = (SolarisProcess *) proc; >++ xSnprintf(filename, MAX_NAME, "%s/%s/psinfo", PROCDIR, name); >++ fp = fopen(filename, "r"); >++ if ( fp == NULL ) continue; >++ fread(&_psinfo,sizeof(psinfo_t),1,fp); >++ fclose(fp); >++ xSnprintf(filename, MAX_NAME, "%s/%s/status", PROCDIR, name); >++ fp = fopen(filename, "r"); >++ if ( fp != NULL ) { >++ fread(&_pstatus,sizeof(pstatus_t),1,fp); >++ } >++ fclose(fp); >++ xSnprintf(filename, MAX_NAME, "%s/%s/usage", PROCDIR, name); >++ fp = fopen(filename,"r"); >++ if ( fp == NULL ) continue; >++ fread(&_prusage,sizeof(prusage_t),1,fp); >++ fclose(fp); >++ >++ if(!preExisting) { >++ sproc->kernel = false; >++ proc->pid = _psinfo.pr_pid; >++ proc->ppid = _psinfo.pr_ppid; >++ proc->tgid = _psinfo.pr_pid; >++ sproc->zoneid = _psinfo.pr_zoneid; >++ proc->tty_nr = _psinfo.pr_ttydev; >++ proc->pgrp = _psinfo.pr_pgid; >++ // NOTE: These 'percentages' are 16-bit BINARY FRACTIONS where 1.0 = 0x8000 >++ // Source: https://docs.oracle.com/cd/E19253-01/816-5174/proc-4/index.html >++ // (accessed on 18 November 2017) >++ proc->percent_cpu = ((uint16_t)_psinfo.pr_pctcpu/(double)32768)*(double)100.0; >++ proc->percent_mem = ((uint16_t)_psinfo.pr_pctmem/(double)32768)*(double)100.0; >++ proc->st_uid = _psinfo.pr_euid; >++ proc->user = UsersTable_getRef(this->usersTable, proc->st_uid); >++ proc->nlwp = _psinfo.pr_nlwp; >++ proc->session = _pstatus.pr_sid; >++ setCommand(proc,_psinfo.pr_fname,PRFNSZ); >++ setZoneName(spl->kd,sproc); >++ proc->majflt = _prusage.pr_majf; >++ proc->minflt = _prusage.pr_minf; >++ proc->m_resident = (_psinfo.pr_rssize)/8; >++ proc->m_size = (_psinfo.pr_size)/8; >++ proc->priority = _psinfo.pr_lwp.pr_pri; >++ proc->nice = _psinfo.pr_lwp.pr_nice; >++ proc->processor = _psinfo.pr_lwp.pr_onpro; >++ proc->state = _psinfo.pr_lwp.pr_sname; >++ proc->time = _psinfo.pr_time.tv_sec; >++ sproc->taskid = _psinfo.pr_taskid; >++ sproc->projid = _psinfo.pr_projid; >++ sproc->poolid = _psinfo.pr_poolid; >++ sproc->contid = _psinfo.pr_contract; >++ proc->starttime_ctime = _psinfo.pr_start.tv_sec; >++ (void) localtime_r((time_t*) &proc->starttime_ctime, &date); >++ strftime(proc->starttime_show, 7, ((proc->starttime_ctime > tv.tv_sec - 86400) ? "%R " : "%b%d "), &date); >++ ProcessList_add(this, proc); >++ } else { >++ proc->ppid = _psinfo.pr_ppid; >++ sproc->zoneid = _psinfo.pr_zoneid; >++ // See note above about these percentages >++ proc->percent_cpu = ((uint16_t)_psinfo.pr_pctcpu/(double)32768)*(double)100.0; >++ proc->percent_mem = ((uint16_t)_psinfo.pr_pctmem/(double)32768)*(double)100.0; >++ proc->st_uid = _psinfo.pr_euid; >++ proc->pgrp = _psinfo.pr_pgid; >++ proc->nlwp = _psinfo.pr_nlwp; >++ proc->user = UsersTable_getRef(this->usersTable, proc->st_uid); >++ setCommand(proc,_psinfo.pr_fname,PRFNSZ); >++ setZoneName(spl->kd,sproc); >++ proc->majflt = _prusage.pr_majf; >++ proc->minflt = _prusage.pr_minf; >++ proc->m_resident = (_psinfo.pr_rssize)/8; >++ proc->m_size = (_psinfo.pr_size)/8; >++ proc->priority = _psinfo.pr_lwp.pr_pri; >++ proc->nice = _psinfo.pr_lwp.pr_nice; >++ proc->processor = _psinfo.pr_lwp.pr_onpro; >++ proc->state = _psinfo.pr_lwp.pr_sname; >++ proc->time = _psinfo.pr_time.tv_sec; >++ sproc->taskid = _psinfo.pr_taskid; >++ sproc->projid = _psinfo.pr_projid; >++ sproc->poolid = _psinfo.pr_poolid; >++ sproc->contid = _psinfo.pr_contract; >++ } >++ proc->show = !(hideKernelThreads && (_pstatus.pr_flags & PR_ISSYS)); >++ if (_pstatus.pr_flags & PR_ISSYS) { >++ if (hideKernelThreads) { >++ addRunning = 0; >++ addTotal = 0; >++ } else { >++ this->kernelThreads += proc->nlwp; >++ if (proc->state == 'O') { >++ addRunning++; >++ addTotal = proc->nlwp+1; >++ } else { >++ addTotal = proc->nlwp+1; >++ } >++ } >++ } else { >++ if (hideUserlandThreads) { >++ if(proc->state == 'O') { >++ addRunning++; >++ addTotal++; >++ } else { >++ addTotal++; >++ } >++ } else { >++ this->userlandThreads += proc->nlwp; >++ if(proc->state == 'O') { >++ addRunning++; >++ addTotal = proc->nlwp+1; >++ } else { >++ addTotal = proc->nlwp+1; >++ } >++ } >++ } >++ this->runningTasks+=addRunning; >++ this->totalTasks+=addTotal; >++ proc->updated = true; >++ } // while ((entry = readdir(dir)) != NULL) >++ closedir(dir); >++} >++ > >Property changes on: sysutils/htop/files/patch-solaris__SolarisProcessList.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-solaris__SolarisProcessList.h >=================================================================== >--- sysutils/htop/files/patch-solaris__SolarisProcessList.h (nonexistent) >+++ sysutils/htop/files/patch-solaris__SolarisProcessList.h (working copy) >@@ -0,0 +1,56 @@ >+--- /dev/null 2018-03-05 11:22:00.000000000 +0800 >++++ solaris/SolarisProcessList.h 2018-03-05 11:15:52.015532000 +0800 >+@@ -0,0 +1,53 @@ >++/* Do not edit this file. It was automatically generated. */ >++ >++#ifndef HEADER_SolarisProcessList >++#define HEADER_SolarisProcessList >++/* >++htop - SolarisProcessList.h >++(C) 2014 Hisham H. Muhammad >++(C) 2017 Guy M. Broome >++Released under the GNU GPL, see the COPYING file >++in the source distribution for its full text. >++*/ >++ >++#define MAXCMDLINE 255 >++ >++ >++#include <kstat.h> >++#include <sys/param.h> >++#include <sys/zone.h> >++#include <sys/uio.h> >++#include <sys/resource.h> >++#include <sys/sysconf.h> >++#include <sys/sysinfo.h> >++#include <sys/swap.h> >++ >++#define ZONE_ERRMSGLEN 1024 >++char zone_errmsg[ZONE_ERRMSGLEN]; >++ >++typedef struct CPUData_ { >++ double userPercent; >++ double nicePercent; >++ double systemPercent; >++ double irqPercent; >++ double idlePercent; >++ double systemAllPercent; >++ uint64_t luser; >++ uint64_t lkrnl; >++ uint64_t lintr; >++ uint64_t lidle; >++} CPUData; >++ >++typedef struct SolarisProcessList_ { >++ ProcessList super; >++ kstat_ctl_t* kd; >++ CPUData* cpus; >++} SolarisProcessList; >++ >++ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId); >++ >++void ProcessList_delete(ProcessList* this); >++ >++void ProcessList_goThroughEntries(ProcessList* this); >++ >++#endif > >Property changes on: sysutils/htop/files/patch-solaris__SolarisProcessList.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-unsupported__UnsupportedProcessList.c >=================================================================== >--- sysutils/htop/files/patch-unsupported__UnsupportedProcessList.c (nonexistent) >+++ sysutils/htop/files/patch-unsupported__UnsupportedProcessList.c (working copy) >@@ -0,0 +1,11 @@ >+--- unsupported/UnsupportedProcessList.c.orig 2018-02-05 03:13:55.000000000 +0800 >++++ unsupported/UnsupportedProcessList.c 2018-03-05 11:10:49.428910000 +0800 >+@@ -68,8 +68,3 @@ >+ proc->minflt = 20; >+ proc->majflt = 20; >+ } >+- >+-void UnsupportedProcessList_scan(ProcessList* this) { >+- (void) this; >+- // stub! >+-} > >Property changes on: sysutils/htop/files/patch-unsupported__UnsupportedProcessList.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-unsupported__UnsupportedProcessList.h >=================================================================== >--- sysutils/htop/files/patch-unsupported__UnsupportedProcessList.h (nonexistent) >+++ sysutils/htop/files/patch-unsupported__UnsupportedProcessList.h (working copy) >@@ -0,0 +1,9 @@ >+--- unsupported/UnsupportedProcessList.h.orig 2018-02-05 03:13:55.000000000 +0800 >++++ unsupported/UnsupportedProcessList.h 2018-03-05 11:10:59.373811000 +0800 >+@@ -17,6 +17,4 @@ >+ >+ void ProcessList_goThroughEntries(ProcessList* super); >+ >+-void UnsupportedProcessList_scan(ProcessList* this); >+- >+ #endif > >Property changes on: sysutils/htop/files/patch-unsupported__UnsupportedProcessList.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
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