[PATCH 1/2] libbb: add "isthread" indicator to procps_status_t

Denys Vlasenko vda.linux at googlemail.com
Sun Dec 5 04:24:49 UTC 2010


On Friday 03 December 2010 17:57, Lauri Kasanen wrote:
> Hi
> 
> Pstree needs to be able to separate normal processes from threads. To be able to use procps_scan fully in pstree, let's add that ability to procps_scan.
> 
> If this is deemed unsuitable, the thread check can be done in pstree as well, but this way saves ~20 bytes.

The code is broken.

oldpid (nad name btw, I'd call it thread_master_pid)
is 0 for every thread directory except 1st.

Therefore the code declares 1st thread (with smallest pid)
to be "not-a-thread", not the thread with pid == master thread pid.

Please do test your code.

-- 
vda


More information about the busybox mailing list