Subject: Re: Threads information /proc
To: None <netbsd-help@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: netbsd-help
Date: 01/11/2007 17:57:39
In article <9671c76b0701110426ra1582acu23d94eda1a64fcb2@mail.gmail.com>,
aalu paneer <aalu.paneer@gmail.com> wrote:
>Hello All,
>
>I am trying to port an application from Linux to NetBSD.
>
>The application needs to know how many threads any given process has.
>In Linux, it looks into /proc/<pid>/task for a count and thread id of
>the various threads.

This depends on the thread model used. If I am running under the old
linux threads (non NPTL), each thread is a process, and both stat
and tasks report the wrong information.

>But /proc in NetBSD does not carry this information. Even the number
>of threads reported in /proc/<pid>/stat is not proper.

Same...

>Any suggestion on how to get the information provided in Linux via
>/proc/<pid>/task in NetBSD?

Our linux emulation needs a lot of tender love and attention so that
it will be able to emulate applications that assume and require NPTL.
We could in the short term fix procfs to create the task subdirectory
and populate it with the information from curproc, but I don't think
that this will be enough.

christos