]> granicus.if.org Git - procps-ng/commitdiff
top: with new 'X' command, WCHAN becomes fixed-width
authorJim Warner <james.warner@comcast.net>
Tue, 25 Sep 2012 07:02:02 +0000 (02:02 -0500)
committerCraig Small <csmall@enc.com.au>
Tue, 2 Oct 2012 10:56:40 +0000 (20:56 +1000)
This 'Sleeping in function' field was made variable
width because the length of current kernel symbols
usually exceeded the former top's 9 character limit.

As a variable width field it would steal valuable
horizontal display positions from other, more likely,
displayed fields such as COMMAND or CGROUPS.

With the advent of the new 'X' toggle, no fixed-width
non-scalable field need suffer permanent truncation.
Thus, WCHAN is being made fixed width with a default
size of 10 characters.

Signed-off-by: Jim Warner <james.warner@comcast.net>
 top/top.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

top/top.1
top/top.c

index 4b3f02cbe5b5af584481dc1cc63294392e2c70fa..0057a9ad037514340e65a32242fb72ff79d3370a 100644 (file)
--- a/top/top.1
+++ b/top/top.1
@@ -718,13 +718,6 @@ By displaying this field, \*(We's own working set could be increased by over
 Should that occur, your only means of reducing that overhead will be to stop
 and restart \*(We.
 
-\*(NT The 'WCHAN' field, unlike most columns, is not fixed-width.
-When displayed, it plus any other variable width columns will be allocated
-all remaining screen width (up to the maximum \*(WX characters).
-Even so, such variable width fields could still suffer truncation.
-\*(XT 5c. SCROLLING a Window for additional information on accessing
-any truncated data.
-
 .TP 4
 37.\fB nDRT \*(Em Dirty Pages Count \fR
 The number of pages that have been modified since they were last
@@ -973,8 +966,8 @@ by a '+' in the last position.
 This \*(CI can be used to alter the widths for the following fields:
 
 .Bd -literal
-   \fI field  default    field  default \fR
-    GID       5       GROUP     8
+   \fI field  default    field  default    field  default \fR
+    GID       5       GROUP     8       WCHAN    10
     RUID      5       RUSER     8
     SUID      5       SUSER     8
     UID       5       USER      8
index c0c0cbf6f7e5bb63441e72ee75ddcb996b127201..b99c401a9ab36e3c7f6bb9120139244bebe375bd 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -1382,7 +1382,7 @@ static FLD_t Fieldstab[] = {
    {     4,  SK_no,  A_right,  SF(DRT),  L_statm   },
    {     1,     -1,  A_right,  SF(STA),  L_EITHER  },
    {    -1,     -1,  A_left,   SF(CMD),  L_EITHER  },
-   {    -1,     -1,  A_left,   SF(WCH),  L_stat    },
+   {    10,     -1,  A_left,   SF(WCH),  L_stat    },
    {     8,     -1,  A_left,   SF(FLG),  L_stat    },
    {    -1,     -1,  A_left,   SF(CGR),  L_CGROUP  },
    {    -1,     -1,  A_left,   SF(SGD),  L_status  },
@@ -1901,6 +1901,8 @@ static void zap_fieldstab (void) {
       = Rc.fixed_widest ? 8 + Rc.fixed_widest : 8;
    Fieldstab[P_TTY].width
       = Rc.fixed_widest ? 8 + Rc.fixed_widest : 8;
+   Fieldstab[P_WCH].width
+      = Rc.fixed_widest ? 10 + Rc.fixed_widest : 10;
 
    // lastly, ensure we've got proper column headers...
    calibrate_fields();
@@ -3955,7 +3957,7 @@ static const char *task_show (const WIN_t *q, const proc_t *p) {
                u = hex_make(p->wchan, 0);
             else
                u = lookup_wchan(p->wchan, p->tid);
-            makeVAR(u);
+            cp = make_str(u, W, Js);
          }
             break;
          default:                 // keep gcc happy