]> granicus.if.org Git - procps-ng/commitdiff
library <stat>: remove that PIDS_WCHAN_ADDR enumerator
authorJim Warner <james.warner@comcast.net>
Fri, 7 Oct 2016 09:44:44 +0000 (04:44 -0500)
committerCraig Small <csmall@enc.com.au>
Sat, 15 Oct 2016 21:23:38 +0000 (08:23 +1100)
Removing the Item_table 'stat' oldflags for WCHAN_ADDR
was wrong since that 'stat' field is not a constant 0.
Rather, it could assume these 3 values: -1, 0, and +1.

I have not been able to pin down a '-1' result, but it
probably means some sort of permission error (-EPERM).

The '1' or '0' values were supposed to distinguish the
tasks that were or were not blocked (whether there was
a wchan address). However, in practice there is little
correlation between those values and availability of a
kernel symbol in /proc/$$/wchan (perhaps due to race).

Anyway, the real point is that a 'stat' wchan does not
now intentionally contain an address. Thus, outputting
'ffffff', '-' or '1' in programs like ps is senseless.

So this patch just eliminates PIDS_WCHAN_ADDR from our
item enumerators leaving only the PIDS_WCHAN_NAME guy.
Now the new library can't be blamed for bad addresses!

Reference(s):
. removed Item_table 'oldflags'
commit c4aa6c0ab4263976b2abbc5df0068d5a1612d731
. linux removal of wchan addresses
commit b2f73922d119686323f14fbbe46587f863852328

Signed-off-by: Jim Warner <james.warner@comcast.net>
proc/pids.c
proc/pids.h

index ff7657c4d65e7b4dc00285b1ed813cbbaa513671..446add3fbacdbb64b926f1ac2d9aa7f195018d3e 100644 (file)
@@ -251,7 +251,6 @@ REG_set(VM_STACK,         ul_int,  vm_stack)
 REG_set(VM_SWAP,          ul_int,  vm_swap)
 setDECL(VM_USED)        { (void)I; R->result.ul_int = P->vm_swap + P->vm_rss; }
 REG_set(VSIZE_PGS,        ul_int,  vsize)
-REG_set(WCHAN_ADDR,       ul_int,  wchan)
 setDECL(WCHAN_NAME)     { (void)I; R->result.str = strdup(lookup_wchan(P->tid)); }
 
 #undef setDECL
@@ -500,7 +499,6 @@ static struct {
     { RS(VM_SWAP),           f_status,   NULL,      QS(ul_int),    0,        TS(ul_int)  },
     { RS(VM_USED),           f_status,   NULL,      QS(ul_int),    0,        TS(ul_int)  },
     { RS(VSIZE_PGS),         f_stat,     NULL,      QS(ul_int),    0,        TS(ul_int)  },
-    { RS(WCHAN_ADDR),        0,          NULL,      QS(ul_int),    0,        TS(ul_int)  }, // oldflags: was f_stat, but linux obsoleted
     { RS(WCHAN_NAME),        0,          FF(str),   QS(str),       0,        TS(str)     }, // oldflags: tid already free
 
    // dummy entry corresponding to PIDS_logical_end ...
index 35c5cbac3dacf13734d1fd247a86f96db5b06740..19f12f67b18dfe604b7007de9fa4f7d034c0fe43 100644 (file)
@@ -144,7 +144,6 @@ enum pids_item {
     PIDS_VM_SWAP,           //  ul_int
     PIDS_VM_USED,           //  ul_int
     PIDS_VSIZE_PGS,         //  ul_int
-    PIDS_WCHAN_ADDR,        //  ul_int
     PIDS_WCHAN_NAME         //     str
 };