diff --git a/0001-top-add-the-major-version-to-dlopen-of-libnuma-sonam.patch b/0001-top-add-the-major-version-to-dlopen-of-libnuma-sonam.patch index 56c1fe8..3337aae 100644 --- a/0001-top-add-the-major-version-to-dlopen-of-libnuma-sonam.patch +++ b/0001-top-add-the-major-version-to-dlopen-of-libnuma-sonam.patch @@ -1,4 +1,4 @@ -From a6dfe2648a39d5fed8de0361aecf0e035ad80222 Mon Sep 17 00:00:00 2001 +From b55f9b97db9101e8fb1903d03f7bc7e9c8476572 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Thu, 6 Jun 2013 00:00:00 -0500 Subject: [PATCH] top: add the major version to dlopen of libnuma soname @@ -21,13 +21,13 @@ commit edba932a7e9b950dd91bc486e107788e977a5186 Signed-off-by: Jim Warner --- - top/top.c | 2 +- + top/top.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/top/top.c b/top/top.c -index c1853ee..1d38c0f 100644 ---- a/top/top.c -+++ b/top/top.c +diff --git top/top.c top/top.c +index 2b05a60..0d7ee2d 100644 +--- top/top.c ++++ top/top.c @@ -3246,7 +3246,7 @@ static void before (char *me) { #if defined(PRETEND_NUMA) || defined(PRETEND8CPUS) Numa_node_tot = Numa_max_node() + 1; @@ -38,5 +38,5 @@ index c1853ee..1d38c0f 100644 Numa_max_node = dlsym(Libnuma_handle, "numa_max_node"); Numa_node_of_cpu = dlsym(Libnuma_handle, "numa_node_of_cpu"); -- -1.8.1.2 +1.7.9.2 diff --git a/0001-top-trade-two-groff_mdoc-macros-for-groff-equivalent.patch b/0002-top-trade-two-groff_mdoc-macros-for-groff-equivalent.patch similarity index 98% rename from 0001-top-trade-two-groff_mdoc-macros-for-groff-equivalent.patch rename to 0002-top-trade-two-groff_mdoc-macros-for-groff-equivalent.patch index 226b422..a41049d 100644 --- a/0001-top-trade-two-groff_mdoc-macros-for-groff-equivalent.patch +++ b/0002-top-trade-two-groff_mdoc-macros-for-groff-equivalent.patch @@ -1,7 +1,7 @@ -From 2c19223cf286a9f47fd95e557b1644ed44625b9a Mon Sep 17 00:00:00 2001 +From b79b927f9781c02c82f906bf8bc5aa16c5df2a87 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Thu, 20 Jun 2013 00:00:00 -0500 -Subject: [PATCH 1/2] top: trade two groff_mdoc macros for groff equivalents +Subject: [PATCH] top: trade two groff_mdoc macros for groff equivalents The .Bd and .Ed macros, from the mdoc collection, have caused a few raised eyebrows (lintian, doclifter, etc) @@ -10,13 +10,13 @@ for the standard existing groff .nf & .fi equivalents. Signed-off-by: Jim Warner --- - top/top.1 | 155 +++++++++++++++++++++++++++++++------------------------------- + top/top.1 | 155 +++++++++++++++++++++++++++++++------------------------------ 1 file changed, 78 insertions(+), 77 deletions(-) -diff --git a/top/top.1 b/top/top.1 +diff --git top/top.1 top/top.1 index 53ebaf2..0a753a8 100644 ---- a/top/top.1 -+++ b/top/top.1 +--- top/top.1 ++++ top/top.1 @@ -118,7 +118,7 @@ display and used when reading and writing a \*(CF. .\" ---------------------------------------------------------------------- The remaining Table of Contents @@ -566,5 +566,5 @@ index 53ebaf2..0a753a8 100644 What you'll see is a very busy Linux doing what he's always done for you, but there was no program available to illustrate this. -- -1.8.1.2 +1.7.9.2 diff --git a/0002-library-for-atexit-support-fix-fileutils-for-EPIPE.patch b/0003-library-for-atexit-support-fix-fileutils-for-EPIPE.patch similarity index 81% rename from 0002-library-for-atexit-support-fix-fileutils-for-EPIPE.patch rename to 0003-library-for-atexit-support-fix-fileutils-for-EPIPE.patch index a2f0a2b..629b9de 100644 --- a/0002-library-for-atexit-support-fix-fileutils-for-EPIPE.patch +++ b/0003-library-for-atexit-support-fix-fileutils-for-EPIPE.patch @@ -1,7 +1,7 @@ -From b1f06bdcc9e02f7dbaf1161ad6231c45ea3f9d88 Mon Sep 17 00:00:00 2001 +From ce5e995921e770bfcda25e42fe090aeccdbf1291 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Tue, 25 Jun 2013 00:00:00 -0500 -Subject: [PATCH 2/2] library: for atexit() support, fix fileutils for EPIPE +Subject: [PATCH] library: for atexit() support, fix fileutils for EPIPE When fileutils with stream error checking was borrowed from GNU lib, an omission was also propagated where an @@ -21,13 +21,13 @@ commit c7cf98b0e03780f78abe5275c6fb282f71a2369f . bugzilla report https://bugzilla.redhat.com/show_bug.cgi?id=976199 --- - lib/fileutils.c | 2 +- + lib/fileutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/lib/fileutils.c b/lib/fileutils.c +diff --git lib/fileutils.c lib/fileutils.c index a9ef2ff..1ade3d8 100644 ---- a/lib/fileutils.c -+++ b/lib/fileutils.c +--- lib/fileutils.c ++++ lib/fileutils.c @@ -24,7 +24,7 @@ int close_stream(FILE * stream) const int prev_fail = (ferror(stream) != 0); const int fclose_fail = (fclose(stream) != 0); @@ -38,5 +38,5 @@ index a9ef2ff..1ade3d8 100644 return EOF; } -- -1.8.1.2 +1.7.9.2 diff --git a/0001-top-enable-screen-contents-preservation-at-endofjob.patch b/0004-top-enable-screen-contents-preservation-at-end-of-jo.patch similarity index 58% rename from 0001-top-enable-screen-contents-preservation-at-endofjob.patch rename to 0004-top-enable-screen-contents-preservation-at-end-of-jo.patch index 1100e4e..4a07b9b 100644 --- a/0001-top-enable-screen-contents-preservation-at-endofjob.patch +++ b/0004-top-enable-screen-contents-preservation-at-end-of-jo.patch @@ -1,13 +1,64 @@ -Signed-off-by: Jim Warner +From 5c974ff44da4fbbb9170dd15bdd81555c62c31a9 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Fri, 28 Jun 2013 00:00:00 -0500 +Subject: [PATCH] top: enable screen contents preservation at end-of-job + +The title of this commit is actually quite misleading. + +Were it more accurate, it would at least mention a tty +emulator's scrollback buffer, which was the cumulation +of a long pursuit to reduce the SIGWINCH overhead when +a window manager carelessly floods an application with +that signal *while* a user is still resizing a window! + +Disabling and enabling that scrollback buffer resulted +in the final top display replaced with original screen +contents, a phenomenon acknowledged at the time but it +also represented a user interface change which has now +produced the first request for return to old behavior. + +After the SIGWINCH dust settled, another problem arose +regarding behaviors under the 'screen' window manager. +In response, top was refactored a bit to avoid display +corruption. That was before discovering 'screen' could +duplicate the scrollback buffer behavior top expected. + +As it turns out, the 'screen' refactoring had probably +made scrollback buffer manipulation unnecessary. Still +one could argue that a window should not be allowed to +scroll while a constantly updating program was active. + +The solution represented in this commit returns former +behavior at program end (retaining top's last screen). +And if we ever wish to disable scrollback buffers, the +associated logic was retained but made conditional. It +is not reflected in configure.ac but might be someday. + +Lastly, this commit corrects cursor positioning when a +^C is issued under 'Fields Management' at any terminal +that didn't have a scrollback buffer (i.e. a console). + +Reference(s): +https://bugzilla.redhat.com/show_bug.cgi?id=977561 +http://www.freelists.org/post/procps/top-library-miscellaneous-tweaks,1 +. screen program refactor +commit 0fe393ff270922cd4f6edbcaabba006314e73a37 +. scrollback buffer disabled +commit dedaf6e1a81738ff08ee8e8523871e12f555ad6d +. sigwinch management defines +commit adca737758e5afc7be344a736953931894cbc19f +commit 4f33b6b8c56464b4044deb29a3bb0e32622e108f + +Signed-off-by: Jim Warner --- - top/top.c | 18 +++++++++++------- - top/top.h | 1 + + top/top.c | 18 +++++++++++------- + top/top.h | 1 + 2 files changed, 12 insertions(+), 7 deletions(-) -diff --git a/top/top.c b/top/top.c -index 1d38c0f..cdcf3c0 100644 ---- a/top/top.c -+++ b/top/top.c +diff --git top/top.c top/top.c +index 0d7ee2d..07217c8 100644 +--- top/top.c ++++ top/top.c @@ -72,8 +72,9 @@ static struct termios Tty_original, // our inherited terminal definition Tty_raw; // for unsolicited input static int Ttychanged = 0; @@ -82,10 +133,10 @@ index 1d38c0f..cdcf3c0 100644 // and don't forget to ask iokey to initialize his tinfo_tab iokey(0); } // end: whack_terminal -diff --git a/top/top.h b/top/top.h +diff --git top/top.h top/top.h index f356798..a8a7357 100644 ---- a/top/top.h -+++ b/top/top.h +--- top/top.h ++++ top/top.h @@ -41,6 +41,7 @@ //#define INSP_SAVEBUF /* preserve 'Insp_buf' contents in a file */ //#define INSP_SLIDE_1 /* when scrolling left/right don't move 8 */ @@ -95,4 +146,5 @@ index f356798..a8a7357 100644 //#define PRETEND2_5_X /* pretend we're linux 2.5.x (for IO-wait) */ //#define PRETEND8CPUS /* pretend we're smp with 8 ticsers (sic) */ -- -1.8.1.2 +1.7.9.2 + diff --git a/0001-top-refine-some-miscellaneous-signals-interrupt-stuf.patch b/0005-top-refine-some-miscellaneous-signals-interrupt-stuf.patch similarity index 95% rename from 0001-top-refine-some-miscellaneous-signals-interrupt-stuf.patch rename to 0005-top-refine-some-miscellaneous-signals-interrupt-stuf.patch index 6e82fec..a867686 100644 --- a/0001-top-refine-some-miscellaneous-signals-interrupt-stuf.patch +++ b/0005-top-refine-some-miscellaneous-signals-interrupt-stuf.patch @@ -1,7 +1,7 @@ -From e5d1a884f4e780aca7f9eaf68a51b967f9b43abf Mon Sep 17 00:00:00 2001 +From 25ed080eaa9cec603bc486b47b4a96d6438cf94f Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Sun, 30 Jun 2013 00:00:00 -0500 -Subject: [PATCH 1/2] top: refine some miscellaneous signals interrupt stuff +Subject: [PATCH] top: refine some miscellaneous signals interrupt stuff This commit mostly justs renames a few identifiers but it also will now suppress any end-of-job report if top @@ -9,14 +9,14 @@ wasn't ended via the 'q' key convention (i.e. signal). Signed-off-by: Jim Warner --- - top/top.c | 48 +++++++++++++++++++++++++----------------------- - top/top.h | 4 ++-- + top/top.c | 48 +++++++++++++++++++++++++----------------------- + top/top.h | 4 ++-- 2 files changed, 27 insertions(+), 25 deletions(-) -diff --git a/top/top.c b/top/top.c -index cdcf3c0..c1c61dd 100644 ---- a/top/top.c -+++ b/top/top.c +diff --git top/top.c top/top.c +index 07217c8..cb7f3b8 100644 +--- top/top.c ++++ top/top.c @@ -174,7 +174,7 @@ static WIN_t *Curwin; and/or that are simply more efficiently handled as globals [ 'Frames_...' (plural) stuff persists beyond 1 frame ] @@ -211,10 +211,10 @@ index cdcf3c0..c1c61dd 100644 (everything is perfectly justified plus right margins) (are completely filled, but of course it must be luck) -diff --git a/top/top.h b/top/top.h +diff --git top/top.h top/top.h index a8a7357..43d1ebc 100644 ---- a/top/top.h -+++ b/top/top.h +--- top/top.h ++++ top/top.h @@ -208,9 +208,9 @@ enum scale_enum { SK_Kb, SK_Mb, SK_Gb, SK_Tb, SK_Pb, SK_Eb, SK_SENTINEL }; @@ -228,5 +228,5 @@ index a8a7357..43d1ebc 100644 /* This typedef just ensures consistent 'process flags' handling */ -- -1.8.1.2 +1.7.9.2 diff --git a/0002-top-cursor-repositioning-includes-line-oriented-inpu.patch b/0006-top-cursor-repositioning-includes-line-oriented-inpu.patch similarity index 85% rename from 0002-top-cursor-repositioning-includes-line-oriented-inpu.patch rename to 0006-top-cursor-repositioning-includes-line-oriented-inpu.patch index c670eb1..bd8781a 100644 --- a/0002-top-cursor-repositioning-includes-line-oriented-inpu.patch +++ b/0006-top-cursor-repositioning-includes-line-oriented-inpu.patch @@ -1,7 +1,7 @@ -From eee15b862dd5b051f16c719bf3c974591783a8f8 Mon Sep 17 00:00:00 2001 +From 33104a2bcc321495107d72e4cfee4090b1d90f76 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Mon, 1 Jul 2013 00:00:00 -0500 -Subject: [PATCH 2/2] top: cursor repositioning includes line oriented input +Subject: [PATCH] top: cursor repositioning includes line oriented input A recent patch introduced the ability to recognize the need to reposition the cursor at suspension or program @@ -17,13 +17,13 @@ commit 5c974ff44da4fbbb9170dd15bdd81555c62c31a9 Signed-off-by: Jim Warner --- - top/top.c | 4 ++++ + top/top.c | 4 ++++ 1 file changed, 4 insertions(+) -diff --git a/top/top.c b/top/top.c -index c1c61dd..138f3ee 100644 ---- a/top/top.c -+++ b/top/top.c +diff --git top/top.c top/top.c +index cb7f3b8..223ed70 100644 +--- top/top.c ++++ top/top.c @@ -1081,12 +1081,14 @@ static char *ioline (const char *prompt) { static char buf[MEDBUFSIZ]; char *p; @@ -56,5 +56,5 @@ index c1c61dd..138f3ee 100644 for (i = 0, plin = anchor; ; i++) { #ifdef RECALL_FIXED -- -1.8.1.2 +1.7.9.2 diff --git a/0007-top-correct-improve-or-otherwise-tweak-some-comments.patch b/0007-top-correct-improve-or-otherwise-tweak-some-comments.patch new file mode 100644 index 0000000..66f3ff4 --- /dev/null +++ b/0007-top-correct-improve-or-otherwise-tweak-some-comments.patch @@ -0,0 +1,63 @@ +From 6967bf80a61fa42d8b02b08c358ea582a02f6856 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Thu, 4 Jul 2013 00:00:00 -0500 +Subject: [PATCH] top: correct, improve or otherwise tweak some comments + +Signed-off-by: Jim Warner +--- + top/top.c | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git top/top.c top/top.c +index 223ed70..978071c 100644 +--- top/top.c ++++ top/top.c +@@ -2794,7 +2794,7 @@ static void insp_cnt_nl (void) { + Insp_p[0] = Insp_buf; + Insp_p[Insp_nl++] = cur; + Insp_p[Insp_nl] = end; +- if ((end - cur) == 1) // if there's a eof null delimiter, ++ if ((end - cur) == 1) // if there's an eof null delimiter, + --Insp_nl; // don't count it as a new line + } // end: insp_cnt_nl + +@@ -3824,12 +3824,12 @@ static WIN_t *win_select (int ch) { + if (1 > (ch = iokey(1))) return w; + } + switch (ch) { +- case 'a': // we don't carry 'a' / 'w' in our +- w = w->next; // pmt - they're here for a good +- break; // friend of ours -- wins_colors. +- case 'w': // (however those letters work via +- w = w->prev; // the pmt too but gee, end-loser +- break; // should just press the darn key) ++ case 'a': // we don't carry 'a' / 'w' in our ++ w = w->next; // pmt - they're here for a good ++ break; // friend of ours -- wins_colors. ++ case 'w': // (however those letters work via ++ w = w->prev; // the pmt too but gee, end-loser ++ break; // should just press the darn key) + case '1': case '2' : case '3': case '4': + w = &Winstk[ch - '1']; + break; +@@ -5483,6 +5483,7 @@ static void frame_make (void) { + Max_lines = (Screen_rows - Msg_row) - 1; + OFFw(w, INFINDS_xxx); + ++ // one way or another, rid us of any prior frame's msg + if (VIZISw(w) && CHKw(w, View_SCROLL)) show_scroll(); + else PUTT("%s%s", tg2(0, Msg_row), Cap_clr_eol); + +@@ -5501,8 +5502,7 @@ static void frame_make (void) { + } + } + +- /* clear to end-of-screen (critical if last window is 'idleps off'), +- then put the cursor in-its-place, and rid us of any prior frame's msg ++ /* clear to end-of-screen - critical if last window is 'idleps off' + (main loop must iterate such that we're always called before sleep) */ + if (scrlins < Max_lines) { + putp(Cap_nl_clreos); +-- +1.7.9.2 + diff --git a/0008-top-tweak-cursor-state-code-to-swat-an-obscure-bugle.patch b/0008-top-tweak-cursor-state-code-to-swat-an-obscure-bugle.patch new file mode 100644 index 0000000..724a010 --- /dev/null +++ b/0008-top-tweak-cursor-state-code-to-swat-an-obscure-bugle.patch @@ -0,0 +1,66 @@ +From 30e90e426980c3122c668dd2a6b9236d4db6e048 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Fri, 5 Jul 2013 00:00:00 -0500 +Subject: [PATCH] top: tweak cursor state code to swat an obscure buglet + +An obscure bug has been discovered where a 'W' with an +old rcfile, warning against overwrite, would display a +cursor that should normally be hidden. This followed a +user's reply. So some logic was rearranged just a bit. + +Signed-off-by: Jim Warner +--- + top/top.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git top/top.c top/top.c +index 978071c..8978cd1 100644 +--- top/top.c ++++ top/top.c +@@ -3104,6 +3104,7 @@ signify_that: + case '/': + case 'n': + insp_find_str(key, &curcol, &curlin); ++ // must re-hide cursor in case a prompt for a string makes it huge + putp((Cursor_state = Cap_curs_hide)); + break; + case '=': +@@ -4901,23 +4902,21 @@ static void do_key (int ch) { + }; + int i; + +- putp((Cursor_state = Cap_curs_hide)); + switch (ch) { + case 0: // ignored (always) + case kbd_ESC: // ignored (sometimes) +- return; ++ goto all_done; + case 'q': // no return from this guy + bye_bye(NULL); + case 'W': // no need for rebuilds + write_rcfile(); +- return; ++ goto all_done; + default: // and now, the real work... + for (i = 0; i < MAXTBL(key_tab); ++i) + if (strchr(key_tab[i].keys, ch)) { + key_tab[i].func(ch); + Frames_signal = BREAK_kbd; +- putp((Cursor_state = Cap_curs_hide)); +- return; ++ goto all_done; + } + }; + /* Frames_signal above will force a rebuild of all column headers and +@@ -4943,6 +4942,8 @@ static void do_key (int ch) { + */ + + show_msg(N_txt(UNKNOWN_cmds_txt)); ++all_done: ++ putp((Cursor_state = Cap_curs_hide)); + } // end: do_key + + +-- +1.7.9.2 + diff --git a/0009-top-correct-cursor-positioning-for-all-Z-or-C-cases.patch b/0009-top-correct-cursor-positioning-for-all-Z-or-C-cases.patch new file mode 100644 index 0000000..5202e67 --- /dev/null +++ b/0009-top-correct-cursor-positioning-for-all-Z-or-C-cases.patch @@ -0,0 +1,130 @@ +From 46a1356219cfab67240704af9cd73b58a20d4232 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Sat, 6 Jul 2013 00:00:00 -0500 +Subject: [PATCH] top: correct cursor positioning for all ^Z or ^C cases + +Some more (very obscure) conditions where a suspension +or program end might embed the shell prompt within top +output have been uncovered beyond the 2 already known. + +We had already covered some suspend/end contingencies: +1. the users were using the 'fields management' screen +2. the users were prompted for any line oriented input + +However, there remained some situations where ^Z or ^C +could still produce a misplaced cursor + shell prompt: +3. the 'g' command while waiting for the window choice +4. the 'W' command if about to overwrite an old rcfile +5. the '=' command when exploiting the Inspect feature +6. the period during which any error message was shown + +But, even when all those bases are covered there still +remains a remote possibility that such interrupts will +occur during a top repaint cycle. So rather than throw +yet more code at these self-inflicted problems perhaps +it is better if we just throw in the proverbial towel. + +Thus, I'll take the only sane approach and restore the +results expected ever since top's inception and before +scrollback buffers entered the picture. Namely, with a +^Z or ^C the cursor will be placed on the final screen +row. That usually means it will immediately follow the +last output line but it may follow many blank lines if +the user interrupts top when *not* on the main screen. + +Reference(s): +. expanded repositioning (for line oriented input) +commit 33104a2bcc321495107d72e4cfee4090b1d90f76 +. introduced repositioning (for fields management) +commit 5c974ff44da4fbbb9170dd15bdd81555c62c31a9 +. scrollback buffers (the cursor handling changes) +commit dedaf6e1a81738ff08ee8e8523871e12f555ad6d + +Signed-off-by: Jim Warner +--- + top/top.c | 13 +++---------- + 1 file changed, 3 insertions(+), 10 deletions(-) + +diff --git top/top.c top/top.c +index 8978cd1..e2451f5 100644 +--- top/top.c ++++ top/top.c +@@ -72,9 +72,8 @@ static struct termios Tty_original, // our inherited terminal definition + Tty_raw; // for unsolicited input + static int Ttychanged = 0; + +- /* Last established cursor state/shape, and is re-position needed */ ++ /* Last established cursor state/shape */ + static const char *Cursor_state = ""; +-static int Cursor_repos; + + /* Program name used in error messages and local 'rc' file name */ + static char *Myname; +@@ -351,7 +350,7 @@ static void at_eoj (void) { + if (Ttychanged) { + tcsetattr(STDIN_FILENO, TCSAFLUSH, &Tty_original); + if (keypad_local) putp(keypad_local); +- if (Cursor_repos) putp(tg2(0, Screen_rows)); ++ putp(tg2(0, Screen_rows)); + putp("\n"); + #ifdef OFF_SCROLLBK + if (exit_ca_mode) { +@@ -602,7 +601,7 @@ static void sig_paused (int dont_care_sig) { + if (-1 == tcsetattr(STDIN_FILENO, TCSAFLUSH, &Tty_original)) + error_exit(fmtmk(N_fmt(FAIL_tty_set_fmt), strerror(errno))); + if (keypad_local) putp(keypad_local); +- if (Cursor_repos) putp(tg2(0, Screen_rows)); ++ putp(tg2(0, Screen_rows)); + putp(Cap_curs_norm); + #ifndef RMAN_IGNORED + putp(Cap_smam); +@@ -1081,14 +1080,12 @@ static char *ioline (const char *prompt) { + static char buf[MEDBUFSIZ]; + char *p; + +- Cursor_repos = 1; + show_pmt(prompt); + memset(buf, '\0', sizeof(buf)); + ioch(1, buf, sizeof(buf)-1); + + if ((p = strpbrk(buf, ws))) *p = '\0'; + // note: we DO produce a vaid 'string' +- Cursor_repos = 0; + return buf; + } // end: ioline + +@@ -1119,7 +1116,6 @@ static char *ioline (const char *prompt) { + }; + static struct lin_s *anchor, *plin; + +- Cursor_repos = 1; + if (!anchor) { + anchor = alloc_c(sizeof(struct lin_s)); + anchor->str = alloc_s(""); // top-of-stack == empty str +@@ -1185,7 +1181,6 @@ static char *ioline (const char *prompt) { + putp(tg2(beg+pos, Msg_row)); + } while (key && key != kbd_ENTER && key != kbd_ESC); + +- Cursor_repos = 0; + // weed out duplicates, including empty strings (top-of-stack)... + for (i = 0, plin = anchor; ; i++) { + #ifdef RECALL_FIXED +@@ -2126,7 +2121,6 @@ static void fields_utility (void) { + int i, key; + FLG_t f; + +- Cursor_repos = 1; + spewFI + signify_that: + putp(Cap_clr_scr); +@@ -2187,7 +2181,6 @@ signify_that: + break; + } + } while (key != 'q' && key != kbd_ESC); +- Cursor_repos = 0; + #undef unSCRL + #undef swapEM + #undef spewFI +-- +1.7.9.2 + diff --git a/0010-ps-address-a-potential-newline-quirk-the-libselinux.patch b/0010-ps-address-a-potential-newline-quirk-the-libselinux.patch new file mode 100644 index 0000000..9a6ecce --- /dev/null +++ b/0010-ps-address-a-potential-newline-quirk-the-libselinux.patch @@ -0,0 +1,33 @@ +From 7c4894dd222ff951e9b8a7efce00a9d9ab9ee586 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Wed, 7 Aug 2013 12:58:57 -0500 +Subject: [PATCH] ps: address a potential 'newline' quirk the libselinux + +Sometimes with libselinux present but SELinux inactive +the context reported is "unconfined" which contains an +embedded newline. This then causes misalignment of any +subsequent data. So, ps will now protect against that. + +Reference(s): +http://www.freelists.org/post/procps/enablelibselinux-switch,14 + +Signed-off-by: Jim Warner +--- + ps/output.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git ps/output.c ps/output.c +index b7b21d1..d457a89 100644 +--- ps/output.c ++++ ps/output.c +@@ -1339,6 +1339,7 @@ static int pr_context(char *restrict const outbuf, const proc_t *restrict const + len = strlen(context); + if(len > max_len) len = max_len; + memcpy(outbuf, context, len); ++ if (outbuf[len-1] == '\n') --len; + outbuf[len] = '\0'; + free(context); + }else{ +-- +1.7.9.2 + diff --git a/0012-top-hint-that-Summary-Area-cached-is-Mem-not-Swap.patch b/0012-top-hint-that-Summary-Area-cached-is-Mem-not-Swap.patch new file mode 100644 index 0000000..772c5fb --- /dev/null +++ b/0012-top-hint-that-Summary-Area-cached-is-Mem-not-Swap.patch @@ -0,0 +1,33 @@ +From 739effd90701d5d327624cd833d20c7f35981613 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Fri, 9 Aug 2013 00:00:00 -0500 +Subject: [PATCH] top: hint that Summary Area 'cached' is Mem (not Swap) + +This patch just provides a visual clue to separate the +values reported for cached Memory from other values on +the Swapped line (which is being shared due to space). + +Reference(s): +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718670 + +Signed-off-by: Jim Warner +--- + top/top_nls.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git top/top_nls.c top/top_nls.c +index fa6969e..25c7f56 100644 +--- top/top_nls.c ++++ top/top_nls.c +@@ -618,7 +618,7 @@ static void build_uniq_nlstab (void) { + . words: total, used, free, buffers, cached */ + Uniq_nlstab[MEMORY_lines_fmt] = _("" + "%s Mem: ~3 %9.9s~2total,~3 %9.9s~2used,~3 %9.9s~2free,~3 %9.9s~2buffers~3\n" +- "%s Swap:~3 %9.9s~2total,~3 %9.9s~2used,~3 %9.9s~2free,~3 %9.9s~2cached~3\n"); ++ "%s Swap:~3 %9.9s~2total,~3 %9.9s~2used,~3 %9.9s~2free.~3 %9.9s~2cached Mem~3\n"); + + Uniq_nlstab[INSP_hdrsels_fmt] = _("" + "Inspection~2 Pause at: pid ~1%d~6 running ~1%s~6 as user ~1%s~6\n" +-- +1.7.9.2 + diff --git a/0013-top-modest-efficiency-change-to-message-line-handlin.patch b/0013-top-modest-efficiency-change-to-message-line-handlin.patch new file mode 100644 index 0000000..e7283dc --- /dev/null +++ b/0013-top-modest-efficiency-change-to-message-line-handlin.patch @@ -0,0 +1,97 @@ +From 80e678343653ccadaaf66bf719b3da9d6168d9ec Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Thu, 15 Aug 2013 00:00:00 -0500 +Subject: [PATCH] top: modest efficiency change to message line handling + +When the final solution for cursor positioning for all +^Z or ^C cases was introduced the revised placement of +message line management introduced with the window mgr +'screen' refactor was retained. Those two commits mean +that a former tgoto was no longer needed when clearing +that msg line or displaying the scroll coordinate msg. + +This patch eliminates the tgoto employed by frame_make +while assimilating a now defunct show_scroll function. + +Reference(s): +. final cursor positioning for ^Z or ^C +commit 46a1356219cfab67240704af9cd73b58a20d4232 +. 'screen' window manager refactor +commit 0fe393ff270922cd4f6edbcaabba006314e73a37 + +Signed-off-by: Jim Warner +--- + top/top.c | 22 ++++++++++------------ + top/top.h | 1 - + 2 files changed, 10 insertions(+), 13 deletions(-) + +diff --git top/top.c top/top.c +index e2451f5..c29bb07 100644 +--- top/top.c ++++ top/top.c +@@ -751,13 +751,6 @@ static int show_pmt (const char *str) { + + + /* +- * Show a special coordinate message, in support of scrolling */ +-static inline void show_scroll (void) { +- PUTT(Scroll_fmts, tg2(0, Msg_row), Frame_maxtask); +-} // end: show_scroll +- +- +- /* + * Show lines with specially formatted elements, but only output + * what will fit within the current screen width. + * Our special formatting consists of: +@@ -857,7 +850,7 @@ static void show_special (int interact, const char *glob) { + + /* + * Create a nearly complete scroll coordinates message, but still +- * a format string since we'll be missing a tgoto and total tasks. */ ++ * a format string since we'll be missing the current total tasks. */ + static void updt_scroll_msg (void) { + char tmp1[SMLBUFSIZ], tmp2[SMLBUFSIZ]; + int totpflgs = Curwin->totpflgs; +@@ -878,8 +871,10 @@ static void updt_scroll_msg (void) { + if (Curwin->varcolbeg) + snprintf(tmp2, sizeof(tmp2), "%s + %d", tmp1, Curwin->varcolbeg); + #endif ++ // this Scroll_fmts string no longer provides for termcap tgoto so that ++ // the usage timing is critical -- see frame_make() for additional info + snprintf(Scroll_fmts, sizeof(Scroll_fmts) +- , "%%s%s %.*s%s", Caps_off, Screen_cols - 3, tmp2, Cap_clr_eol); ++ , "%s %.*s%s", Caps_off, Screen_cols - 3, tmp2, Cap_clr_eol); + } // end: updt_scroll_msg + + /*###### Low Level Memory/Keyboard/File I/O support ####################*/ +@@ -5477,9 +5472,12 @@ static void frame_make (void) { + Max_lines = (Screen_rows - Msg_row) - 1; + OFFw(w, INFINDS_xxx); + +- // one way or another, rid us of any prior frame's msg +- if (VIZISw(w) && CHKw(w, View_SCROLL)) show_scroll(); +- else PUTT("%s%s", tg2(0, Msg_row), Cap_clr_eol); ++ /* one way or another, rid us of any prior frame's msg ++ [ now that this is positioned after the call to summary_show(), ] ++ [ we no longer need or employ tg2(0, Msg_row) since all summary ] ++ [ lines end with a newline, and header lines begin with newline ] */ ++ if (VIZISw(w) && CHKw(w, View_SCROLL)) PUTT(Scroll_fmts, Frame_maxtask); ++ else putp(Cap_clr_eol); + + if (!Rc.mode_altscr) { + // only 1 window to show so, piece o' cake +diff --git top/top.h top/top.h +index 43d1ebc..017644f 100644 +--- top/top.h ++++ top/top.h +@@ -658,7 +658,6 @@ typedef struct WIN_t { + //atic void capsmk (WIN_t *q); + //atic void show_msg (const char *str); + //atic int show_pmt (const char *str); +-//atic inline void show_scroll (void); + //atic void show_special (int interact, const char *glob); + //atic void updt_scroll_msg (void); + /*------ Low Level Memory/Keyboard/File I/O support --------------------*/ +-- +1.7.9.2 + diff --git a/0014-top-correct-improve-and-otherwise-tweak-configs_read.patch b/0014-top-correct-improve-and-otherwise-tweak-configs_read.patch new file mode 100644 index 0000000..0a2725c --- /dev/null +++ b/0014-top-correct-improve-and-otherwise-tweak-configs_read.patch @@ -0,0 +1,104 @@ +From 819ede1a6bc25d732cf84d15c48be9ca86f336a2 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Tue, 20 Aug 2013 00:00:00 -0500 +Subject: [PATCH] top: correct, improve and otherwise tweak configs_read + +This patch addresses the four '-Wunused-result' errors +generated whenever an optimized compile is invoked. It +also made the configs_read() guy a little more robust. + +In the process, some logic was rearranged slightly and +some comments were re-indented simply for consistency. + +Reference(s): +warning: ignoring return value of 'fgets', declared with attribute warn_unused_result [-Wunused-result] +warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result] + +Signed-off-by: Jim Warner +--- + top/top.c | 38 +++++++++++++++++++------------------- + 1 file changed, 19 insertions(+), 19 deletions(-) + +diff --git top/top.c top/top.c +index c29bb07..bdfcf20 100644 +--- top/top.c ++++ top/top.c +@@ -3394,26 +3394,25 @@ static void configs_read (void) { + + fp = fopen(SYS_RCFILESPEC, "r"); + if (fp) { +- fbuf[0] = '\0'; +- fgets(fbuf, sizeof(fbuf), fp); // sys rc file, line 1 +- if (strchr(fbuf, 's')) Secure_mode = 1; +- fbuf[0] = '\0'; +- fgets(fbuf, sizeof(fbuf), fp); // sys rc file, line 2 +- sscanf(fbuf, "%f", &Rc.delay_time); ++ if (fgets(fbuf, sizeof(fbuf), fp)) { // sys rc file, line 1 ++ Secure_mode = 1; ++ if (fgets(fbuf, sizeof(fbuf), fp)) // sys rc file, line 2 ++ sscanf(fbuf, "%f", &Rc.delay_time); ++ } + fclose(fp); + } + + fp = fopen(Rc_name, "r"); + if (fp) { + int tmp_whole, tmp_fract; +- fbuf[0] = '\0'; +- fgets(fbuf, sizeof(fbuf), fp); // ignore eyecatcher ++ if (fgets(fbuf, sizeof(fbuf), fp)) // ignore eyecatcher ++ ; // avoid -Wunused-result + if (6 != fscanf(fp + , "Id:%c, Mode_altscr=%d, Mode_irixps=%d, Delay_time=%d.%d, Curwin=%d\n" + , &Rc.id, &Rc.mode_altscr, &Rc.mode_irixps, &tmp_whole, &tmp_fract, &i)) { + p = fmtmk(N_fmt(RC_bad_files_fmt), Rc_name); + Rc_questions = -1; +- goto try_inspect_entries; // maybe a faulty 'inspect' echo ++ goto try_inspect_entries; // maybe a faulty 'inspect' echo + } + // you saw that, right? (fscanf stickin' it to 'i') + Curwin = &Winstk[i]; +@@ -3442,20 +3441,20 @@ static void configs_read (void) { + goto default_or_error; + + switch (Rc.id) { +- case 'f': // 3.3.0 thru 3.3.3 (procps-ng) +- SETw(w, Show_JRNUMS); // fall through ! +- case 'g': // current RCF_VERSION_ID +- default: // and future versions? ++ case 'a': // 3.2.8 (former procps) ++ if (config_cvt(w)) ++ goto default_or_error; ++ break; ++ case 'f': // 3.3.0 thru 3.3.3 (procps-ng) ++ SETw(w, Show_JRNUMS); // fall through ! ++ case 'g': // current RCF_VERSION_ID ++ default: // and future versions? + if (strlen(w->rc.fieldscur) != sizeof(DEF_FIELDS) - 1) + goto default_or_error; + for (x = 0; x < P_MAXPFLGS; ++x) + if (P_MAXPFLGS <= FLDget(w, x)) + goto default_or_error; + break; +- case 'a': // 3.2.8 (former procps) +- if (config_cvt(w)) +- goto default_or_error; +- break; + } + #ifndef USE_X_COLHDR + OFFw(w, NOHIFND_xxx | NOHISEL_xxx); +@@ -3463,8 +3462,9 @@ static void configs_read (void) { + } // end: for (GROUPSMAX) + + // any new addition(s) last, for older rcfiles compatibility... +- fscanf(fp, "Fixed_widest=%d, Summ_mscale=%d, Task_mscale=%d, Zero_suppress=%d\n" +- , &Rc.fixed_widest, &Rc.summ_mscale, &Rc.task_mscale, &Rc.zero_suppress); ++ if (fscanf(fp, "Fixed_widest=%d, Summ_mscale=%d, Task_mscale=%d, Zero_suppress=%d\n" ++ , &Rc.fixed_widest, &Rc.summ_mscale, &Rc.task_mscale, &Rc.zero_suppress)) ++ ; // avoid -Wunused-result + + try_inspect_entries: + // we'll start off Inspect stuff with 1 'potential' blank line +-- +1.7.9.2 + diff --git a/0015-top-swat-bug-affecting-batch-mode-and-width-provisio.patch b/0015-top-swat-bug-affecting-batch-mode-and-width-provisio.patch new file mode 100644 index 0000000..9d47bc2 --- /dev/null +++ b/0015-top-swat-bug-affecting-batch-mode-and-width-provisio.patch @@ -0,0 +1,39 @@ +From 06c19f5ba4e8fcb704936609e8ef7d328ca54a28 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Thu, 29 Aug 2013 00:00:00 -0500 +Subject: [PATCH] top: swat bug affecting batch mode and width provision + +Normally, the internally tracked 'Screen_cols' can not +exceed the lessor of 512 or actual screen width. There +was one case, however, where that 512 byte upper limit +was no longer properly imposed as it should have been. + +When operating in 'Batch' mode the actual screen width +was allowed to be exceeded when the optional -w switch +was also used. But, it should never have exceeded 512. + +This patch ensures the upper limit is always observed. + +Reference(s): +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=721204 + +Signed-off-by: Jim Warner +--- + top/top.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git top/top.c top/top.c +index bdfcf20..9996fbf 100644 +--- top/top.c ++++ top/top.c +@@ -1792,6 +1792,7 @@ static void adj_geometry (void) { + if (w_cols && w_cols < W_MIN_COL) w_cols = W_MIN_COL; + if (w_rows && w_rows < W_MIN_ROW) w_rows = W_MIN_ROW; + } ++ if (w_cols > SCREENMAX) w_cols = SCREENMAX; + w_set = 1; + } + +-- +1.7.9.2 + diff --git a/0018-top-restore-the-lost-final-newline-when-in-Batch-mod.patch b/0018-top-restore-the-lost-final-newline-when-in-Batch-mod.patch new file mode 100644 index 0000000..f07c068 --- /dev/null +++ b/0018-top-restore-the-lost-final-newline-when-in-Batch-mod.patch @@ -0,0 +1,32 @@ +From 4141efaf13254564f0377289bcf5a1a1389f60af Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Tue, 17 Sep 2013 00:00:00 -0500 +Subject: [PATCH] top: restore the lost final newline when in Batch mode + +This patch adds the final newline when exiting 'Batch' +mode. Interestingly, it has been missing since release +3.3.5 but undetected until the Redhat bugzilla report. + +Reference(s): +https://bugzilla.redhat.com/show_bug.cgi?id=1008674 + +Signed-off-by: Jim Warner +--- + top/top.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git top/top.c top/top.c +index 6f4f728..44bc380 100644 +--- top/top.c ++++ top/top.c +@@ -527,6 +527,7 @@ static void bye_bye (const char *str) { + fputs(str, stderr); + exit(EXIT_FAILURE); + } ++ if (Batch) putp("\n"); + exit(EXIT_SUCCESS); + } // end: bye_bye + +-- +1.7.9.2 + diff --git a/0019-top-swat-bug-impacting-idle-mode-user-filtering.patch b/0019-top-swat-bug-impacting-idle-mode-user-filtering.patch new file mode 100644 index 0000000..489fdb5 --- /dev/null +++ b/0019-top-swat-bug-impacting-idle-mode-user-filtering.patch @@ -0,0 +1,62 @@ +From e6a78f2745ca6c7ceed4406d3ce5397e77518b11 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Fri, 27 Sep 2013 12:12:12 -0500 +Subject: [PATCH] top: swat bug impacting 'idle' mode & 'user' filtering + +When Other filtering was introduced the nature of what +constituted a displayed row changed. No longer would a +task_show() call guarantee that another line is shown. +Rather, a non-empty string must have also been tested. + +Unfortunately, when any task window was being filtered +for 'idle' mode or a particular 'user', the proc index +was incremented twice due to the perils of copy/paste. +Combining such an index increment with the new test of +task_show results works fine if filtering is inactive. + +This was a particularly insidious bug which meant that +an adjacent task would be skipped whenever the current +task met 'idle' and/or 'user' filter criteria, and was +not otherwise excluded due to 'Other' filter criteria. + +And, since it was the very next task that was ignored, +the bug was very susceptible to a window's sort order. +This could be illustrated when filtering on some user, +while sorting on PID. Then, toggling Forest View could +make otherwise unseen tasks appear and then disappear. + +User workarounds are possible via interactive commands +trading the 'i' and 'u'/'U' provisions for the 'o'/'O' +other filtering capability thus avoiding an extra i++. +But that is certainly less than ideal and doesn't help +the 3.3.7 and 3.3.8 distorted command line provisions. + +( this little buggie may end up costing me my pocket ) +( protector, my coding badge & maybe even my cubicle ) + +Reference(s): +http://www.freelists.org/post/procps/Idle-elides-nonidle-processes +. bug originated with 'Other' filtering +commit 5edc6fb3174f1fd02bbfca61ec6d8a3a2e12f71c + +Signed-off-by: Jim Warner +--- + top/top.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git top/top.c top/top.c +index 44bc380..aa2777b 100644 +--- top/top.c ++++ top/top.c +@@ -5399,7 +5399,7 @@ static int window_show (WIN_t *q, int wmax) { + while (i < Frame_maxtask && lwin < wmax) { + if ((CHKw(q, Show_IDLEPS) || isBUSY(q->ppt[i])) + && user_matched(q, q->ppt[i]) +- && *task_show(q, q->ppt[i++])) ++ && *task_show(q, q->ppt[i])) + ++lwin; + ++i; + } +-- +1.7.9.2 + diff --git a/0021-top-address-some-potential-libnuma-display-corruptio.patch b/0021-top-address-some-potential-libnuma-display-corruptio.patch new file mode 100644 index 0000000..cdeb416 --- /dev/null +++ b/0021-top-address-some-potential-libnuma-display-corruptio.patch @@ -0,0 +1,83 @@ +From 35dc6dcc49cc9cf8cff4300cb03a38dbe44c05db Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Sun, 3 Nov 2013 00:00:00 -0500 +Subject: [PATCH] top: address some potential libnuma display corruption + +There is a chance that the libnuma library may corrupt +top's display with some stderr warning messages in the +event something under /sys/devices/system/node/ cannot +be accessed. And, while 2 overridable 'weak' functions +are provided to alter such behavior, we can't use them +since top dynamically links to the library via dlopen. + +This commit will redirect stderr to '/dev/null' during +just the first screen display cycle. Thus we can avoid +the corruption which would have remained visible until +the underlining screen row's data had finally changed. + +Lastly, this patch should allow such a library warning +to actually appear when one finally exits our program. + +[ i think the libnuma folks should consider changing ] +[ the error/warning interfaces to accommodate dlopen ] +[ rather than forcing something like the ugly kludge ] +[ we have employed or libnuma dependency on everyone ] + +Reference(s): +https://bugzilla.redhat.com/show_bug.cgi?id=998678 + +Signed-off-by: Jim Warner +--- + top/top.c | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git top/top.c top/top.c +index aa2777b..a48a5b9 100644 +--- top/top.c ++++ top/top.c +@@ -220,6 +220,7 @@ static int Numa_node_tot; + static int Numa_node_sel = -1; + #ifndef NUMA_DISABLE + static void *Libnuma_handle; ++static int stderr_save = -1; + #if defined(PRETEND_NUMA) || defined(PRETEND8CPUS) + static int Numa_max_node(void) { return 3; } + static int Numa_node_of_cpu(int num) { return (num % 4); } +@@ -4043,6 +4044,17 @@ static void wins_stage_2 (void) { + // fill in missing Fieldstab members and build each window's columnhdr + zap_fieldstab(); + ++#ifndef NUMA_DISABLE ++ /* there's a chance that damn libnuma may spew to stderr so we gotta ++ make sure he does not corrupt poor ol' top's first output screen! ++ Yes, he provides some overridable 'weak' functions to change such ++ behavior but we can't exploit that since we don't follow a normal ++ ld route to symbol resolution (we use that dlopen() guy instead)! */ ++ stderr_save = dup(fileno(stderr)); ++ if (-1 < stderr_save && freopen("/dev/null", "w", stderr)) ++ ; // avoid -Wunused-result ++#endif ++ + // lastly, initialize a signal set used to throttle one troublesome signal + sigemptyset(&Sigwinch_set); + #ifdef SIGNALS_LESS +@@ -5508,6 +5520,16 @@ static void frame_make (void) { + the normal non-interactive output optimization... */ + if (!Cap_can_goto) PSU_CLREOS(0); + ++#ifndef NUMA_DISABLE ++ /* we gotta reverse the stderr redirect which was employed in wins_stage_2 ++ and needed because the two libnuma 'weak' functions were useless to us! */ ++ if (-1 < stderr_save) { ++ dup2(stderr_save, fileno(stderr)); ++ close(stderr_save); ++ stderr_save = -1; ++ } ++#endif ++ + /* lastly, check auto-sized width needs for the next iteration */ + if (AUTOX_MODE && Autox_found) + widths_resize(); +-- +1.7.9.2 + diff --git a/0022-top-fix-miscellaneous-spelling-errors-in-man-documen.patch b/0022-top-fix-miscellaneous-spelling-errors-in-man-documen.patch new file mode 100644 index 0000000..5ff9989 --- /dev/null +++ b/0022-top-fix-miscellaneous-spelling-errors-in-man-documen.patch @@ -0,0 +1,76 @@ +From 5a8adee659524ef72583d8ea494721d279b5bea1 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Tue, 5 Nov 2013 00:00:00 -0600 +Subject: [PATCH] top: fix miscellaneous spelling errors in man document + +Signed-off-by: Jim Warner +--- + procps-ng-3.3.8/top/top.1 | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +--- top/top.1 ++++ top/top.1 2014-05-15 10:27:04.482756345 +0000 +@@ -383,8 +383,8 @@ Display only processes with a user id or + The '\-u' option matches on \fI effective\fR user whereas the '\-U' option + matches on\fI any\fR user (real, effective, saved, or filesystem). + +-Prepending an exclamation point ('!') to the user id or name instucts top to +-display only processes with users not matching the one provided. ++Prepending an exclamation point ('!') to the user id or name instructs top ++to display only processes with users not matching the one provided. + + The 'p', 'u' and 'U' \*(COs are mutually exclusive. + +@@ -650,8 +650,8 @@ If you see 'rt' in this field, it means + 'real time' scheduling priority. + + Under linux, real time priority is somewhat misleading since traditionally +-the operating itself was not preemptable. +-And while the 2.6 kernel can be made mostly preemptable, it is not always so. ++the operating itself was not preemptible. ++And while the 2.6 kernel can be made mostly preemptible, it is not always so. + + .TP 4 + 17.\fB RES \*(Em Resident Memory Size (KiB) \fR +@@ -1337,10 +1337,10 @@ matches on\fB any\fR user (real, effecti + + Thereafter, in that \*(TW only matching users will be shown, or possibly + no processes will be shown. +-Prepending an exclamation point ('!') to the user id or name instucts top ++Prepending an exclamation point ('!') to the user id or name instructs top + to display only processes with users not matching the one provided. + +-Different \*(TWs can can be used to filter different users. ++Different \*(TWs can be used to filter different users. + Later, if you wish to monitor all users again in the \*(CW, re-issue this + command but just press at the prompt. + +@@ -1349,7 +1349,7 @@ command but just press at the pr + In this mode, processes are reordered according to their parents and + the layout of the COMMAND column resembles that of a tree. + In forest view mode it is still possible to toggle between program +-name and commamd line (\*(Xc 'c' \*(CI) or between processes and ++name and command line (\*(Xc 'c' \*(CI) or between processes and + threads (\*(Xc 'H' \*(CI). + + \*(NT Typing any key affecting the sort order will exit forest view +@@ -1673,8 +1673,8 @@ The above \*(CIs are\fB always\fR availa + available in \*(AM if the \*(CW's \*(TD has been toggled \*F. + + \*(NT When any form of filtering is active, you can expect some slight +-abberations when scrolling since not all tasks will be visible. +-This is paticularly apparent when using the Up/Down \*(KAs. ++aberrations when scrolling since not all tasks will be visible. ++This is particularly apparent when using the Up/Down \*(KAs. + + .\" ...................................................................... + .SS 5d. SEARCHING in a Window +@@ -2037,7 +2037,7 @@ enable backslash interpretation regardle + + \fBCaution\fR: + If any inspect entry you create produces output with unprintable characters +-they will be displayed in either the ^C notation or hexidecimal form, ++they will be displayed in either the ^C notation or hexadecimal form, + depending on their value. + This applies to tab characters as well, which will show as '^I'. + If you want a truer representation, any embedded tabs should be expanded. diff --git a/0023-top-expand-on-column-highlight-quirks-in-man-documen.patch b/0023-top-expand-on-column-highlight-quirks-in-man-documen.patch new file mode 100644 index 0000000..6bd5624 --- /dev/null +++ b/0023-top-expand-on-column-highlight-quirks-in-man-documen.patch @@ -0,0 +1,39 @@ +From 9c776bbcde2260f454b51b86d46aafcc2f7dc71c Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Wed, 6 Nov 2013 00:00:00 -0600 +Subject: [PATCH] top: expand on column highlight quirks in man document + +Confession is supposed to be good for the sole, right? + +After a senior moment regarding the 'x' toggle quirks, +and thinking top had somehow regressed, I concluded an +additional explanatory note might well be appropriate. + +Those quirks were already documented under the 5d & 5e +topics. But there was no such caution documented under +the 'x' command explanation itself, found in topic 4c. + +Signed-off-by: Jim Warner +--- + top/top.1 | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git top/top.1 top/top.1 +index 64a6a36..87659be 100644 +--- top/top.1 ++++ top/top.1 +@@ -1270,6 +1270,11 @@ The sort field might\fI not\fR be visible because: + 1) there is insufficient\fI Screen Width \fR + 2) the 'f' \*(CI turned it \*F + ++\*(NT Whenever 'Searching' and/or 'Other Filtering' is active in a window, ++column highlighting is temporarily disabled. ++\*(XC notes at the end of topics 5d. SEARCHING and 5e. FILTERING for an ++explanation why. ++ + .TP 7 + \ \ \ \fBy\fR\ \ :\fIRow-Highlight\fR toggle \fR + Changes highlighting for "running" tasks. +-- +1.7.9.2 + diff --git a/0024-top-add-some-flexibility-to-dlopen-for-numa-support.patch b/0024-top-add-some-flexibility-to-dlopen-for-numa-support.patch new file mode 100644 index 0000000..ff42ea7 --- /dev/null +++ b/0024-top-add-some-flexibility-to-dlopen-for-numa-support.patch @@ -0,0 +1,60 @@ +From bdb2fe005616bb40f2da53da02b01f91cabf9a87 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Thu, 7 Nov 2013 00:00:00 -0600 +Subject: [PATCH] top: add some flexibility to dlopen() for numa support + +A recent libnuma potential corruption problem solution +suggests that libnuma could change in the future so as +to not spew to stderr. This then raises a question how +top could exploit any such library change since we are +currently locked into version #1 of the library by way +of our dlopen("libnuma.so.1", RTLD_LAZY) runtime call. + +While not an ultimate solution, this commit will first +try for the most recent version of that library during +top's startup before trying the original libnuma.so.1. +We do this via the unqualified library soname symlink. + +For this new dlopen() call to succeed, technically the +numa 'devel' package would usually have been required, +but that's not always true with every distro. And when +the libnuma.so symlink isn't present, it can always be +manually added should a newer & better behaved library +arrive & users tire of the stderr warning at top exit. + +Reference(s): +commit 24bd950cb2e1722d459461f0f9c0c30a4b9ffdaa + +Signed-off-by: Jim Warner +--- + top/top.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git top/top.c top/top.c +index a48a5b9..e619ddd 100644 +--- top/top.c ++++ top/top.c +@@ -3246,8 +3246,9 @@ static void before (char *me) { + #if defined(PRETEND_NUMA) || defined(PRETEND8CPUS) + Numa_node_tot = Numa_max_node() + 1; + #else +- Libnuma_handle = dlopen("libnuma.so.1", RTLD_LAZY); +- if (Libnuma_handle) { ++ // we'll try for the most recent version, then a version we know works... ++ if ((Libnuma_handle = dlopen("libnuma.so", RTLD_LAZY)) ++ || (Libnuma_handle = dlopen("libnuma.so.1", RTLD_LAZY))) { + Numa_max_node = dlsym(Libnuma_handle, "numa_max_node"); + Numa_node_of_cpu = dlsym(Libnuma_handle, "numa_node_of_cpu"); + if (Numa_max_node && Numa_node_of_cpu) +@@ -3265,7 +3266,7 @@ static void before (char *me) { + #endif + // lastly, establish a robust signals environment + sigemptyset(&sa.sa_mask); +- // with user position perserved through SIGWINCH, we must avoid SA_RESTART ++ // with user position preserved through SIGWINCH, we must avoid SA_RESTART + sa.sa_flags = 0; + for (i = SIGRTMAX; i; i--) { + switch (i) { +-- +1.7.9.2 + diff --git a/0025-top-minimize-the-statistics-overhead-for-numa-suppor.patch b/0025-top-minimize-the-statistics-overhead-for-numa-suppor.patch new file mode 100644 index 0000000..a15fbbc --- /dev/null +++ b/0025-top-minimize-the-statistics-overhead-for-numa-suppor.patch @@ -0,0 +1,109 @@ +From f12c0d5c6e84f9409ac3a73c066841a8ff5aab0b Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Fri, 8 Nov 2013 00:00:00 -0600 +Subject: [PATCH] top: minimize the statistics overhead for numa support + +A recent libnuma potential corruption problem solution +has caused me to reevaluate some associated numa logic +for efficiency. Here is a summary of the problems that +exist with current libnuma/user possible interactions: + +. Whenever the numa library was present extra overhead +would always be incurred in maintaining the node stats +even when the '2' or '3' commands were not being used. + +. As part of such overhead a separate loop was used to +reinitialize each cpu/node structure with each display +cycle so that prior accumulated totals were preserved. +Again, it didn't matter if numa data was really shown. + +This commit attempts to refocus on the 'critical path' +costs in a running top by optimizing for the occasions +when numa node data is not being displayed. Under such +conditions, no extra overhead will be incurred whether +or not a distribution has the libnuma library present. + +To achieve this goal, some additional overhead will be +incurred, but only when actually displaying numa data. +And all such new costs have been minimized in spite of +the gcc inclination to duplicate subscript resolution. + +Reference(s): +commit 24bd950cb2e1722d459461f0f9c0c30a4b9ffdaa + +Signed-off-by: Jim Warner +--- + top/top.c | 46 +++++++++++++++++++++++----------------------- + 1 file changed, 23 insertions(+), 23 deletions(-) + +diff --git top/top.c top/top.c +index e619ddd..9d12693 100644 +--- top/top.c ++++ top/top.c +@@ -2361,18 +2361,9 @@ static CPU_t *cpus_refresh (CPU_t *cpus) { + #endif + + #ifndef NUMA_DISABLE +- for (i = 0; i < Numa_node_tot; i++) { +- node = sumSLOT + 1 + i; +- // remember from last time around +- memcpy(&cpus[node].sav, &cpus[node].cur, sizeof(CT_t)); +- // initialize current node statistics +- memset(&cpus[node].cur, 0, sizeof(CT_t)); +-#ifndef CPU_ZEROTICS +- cpus[node].edge = cpus[sumSLOT].edge; +- // this is for symmetry only, it's not currently required +- cpus[node].cur.tot = cpus[sumSLOT].cur.tot; +-#endif +- } ++ // forget all of the prior node statistics (maybe) ++ if (CHKw(Curwin, View_CPUNOD)) ++ memset(&cpus[sumSLOT + 1], 0, Numa_node_tot * sizeof(CPU_t)); + #endif + + // now value each separate cpu's tics... +@@ -2400,21 +2391,30 @@ static CPU_t *cpus_refresh (CPU_t *cpus) { + cpus[i].id = i; + #endif + #ifndef NUMA_DISABLE +- if (Numa_node_tot ++ /* henceforth, with just a little more arithmetic we can avoid ++ maintaining *any* node stats unless they're actually needed */ ++ if (CHKw(Curwin, View_CPUNOD) ++ && Numa_node_tot + && -1 < (node = Numa_node_of_cpu(cpus[i].id))) { ++ // use our own pointer to avoid gcc subscript bloat ++ CPU_t *nod_ptr = &cpus[sumSLOT + 1 + node]; ++ nod_ptr->cur.u += cpus[i].cur.u; nod_ptr->sav.u += cpus[i].sav.u; ++ nod_ptr->cur.n += cpus[i].cur.n; nod_ptr->sav.n += cpus[i].sav.n; ++ nod_ptr->cur.s += cpus[i].cur.s; nod_ptr->sav.s += cpus[i].sav.s; ++ nod_ptr->cur.i += cpus[i].cur.i; nod_ptr->sav.i += cpus[i].sav.i; ++ nod_ptr->cur.w += cpus[i].cur.w; nod_ptr->sav.w += cpus[i].sav.w; ++ nod_ptr->cur.x += cpus[i].cur.x; nod_ptr->sav.x += cpus[i].sav.x; ++ nod_ptr->cur.y += cpus[i].cur.y; nod_ptr->sav.y += cpus[i].sav.y; ++ nod_ptr->cur.z += cpus[i].cur.z; nod_ptr->sav.z += cpus[i].sav.z; ++#ifndef CPU_ZEROTICS ++ /* yep, we re-value this repeatedly for each cpu encountered, but we ++ can then avoid a prior loop to selectively initialize each node */ ++ nod_ptr->edge = cpus[sumSLOT].edge; ++#endif + cpus[i].node = node; +- node += (sumSLOT + 1); +- cpus[node].cur.u += cpus[i].cur.u; +- cpus[node].cur.n += cpus[i].cur.n; +- cpus[node].cur.s += cpus[i].cur.s; +- cpus[node].cur.i += cpus[i].cur.i; +- cpus[node].cur.w += cpus[i].cur.w; +- cpus[node].cur.x += cpus[i].cur.x; +- cpus[node].cur.y += cpus[i].cur.y; +- cpus[node].cur.z += cpus[i].cur.z; + } + #endif +- } ++ } // end: for each cpu + + Cpu_faux_tot = i; // tolerate cpus taken offline + +-- +1.7.9.2 + diff --git a/0026-top-eliminate-yet-more-gcc-subscript-resolution-bloa.patch b/0026-top-eliminate-yet-more-gcc-subscript-resolution-bloa.patch new file mode 100644 index 0000000..69a9623 --- /dev/null +++ b/0026-top-eliminate-yet-more-gcc-subscript-resolution-bloa.patch @@ -0,0 +1,149 @@ +From 89c2f28e393830d899e3e91b60c830a6f07d38d5 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Sat, 9 Nov 2013 00:00:00 -0600 +Subject: [PATCH] top: eliminate yet more gcc subscript resolution bloat + +This patch is inspired by the 'minimize numa overhead' +patch. It trades the use of subscripts for pointers to +avoid gcc repeated subscript offset calculation bloat. + +Now, throughout the cpus_refresh function, a subscript +will be resolved just once & this will (dramatically?) +reduce the path-length taken for each and every frame! + +For example, a non-optimized compilation could produce +400+ fewer machine instructions through pointer usage. + +[ ok, optimized compiles only save 18+ instructions! ] + +Lastly, any residual 'symmetry only' crap is now gone! + +Signed-off-by: Jim Warner +--- + top/top.c | 65 +++++++++++++++++++++++++++++++------------------------------ + 1 file changed, 33 insertions(+), 32 deletions(-) + +diff --git top/top.c top/top.c +index 9d12693..151693d 100644 +--- top/top.c ++++ top/top.c +@@ -2298,6 +2298,7 @@ static CPU_t *cpus_refresh (CPU_t *cpus) { + static FILE *fp = NULL; + static int siz, sav_slot = -1; + static char *buf; ++ CPU_t *sum_ptr; // avoid gcc subscript bloat + int i, num, tot_read; + #ifndef NUMA_DISABLE + int node; +@@ -2342,76 +2343,76 @@ static CPU_t *cpus_refresh (CPU_t *cpus) { + #undef buffGRW + + // remember from last time around +- memcpy(&cpus[sumSLOT].sav, &cpus[sumSLOT].cur, sizeof(CT_t)); ++ sum_ptr = &cpus[sumSLOT]; ++ memcpy(&sum_ptr->sav, &sum_ptr->cur, sizeof(CT_t)); + // then value the last slot with the cpu summary line + if (4 > sscanf(bp, "cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu" +- , &cpus[sumSLOT].cur.u, &cpus[sumSLOT].cur.n, &cpus[sumSLOT].cur.s +- , &cpus[sumSLOT].cur.i, &cpus[sumSLOT].cur.w, &cpus[sumSLOT].cur.x +- , &cpus[sumSLOT].cur.y, &cpus[sumSLOT].cur.z)) ++ , &sum_ptr->cur.u, &sum_ptr->cur.n, &sum_ptr->cur.s ++ , &sum_ptr->cur.i, &sum_ptr->cur.w, &sum_ptr->cur.x ++ , &sum_ptr->cur.y, &sum_ptr->cur.z)) + error_exit(N_txt(FAIL_statget_txt)); + #ifndef CPU_ZEROTICS +- cpus[sumSLOT].cur.tot = cpus[sumSLOT].cur.u + cpus[sumSLOT].cur.s +- + cpus[sumSLOT].cur.n + cpus[sumSLOT].cur.i + cpus[sumSLOT].cur.w +- + cpus[sumSLOT].cur.x + cpus[sumSLOT].cur.y + cpus[sumSLOT].cur.z; ++ sum_ptr->cur.tot = sum_ptr->cur.u + sum_ptr->cur.s ++ + sum_ptr->cur.n + sum_ptr->cur.i + sum_ptr->cur.w ++ + sum_ptr->cur.x + sum_ptr->cur.y + sum_ptr->cur.z; + /* if a cpu has registered substantially fewer tics than those expected, + we'll force it to be treated as 'idle' so as not to present misleading + percentages. */ +- cpus[sumSLOT].edge = +- ((cpus[sumSLOT].cur.tot - cpus[sumSLOT].sav.tot) / smp_num_cpus()) / (100 / TICS_EDGE); ++ sum_ptr->edge = ++ ((sum_ptr->cur.tot - sum_ptr->sav.tot) / smp_num_cpus()) / (100 / TICS_EDGE); + #endif + + #ifndef NUMA_DISABLE + // forget all of the prior node statistics (maybe) + if (CHKw(Curwin, View_CPUNOD)) +- memset(&cpus[sumSLOT + 1], 0, Numa_node_tot * sizeof(CPU_t)); ++ memset(sum_ptr + 1, 0, Numa_node_tot * sizeof(CPU_t)); + #endif + + // now value each separate cpu's tics... + for (i = 0; i < sumSLOT; i++) { ++ CPU_t *cpu_ptr = &cpus[i]; // avoid gcc subscript bloat + #ifdef PRETEND8CPUS + bp = buf; + #endif + bp = 1 + strchr(bp, '\n'); + // remember from last time around +- memcpy(&cpus[i].sav, &cpus[i].cur, sizeof(CT_t)); +- if (4 > sscanf(bp, "cpu%d %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu", &cpus[i].id +- , &cpus[i].cur.u, &cpus[i].cur.n, &cpus[i].cur.s +- , &cpus[i].cur.i, &cpus[i].cur.w, &cpus[i].cur.x +- , &cpus[i].cur.y, &cpus[i].cur.z)) { +- memmove(&cpus[i], &cpus[sumSLOT], sizeof(CPU_t)); ++ memcpy(&cpu_ptr->sav, &cpu_ptr->cur, sizeof(CT_t)); ++ if (4 > sscanf(bp, "cpu%d %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu", &cpu_ptr->id ++ , &cpu_ptr->cur.u, &cpu_ptr->cur.n, &cpu_ptr->cur.s ++ , &cpu_ptr->cur.i, &cpu_ptr->cur.w, &cpu_ptr->cur.x ++ , &cpu_ptr->cur.y, &cpu_ptr->cur.z)) { ++ memmove(cpu_ptr, sum_ptr, sizeof(CPU_t)); + break; // tolerate cpus taken offline + } + + #ifndef CPU_ZEROTICS +- cpus[i].edge = cpus[sumSLOT].edge; +- // this is for symmetry only, it's not currently required +- cpus[i].cur.tot = cpus[sumSLOT].cur.tot; ++ cpu_ptr->edge = sum_ptr->edge; + #endif + #ifdef PRETEND8CPUS +- cpus[i].id = i; ++ cpu_ptr->id = i; + #endif + #ifndef NUMA_DISABLE + /* henceforth, with just a little more arithmetic we can avoid + maintaining *any* node stats unless they're actually needed */ + if (CHKw(Curwin, View_CPUNOD) + && Numa_node_tot +- && -1 < (node = Numa_node_of_cpu(cpus[i].id))) { ++ && -1 < (node = Numa_node_of_cpu(cpu_ptr->id))) { + // use our own pointer to avoid gcc subscript bloat +- CPU_t *nod_ptr = &cpus[sumSLOT + 1 + node]; +- nod_ptr->cur.u += cpus[i].cur.u; nod_ptr->sav.u += cpus[i].sav.u; +- nod_ptr->cur.n += cpus[i].cur.n; nod_ptr->sav.n += cpus[i].sav.n; +- nod_ptr->cur.s += cpus[i].cur.s; nod_ptr->sav.s += cpus[i].sav.s; +- nod_ptr->cur.i += cpus[i].cur.i; nod_ptr->sav.i += cpus[i].sav.i; +- nod_ptr->cur.w += cpus[i].cur.w; nod_ptr->sav.w += cpus[i].sav.w; +- nod_ptr->cur.x += cpus[i].cur.x; nod_ptr->sav.x += cpus[i].sav.x; +- nod_ptr->cur.y += cpus[i].cur.y; nod_ptr->sav.y += cpus[i].sav.y; +- nod_ptr->cur.z += cpus[i].cur.z; nod_ptr->sav.z += cpus[i].sav.z; ++ CPU_t *nod_ptr = sum_ptr + 1 + node; ++ nod_ptr->cur.u += cpu_ptr->cur.u; nod_ptr->sav.u += cpu_ptr->sav.u; ++ nod_ptr->cur.n += cpu_ptr->cur.n; nod_ptr->sav.n += cpu_ptr->sav.n; ++ nod_ptr->cur.s += cpu_ptr->cur.s; nod_ptr->sav.s += cpu_ptr->sav.s; ++ nod_ptr->cur.i += cpu_ptr->cur.i; nod_ptr->sav.i += cpu_ptr->sav.i; ++ nod_ptr->cur.w += cpu_ptr->cur.w; nod_ptr->sav.w += cpu_ptr->sav.w; ++ nod_ptr->cur.x += cpu_ptr->cur.x; nod_ptr->sav.x += cpu_ptr->sav.x; ++ nod_ptr->cur.y += cpu_ptr->cur.y; nod_ptr->sav.y += cpu_ptr->sav.y; ++ nod_ptr->cur.z += cpu_ptr->cur.z; nod_ptr->sav.z += cpu_ptr->sav.z; + #ifndef CPU_ZEROTICS + /* yep, we re-value this repeatedly for each cpu encountered, but we + can then avoid a prior loop to selectively initialize each node */ +- nod_ptr->edge = cpus[sumSLOT].edge; ++ nod_ptr->edge = sum_ptr->edge; + #endif +- cpus[i].node = node; ++ cpu_ptr->node = node; + } + #endif + } // end: for each cpu +-- +1.7.9.2 + diff --git a/0032-top-do-not-lie-about-purported-alphabetical-ordering.patch b/0032-top-do-not-lie-about-purported-alphabetical-ordering.patch new file mode 100644 index 0000000..a5fee49 --- /dev/null +++ b/0032-top-do-not-lie-about-purported-alphabetical-ordering.patch @@ -0,0 +1,63 @@ +Based on 57ab5eed15a577fda6ce24753948ab29f30de2d4 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Fri, 29 Nov 2013 00:00:00 -0600 +Subject: [PATCH] top: do not lie about purported alphabetical orderings + +Excluding those special X_XON/X_XOF enums, which might +not even be present, restore strict collating order of +all the case labels in the task_show switch statement. + +Also, adjust a few sort callbacks for the same reason. + +Signed-off-by: Jim Warner +--- + top/top.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git top/top.c top/top.c +index 70eaa4a..59dcb3f 100644 +--- top/top.c ++++ top/top.c +@@ -246,9 +246,9 @@ SCB_NUM1(CPU, pcpu) + SCB_NUM1(DAT, drs) + SCB_NUM1(DRT, dt) + SCB_STRS(ENV, environ[0]) +-SCB_NUM1(FLG, flags) + SCB_NUM1(FL1, maj_flt) + SCB_NUM1(FL2, min_flt) ++SCB_NUM1(FLG, flags) + SCB_NUM1(FV1, maj_delta) + SCB_NUM1(FV2, min_delta) + SCB_NUMx(GID, egid) +@@ -5220,15 +5220,15 @@ static const char *task_show (const WIN_t *q, const proc_t *p) { + case P_ENV: + makeVAR(p->environ[0]); + break; +- case P_FLG: +- cp = make_str(hex_make(p->flags, 1), W, Js, AUTOX_NO); +- break; + case P_FL1: + cp = scale_num(p->maj_flt, W, Jn); + break; + case P_FL2: + cp = scale_num(p->min_flt, W, Jn); + break; ++ case P_FLG: ++ cp = make_str(hex_make(p->flags, 1), W, Js, AUTOX_NO); ++ break; + case P_FV1: + cp = scale_num(p->maj_delta, W, Jn); + break; +@@ -5308,8 +5308,8 @@ static const char *task_show (const WIN_t *q, const proc_t *p) { + case P_THD: + cp = make_num(p->nlwp, W, Jn, AUTOX_NO); + break; +- case P_TME: + case P_TM2: ++ case P_TME: + { TIC_t t = p->utime + p->stime; + if (CHKw(q, Show_CTIMES)) t += (p->cutime + p->cstime); + cp = scale_tics(t, W, Jn); +-- +1.7.9.2 + diff --git a/0033-top-follow-usual-name-conventions-for-global-variabl.patch b/0033-top-follow-usual-name-conventions-for-global-variabl.patch new file mode 100644 index 0000000..381cffb --- /dev/null +++ b/0033-top-follow-usual-name-conventions-for-global-variabl.patch @@ -0,0 +1,60 @@ +From 4c464acf283b83f052af075f1190f146550c77a5 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Sat, 30 Nov 2013 00:00:00 -0600 +Subject: [PATCH] top: follow usual name conventions for global variable + +A recent change involving a one cycle stderr redirect, +to handle a libnuma potential transgression, failed to +follow normal global variable naming conventions. This +patch will capitalize the 1st letter of 'Stderr_save'. + +Reference(s): +commit 35dc6dcc49cc9cf8cff4300cb03a38dbe44c05db + +Signed-off-by: Jim Warner +--- + top/top.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git top/top.c top/top.c +index 59dcb3f..4d1d912 100644 +--- top/top.c ++++ top/top.c +@@ -220,7 +220,7 @@ static int Numa_node_tot; + static int Numa_node_sel = -1; + #ifndef NUMA_DISABLE + static void *Libnuma_handle; +-static int stderr_save = -1; ++static int Stderr_save = -1; + #if defined(PRETEND_NUMA) || defined(PRETEND8CPUS) + static int Numa_max_node(void) { return 3; } + static int Numa_node_of_cpu(int num) { return (num % 4); } +@@ -4069,8 +4069,8 @@ static void wins_stage_2 (void) { + Yes, he provides some overridable 'weak' functions to change such + behavior but we can't exploit that since we don't follow a normal + ld route to symbol resolution (we use that dlopen() guy instead)! */ +- stderr_save = dup(fileno(stderr)); +- if (-1 < stderr_save && freopen("/dev/null", "w", stderr)) ++ Stderr_save = dup(fileno(stderr)); ++ if (-1 < Stderr_save && freopen("/dev/null", "w", stderr)) + ; // avoid -Wunused-result + #endif + +@@ -5553,10 +5553,10 @@ static void frame_make (void) { + #ifndef NUMA_DISABLE + /* we gotta reverse the stderr redirect which was employed in wins_stage_2 + and needed because the two libnuma 'weak' functions were useless to us! */ +- if (-1 < stderr_save) { +- dup2(stderr_save, fileno(stderr)); +- close(stderr_save); +- stderr_save = -1; ++ if (-1 < Stderr_save) { ++ dup2(Stderr_save, fileno(stderr)); ++ close(Stderr_save); ++ Stderr_save = -1; + } + #endif + +-- +1.7.9.2 + diff --git a/0035-top-provide-for-discontinuous-not-active-NUMA-nodes.patch b/0035-top-provide-for-discontinuous-not-active-NUMA-nodes.patch new file mode 100644 index 0000000..bf45ba8 --- /dev/null +++ b/0035-top-provide-for-discontinuous-not-active-NUMA-nodes.patch @@ -0,0 +1,139 @@ +From b6fcb602ce0f80e818004340e6ddb5a788bb832d Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Sun, 5 Jan 2014 00:00:00 -0600 +Subject: [PATCH] top: provide for discontinuous (not active) NUMA nodes + +Apparently there are occasions when NUMA nodes may not +always be contiguous. Under such conditions nodes that +were not used would still occupy precious Summary Area +space showing 100% idle, under the '2' command toggle. + +With this commit top will no longer display numa nodes +that have no associated cpu when the '2' toggle is on. +But just in case we wish to return to former behavior, +a new #define called OFF_NUMASKIP has been introduced. + +And as an aside, a recent refactor mentioned below set +the stage for this patch to be 'self-tuning'. In other +words, if an inactive/non-displayed node should become +active (if even possible), then top will begin showing +such a node automatically with the next screen update. + +Unfortunately, all inactive nodes now 'suppressed' are +still accessible via the '3' command. Those nodes will +just be displayed as empty (no associated cpus shown). +This is not really a top problem but more of a libnuma +and/or user deficiency. The library lacks the means to +validate a node id and the user then input a node that +was not even shown under a '2' toggle Summary display. + +( too bad libnuma does not offer an 'is_node_active' ) +( type function so top could warn a user when such a ) +( discontinuous node was requested using his '3' cmd ) + +( sure, top could achieve this objective himself but ) +( that would require making yet another array global ) +( which i'm just not in the mood to do - besides, we ) +( have already made enough concessions to libnuma.so ) + +Lastly, an existing #define (PRETEND_NUMA) was changed +to 'disable' node #1 so as to simulate a discontinuous +node. This allows testing of the '2' and '3' commands. + +Reference(s): +http://www.spinics.net/lists/util-linux-ng/msg08671.html +. set stage for self tuning +commit f12c0d5c6e84f9409ac3a73c066841a8ff5aab0b + +Signed-off-by: Jim Warner +--- + top/top.c | 16 +++++++++++++++- + top/top.h | 8 ++++++-- + 2 files changed, 21 insertions(+), 3 deletions(-) + +diff --git top/top.c top/top.c +index bb15d01..cb1a063 100644 +--- top/top.c ++++ top/top.c +@@ -223,7 +223,11 @@ static void *Libnuma_handle; + static int Stderr_save = -1; + #if defined(PRETEND_NUMA) || defined(PRETEND8CPUS) + static int Numa_max_node(void) { return 3; } ++#ifndef OFF_NUMASKIP ++static int Numa_node_of_cpu(int num) { return (1 == (num % 4)) ? 0 : (num % 4); } ++#else + static int Numa_node_of_cpu(int num) { return (num % 4); } ++#endif + #else + static int (*Numa_max_node)(void); + static int (*Numa_node_of_cpu)(int num); +@@ -2430,6 +2434,9 @@ static CPU_t *cpus_refresh (CPU_t *cpus) { + nod_ptr->edge = sum_ptr->edge; + #endif + cpu_ptr->node = node; ++#ifndef OFF_NUMASKIP ++ nod_ptr->id = -1; ++#endif + } + #endif + } // end: for each cpu +@@ -5056,10 +5063,17 @@ static void summary_show (void) { + Msg_row += 1; + // display each cpu node's states + for (i = 0; i < Numa_node_tot; i++) { ++ CPU_t *nod_ptr = &smpcpu[1 + smp_num_cpus() + i]; + if (!isROOM(anyFLG, 1)) break; ++#ifndef OFF_NUMASKIP ++ if (nod_ptr->id) { ++#endif + snprintf(tmp, sizeof(tmp), N_fmt(NUMA_nodenam_fmt), i); +- summary_hlp(&smpcpu[1 + smp_num_cpus() + i], tmp); ++ summary_hlp(nod_ptr, tmp); + Msg_row += 1; ++#ifndef OFF_NUMASKIP ++ } ++#endif + } + } else { + // display the node summary, then the associated cpus (if room) +diff --git top/top.h top/top.h +index 16f7668..8e83b61 100644 +--- top/top.h ++++ top/top.h +@@ -41,12 +41,13 @@ + //#define INSP_SAVEBUF /* preserve 'Insp_buf' contents in a file */ + //#define INSP_SLIDE_1 /* when scrolling left/right don't move 8 */ + //#define OFF_HST_HASH /* use BOTH qsort+bsrch vs. hashing scheme */ ++//#define OFF_NUMASKIP /* do NOT skip numa nodes if discontinuous */ + //#define OFF_SCROLLBK /* disable tty emulators scrollback buffer */ + //#define OFF_STDIOLBF /* disable our own stdout _IOFBF override */ + //#define PRETEND2_5_X /* pretend we're linux 2.5.x (for IO-wait) */ + //#define PRETEND8CPUS /* pretend we're smp with 8 ticsers (sic) */ + //#define PRETENDNOCAP /* use a terminal without essential caps */ +-//#define PRETEND_NUMA /* pretend we've got some linux NUMA Nodes */ ++//#define PRETEND_NUMA /* pretend 4 (or 3 w/o OFF_NUMASKIP) Nodes */ + //#define RCFILE_NOERR /* rcfile errs silently default, vs. fatal */ + //#define RECALL_FIXED /* don't reorder saved strings if recalled */ + //#define RMAN_IGNORED /* don't consider auto right margin glitch */ +@@ -277,7 +278,7 @@ typedef struct CPU_t { + #ifndef CPU_ZEROTICS + SIC_t edge; // tics adjustment threshold boundary + #endif +- int id; // the cpu id number (0 - nn) ++ int id; // cpu number (0 - nn), or numa active flag + #ifndef NUMA_DISABLE + int node; // the numa node it belongs to + #endif +@@ -628,6 +629,9 @@ typedef struct WIN_t { + #if defined(PRETEND_NUMA) && defined(NUMA_DISABLE) + # error 'PRETEND_NUMA' confilcts with 'NUMA_DISABLE' + #endif ++#if defined(OFF_NUMASKIP) && defined(NUMA_DISABLE) ++# error 'OFF_NUMASKIP' confilcts with 'NUMA_DISABLE' ++#endif + #if (LRGBUFSIZ < SCREENMAX) + # error 'LRGBUFSIZ' must NOT be less than 'SCREENMAX' + #endif +-- +1.7.9.2 + diff --git a/0036-top-restore-the-former-behavior-after-stderr-redirec.patch b/0036-top-restore-the-former-behavior-after-stderr-redirec.patch new file mode 100644 index 0000000..15cbf66 --- /dev/null +++ b/0036-top-restore-the-former-behavior-after-stderr-redirec.patch @@ -0,0 +1,124 @@ +From bcf4f5a830ad008e0bd9341105db825a22ea3906 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Thu, 20 Feb 2014 00:00:00 -0600 +Subject: [PATCH] top: restore the former behavior after stderr redirect + +When top originally responded to the potential libnuma +stderr write, the library was consistently called with +each refresh cycle. That, in turn, guaranteed that any +warning message would be seen at program end by virtue +of: 1) having been issued before the 2nd refresh cycle +and; 2) benefiting from inherited /dev/null buffering. + +A later efficiency refactor meant the numa library may +not always be called with every refresh cycle. Rather, +it was only called if top was in one of two numa views +(the '2' or '3' toggles). That, in turn, resulted in a +loss of any warning message at program end unless numa +mode had been preserved in the rcfile. In other words, +if top was started normally then a single cycle stderr +redirect would have long passed by the time the '2' or +'3' toggle was activated. The warning message actually +was spewed but quickly lost to the full screen refresh +which follows all keyboard interactions with the user. + +This commit simply moves the restoration of our stderr +redirect to program end (instead of that first display +refresh). Now, any libnuma stderr warning message will +appear as the concluding output line upon quitting top +without regard to when any numa mode view was invoked. + +And since this technique might be useful in some other +context (as an example of how to 'buffer' stderr) it's +been generalized with its own #define. But to maximize +its usefulness, the original redirect should be issued +much earlier in pgm startup than top has chosen to do. + +Reference(s): +. original libnuma stderr response (msg seen) +commit 35dc6dcc49cc9cf8cff4300cb03a38dbe44c05db +. numa refractoring for efficiency (msg lost) +commit f12c0d5c6e84f9409ac3a73c066841a8ff5aab0b + +Signed-off-by: Jim Warner +--- + top/top.c | 25 +++++++++++++------------ + top/top.h | 1 + + 2 files changed, 14 insertions(+), 12 deletions(-) + +diff --git top/top.c top/top.c +index cb1a063..23dad92 100644 +--- top/top.c ++++ top/top.c +@@ -216,11 +216,13 @@ static int Autox_array [P_MAXPFLGS], + + /* Support for NUMA Node display, node expansion/targeting and + run-time dynamic linking with libnuma.so treated as a plugin */ ++#ifndef OFF_STDERROR ++static int Stderr_save = -1; ++#endif + static int Numa_node_tot; + static int Numa_node_sel = -1; + #ifndef NUMA_DISABLE + static void *Libnuma_handle; +-static int Stderr_save = -1; + #if defined(PRETEND_NUMA) || defined(PRETEND8CPUS) + static int Numa_max_node(void) { return 3; } + #ifndef OFF_NUMASKIP +@@ -377,6 +379,15 @@ static void at_eoj (void) { + #endif + } + fflush(stdout); ++#ifndef OFF_STDERROR ++ /* we gotta reverse the stderr redirect which was employed during start up ++ and needed because the two libnuma 'weak' functions were useless to us! */ ++ if (-1 < Stderr_save) { ++ dup2(Stderr_save, fileno(stderr)); ++ close(Stderr_save); ++ Stderr_save = -1; // we'll be ending soon anyway but what the heck ++ } ++#endif + } // end: at_eoj + + +@@ -4070,7 +4081,7 @@ static void wins_stage_2 (void) { + // fill in missing Fieldstab members and build each window's columnhdr + zap_fieldstab(); + +-#ifndef NUMA_DISABLE ++#ifndef OFF_STDERROR + /* there's a chance that damn libnuma may spew to stderr so we gotta + make sure he does not corrupt poor ol' top's first output screen! + Yes, he provides some overridable 'weak' functions to change such +@@ -5564,16 +5575,6 @@ static void frame_make (void) { + the normal non-interactive output optimization... */ + if (!Cap_can_goto) PSU_CLREOS(0); + +-#ifndef NUMA_DISABLE +- /* we gotta reverse the stderr redirect which was employed in wins_stage_2 +- and needed because the two libnuma 'weak' functions were useless to us! */ +- if (-1 < Stderr_save) { +- dup2(Stderr_save, fileno(stderr)); +- close(Stderr_save); +- Stderr_save = -1; +- } +-#endif +- + /* lastly, check auto-sized width needs for the next iteration */ + if (AUTOX_MODE && Autox_found) + widths_resize(); +diff --git top/top.h top/top.h +index 8e83b61..862568c 100644 +--- top/top.h ++++ top/top.h +@@ -43,6 +43,7 @@ + //#define OFF_HST_HASH /* use BOTH qsort+bsrch vs. hashing scheme */ + //#define OFF_NUMASKIP /* do NOT skip numa nodes if discontinuous */ + //#define OFF_SCROLLBK /* disable tty emulators scrollback buffer */ ++//#define OFF_STDERROR /* disable our stderr buffering (redirect) */ + //#define OFF_STDIOLBF /* disable our own stdout _IOFBF override */ + //#define PRETEND2_5_X /* pretend we're linux 2.5.x (for IO-wait) */ + //#define PRETEND8CPUS /* pretend we're smp with 8 ticsers (sic) */ +-- +1.7.9.2 + diff --git a/0037-top-avoid-name-conflict-in-the-next-version-of-stdli.patch b/0037-top-avoid-name-conflict-in-the-next-version-of-stdli.patch new file mode 100644 index 0000000..7bd9d4b --- /dev/null +++ b/0037-top-avoid-name-conflict-in-the-next-version-of-stdli.patch @@ -0,0 +1,1054 @@ +Based on 24f1fbd9d051353dd8ebde048f1903d68834af74 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Tue, 25 Feb 2014 00:00:00 -0600 +Subject: [PATCH] top: avoid name conflict in the next version of stdlib + +Since its inception top has always used enumerators to +identify displayable fields. They've taken the form of +P_PID, etc. As it turns out, something has changed for +libc6-dev versions beyond 2.17-93 wherein 'P_PID' will +now be exposed via stdlib.h. I have not pinpointed the +exact cause but it may depend on header include order. + +This patch just trades top's long standing 'P_' prefix +convention for that of 'EU_' (short for enumerator). I +cannot find *any* header under /usr/include/ currently +utilizing this particular three character combination. + +And as a further safeguard top will henceforth include +'system' specific headers after the standard includes. + +Reference(s): +http://www.freelists.org/post/procps/top-wont-compile-anymore + +Signed-off-by: Jim Warner +--- + top/top.c | 274 +++++++++++++++++++++++++++++----------------------------- + top/top.h | 44 ++++----- + top/top_nls.c | 186 +++++++++++++++++++-------------------- + 3 files changed, 252 insertions(+), 252 deletions(-) + +--- top/top.c ++++ top/top.c 2014-05-15 11:24:26.438236477 +0000 +@@ -18,12 +18,6 @@ + * Sami Kerola, + */ + +-#include +-#include +-#include +-#include +-#include +- + #include + #include + #ifndef NUMA_DISABLE +@@ -37,7 +31,7 @@ + #include + #include + #include +-#include // foul sob, defines all sorts of stuff... ++#include // foul sob, defines all sorts of stuff... + #undef tab + #undef TTY + #include +@@ -45,6 +39,12 @@ + #include + #include + ++#include ++#include ++#include // also available via ++#include ++#include // also available via ++ + #include "../include/fileutils.h" + #include "../include/nls.h" + +@@ -201,10 +201,10 @@ static int *PHash_sav = HHash_one, / + + /* Support for automatically sized fixed-width column expansions. + * (hopefully, the macros help clarify/document our new 'feature') */ +-static int Autox_array [P_MAXPFLGS], ++static int Autox_array [EU_MAXPFLGS], + Autox_found; +-#define AUTOX_NO P_MAXPFLGS +-#define AUTOX_COL(f) if (P_MAXPFLGS > f) Autox_array[f] = Autox_found = 1 ++#define AUTOX_NO EU_MAXPFLGS ++#define AUTOX_COL(f) if (EU_MAXPFLGS > f) Autox_array[f] = Autox_found = 1 + #define AUTOX_MODE (0 > Rc.fixed_widest) + + /* Support for scale_mem and scale_num (to avoid duplication. */ +@@ -1681,9 +1681,9 @@ static FLD_t Fieldstab[] = { + a -1 width represents variable width columns + a 0 width represents columns set once at startup (see zap_fieldstab) + .lflg anomalies: +- P_UED, L_NONE - natural outgrowth of 'stat()' in readproc (euid) +- P_CPU, L_stat - never filled by libproc, but requires times (pcpu) +- P_CMD, L_stat - may yet require L_CMDLINE in calibrate_fields (cmd/cmdline) ++ EU_UED, L_NONE - natural outgrowth of 'stat()' in readproc (euid) ++ EU_CPU, L_stat - never filled by libproc, but requires times (pcpu) ++ EU_CMD, L_stat - may yet require L_CMDLINE in calibrate_fields (cmd/cmdline) + L_EITHER - must L_status, else L_stat == 64-bit math (__udivdi3) on 32-bit ! + + .width .scale .align .sort .lflg +@@ -1708,11 +1708,11 @@ static FLD_t Fieldstab[] = { + { 0, -1, A_right, SF(CPN), L_stat }, + { 0, -1, A_right, SF(CPU), L_stat }, + { 6, -1, A_right, SF(TME), L_stat }, +- { 9, -1, A_right, SF(TME), L_stat }, // P_TM2 slot ++ { 9, -1, A_right, SF(TME), L_stat }, // EU_TM2 slot + #ifdef BOOST_PERCNT +- { 5, -1, A_right, SF(RES), L_statm }, // P_MEM slot ++ { 5, -1, A_right, SF(RES), L_statm }, // EU_MEM slot + #else +- { 4, -1, A_right, SF(RES), L_statm }, // P_MEM slot ++ { 4, -1, A_right, SF(RES), L_statm }, // EU_MEM slot + #endif + #ifndef NOBOOST_MEMS + { 7, SK_Kb, A_right, SF(VRT), L_statm }, +@@ -1866,10 +1866,10 @@ static void build_headers (void) { + w->hdrcaplen += strlen(Caps_off) + strlen(w->capclr_msg); + } + #else +- if (P_MAXPFLGS <= f) continue; ++ if (EU_MAXPFLGS <= f) continue; + #endif +- if (P_WCH == f) needpsdb = 1; +- if (P_CMD == f && CHKw(w, Show_CMDLIN)) Frames_libflags |= L_CMDLINE; ++ if (EU_WCH == f) needpsdb = 1; ++ if (EU_CMD == f && CHKw(w, Show_CMDLIN)) Frames_libflags |= L_CMDLINE; + Frames_libflags |= Fieldstab[w->procflgs[i]].lflg; + s = scat(s, justify_pad(N_col(f) + , VARcol(f) ? w->varcolsz : Fieldstab[f].width +@@ -1892,7 +1892,7 @@ static void build_headers (void) { + // we must also accommodate an out of view sort field... + f = w->rc.sortindx; + Frames_libflags |= Fieldstab[f].lflg; +- if (P_CMD == f && CHKw(w, Show_CMDLIN)) Frames_libflags |= L_CMDLINE; ++ if (EU_CMD == f && CHKw(w, Show_CMDLIN)) Frames_libflags |= L_CMDLINE; + } // end: VIZISw(w) + + if (Rc.mode_altscr) w = w->next; +@@ -1945,16 +1945,16 @@ static void calibrate_fields (void) { + if (VIZISw(w)) { + w->hdrcaplen = 0; // really only used with USE_X_COLHDR + // build window's pflgsall array, establish upper bounds for maxpflgs +- for (i = 0, w->totpflgs = 0; i < P_MAXPFLGS; i++) { ++ for (i = 0, w->totpflgs = 0; i < EU_MAXPFLGS; i++) { + if (FLDviz(w, i)) { + f = FLDget(w, i); + #ifdef USE_X_COLHDR + w->pflgsall[w->totpflgs++] = f; + #else + if (CHKw(w, Show_HICOLS) && f == w->rc.sortindx) { +- w->pflgsall[w->totpflgs++] = X_XON; ++ w->pflgsall[w->totpflgs++] = EU_XON; + w->pflgsall[w->totpflgs++] = f; +- w->pflgsall[w->totpflgs++] = X_XOF; ++ w->pflgsall[w->totpflgs++] = EU_XOF; + } else + w->pflgsall[w->totpflgs++] = f; + #endif +@@ -1970,7 +1970,7 @@ static void calibrate_fields (void) { + f = w->pflgsall[i + w->begpflg]; + w->procflgs[i] = f; + #ifndef USE_X_COLHDR +- if (P_MAXPFLGS <= f) continue; ++ if (EU_MAXPFLGS <= f) continue; + #endif + h = N_col(f); + len = (VARcol(f) ? (int)strlen(h) : Fieldstab[f].width) + COLPADSIZ; +@@ -1980,7 +1980,7 @@ static void calibrate_fields (void) { + s = scat(s, fmtmk("%*.*s", len, len, h)); + } + #ifndef USE_X_COLHDR +- if (X_XON == w->procflgs[i - 1]) --i; ++ if (EU_XON == w->procflgs[i - 1]) --i; + #endif + + /* establish the final maxpflgs and prepare to grow the variable column +@@ -1997,7 +1997,7 @@ static void calibrate_fields (void) { + for (i = w->totpflgs - 1; -1 < i; i--) { + f = w->pflgsall[i]; + #ifndef USE_X_COLHDR +- if (P_MAXPFLGS <= f) { w->endpflg = i; continue; } ++ if (EU_MAXPFLGS <= f) { w->endpflg = i; continue; } + #endif + h = N_col(f); + len = (VARcol(f) ? (int)strlen(h) : Fieldstab[f].width) + COLPADSIZ; +@@ -2006,7 +2006,7 @@ static void calibrate_fields (void) { + w->endpflg = i; + } + #ifndef USE_X_COLHDR +- if (X_XOF == w->pflgsall[w->endpflg]) ++w->endpflg; ++ if (EU_XOF == w->pflgsall[w->endpflg]) ++w->endpflg; + #endif + } // end: if (VIZISw(w)) + +@@ -2063,10 +2063,10 @@ static void display_fields (int focus, i + int rmax = Screen_rows - yRSVD; // total useable rows + static int col_sav, row_sav; + +- i = (P_MAXPFLGS % mxCOL) ? 1 : 0; +- if (rmax < i + (P_MAXPFLGS / mxCOL)) mkERR; +- i = P_MAXPFLGS / rmax; +- if (P_MAXPFLGS % rmax) ++i; ++ i = (EU_MAXPFLGS % mxCOL) ? 1 : 0; ++ if (rmax < i + (EU_MAXPFLGS / mxCOL)) mkERR; ++ i = EU_MAXPFLGS / rmax; ++ if (EU_MAXPFLGS % rmax) ++i; + if (i > 1) { cmax /= i; xadd = 1; } + if (cmax > xTOTL) cmax = xTOTL; + smax = cmax - xPRFX; +@@ -2081,7 +2081,7 @@ static void display_fields (int focus, i + } + fflush(stdout); + +- for (i = 0; i < P_MAXPFLGS; ++i) { ++ for (i = 0; i < EU_MAXPFLGS; ++i) { + int b = FLDviz(w, i), x = (i / rmax) * cmax, y = (i % rmax) + yRSVD; + const char *e = (i == focus && extend) ? w->capclr_hdr : ""; + FLG_t f = FLDget(w, i); +@@ -2156,7 +2156,7 @@ signify_that: + if (i > 0) { --i; if (p) swapEM } + break; + case kbd_DOWN: +- if (i + 1 < P_MAXPFLGS) { ++i; if (p) swapEM } ++ if (i + 1 < EU_MAXPFLGS) { ++i; if (p) swapEM } + break; + case kbd_LEFT: + case kbd_ENTER: +@@ -2171,7 +2171,7 @@ signify_that: + break; + case kbd_END: + case kbd_PGDN: +- if (!p) i = P_MAXPFLGS - 1; ++ if (!p) i = EU_MAXPFLGS - 1; + break; + case kbd_SPACE: + case 'd': +@@ -2209,7 +2209,7 @@ static inline void widths_resize (void) + + // next var may also be set by the guys that actually truncate stuff + Autox_found = 0; +- for (i = 0; i < P_MAXPFLGS; i++) { ++ for (i = 0; i < EU_MAXPFLGS; i++) { + if (Autox_array[i]) { + Fieldstab[i].width++; + Autox_array[i] = 0; +@@ -2229,58 +2229,58 @@ static void zap_fieldstab (void) { + char buf[8]; + + if (!once) { +- Fieldstab[P_PID].width = Fieldstab[P_PPD].width +- = Fieldstab[P_PGD].width = Fieldstab[P_SID].width +- = Fieldstab[P_TGD].width = Fieldstab[P_TPG].width = 5; ++ Fieldstab[EU_PID].width = Fieldstab[EU_PPD].width ++ = Fieldstab[EU_PGD].width = Fieldstab[EU_SID].width ++ = Fieldstab[EU_TGD].width = Fieldstab[EU_TPG].width = 5; + if (5 < (digits = get_pid_digits())) { + if (10 < digits) error_exit(N_txt(FAIL_widepid_txt)); +- Fieldstab[P_PID].width = Fieldstab[P_PPD].width +- = Fieldstab[P_PGD].width = Fieldstab[P_SID].width +- = Fieldstab[P_TGD].width = Fieldstab[P_TPG].width = digits; ++ Fieldstab[EU_PID].width = Fieldstab[EU_PPD].width ++ = Fieldstab[EU_PGD].width = Fieldstab[EU_SID].width ++ = Fieldstab[EU_TGD].width = Fieldstab[EU_TPG].width = digits; + } + once = 1; + } + + /*** hotplug_acclimated ***/ + +- Fieldstab[P_CPN].width = 1; ++ Fieldstab[EU_CPN].width = 1; + if (1 < (digits = (unsigned)snprintf(buf, sizeof(buf), "%u", (unsigned)smp_num_cpus()))) { + if (5 < digits) error_exit(N_txt(FAIL_widecpu_txt)); +- Fieldstab[P_CPN].width = digits; ++ Fieldstab[EU_CPN].width = digits; + } + + #ifdef BOOST_PERCNT + Cpu_pmax = 99.9; +- Fieldstab[P_CPU].width = 5; ++ Fieldstab[EU_CPU].width = 5; + if (Rc.mode_irixps && smp_num_cpus() > 1 && !Thread_mode) { + Cpu_pmax = 100.0 * smp_num_cpus(); + if (smp_num_cpus() > 1000) { + if (Cpu_pmax > 9999999.0) Cpu_pmax = 9999999.0; +- Fieldstab[P_CPU].width = 8; ++ Fieldstab[EU_CPU].width = 8; + } else if (smp_num_cpus() > 100) { + if (Cpu_pmax > 999999.0) Cpu_pmax = 999999.0; +- Fieldstab[P_CPU].width = 7; ++ Fieldstab[EU_CPU].width = 7; + } else if (smp_num_cpus() > 10) { + if (Cpu_pmax > 99999.0) Cpu_pmax = 99999.0; +- Fieldstab[P_CPU].width = 6; ++ Fieldstab[EU_CPU].width = 6; + } else { + if (Cpu_pmax > 999.9) Cpu_pmax = 999.9; + } + } + #else + Cpu_pmax = 99.9; +- Fieldstab[P_CPU].width = 4; ++ Fieldstab[EU_CPU].width = 4; + if (Rc.mode_irixps && smp_num_cpus() > 1 && !Thread_mode) { + Cpu_pmax = 100.0 * smp_num_cpus(); + if (smp_num_cpus() > 1000) { + if (Cpu_pmax > 9999999.0) Cpu_pmax = 9999999.0; +- Fieldstab[P_CPU].width = 7; ++ Fieldstab[EU_CPU].width = 7; + } else if (smp_num_cpus() > 100) { + if (Cpu_pmax > 999999.0) Cpu_pmax = 999999.0; +- Fieldstab[P_CPU].width = 6; ++ Fieldstab[EU_CPU].width = 6; + } else if (smp_num_cpus() > 10) { + if (Cpu_pmax > 99999.0) Cpu_pmax = 99999.0; +- Fieldstab[P_CPU].width = 5; ++ Fieldstab[EU_CPU].width = 5; + } else { + if (Cpu_pmax > 999.9) Cpu_pmax = 999.9; + } +@@ -2289,23 +2289,23 @@ static void zap_fieldstab (void) { + + /* and accommodate optional wider non-scalable columns (maybe) */ + if (!AUTOX_MODE) { +- Fieldstab[P_UED].width = Fieldstab[P_URD].width +- = Fieldstab[P_USD].width = Fieldstab[P_GID].width ++ Fieldstab[EU_UED].width = Fieldstab[EU_URD].width ++ = Fieldstab[EU_USD].width = Fieldstab[EU_GID].width + = Rc.fixed_widest ? 5 + Rc.fixed_widest : 5; +- Fieldstab[P_UEN].width = Fieldstab[P_URN].width +- = Fieldstab[P_USN].width = Fieldstab[P_GRP].width ++ Fieldstab[EU_UEN].width = Fieldstab[EU_URN].width ++ = Fieldstab[EU_USN].width = Fieldstab[EU_GRP].width + = Rc.fixed_widest ? 8 + Rc.fixed_widest : 8; +- Fieldstab[P_TTY].width ++ Fieldstab[EU_TTY].width + = Rc.fixed_widest ? 8 + Rc.fixed_widest : 8; +- Fieldstab[P_WCH].width ++ Fieldstab[EU_WCH].width + = Rc.fixed_widest ? 10 + Rc.fixed_widest : 10; + } + + /* plus user selectable scaling */ +- Fieldstab[P_VRT].scale = Fieldstab[P_SWP].scale +- = Fieldstab[P_RES].scale = Fieldstab[P_COD].scale +- = Fieldstab[P_DAT].scale = Fieldstab[P_SHR].scale +- = Fieldstab[P_USE].scale = Rc.task_mscale; ++ Fieldstab[EU_VRT].scale = Fieldstab[EU_SWP].scale ++ = Fieldstab[EU_RES].scale = Fieldstab[EU_COD].scale ++ = Fieldstab[EU_DAT].scale = Fieldstab[EU_SHR].scale ++ = Fieldstab[EU_USE].scale = Rc.task_mscale; + + // lastly, ensure we've got proper column headers... + calibrate_fields(); +@@ -3491,8 +3491,8 @@ static void configs_read (void) { + default: // and future versions? + if (strlen(w->rc.fieldscur) != sizeof(DEF_FIELDS) - 1) + goto default_or_error; +- for (x = 0; x < P_MAXPFLGS; ++x) +- if (P_MAXPFLGS <= FLDget(w, x)) ++ for (x = 0; x < EU_MAXPFLGS; ++x) ++ if (EU_MAXPFLGS <= FLDget(w, x)) + goto default_or_error; + break; + } +@@ -3671,16 +3671,16 @@ static void parse_args (char **args) { + else error_exit(fmtmk(N_fmt(MISSING_args_fmt), ch)); + if (*cp == '+') { SETw(Curwin, Qsrt_NORMAL); ++cp; } + else if (*cp == '-') { OFFw(Curwin, Qsrt_NORMAL); ++cp; } +- for (i = 0; i < P_MAXPFLGS; i++) ++ for (i = 0; i < EU_MAXPFLGS; i++) + if (!STRCMP(cp, N_col(i))) break; +- if (i == P_MAXPFLGS) ++ if (i == EU_MAXPFLGS) + error_exit(fmtmk(N_fmt(XTRA_badflds_fmt), cp)); + OFFw(Curwin, Show_FOREST); + Curwin->rc.sortindx = i; + cp += strlen(cp); + break; + case 'O': +- for (i = 0; i < P_MAXPFLGS; i++) ++ for (i = 0; i < EU_MAXPFLGS; i++) + puts(N_col(i)); + bye_bye(NULL); + case 'p': +@@ -4244,9 +4244,9 @@ static void other_selection (int ch) { + } + ops = *(pval); + *(pval++) = '\0'; +- for (enu = 0; enu < P_MAXPFLGS; enu++) // #4: is this a valid field? ++ for (enu = 0; enu < EU_MAXPFLGS; enu++) // #4: is this a valid field? + if (!STRCMP(N_col(enu), glob)) break; +- if (enu == P_MAXPFLGS) { ++ if (enu == EU_MAXPFLGS) { + show_msg(fmtmk(N_fmt(XTRA_badflds_fmt), glob)); + return; + } +@@ -4521,7 +4521,7 @@ static void keys_task (int ch) { + if (*p == w->rc.sortindx) { + --p; + #ifndef USE_X_COLHDR +- if (P_MAXPFLGS < *p) --p; ++ if (EU_MAXPFLGS < *p) --p; + #endif + if (p >= w->procflgs) { + w->rc.sortindx = *p; +@@ -4542,7 +4542,7 @@ static void keys_task (int ch) { + if (*p == w->rc.sortindx) { + ++p; + #ifndef USE_X_COLHDR +- if (P_MAXPFLGS < *p) ++p; ++ if (EU_MAXPFLGS < *p) ++p; + #endif + if (p < w->procflgs + w->maxpflgs) { + w->rc.sortindx = *p; +@@ -4611,7 +4611,7 @@ static void keys_task (int ch) { + case 'V': + if (VIZCHKw(w)) { + TOGw(w, Show_FOREST); +- if (!ENUviz(w, P_CMD)) ++ if (!ENUviz(w, EU_CMD)) + show_msg(fmtmk(N_fmt(FOREST_modes_fmt) , CHKw(w, Show_FOREST) + ? N_txt(ON_word_only_txt) : N_txt(OFF_one_word_txt))); + } +@@ -4731,13 +4731,13 @@ static void keys_window (int ch) { + w->varcolbeg -= SCROLLAMT; + else if (0 < w->begpflg) { + w->begpflg -= 1; +- if (P_MAXPFLGS < w->pflgsall[w->begpflg]) w->begpflg -= 2; ++ if (EU_MAXPFLGS < w->pflgsall[w->begpflg]) w->begpflg -= 2; + } + } + #else + if (VIZCHKw(w)) if (0 < w->begpflg) { + w->begpflg -= 1; +- if (P_MAXPFLGS < w->pflgsall[w->begpflg]) w->begpflg -= 2; ++ if (EU_MAXPFLGS < w->pflgsall[w->begpflg]) w->begpflg -= 2; + } + #endif + break; +@@ -4748,14 +4748,14 @@ static void keys_window (int ch) { + w->varcolbeg += SCROLLAMT; + if (0 > w->varcolbeg) w->varcolbeg = 0; + } else if (w->begpflg + 1 < w->totpflgs) { +- if (P_MAXPFLGS < w->pflgsall[w->begpflg]) ++ if (EU_MAXPFLGS < w->pflgsall[w->begpflg]) + w->begpflg += (w->begpflg + 3 < w->totpflgs) ? 3 : 0; + else w->begpflg += 1; + } + } + #else + if (VIZCHKw(w)) if (w->begpflg + 1 < w->totpflgs) { +- if (P_MAXPFLGS < w->pflgsall[w->begpflg]) ++ if (EU_MAXPFLGS < w->pflgsall[w->begpflg]) + w->begpflg += (w->begpflg + 3 < w->totpflgs) ? 3 : 0; + else w->begpflg += 1; + } +@@ -4812,19 +4812,19 @@ static void keys_xtra (int ch) { + we would just whack do_key's key_tab entry and this function... */ + switch (ch) { + case 'M': +- w->rc.sortindx = P_MEM; ++ w->rc.sortindx = EU_MEM; + // xmsg = "Memory"; + break; + case 'N': +- w->rc.sortindx = P_PID; ++ w->rc.sortindx = EU_PID; + // xmsg = "Numerical"; + break; + case 'P': +- w->rc.sortindx = P_CPU; ++ w->rc.sortindx = EU_CPU; + // xmsg = "CPU"; + break; + case 'T': +- w->rc.sortindx = P_TM2; ++ w->rc.sortindx = EU_TM2; + // xmsg = "Time"; + break; + default: // keep gcc happy +@@ -5204,30 +5204,30 @@ static const char *task_show (const WIN_ + switch (i) { + #ifndef USE_X_COLHDR + // these 2 aren't real procflgs, they're used in column highlighting! +- case X_XON: +- case X_XOF: ++ case EU_XON: ++ case EU_XOF: + cp = NULL; + if (!CHKw(q, INFINDS_xxx | NOHIFND_xxx | NOHISEL_xxx)) { + /* treat running tasks specially - entire row may get highlighted + so we needn't turn it on and we MUST NOT turn it off */ + if (!('R' == p->state && CHKw(q, Show_HIROWS))) +- cp = (X_XON == i ? q->capclr_rowhigh : q->capclr_rownorm); ++ cp = (EU_XON == i ? q->capclr_rowhigh : q->capclr_rownorm); + } + break; + #endif +- case P_CGR: ++ case EU_CGR: + makeVAR(p->cgroup[0]); + break; +- case P_CMD: ++ case EU_CMD: + makeVAR(forest_display(q, p)); + break; +- case P_COD: ++ case EU_COD: + cp = scale_mem(S, pages2K(p->trs), W, Jn); + break; +- case P_CPN: ++ case EU_CPN: + cp = make_num(p->processor, W, Jn, AUTOX_NO); + break; +- case P_CPU: ++ case EU_CPU: + { float u = (float)p->pcpu * Frame_etscale; + /* process can't use more %cpu than number of threads it has + ( thanks Jaromir Capik ) */ +@@ -5236,139 +5236,139 @@ static const char *task_show (const WIN_ + cp = scale_pcnt(u, W, Jn); + } + break; +- case P_DAT: ++ case EU_DAT: + cp = scale_mem(S, pages2K(p->drs), W, Jn); + break; +- case P_DRT: ++ case EU_DRT: + cp = scale_num(p->dt, W, Jn); + break; +- case P_ENV: ++ case EU_ENV: + makeVAR(p->environ[0]); + break; +- case P_FL1: ++ case EU_FL1: + cp = scale_num(p->maj_flt, W, Jn); + break; +- case P_FL2: ++ case EU_FL2: + cp = scale_num(p->min_flt, W, Jn); + break; +- case P_FLG: ++ case EU_FLG: + cp = make_str(hex_make(p->flags, 1), W, Js, AUTOX_NO); + break; +- case P_FV1: ++ case EU_FV1: + cp = scale_num(p->maj_delta, W, Jn); + break; +- case P_FV2: ++ case EU_FV2: + cp = scale_num(p->min_delta, W, Jn); + break; +- case P_GID: +- cp = make_num(p->egid, W, Jn, P_GID); ++ case EU_GID: ++ cp = make_num(p->egid, W, Jn, EU_GID); + break; +- case P_GRP: +- cp = make_str(p->egroup, W, Js, P_GRP); ++ case EU_GRP: ++ cp = make_str(p->egroup, W, Js, EU_GRP); + break; +- case P_MEM: ++ case EU_MEM: + cp = scale_pcnt((float)pages2K(p->resident) * 100 / kb_main_total, W, Jn); + break; +- case P_NCE: ++ case EU_NCE: + cp = make_num(p->nice, W, Jn, AUTOX_NO); + break; + #ifdef OOMEM_ENABLE +- case P_OOA: ++ case EU_OOA: + cp = make_num(p->oom_adj, W, Jn, AUTOX_NO); + break; +- case P_OOM: ++ case EU_OOM: + cp = make_num(p->oom_score, W, Jn, AUTOX_NO); + break; + #endif +- case P_PGD: ++ case EU_PGD: + cp = make_num(p->pgrp, W, Jn, AUTOX_NO); + break; +- case P_PID: ++ case EU_PID: + cp = make_num(p->tid, W, Jn, AUTOX_NO); + break; +- case P_PPD: ++ case EU_PPD: + cp = make_num(p->ppid, W, Jn, AUTOX_NO); + break; +- case P_PRI: ++ case EU_PRI: + if (-99 > p->priority || 999 < p->priority) { + cp = make_str("rt", W, Jn, AUTOX_NO); + } else + cp = make_num(p->priority, W, Jn, AUTOX_NO); + break; +- case P_RES: ++ case EU_RES: + cp = scale_mem(S, pages2K(p->resident), W, Jn); + break; +- case P_SGD: ++ case EU_SGD: + makeVAR(p->supgid); + break; +- case P_SGN: ++ case EU_SGN: + makeVAR(p->supgrp); + break; +- case P_SHR: ++ case EU_SHR: + cp = scale_mem(S, pages2K(p->share), W, Jn); + break; +- case P_SID: ++ case EU_SID: + cp = make_num(p->session, W, Jn, AUTOX_NO); + break; +- case P_STA: ++ case EU_STA: + cp = make_chr(p->state, W, Js); + break; +- case P_SWP: ++ case EU_SWP: + cp = scale_mem(S, p->vm_swap, W, Jn); + break; +- case P_TGD: ++ case EU_TGD: + cp = make_num(p->tgid, W, Jn, AUTOX_NO); + break; +- case P_THD: ++ case EU_THD: + cp = make_num(p->nlwp, W, Jn, AUTOX_NO); + break; +- case P_TM2: +- case P_TME: ++ case EU_TM2: ++ case EU_TME: + { TIC_t t = p->utime + p->stime; + if (CHKw(q, Show_CTIMES)) t += (p->cutime + p->cstime); + cp = scale_tics(t, W, Jn); + } + break; +- case P_TPG: ++ case EU_TPG: + cp = make_num(p->tpgid, W, Jn, AUTOX_NO); + break; +- case P_TTY: ++ case EU_TTY: + { char tmp[SMLBUFSIZ]; + dev_to_tty(tmp, W, p->tty, p->tid, ABBREV_DEV); +- cp = make_str(tmp, W, Js, P_TTY); ++ cp = make_str(tmp, W, Js, EU_TTY); + } + break; +- case P_UED: +- cp = make_num(p->euid, W, Jn, P_UED); ++ case EU_UED: ++ cp = make_num(p->euid, W, Jn, EU_UED); + break; +- case P_UEN: +- cp = make_str(p->euser, W, Js, P_UEN); ++ case EU_UEN: ++ cp = make_str(p->euser, W, Js, EU_UEN); + break; +- case P_URD: +- cp = make_num(p->ruid, W, Jn, P_URD); ++ case EU_URD: ++ cp = make_num(p->ruid, W, Jn, EU_URD); + break; +- case P_URN: +- cp = make_str(p->ruser, W, Js, P_URN); ++ case EU_URN: ++ cp = make_str(p->ruser, W, Js, EU_URN); + break; +- case P_USD: +- cp = make_num(p->suid, W, Jn, P_USD); ++ case EU_USD: ++ cp = make_num(p->suid, W, Jn, EU_USD); + break; +- case P_USE: ++ case EU_USE: + cp = scale_mem(S, (p->vm_swap + pages2K(p->resident)), W, Jn); + break; +- case P_USN: +- cp = make_str(p->suser, W, Js, P_USN); ++ case EU_USN: ++ cp = make_str(p->suser, W, Js, EU_USN); + break; +- case P_VRT: ++ case EU_VRT: + cp = scale_mem(S, pages2K(p->size), W, Jn); + break; +- case P_WCH: ++ case EU_WCH: + { const char *u; + if (No_ksyms) + u = hex_make(p->wchan, 0); + else + u = lookup_wchan(p->wchan, p->tid); +- cp = make_str(u, W, Js, P_WCH); ++ cp = make_str(u, W, Js, EU_WCH); + } + break; + default: // keep gcc happy +--- top/top.h ++++ top/top.h 2014-05-15 11:25:39.890735226 +0000 +@@ -181,27 +181,27 @@ char *strcasestr(const char *haystack, c + /* Flags for each possible field (and then some) -- + these MUST be kept in sync with the FLD_t Fieldstab[] array !! */ + enum pflag { +- P_PID = 0, P_PPD, +- P_UED, P_UEN, P_URD, P_URN, P_USD, P_USN, +- P_GID, P_GRP, P_PGD, P_TTY, P_TPG, P_SID, +- P_PRI, P_NCE, P_THD, +- P_CPN, P_CPU, P_TME, P_TM2, +- P_MEM, P_VRT, P_SWP, P_RES, P_COD, P_DAT, P_SHR, +- P_FL1, P_FL2, P_DRT, +- P_STA, P_CMD, P_WCH, P_FLG, P_CGR, +- P_SGD, P_SGN, P_TGD, ++ EU_PID = 0, EU_PPD, ++ EU_UED, EU_UEN, EU_URD, EU_URN, EU_USD, EU_USN, ++ EU_GID, EU_GRP, EU_PGD, EU_TTY, EU_TPG, EU_SID, ++ EU_PRI, EU_NCE, EU_THD, ++ EU_CPN, EU_CPU, EU_TME, EU_TM2, ++ EU_MEM, EU_VRT, EU_SWP, EU_RES, EU_COD, EU_DAT, EU_SHR, ++ EU_FL1, EU_FL2, EU_DRT, ++ EU_STA, EU_CMD, EU_WCH, EU_FLG, EU_CGR, ++ EU_SGD, EU_SGN, EU_TGD, + #ifdef OOMEM_ENABLE +- P_OOA, P_OOM, ++ EU_OOA, EU_OOM, + #endif +- P_ENV, +- P_FV1, P_FV2, +- P_USE, ++ EU_ENV, ++ EU_FV1, EU_FV2, ++ EU_USE, + #ifdef USE_X_COLHDR + // not really pflags, used with tbl indexing +- P_MAXPFLGS ++ EU_MAXPFLGS + #else + // not really pflags, used with tbl indexing & col highlighting +- P_MAXPFLGS, X_XON, X_XOF ++ EU_MAXPFLGS, X_XON, X_XOF + #endif + }; + +@@ -445,7 +445,7 @@ typedef struct WIN_t { + #define VARright(w) (1 == w->maxpflgs && VARcol(w->procflgs[0])) + #else + #define VARright(w) ((1 == w->maxpflgs && VARcol(w->procflgs[0])) || \ +- (3 == w->maxpflgs && X_XON == w->procflgs[0] && VARcol(w->procflgs[1]))) ++ (3 == w->maxpflgs && EU_XON == w->procflgs[0] && VARcol(w->procflgs[1]))) + #endif + #define VARleft(w) (w->varcolbeg && VARright(w)) + #define SCROLLAMT 8 +@@ -475,7 +475,7 @@ typedef struct WIN_t { + /* Used to create *most* of the sort callback functions + note: some of the callbacks are NOT your father's callbacks, they're + highly optimized to save them ol' precious cycles! */ +-#define SCB_NAME(f) sort_P_ ## f ++#define SCB_NAME(f) sort_EU_ ## f + #define SCB_NUM1(f,n) \ + static int SCB_NAME(f) (const proc_t **P, const proc_t **Q) { \ + if ( (*P)->n < (*Q)->n ) return SORT_lt; \ +@@ -596,16 +596,16 @@ typedef struct WIN_t { + /* The default values for the local config file */ + #define DEF_RCFILE { \ + RCF_VERSION_ID, 0, 1, DEF_DELAY, 0, { \ +- { P_CPU, DEF_WINFLGS, 0, \ ++ { EU_CPU, DEF_WINFLGS, 0, \ + COLOR_RED, COLOR_RED, COLOR_YELLOW, COLOR_RED, \ + "Def", DEF_FIELDS }, \ +- { P_PID, DEF_WINFLGS, 0, \ ++ { EU_PID, DEF_WINFLGS, 0, \ + COLOR_CYAN, COLOR_CYAN, COLOR_WHITE, COLOR_CYAN, \ + "Job", JOB_FIELDS }, \ +- { P_MEM, DEF_WINFLGS, 0, \ ++ { EU_MEM, DEF_WINFLGS, 0, \ + COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLUE, COLOR_MAGENTA, \ + "Mem", MEM_FIELDS }, \ +- { P_UEN, DEF_WINFLGS, 0, \ ++ { EU_UEN, DEF_WINFLGS, 0, \ + COLOR_YELLOW, COLOR_YELLOW, COLOR_GREEN, COLOR_YELLOW, \ + "Usr", USR_FIELDS } \ + }, 0, SK_Kb, SK_Kb, 0 } +@@ -645,7 +645,7 @@ typedef struct WIN_t { + /* ( see the find_string function for the one true required protoype ) */ + /*------ Sort callbacks ------------------------------------------------*/ + /* for each possible field, in the form of: */ +-/*atic int sort_P_XXX (const proc_t **P, const proc_t **Q); */ ++/*atic int sort_EU_XXX (const proc_t **P, const proc_t **Q); */ + /*------ Tiny useful routine(s) ----------------------------------------*/ + //atic const char *fmtmk (const char *fmts, ...); + //atic inline char *scat (char *dst, const char *src); +--- top/top_nls.c ++++ top/top_nls.c 2014-05-15 11:26:38.222235592 +0000 +@@ -94,8 +94,8 @@ + * + none of the important translator only comments will + * clutter and obscure the main program + */ +-const char *Head_nlstab[P_MAXPFLGS]; +-const char *Desc_nlstab[P_MAXPFLGS]; ++const char *Head_nlstab[EU_MAXPFLGS]; ++const char *Desc_nlstab[EU_MAXPFLGS]; + const char *Norm_nlstab[norm_MAX]; + const char *Uniq_nlstab[uniq_MAX]; + +@@ -121,144 +121,144 @@ static void build_two_nlstabs (void) { + . */ + + /* Translation Hint: maximum 'PID' = 5 */ +- Head_nlstab[P_PID] = _("PID"); +- Desc_nlstab[P_PID] = _("Process Id"); ++ Head_nlstab[EU_PID] = _("PID"); ++ Desc_nlstab[EU_PID] = _("Process Id"); + /* Translation Hint: maximum 'PPID' = 5 */ +- Head_nlstab[P_PPD] = _("PPID"); +- Desc_nlstab[P_PPD] = _("Parent Process pid"); ++ Head_nlstab[EU_PPD] = _("PPID"); ++ Desc_nlstab[EU_PPD] = _("Parent Process pid"); + /* Translation Hint: maximum 'UID' = 5 */ +- Head_nlstab[P_UED] = _("UID"); +- Desc_nlstab[P_UED] = _("Effective User Id"); ++ Head_nlstab[EU_UED] = _("UID"); ++ Desc_nlstab[EU_UED] = _("Effective User Id"); + /* Translation Hint: maximum 'USER' = 8 */ +- Head_nlstab[P_UEN] = _("USER"); +- Desc_nlstab[P_UEN] = _("Effective User Name"); ++ Head_nlstab[EU_UEN] = _("USER"); ++ Desc_nlstab[EU_UEN] = _("Effective User Name"); + /* Translation Hint: maximum 'RUID' = 5 */ +- Head_nlstab[P_URD] = _("RUID"); +- Desc_nlstab[P_URD] = _("Real User Id"); ++ Head_nlstab[EU_URD] = _("RUID"); ++ Desc_nlstab[EU_URD] = _("Real User Id"); + /* Translation Hint: maximum 'RUSER' = 8 */ +- Head_nlstab[P_URN] = _("RUSER"); +- Desc_nlstab[P_URN] = _("Real User Name"); ++ Head_nlstab[EU_URN] = _("RUSER"); ++ Desc_nlstab[EU_URN] = _("Real User Name"); + /* Translation Hint: maximum 'SUID' = 5 */ +- Head_nlstab[P_USD] = _("SUID"); +- Desc_nlstab[P_USD] = _("Saved User Id"); ++ Head_nlstab[EU_USD] = _("SUID"); ++ Desc_nlstab[EU_USD] = _("Saved User Id"); + /* Translation Hint: maximum 'SUSER' = 8 */ +- Head_nlstab[P_USN] = _("SUSER"); +- Desc_nlstab[P_USN] = _("Saved User Name"); ++ Head_nlstab[EU_USN] = _("SUSER"); ++ Desc_nlstab[EU_USN] = _("Saved User Name"); + /* Translation Hint: maximum 'GID' = 5 */ +- Head_nlstab[P_GID] = _("GID"); +- Desc_nlstab[P_GID] = _("Group Id"); ++ Head_nlstab[EU_GID] = _("GID"); ++ Desc_nlstab[EU_GID] = _("Group Id"); + /* Translation Hint: maximum 'GROUP' = 8 */ +- Head_nlstab[P_GRP] = _("GROUP"); +- Desc_nlstab[P_GRP] = _("Group Name"); ++ Head_nlstab[EU_GRP] = _("GROUP"); ++ Desc_nlstab[EU_GRP] = _("Group Name"); + /* Translation Hint: maximum 'PGRP' = 5 */ +- Head_nlstab[P_PGD] = _("PGRP"); +- Desc_nlstab[P_PGD] = _("Process Group Id"); ++ Head_nlstab[EU_PGD] = _("PGRP"); ++ Desc_nlstab[EU_PGD] = _("Process Group Id"); + /* Translation Hint: maximum 'TTY' = 8 */ +- Head_nlstab[P_TTY] = _("TTY"); +- Desc_nlstab[P_TTY] = _("Controlling Tty"); ++ Head_nlstab[EU_TTY] = _("TTY"); ++ Desc_nlstab[EU_TTY] = _("Controlling Tty"); + /* Translation Hint: maximum 'TPGID' = 5 */ +- Head_nlstab[P_TPG] = _("TPGID"); +- Desc_nlstab[P_TPG] = _("Tty Process Grp Id"); ++ Head_nlstab[EU_TPG] = _("TPGID"); ++ Desc_nlstab[EU_TPG] = _("Tty Process Grp Id"); + /* Translation Hint: maximum 'SID' = 5 */ +- Head_nlstab[P_SID] = _("SID"); +- Desc_nlstab[P_SID] = _("Session Id"); ++ Head_nlstab[EU_SID] = _("SID"); ++ Desc_nlstab[EU_SID] = _("Session Id"); + /* Translation Hint: maximum 'PR' = 3 */ +- Head_nlstab[P_PRI] = _("PR"); +- Desc_nlstab[P_PRI] = _("Priority"); ++ Head_nlstab[EU_PRI] = _("PR"); ++ Desc_nlstab[EU_PRI] = _("Priority"); + /* Translation Hint: maximum 'NI' = 3 */ +- Head_nlstab[P_NCE] = _("NI"); +- Desc_nlstab[P_NCE] = _("Nice Value"); ++ Head_nlstab[EU_NCE] = _("NI"); ++ Desc_nlstab[EU_NCE] = _("Nice Value"); + /* Translation Hint: maximum 'nTH' = 3 */ +- Head_nlstab[P_THD] = _("nTH"); +- Desc_nlstab[P_THD] = _("Number of Threads"); ++ Head_nlstab[EU_THD] = _("nTH"); ++ Desc_nlstab[EU_THD] = _("Number of Threads"); + /* Translation Hint: maximum 'P' = 1 */ +- Head_nlstab[P_CPN] = _("P"); +- Desc_nlstab[P_CPN] = _("Last Used Cpu (SMP)"); ++ Head_nlstab[EU_CPN] = _("P"); ++ Desc_nlstab[EU_CPN] = _("Last Used Cpu (SMP)"); + /* Translation Hint: maximum '%CPU' = 4 */ +- Head_nlstab[P_CPU] = _("%CPU"); +- Desc_nlstab[P_CPU] = _("CPU Usage"); ++ Head_nlstab[EU_CPU] = _("%CPU"); ++ Desc_nlstab[EU_CPU] = _("CPU Usage"); + /* Translation Hint: maximum '' = 6 */ +- Head_nlstab[P_TME] = _("TIME"); +- Desc_nlstab[P_TME] = _("CPU Time"); ++ Head_nlstab[EU_TME] = _("TIME"); ++ Desc_nlstab[EU_TME] = _("CPU Time"); + /* Translation Hint: maximum 'TIME+' = 9 */ +- Head_nlstab[P_TM2] = _("TIME+"); +- Desc_nlstab[P_TM2] = _("CPU Time, hundredths"); ++ Head_nlstab[EU_TM2] = _("TIME+"); ++ Desc_nlstab[EU_TM2] = _("CPU Time, hundredths"); + /* Translation Hint: maximum '%MEM' = 4 */ +- Head_nlstab[P_MEM] = _("%MEM"); +- Desc_nlstab[P_MEM] = _("Memory Usage (RES)"); ++ Head_nlstab[EU_MEM] = _("%MEM"); ++ Desc_nlstab[EU_MEM] = _("Memory Usage (RES)"); + /* Translation Hint: maximum 'VIRT' = 5 */ +- Head_nlstab[P_VRT] = _("VIRT"); +- Desc_nlstab[P_VRT] = _("Virtual Image (KiB)"); ++ Head_nlstab[EU_VRT] = _("VIRT"); ++ Desc_nlstab[EU_VRT] = _("Virtual Image (KiB)"); + /* Translation Hint: maximum 'SWAP' = 4 */ +- Head_nlstab[P_SWP] = _("SWAP"); +- Desc_nlstab[P_SWP] = _("Swapped Size (KiB)"); ++ Head_nlstab[EU_SWP] = _("SWAP"); ++ Desc_nlstab[EU_SWP] = _("Swapped Size (KiB)"); + /* Translation Hint: maximum 'RES' = 4 */ +- Head_nlstab[P_RES] = _("RES"); +- Desc_nlstab[P_RES] = _("Resident Size (KiB)"); ++ Head_nlstab[EU_RES] = _("RES"); ++ Desc_nlstab[EU_RES] = _("Resident Size (KiB)"); + /* Translation Hint: maximum 'CODE' = 4 */ +- Head_nlstab[P_COD] = _("CODE"); +- Desc_nlstab[P_COD] = _("Code Size (KiB)"); ++ Head_nlstab[EU_COD] = _("CODE"); ++ Desc_nlstab[EU_COD] = _("Code Size (KiB)"); + /* Translation Hint: maximum 'DATA' = 4 */ +- Head_nlstab[P_DAT] = _("DATA"); +- Desc_nlstab[P_DAT] = _("Data+Stack (KiB)"); ++ Head_nlstab[EU_DAT] = _("DATA"); ++ Desc_nlstab[EU_DAT] = _("Data+Stack (KiB)"); + /* Translation Hint: maximum 'SHR' = 4 */ +- Head_nlstab[P_SHR] = _("SHR"); +- Desc_nlstab[P_SHR] = _("Shared Memory (KiB)"); ++ Head_nlstab[EU_SHR] = _("SHR"); ++ Desc_nlstab[EU_SHR] = _("Shared Memory (KiB)"); + /* Translation Hint: maximum 'nMaj' = 4 */ +- Head_nlstab[P_FL1] = _("nMaj"); +- Desc_nlstab[P_FL1] = _("Major Page Faults"); ++ Head_nlstab[EU_FL1] = _("nMaj"); ++ Desc_nlstab[EU_FL1] = _("Major Page Faults"); + /* Translation Hint: maximum 'nMin' = 4 */ +- Head_nlstab[P_FL2] = _("nMin"); +- Desc_nlstab[P_FL2] = _("Minor Page Faults"); ++ Head_nlstab[EU_FL2] = _("nMin"); ++ Desc_nlstab[EU_FL2] = _("Minor Page Faults"); + /* Translation Hint: maximum 'nDRT' = 4 */ +- Head_nlstab[P_DRT] = _("nDRT"); +- Desc_nlstab[P_DRT] = _("Dirty Pages Count"); ++ Head_nlstab[EU_DRT] = _("nDRT"); ++ Desc_nlstab[EU_DRT] = _("Dirty Pages Count"); + /* Translation Hint: maximum 'S' = 1 */ +- Head_nlstab[P_STA] = _("S"); +- Desc_nlstab[P_STA] = _("Process Status"); ++ Head_nlstab[EU_STA] = _("S"); ++ Desc_nlstab[EU_STA] = _("Process Status"); + /* Translation Hint: maximum 'COMMAND' = 7 */ +- Head_nlstab[P_CMD] = _("COMMAND"); +- Desc_nlstab[P_CMD] = _("Command Name/Line"); ++ Head_nlstab[EU_CMD] = _("COMMAND"); ++ Desc_nlstab[EU_CMD] = _("Command Name/Line"); + /* Translation Hint: maximum 'WCHAN' = 7 */ +- Head_nlstab[P_WCH] = _("WCHAN"); +- Desc_nlstab[P_WCH] = _("Sleeping in Function"); ++ Head_nlstab[EU_WCH] = _("WCHAN"); ++ Desc_nlstab[EU_WCH] = _("Sleeping in Function"); + /* Translation Hint: maximum 'Flags' = 8 */ +- Head_nlstab[P_FLG] = _("Flags"); +- Desc_nlstab[P_FLG] = _("Task Flags "); ++ Head_nlstab[EU_FLG] = _("Flags"); ++ Desc_nlstab[EU_FLG] = _("Task Flags "); + /* Translation Hint: maximum 'CGROUPS' = 7 */ +- Head_nlstab[P_CGR] = _("CGROUPS"); +- Desc_nlstab[P_CGR] = _("Control Groups"); ++ Head_nlstab[EU_CGR] = _("CGROUPS"); ++ Desc_nlstab[EU_CGR] = _("Control Groups"); + /* Translation Hint: maximum 'SUPGIDS' = 7 */ +- Head_nlstab[P_SGD] = _("SUPGIDS"); +- Desc_nlstab[P_SGD] = _("Supp Groups IDs"); ++ Head_nlstab[EU_SGD] = _("SUPGIDS"); ++ Desc_nlstab[EU_SGD] = _("Supp Groups IDs"); + /* Translation Hint: maximum 'SUPGRPS' = 7 */ +- Head_nlstab[P_SGN] = _("SUPGRPS"); +- Desc_nlstab[P_SGN] = _("Supp Groups Names"); ++ Head_nlstab[EU_SGN] = _("SUPGRPS"); ++ Desc_nlstab[EU_SGN] = _("Supp Groups Names"); + /* Translation Hint: maximum 'TGID' = 5 */ +- Head_nlstab[P_TGD] = _("TGID"); +- Desc_nlstab[P_TGD] = _("Thread Group Id"); ++ Head_nlstab[EU_TGD] = _("TGID"); ++ Desc_nlstab[EU_TGD] = _("Thread Group Id"); + #ifdef OOMEM_ENABLE + /* Translation Hint: maximum 'Adj' = 3 */ +- Head_nlstab[P_OOA] = _("Adj"); +- Desc_nlstab[P_OOA] = _("oom_adjustment (2^X)"); ++ Head_nlstab[EU_OOA] = _("Adj"); ++ Desc_nlstab[EU_OOA] = _("oom_adjustment (2^X)"); + /* Translation Hint: maximum 'Badness' = 8 */ +- Head_nlstab[P_OOM] = _("Badness"); +- Desc_nlstab[P_OOM] = _("oom_score (badness)"); ++ Head_nlstab[EU_OOM] = _("Badness"); ++ Desc_nlstab[EU_OOM] = _("oom_score (badness)"); + #endif + /* Translation Hint: maximum 'ENVIRON' = 7 */ +- Head_nlstab[P_ENV] = _("ENVIRON"); ++ Head_nlstab[EU_ENV] = _("ENVIRON"); + /* Translation Hint: the abbreviation 'vars' below is shorthand for + 'variables' */ +- Desc_nlstab[P_ENV] = _("Environment vars"); ++ Desc_nlstab[EU_ENV] = _("Environment vars"); + /* Translation Hint: maximum 'vMj' = 3 */ +- Head_nlstab[P_FV1] = _("vMj"); +- Desc_nlstab[P_FV1] = _("Major Faults delta"); ++ Head_nlstab[EU_FV1] = _("vMj"); ++ Desc_nlstab[EU_FV1] = _("Major Faults delta"); + /* Translation Hint: maximum 'vMn' = 3 */ +- Head_nlstab[P_FV2] = _("vMn"); +- Desc_nlstab[P_FV2] = _("Minor Faults delta"); ++ Head_nlstab[EU_FV2] = _("vMn"); ++ Desc_nlstab[EU_FV2] = _("Minor Faults delta"); + /* Translation Hint: maximum 'USED' = 4 */ +- Head_nlstab[P_USE] = _("USED"); +- Desc_nlstab[P_USE] = _("Res+Swap Size (KiB)"); ++ Head_nlstab[EU_USE] = _("USED"); ++ Desc_nlstab[EU_USE] = _("Res+Swap Size (KiB)"); + } + + +@@ -663,7 +663,7 @@ void initialize_nls (void) { + memset(Head_nlstab, 0, sizeof(Head_nlstab)); + memset(Desc_nlstab, 0, sizeof(Desc_nlstab)); + build_two_nlstabs(); +- for (i = 0; i < P_MAXPFLGS; i++) { ++ for (i = 0; i < EU_MAXPFLGS; i++) { + if (!Head_nlstab[i]) { + fprintf(stderr, nls_err, "Head", i); + exit(1); diff --git a/0038-top-protect-against-distortion-when-system-time-rese.patch b/0038-top-protect-against-distortion-when-system-time-rese.patch new file mode 100644 index 0000000..921250c --- /dev/null +++ b/0038-top-protect-against-distortion-when-system-time-rese.patch @@ -0,0 +1,76 @@ +Based on 22e658297494e11ef92a81069b49a40420b8d824 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Fri, 25 Apr 2014 00:00:00 -0500 +Subject: [PATCH] top: protect against distortion when system time reset + +If a system's time is adjusted backwards, then elapsed +time could appear as negative. This yielded a negative +%CPU value. Alternately if zeros were suppressed ('0') +the result was a blank %CPU column. In both cases that +distortion would last for one display cycle or until a +user forced a display refresh via some keyboard input. + +The original recommendation was trading gettimeofday() +for clock_gettime() using CLOCK_MONOTONIC. But on some +systems that might not be possible, forcing the use of +CLOCK_REALTIME instead. Not only would that complicate +the build system, but it may leave us with minus %CPU. + +Another approach was to ensure that elapsed time could +never be negative. Of course, this produced distortion +of %CPU values but it would be proportionally correct. +This wasn't dissimilar to a distortion already present +should the time be adjusted forward or backward within +any 'remaining' top delay intervals. These aberrations +would be avoided with clock_gettime & CLOCK_MONOTONIC, +but that is a less than ideal solution as noted above. + +This final solution, which originated down under, will +simply rely on the /proc/uptime seconds, which will be +immune to *any* tampering with the system clock. Thus, +we now have a fix for the distortion we didn't know we +suffered plus a negative %CPU that began this odyssey. + +Thanks to: +sk.alvin.x@gmail.com, for the original effort +jcapik@redhat.com, for a heads up on CLOCK_MONOTONIC +csmall-procps@enc.com.au, for the best suggestion of all + +Reference(s): +. original post/patch +http://www.freelists.org/post/procps/PATCH-top-use-clock-gettime-instead-of-gettimeofday +. heads up on CLOCK_MONOTONIC +http://www.freelists.org/post/procps/PATCH-top-use-clock-gettime-instead-of-gettimeofday,2 +. the final solution +http://www.freelists.org/post/procps/PATCH-top-use-clock-gettime-instead-of-gettimeofday,11 + +Signed-off-by: Jim Warner +--- + top/top.c | 13 +++++-------- + 1 file changed, 5 insertions(+), 8 deletions(-) + +--- top/top.c ++++ top/top.c 2014-05-15 00:00:00.000000000 +0000 +@@ -2514,17 +2514,14 @@ static void procs_hlp (proc_t *this) { + HST_t *h; + + if (!this) { +- static struct timeval oldtimev; +- struct timeval timev; +- struct timezone timez; ++ static double uptime_sav; ++ double uptime_cur; + float et; + void *v; + +- gettimeofday(&timev, &timez); +- et = (timev.tv_sec - oldtimev.tv_sec) +- + (float)(timev.tv_usec - oldtimev.tv_usec) / 1000000.0; +- oldtimev.tv_sec = timev.tv_sec; +- oldtimev.tv_usec = timev.tv_usec; ++ uptime(&uptime_cur, NULL); ++ et = uptime_cur - uptime_sav; ++ uptime_sav = uptime_cur; + + // if in Solaris mode, adjust our scaling for all cpus + Frame_etscale = 100.0f / ((float)Hertz * (float)et * (Rc.mode_irixps ? 1 : smp_num_cpus())); diff --git a/0044-top-avoid-a-nan-when-the-delay-interval-is-very-low.patch b/0044-top-avoid-a-nan-when-the-delay-interval-is-very-low.patch new file mode 100644 index 0000000..bf05c63 --- /dev/null +++ b/0044-top-avoid-a-nan-when-the-delay-interval-is-very-low.patch @@ -0,0 +1,32 @@ +From fe37ad15cd394af021af7a3e5ad11bad70af4bfd Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Sun, 27 Apr 2014 00:00:00 -0500 +Subject: [PATCH] top: avoid a 'nan' when the delay interval is very low + +The granularity of /proc/uptime is fixed at hundredths +of a second. And, since we can cycle faster than that, +we are exposed to 'nan' when calculating elapsed time. + +This commit will protect us from that outcome when the +delay interval has been set to an extremely low value. + +Signed-off-by: Jim Warner +--- + top/top.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git top/top.c top/top.c +index 0428496..0ae5388 100644 +--- top/top.c ++++ top/top.c +@@ -2525,6 +2525,7 @@ static void procs_hlp (proc_t *this) { + + uptime(&uptime_cur, NULL); + et = uptime_cur - uptime_sav; ++ if (et < 0.01) et = 0.005; + uptime_sav = uptime_cur; + + // if in Solaris mode, adjust our scaling for all cpus +-- +1.7.9.2 + diff --git a/0045-top-standardize-Esc-key-support-with-prompted-input.patch b/0045-top-standardize-Esc-key-support-with-prompted-input.patch new file mode 100644 index 0000000..5b2d91c --- /dev/null +++ b/0045-top-standardize-Esc-key-support-with-prompted-input.patch @@ -0,0 +1,287 @@ +From bef6b0f025a0638c37bf987039b65272f0fff587 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Sun, 27 Apr 2014 00:00:00 -0500 +Subject: [PATCH] top: standardize key support with prompted input + +In release 3.3.6, some commands were equipped with the +concept of a 'default pid'. The initial implementation +meant that the intuitive key would not always be +treated as one would expect under any well behaved UI. + +This patch ensures the expected key behavior of: +terminating user input while still making possible the +necessary distinction between 'no input' & 'defaults'. + +Reference(s): +http://www.freelists.org/post/procps/top-Escape-doesnt-abort-kill-command + +Signed-off-by: Jim Warner +--- + top/top.1 | 2 ++ + top/top.c | 105 ++++++++++++++++++++++++++++++++++++------------------------- + 2 files changed, 65 insertions(+), 42 deletions(-) + +diff --git top/top.1 top/top.1 +index c15a871..67b8b35 100644 +--- top/top.1 ++++ top/top.1 +@@ -1082,6 +1082,7 @@ depending on your progress: + .nf + 1) at the pid prompt, type an invalid number + 2) at the signal prompt, type 0 (or any invalid signal) ++ 3) at any prompt, type + .fi + + .TP 7 +@@ -1106,6 +1107,7 @@ depending on your progress: + .nf + 1) at the pid prompt, type an invalid number + 2) at the nice prompt, type with no input ++ 3) at any prompt, type + .fi + + .TP 7 +diff --git top/top.c top/top.c +index 0ae5388..9f33a05 100644 +--- top/top.c ++++ top/top.c +@@ -1150,8 +1150,11 @@ static char *ioline (const char *prompt) { + key = iokey(2); + switch (key) { + case 0: ++ buf[0] = '\0'; ++ return buf; + case kbd_ESC: +- buf[0] = '\0'; // fall through ! ++ buf[0] = kbd_ESC; ++ return buf; + case kbd_ENTER: + continue; + case kbd_INS: +@@ -1197,7 +1200,7 @@ static char *ioline (const char *prompt) { + } + putp(fmtmk("%s%s%s", tg2(beg, Msg_row), Cap_clr_eol, buf)); + putp(tg2(beg+pos, Msg_row)); +- } while (key && key != kbd_ENTER && key != kbd_ESC); ++ } while (key != kbd_ENTER); + + // weed out duplicates, including empty strings (top-of-stack)... + for (i = 0, plin = anchor; ; i++) { +@@ -1275,6 +1278,10 @@ static int readfile (FILE *fp, char **baddr, size_t *bsize, size_t *bread) { + + /*###### Small Utility routines ########################################*/ + ++#define GET_NUM_BAD INT_MIN ++#define GET_NUM_ESC (INT_MIN + 1) ++#define GET_NUM_NOT (INT_MIN + 2) ++ + /* + * Get a float from the user */ + static float get_float (const char *prompt) { +@@ -1282,20 +1289,18 @@ static float get_float (const char *prompt) { + float f; + + line = ioline(prompt); +- if (!line[0] || Frames_signal) return -1.0; ++ if (line[0] == kbd_ESC || Frames_signal) return GET_NUM_ESC; ++ if (!line[0]) return GET_NUM_NOT; + // note: we're not allowing negative floats + if (strcspn(line, "+,.0123456789")) { + show_msg(N_txt(BAD_numfloat_txt)); +- return -1.0; ++ return GET_NUM_BAD; + } + sscanf(line, "%f", &f); + return f; + } // end: get_float + + +-#define GET_INT_BAD INT_MIN +-#define GET_INTNONE (INT_MIN + 1) +- + /* + * Get an integer from the user, returning INT_MIN for error */ + static int get_int (const char *prompt) { +@@ -1303,12 +1308,12 @@ static int get_int (const char *prompt) { + int n; + + line = ioline(prompt); +- if (Frames_signal) return GET_INT_BAD; +- if (!line[0]) return GET_INTNONE; ++ if (line[0] == kbd_ESC || Frames_signal) return GET_NUM_ESC; ++ if (!line[0]) return GET_NUM_NOT; + // note: we've got to allow negative ints (renice) + if (strcspn(line, "-+0123456789")) { + show_msg(N_txt(BAD_integers_txt)); +- return GET_INT_BAD; ++ return GET_NUM_BAD; + } + sscanf(line, "%d", &n); + return n; +@@ -2918,7 +2923,9 @@ static void insp_find_str (int ch, int *col, int *row) { + return; + } + if (ch == 'L' || ch == '/') { +- snprintf(Insp_sel->fstr, FNDBUFSIZ, "%s", ioline(N_txt(GET_find_str_txt))); ++ char *str = ioline(N_txt(GET_find_str_txt)); ++ if (*str == kbd_ESC) return; ++ snprintf(Insp_sel->fstr, FNDBUFSIZ, "%s", str); + Insp_sel->flen = strlen(Insp_sel->fstr); + found = 0; + } +@@ -4135,7 +4142,9 @@ static void find_string (int ch) { + return; + } + if ('L' == ch) { +- snprintf(Curwin->findstr, FNDBUFSIZ, "%s", ioline(N_txt(GET_find_str_txt))); ++ char *str = ioline(N_txt(GET_find_str_txt)); ++ if (*str == kbd_ESC) return; ++ snprintf(Curwin->findstr, FNDBUFSIZ, "%s", str); + Curwin->findlen = strlen(Curwin->findstr); + found = 0; + #ifndef USE_X_COLHDR +@@ -4225,7 +4234,9 @@ static void other_selection (int ch) { + sel = strstr; + } + glob = ioline(fmtmk(N_fmt(OSEL_prompts_fmt), Curwin->osel_tot + 1, typ)); +- if (!snprintf(raw, sizeof(raw), "%s", glob)) return; ++ if (*glob == kbd_ESC ++ || !snprintf(raw, sizeof(raw), "%s", glob)) ++ return; + for (osel = Curwin->osel_1st; osel; ) { + if (!strcmp(osel->raw, glob)) { // #1: is criteria duplicate? + show_msg(N_txt(OSEL_errdups_txt)); +@@ -4343,7 +4354,7 @@ static void keys_global (int ch) { + else { + float tmp = + get_float(fmtmk(N_fmt(DELAY_change_fmt), Rc.delay_time)); +- if (-1 < tmp) Rc.delay_time = tmp; ++ if (tmp > -1) Rc.delay_time = tmp; + } + break; + case 'E': +@@ -4379,17 +4390,21 @@ static void keys_global (int ch) { + if (Secure_mode) { + show_msg(N_txt(NOT_onsecure_txt)); + } else { +- int pid, sig = SIGTERM, def = w->ppt[w->begtask]->tid; +- if (GET_INT_BAD < (pid = get_int(fmtmk(N_txt(GET_pid2kill_fmt), def)))) { ++ int sig = SIGTERM, ++ def = w->ppt[w->begtask]->tid, ++ pid = get_int(fmtmk(N_txt(GET_pid2kill_fmt), def)); ++ if (pid > GET_NUM_ESC) { + char *str; +- if (0 > pid) pid = def; ++ if (pid == GET_NUM_NOT) pid = def; + str = ioline(fmtmk(N_fmt(GET_sigs_num_fmt), pid, SIGTERM)); +- if (*str) sig = signal_name_to_number(str); +- if (Frames_signal) break; +- if (0 < sig && kill(pid, sig)) +- show_msg(fmtmk(N_fmt(FAIL_signals_fmt) +- , pid, sig, strerror(errno))); +- else if (0 > sig) show_msg(N_txt(BAD_signalid_txt)); ++ if (*str != kbd_ESC) { ++ if (*str) sig = signal_name_to_number(str); ++ if (Frames_signal) break; ++ if (0 < sig && kill(pid, sig)) ++ show_msg(fmtmk(N_fmt(FAIL_signals_fmt) ++ , pid, sig, strerror(errno))); ++ else if (0 > sig) show_msg(N_txt(BAD_signalid_txt)); ++ } + } + } + break; +@@ -4397,21 +4412,24 @@ static void keys_global (int ch) { + if (Secure_mode) + show_msg(N_txt(NOT_onsecure_txt)); + else { +- int val, pid, def = w->ppt[w->begtask]->tid; +- if (GET_INT_BAD < (pid = get_int(fmtmk(N_txt(GET_pid2nice_fmt), def)))) { +- if (0 > pid) pid = def; +- if (GET_INTNONE < (val = get_int(fmtmk(N_fmt(GET_nice_num_fmt), pid)))) +- if (setpriority(PRIO_PROCESS, (unsigned)pid, val)) +- show_msg(fmtmk(N_fmt(FAIL_re_nice_fmt) +- , pid, val, strerror(errno))); ++ int val, ++ def = w->ppt[w->begtask]->tid, ++ pid = get_int(fmtmk(N_txt(GET_pid2nice_fmt), def)); ++ if (pid > GET_NUM_ESC) { ++ if (pid == GET_NUM_NOT) pid = def; ++ val = get_int(fmtmk(N_fmt(GET_nice_num_fmt), pid)); ++ if (val > GET_NUM_NOT ++ && setpriority(PRIO_PROCESS, (unsigned)pid, val)) ++ show_msg(fmtmk(N_fmt(FAIL_re_nice_fmt) ++ , pid, val, strerror(errno))); + } + } + break; + case 'X': + { int wide = get_int(fmtmk(N_fmt(XTRA_fixwide_fmt), Rc.fixed_widest)); +- if (GET_INTNONE < wide) { +- if (-1 < wide) Rc.fixed_widest = wide; +- else if (INT_MIN < wide) Rc.fixed_widest = -1; ++ if (wide > GET_NUM_NOT) { ++ if (wide > -1) Rc.fixed_widest = wide; ++ else Rc.fixed_widest = -1; + } + } + break; +@@ -4419,9 +4437,10 @@ static void keys_global (int ch) { + if (!Inspect.total) + ioline(N_txt(YINSP_noents_txt)); + else { +- int pid, def = w->ppt[w->begtask]->tid; +- if (GET_INT_BAD < (pid = get_int(fmtmk(N_fmt(YINSP_pidsee_fmt), def)))) { +- if (0 > pid) pid = def; ++ int def = w->ppt[w->begtask]->tid, ++ pid = get_int(fmtmk(N_fmt(YINSP_pidsee_fmt), def)); ++ if (pid > GET_NUM_ESC) { ++ if (pid == GET_NUM_NOT) pid = def; + if (pid) inspection_utility(pid); + } + } +@@ -4467,7 +4486,7 @@ static void keys_summary (int ch) { + show_msg(N_txt(NUMA_nodenot_txt)); + else { + int num = get_int(fmtmk(N_fmt(NUMA_nodeget_fmt), Numa_node_tot -1)); +- if (GET_INTNONE < num) { ++ if (num > GET_NUM_NOT) { + if (num >= 0 && num < Numa_node_tot) { + Numa_node_sel = num; + SETw(w, View_CPUNOD | View_STATES); +@@ -4503,7 +4522,7 @@ static void keys_task (int ch) { + case 'n': + if (VIZCHKw(w)) { + int num = get_int(fmtmk(N_fmt(GET_max_task_fmt), w->rc.maxtasks)); +- if (GET_INTNONE < num) { ++ if (num > GET_NUM_NOT) { + if (-1 < num ) w->rc.maxtasks = num; + else show_msg(N_txt(BAD_max_task_txt)); + } +@@ -4601,9 +4620,11 @@ static void keys_task (int ch) { + case 'U': + case 'u': + if (VIZCHKw(w)) { +- const char *errmsg; +- if ((errmsg = user_certify(w, ioline(N_txt(GET_user_ids_txt)), ch))) +- show_msg(errmsg); ++ const char *errmsg, *str = ioline(N_txt(GET_user_ids_txt)); ++ if (*str != kbd_ESC ++ && (errmsg = user_certify(w, str, ch))) ++ show_msg(errmsg); ++ + } + break; + case 'V': +@@ -4686,7 +4707,7 @@ static void keys_window (int ch) { + if (ALTCHKw) { + char tmp[SMLBUFSIZ]; + STRLCPY(tmp, ioline(fmtmk(N_fmt(NAME_windows_fmt), w->rc.winname))); +- if (tmp[0]) win_names(w, tmp); ++ if (tmp[0] && tmp[0] != kbd_ESC) win_names(w, tmp); + } + break; + case kbd_UP: +-- +1.7.9.2 + diff --git a/0046-top-miscellaneous-accumulated-changes-to-program-cod.patch b/0046-top-miscellaneous-accumulated-changes-to-program-cod.patch new file mode 100644 index 0000000..c042843 --- /dev/null +++ b/0046-top-miscellaneous-accumulated-changes-to-program-cod.patch @@ -0,0 +1,33 @@ +Based on 0caa6d6e676c8d28b933066d19c112b02ed59245 Mon Sep 17 00:00:00 2001 +From: Jim Warner +Date: Wed, 7 May 2014 00:00:00 -0500 +Subject: [PATCH] top: miscellaneous accumulated changes to program code + +. prevent any input recall overrun if window downsized +. adjust translation notes for true column hdr maximum + +Signed-off-by: Jim Warner +--- + top/top.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git top/top.c top/top.c +index 9f33a05..bc755f3 100644 +--- top/top.c ++++ top/top.c +@@ -1183,13 +1183,13 @@ static char *ioline (const char *prompt) { + if (plin->bkw) { + plin = plin->bkw; + memset(buf, '\0', sizeof(buf)); +- pos = snprintf(buf, sizeof(buf), "%s", plin->str); ++ pos = snprintf(buf, sizeof(buf), "%.*s", Screen_cols - beg - 1, plin->str); + } + break; + case kbd_DOWN: + memset(buf, '\0', sizeof(buf)); + if (plin->fwd) plin = plin->fwd; +- pos = snprintf(buf, sizeof(buf), "%s", plin->str); ++ pos = snprintf(buf, sizeof(buf), "%.*s", Screen_cols - beg - 1, plin->str); + break; + default: // what we REALLY wanted (maybe) + if (isprint(key) && logCOL < bufMAX && phyCOL < Screen_cols) { diff --git a/procps-ng-3.3.8-libselinux.patch b/procps-ng-3.3.8-libselinux.patch index 1baf5e2..ce95755 100644 --- a/procps-ng-3.3.8-libselinux.patch +++ b/procps-ng-3.3.8-libselinux.patch @@ -50,36 +50,3 @@ diff -Naur procps-ng-3.3.8.orig/ps/output.c procps-ng-3.3.8/ps/output.c #endif -From 4f0fe2993a92ac355ea8da3f1434cba0389ef389 Mon Sep 17 00:00:00 2001 -From: Jim Warner -Date: Wed, 7 Aug 2013 12:58:57 -0500 -Subject: [PATCH] ps: address a potential 'newline' quirk the libselinux - -Sometimes with libselinux present but SELinux inactive -the context reported is "unconfined" which contains an -embedded newline. This then causes misalignment of any -subsequent data. So, ps will now protect against that. - -Reference(s): -http://www.freelists.org/post/procps/enablelibselinux-switch,14 - -Signed-off-by: Jim Warner ---- - ps/output.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/ps/output.c b/ps/output.c -index b7b21d1..d457a89 100644 ---- a/ps/output.c -+++ b/ps/output.c -@@ -1339,6 +1339,7 @@ static int pr_context(char *restrict const outbuf, const proc_t *restrict const - len = strlen(context); - if(len > max_len) len = max_len; - memcpy(outbuf, context, len); -+ if (outbuf[len-1] == '\n') --len; - outbuf[len] = '\0'; - free(context); - }else{ --- -1.8.1.2 - diff --git a/procps.changes b/procps.changes index 112f1bd..7225dcd 100644 --- a/procps.changes +++ b/procps.changes @@ -1,3 +1,55 @@ +------------------------------------------------------------------- +Thu May 15 11:50:39 UTC 2014 - werner@suse.de + +- Fix missing job in D states in idle mode of top, therefore + update to latest top of procps-ng git HEAD + * Rename the patches + 0001-top-enable-screen-contents-preservation-at-endofjob.patch + 0001-top-refine-some-miscellaneous-signals-interrupt-stuf.patch + 0001-top-trade-two-groff_mdoc-macros-for-groff-equivalent.patch + 0002-library-for-atexit-support-fix-fileutils-for-EPIPE.patch + 0002-top-cursor-repositioning-includes-line-oriented-inpu.patch + to + 0002-top-trade-two-groff_mdoc-macros-for-groff-equivalent.patch + 0003-library-for-atexit-support-fix-fileutils-for-EPIPE.patch + 0004-top-enable-screen-contents-preservation-at-end-of-jo.patch + 0005-top-refine-some-miscellaneous-signals-interrupt-stuf.patch + 0006-top-cursor-repositioning-includes-line-oriented-inpu.patch + * Add upstream patches + 0002-top-trade-two-groff_mdoc-macros-for-groff-equivalent.patch + 0003-library-for-atexit-support-fix-fileutils-for-EPIPE.patch + 0004-top-enable-screen-contents-preservation-at-end-of-jo.patch + 0005-top-refine-some-miscellaneous-signals-interrupt-stuf.patch + 0006-top-cursor-repositioning-includes-line-oriented-inpu.patch + 0007-top-correct-improve-or-otherwise-tweak-some-comments.patch + 0008-top-tweak-cursor-state-code-to-swat-an-obscure-bugle.patch + 0009-top-correct-cursor-positioning-for-all-Z-or-C-cases.patch + 0010-ps-address-a-potential-newline-quirk-the-libselinux.patch + 0012-top-hint-that-Summary-Area-cached-is-Mem-not-Swap.patch + 0013-top-modest-efficiency-change-to-message-line-handlin.patch + 0014-top-correct-improve-and-otherwise-tweak-configs_read.patch + 0015-top-swat-bug-affecting-batch-mode-and-width-provisio.patch + 0018-top-restore-the-lost-final-newline-when-in-Batch-mod.patch + 0019-top-swat-bug-impacting-idle-mode-user-filtering.patch + 0021-top-address-some-potential-libnuma-display-corruptio.patch + 0022-top-fix-miscellaneous-spelling-errors-in-man-documen.patch + 0023-top-expand-on-column-highlight-quirks-in-man-documen.patch + 0024-top-add-some-flexibility-to-dlopen-for-numa-support.patch + 0025-top-minimize-the-statistics-overhead-for-numa-suppor.patch + 0026-top-eliminate-yet-more-gcc-subscript-resolution-bloa.patch + 0032-top-do-not-lie-about-purported-alphabetical-ordering.patch + 0033-top-follow-usual-name-conventions-for-global-variabl.patch + 0035-top-provide-for-discontinuous-not-active-NUMA-nodes.patch + 0036-top-restore-the-former-behavior-after-stderr-redirec.patch + 0037-top-avoid-name-conflict-in-the-next-version-of-stdli.patch + 0038-top-protect-against-distortion-when-system-time-rese.patch + 0044-top-avoid-a-nan-when-the-delay-interval-is-very-low.patch + 0045-top-standardize-Esc-key-support-with-prompted-input.patch + 0046-top-miscellaneous-accumulated-changes-to-program-cod.patch + * Modify patches + 0001-top-add-the-major-version-to-dlopen-of-libnuma-sonam.patch + procps-ng-3.3.8-libselinux.patch + ------------------------------------------------------------------- Tue Mar 25 12:43:12 CET 2014 - tiwai@suse.de diff --git a/procps.spec b/procps.spec index 8d909d0..2a0e558 100644 --- a/procps.spec +++ b/procps.spec @@ -71,26 +71,78 @@ Patch18: procps-ng-3.3.8-petabytes.patch Patch19: procps-v3.3.4-large_pcpu.patch Patch20: procps-ng-3.3.8-tinfo.dif Patch21: procps-v3.3.3-pwdx.patch -# PATCH-FIX-UPSTREAM -- Add the major version to dlopen of libnuma -Patch22: 0001-top-add-the-major-version-to-dlopen-of-libnuma-sonam.patch -# PATCH-FIX-UPSTREAM -- Use common mdoc nroff macros -Patch23: 0001-top-trade-two-groff_mdoc-macros-for-groff-equivalent.patch # PATCH-FIX-UPSTREAM -- Let libproc support EPIPE in close_stream -Patch24: 0002-library-for-atexit-support-fix-fileutils-for-EPIPE.patch -# PATCH-FIX-UPSTREAM -- Do not clear screen after end-of-job -Patch25: 0001-top-enable-screen-contents-preservation-at-endofjob.patch -# PATCH-FIX-UPSTREAM -- Cursor repositioning includes line oriented input -Patch26: 0002-top-cursor-repositioning-includes-line-oriented-inpu.patch -# PATCH-FIX-UPSTREAM -- Suppress end-of-job report if top if not ended with 'q' key -Patch27: 0001-top-refine-some-miscellaneous-signals-interrupt-stuf.patch +Patch22: 0003-library-for-atexit-support-fix-fileutils-for-EPIPE.patch +# PATCH-FIX-UPSTREAM -- Add enable-libselinux switch +Patch23: procps-ng-3.3.8-libselinux.patch # PATCH-FIX-OPENSUSE -- trifle rest of the old terabyte patch Patch28: procps-ng-3.3.8-vmstat-terabyte.dif # PATCH-FIX-UPSTREAM -- Show shared memory in 'free' again Patch29: procps-ng-3.3.8-shmem.patch # PATCH-FIX-UPSTREAM -- Add enable-libselinux switch -Patch30: procps-ng-3.3.8-libselinux.patch +Patch30: 0010-ps-address-a-potential-newline-quirk-the-libselinux.patch # PATCH-FIX-SUSE -- Ignore scan_unevictable_pages in sysctl Patch31: procps-ng-3.3.8-ignore-scan_unevictable_pages.patch + +# Top patches +# PATCH-FIX-UPSTREAM -- Add the major version to dlopen of libnuma +Patch100: 0001-top-add-the-major-version-to-dlopen-of-libnuma-sonam.patch +# PATCH-FIX-UPSTREAM -- Use common mdoc nroff macros +Patch101: 0002-top-trade-two-groff_mdoc-macros-for-groff-equivalent.patch +# PATCH-FIX-UPSTREAM -- Do not clear screen after end-of-job +Patch102: 0004-top-enable-screen-contents-preservation-at-end-of-jo.patch +# PATCH-FIX-UPSTREAM -- Suppress end-of-job report if top if not ended with 'q' key +Patch103: 0005-top-refine-some-miscellaneous-signals-interrupt-stuf.patch +# PATCH-FIX-UPSTREAM -- Cursor repositioning includes line oriented input +Patch104: 0006-top-cursor-repositioning-includes-line-oriented-inpu.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch105: 0007-top-correct-improve-or-otherwise-tweak-some-comments.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch106: 0008-top-tweak-cursor-state-code-to-swat-an-obscure-bugle.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch107: 0009-top-correct-cursor-positioning-for-all-Z-or-C-cases.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch108: 0012-top-hint-that-Summary-Area-cached-is-Mem-not-Swap.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch109: 0013-top-modest-efficiency-change-to-message-line-handlin.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch110: 0014-top-correct-improve-and-otherwise-tweak-configs_read.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch111: 0015-top-swat-bug-affecting-batch-mode-and-width-provisio.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch112: 0018-top-restore-the-lost-final-newline-when-in-Batch-mod.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch113: 0019-top-swat-bug-impacting-idle-mode-user-filtering.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch114: 0021-top-address-some-potential-libnuma-display-corruptio.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch115: 0022-top-fix-miscellaneous-spelling-errors-in-man-documen.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch116: 0023-top-expand-on-column-highlight-quirks-in-man-documen.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch117: 0024-top-add-some-flexibility-to-dlopen-for-numa-support.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch118: 0025-top-minimize-the-statistics-overhead-for-numa-suppor.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch119: 0026-top-eliminate-yet-more-gcc-subscript-resolution-bloa.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch120: 0032-top-do-not-lie-about-purported-alphabetical-ordering.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch121: 0033-top-follow-usual-name-conventions-for-global-variabl.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch122: 0035-top-provide-for-discontinuous-not-active-NUMA-nodes.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch123: 0036-top-restore-the-former-behavior-after-stderr-redirec.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch124: 0037-top-avoid-name-conflict-in-the-next-version-of-stdli.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch125: 0038-top-protect-against-distortion-when-system-time-rese.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch126: 0044-top-avoid-a-nan-when-the-delay-interval-is-very-low.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch127: 0045-top-standardize-Esc-key-support-with-prompted-input.patch +# PATCH-FIX-UPSTREAM added at 2014/05/15 +Patch128: 0046-top-miscellaneous-accumulated-changes-to-program-cod.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -156,16 +208,42 @@ the process information pseudo-file system, %patch19 %patch20 %patch21 -%patch22 -p1 +%patch22 %patch23 -p1 -%patch24 -p1 -%patch25 -p1 -%patch26 -p1 -%patch27 -p1 %patch28 %patch29 -p1 -%patch30 -p1 +%patch30 %patch31 -p1 +# Patches for top +%patch100 +%patch101 +%patch102 +%patch103 +%patch104 +%patch105 +%patch106 +%patch107 +%patch108 +%patch109 +%patch110 +%patch111 +%patch112 +%patch113 +%patch114 +%patch115 +%patch116 +%patch117 +%patch118 +%patch119 +%patch120 +%patch121 +%patch122 +%patch123 +%patch124 +%patch125 +%patch126 +%patch127 +%patch128 %build tar --strip-components=1 -xf %{S:1} @@ -188,6 +266,7 @@ export LFS_CFLAGS="$(getconf LFS_CFLAGS)" --enable-w-from \ --enable-sigwinch \ --enable-wide-percent \ + --enable-wide-memory \ --enable-w-from \ --enable-libselinux \ --with-pic=yes \