Hi Suren,

On Fri, Feb 10, 2012 at 7:45 PM, Surenkumar Nihalani <[email protected]> wrote:
> Hi guys,
>
> I need help, again. I am writing a kernel module. I have the pid and tid
> from the current structure. How do I figure our the number of threads in the
> given process id?
> If possible, how do I get the individual tids within the pid?

So I took a look at how /proc/TTT/task was implemented, and basically
it uses next_thread from sched.h, which follows the thread_group
structure stored inside task_struct.

You need to acquire the appropriate locks and do checks to make sure
that the thread hasn't died on you, but that's the jist of it.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com

_______________________________________________
Kernelnewbies mailing list
[email protected]
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to