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 <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2016-06-07 00:00:00 -05:00 committed by Craig Small
parent 5f2570c384
commit b09014a7b6
3 changed files with 7 additions and 6 deletions

View File

@ -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_USER }, // ul_int EU_NS5
{ 10, -1, A_right, -1, PROCPS_PIDS_NS_UTS }, // ul_int EU_NS6 { 10, -1, A_right, -1, PROCPS_PIDS_NS_UTS }, // ul_int EU_NS6
{ 8, -1, A_left, -1, PROCPS_PIDS_LXCNAME }, // str EU_LXC { 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 #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_ANON }, // sl_int EU_RZA
{ 6, SK_Kb, A_right, -1, PROCPS_PIDS_VM_RSS_FILE }, // sl_int EU_RZF { 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_LOCKED }, // sl_int EU_RZL
{ 4, SK_Kb, A_right, -1, PROCPS_PIDS_VM_RSS_SHARED }, // sl_int EU_RZS { 4, SK_Kb, A_right, -1, PROCPS_PIDS_VM_RSS_SHARED }, // sl_int EU_RZS
#endif #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 . . . ---------------------------------- // xtra Fieldstab 'pseudo pflag' entries for the newlib interface . . . ----------------------------------
#define eu_CMDLINE eu_LAST +1 #define eu_CMDLINE eu_LAST +1
#define eu_TICS_ALL_C eu_LAST +2 #define eu_TICS_ALL_C eu_LAST +2

View File

@ -180,8 +180,9 @@ enum pflag {
EU_FV1, EU_FV2, EU_FV1, EU_FV2,
EU_USE, EU_USE,
EU_NS1, EU_NS2, EU_NS3, EU_NS4, EU_NS5, EU_NS6, 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_RZA, EU_RZF, EU_RZL, EU_RZS,
EU_CGN,
#ifdef USE_X_COLHDR #ifdef USE_X_COLHDR
// not really pflags, used with tbl indexing // not really pflags, used with tbl indexing
EU_MAXPFLGS EU_MAXPFLGS

View File

@ -278,9 +278,6 @@ static void build_two_nlstabs (void) {
/* Translation Hint: maximum 'LXC' = 7 */ /* Translation Hint: maximum 'LXC' = 7 */
Head_nlstab[EU_LXC] = _("LXC"); Head_nlstab[EU_LXC] = _("LXC");
Desc_nlstab[EU_LXC] = _("LXC container name"); 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 */ /* Translation Hint: maximum 'RSan' = 4 */
Head_nlstab[EU_RZA] = _("RSan"); Head_nlstab[EU_RZA] = _("RSan");
Desc_nlstab[EU_RZA] = _("RES Anonymous (KiB)"); Desc_nlstab[EU_RZA] = _("RES Anonymous (KiB)");
@ -293,6 +290,9 @@ static void build_two_nlstabs (void) {
/* Translation Hint: maximum 'RSsh' = 4 */ /* Translation Hint: maximum 'RSsh' = 4 */
Head_nlstab[EU_RZS] = _("RSsh"); Head_nlstab[EU_RZS] = _("RSsh");
Desc_nlstab[EU_RZS] = _("RES Shared (KiB)"); Desc_nlstab[EU_RZS] = _("RES Shared (KiB)");
/* Translation Hint: maximum 'CGNAME' = 7 */
Head_nlstab[EU_CGN] = _("CGNAME");
Desc_nlstab[EU_CGN] = _("Control Group name");
} }