Hi,

Here's a small patch to remove the `W` flag in the `ps` status column.

This `W` flag appears for every kernel thread in `I` or `S` state with Busybox 
`ps` command but it never appears with Procps one.

Here's an example with the two versions of `ps`:

```
$ busybox ps -o pid,stat,comm
PID   STAT COMMAND
    1 S    systemd
    2 SW   kthreadd
    3 IW<  rcu_gp
    4 IW<  rcu_par_gp
    5 IW<  slub_flushwq
    6 IW<  netns
    8 IW<  kworker/0:0H-ev
   10 IW<  mm_percpu_wq
   11 SW   rcu_tasks_rude_
   12 SW   rcu_tasks_trace
   13 SW   ksoftirqd/0
  [...]

$ ps ax
    PID TTY      STAT   TIME COMMAND
      1 ?        Ss     0:20 /sbin/init splash
      2 ?        S      0:00 [kthreadd]
      3 ?        I<     0:00 [rcu_gp]
      4 ?        I<     0:00 [rcu_par_gp]
      5 ?        I<     0:00 [slub_flushwq]
      6 ?        I<     0:00 [netns]
      8 ?        I<     0:00 [kworker/0:0H-events_highpri]
     10 ?        I<     0:00 [mm_percpu_wq]
     11 ?        S      0:00 [rcu_tasks_rude_]
     12 ?        S      0:00 [rcu_tasks_trace]
     13 ?        S      0:57 [ksoftirqd/0]
    [...]
```

Note that a `W` flag once existed with Procps, but it is no more used since 2.6 
kernel (see ps man page).


Signed-off-by: Christophe Blaess <christophe.bla...@logilin.fr>
---
 libbb/procps.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/libbb/procps.c b/libbb/procps.c
index f56b71b21..8f210117d 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -468,11 +468,6 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* 
sp, int flags)
                        sp->state[1] = ' ';
                        sp->state[2] = ' ';
                        s_idx = 1;
-                       if (sp->vsz == 0 && sp->state[0] != 'Z') {
-                               /* not sure what the purpose of this flag */
-                               sp->state[1] = 'W';
-                               s_idx = 2;
-                       }
                        if (tasknice != 0) {
                                if (tasknice < 0)
                                        sp->state[s_idx] = '<';
-- 
2.34.1

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to