From b09014a7b629f9ac810321af4bce82b89ab95dff Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Tue, 7 Jun 2016 00:00:00 -0500 Subject: [PATCH] top: share the rcfile between master & newlib branches Since the decision was made to also add that Linux-4.5 support (was only in this newlib branch) to our master branch, a tweak to newlib's top is necessary. In order to share the rcfile between them, any fields unique to a branch must appear last in it's list of enumerators. And the troublesome field in question above is CGNAME. It doesn't matter if a unique field is on or off, only that it, as a higher enum/char, appear after all other shared fields. Otherwise one risks the 'corrupt' error message from the top without that field or the display of the wrong column in the top with that unique field. [ and strictly speaking, the changes under top_nls.c ] [ were technically not really necessary. however, we ] [ choose to maintain strict ordering via enum value. ] Signed-off-by: Jim Warner --- top/top.c | 4 ++-- top/top.h | 3 ++- top/top_nls.c | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/top/top.c b/top/top.c index ed70f0a5..d20f8fd3 100644 --- a/top/top.c +++ b/top/top.c @@ -1559,7 +1559,6 @@ static struct { { 10, -1, A_right, -1, PROCPS_PIDS_NS_USER }, // ul_int EU_NS5 { 10, -1, A_right, -1, PROCPS_PIDS_NS_UTS }, // ul_int EU_NS6 { 8, -1, A_left, -1, PROCPS_PIDS_LXCNAME }, // str EU_LXC - { -1, -1, A_left, -1, PROCPS_PIDS_CGNAME }, // str EU_CGN #ifndef NOBOOST_MEMS { 6, SK_Kb, A_right, -1, PROCPS_PIDS_VM_RSS_ANON }, // sl_int EU_RZA { 6, SK_Kb, A_right, -1, PROCPS_PIDS_VM_RSS_FILE }, // sl_int EU_RZF @@ -1571,7 +1570,8 @@ static struct { { 4, SK_Kb, A_right, -1, PROCPS_PIDS_VM_RSS_LOCKED }, // sl_int EU_RZL { 4, SK_Kb, A_right, -1, PROCPS_PIDS_VM_RSS_SHARED }, // sl_int EU_RZS #endif -#define eu_LAST EU_RZS // ( the last real pflag, currently ) + { -1, -1, A_left, -1, PROCPS_PIDS_CGNAME }, // str EU_CGN +#define eu_LAST EU_CGN // ( the last real pflag, currently ) // xtra Fieldstab 'pseudo pflag' entries for the newlib interface . . . ---------------------------------- #define eu_CMDLINE eu_LAST +1 #define eu_TICS_ALL_C eu_LAST +2 diff --git a/top/top.h b/top/top.h index aa3ad043..230208b3 100644 --- a/top/top.h +++ b/top/top.h @@ -180,8 +180,9 @@ enum pflag { EU_FV1, EU_FV2, EU_USE, EU_NS1, EU_NS2, EU_NS3, EU_NS4, EU_NS5, EU_NS6, - EU_LXC, EU_CGN, + EU_LXC, EU_RZA, EU_RZF, EU_RZL, EU_RZS, + EU_CGN, #ifdef USE_X_COLHDR // not really pflags, used with tbl indexing EU_MAXPFLGS diff --git a/top/top_nls.c b/top/top_nls.c index 39ab5fdc..e89b8e09 100644 --- a/top/top_nls.c +++ b/top/top_nls.c @@ -278,9 +278,6 @@ static void build_two_nlstabs (void) { /* Translation Hint: maximum 'LXC' = 7 */ Head_nlstab[EU_LXC] = _("LXC"); Desc_nlstab[EU_LXC] = _("LXC container name"); -/* Translation Hint: maximum 'CGNAME' = 7 */ - Head_nlstab[EU_CGN] = _("CGNAME"); - Desc_nlstab[EU_CGN] = _("Control Group name"); /* Translation Hint: maximum 'RSan' = 4 */ Head_nlstab[EU_RZA] = _("RSan"); Desc_nlstab[EU_RZA] = _("RES Anonymous (KiB)"); @@ -293,6 +290,9 @@ static void build_two_nlstabs (void) { /* Translation Hint: maximum 'RSsh' = 4 */ Head_nlstab[EU_RZS] = _("RSsh"); Desc_nlstab[EU_RZS] = _("RES Shared (KiB)"); +/* Translation Hint: maximum 'CGNAME' = 7 */ + Head_nlstab[EU_CGN] = _("CGNAME"); + Desc_nlstab[EU_CGN] = _("Control Group name"); } -- 2.40.0