show thread as process

Fabian Meier fabian.meier at gmx.ch
Mon Sep 21 10:52:23 UTC 2009


Hi,

Thanks, I just tested the patch. It works with CONFIG_DESKTOP. So I
will have to switch to this option. The binary increases by 5k.
Is there also noticeable memory & performance loss by switching to
CONFIG_DESKTOP? The system is a ppc855 60Mhz and 64Mb ram.
Maybe it is better for me to just patch the procps_scan mask (in bb 1.16.0) with

    while ((p = procps_scan(p, 0
            | PSSCAN_PID
            | PSSCAN_UIDGID
            | PSSCAN_STATE
            | PSSCAN_VSZ
            | PSSCAN_COMM
            | use_selinux
#if ENABLE_FEATURE_SHOW_THREADS
            | PSSCAN_TASKS
#endif
    )) != NULL) {

I will go this way I guess.



Besides, there is a (config) bug in your patch:

  CC      procps/top.o
procps/top.c: In function 'top_main':
procps/top.c:1087: error: assignment of read-only variable 'scan_mask'
make[1]: *** [procps/top.o] Error 1
make: *** [procps] Error 2

 [ ]   Topmem command ('s' key)

 IF_NOT_FEATURE_TOPMEM(const) unsigned scan_mask = TOP_MASK;


regards
Fabian


On Sat, Sep 19, 2009 at 10:29 PM, Denys Vlasenko
<vda.linux at googlemail.com> wrote:
> On Thursday 17 September 2009 10:24, Fabian Meier wrote:
>> Hi
>>
>> The behaviour of ps with linuxthreads is different from nptl. A thread is
>> listed as a process with linuxthreads. With nptl you see only the real
>> process.
>> I modified props_scan so it can also work with threads(tasks) by scanning
>> /proc/<process>/task/*. I also added a config option in ps for that feature.
>
> +config FEATURE_PS_SHOW_THREADS
> +       bool "Show thread as process"
> +       default n
> +       depends on PS
> +       help
> +         Show threads as if they were processes (as it was with linuxthreads)
>
> It's better to create FEATURE_SHOW_THREADS with help text
> "enables option -T for ps and a <corresponding option>
> (or <corresponding> keyboard command) for top"
>
>
> +/* ENABLE_FEATURE_PS_SHOW_THREADS */
> +       DIR *task_dir;
> +       bool is_last_task;
> +/* END ENABLE_FEATURE_PS_SHOW_THREADS */
>
> Yes, this really needs to be #ifdefed out.
>
> Please try attached patch.
> --
> vda
>


More information about the busybox mailing list