How to find the child processes?
From: Dave Hylands <hidden>
Date: 2012-02-11 05:12:02
From: Dave Hylands <hidden>
Date: 2012-02-11 05:12:02
Hi Suren, On Fri, Feb 10, 2012 at 7:45 PM, Surenkumar Nihalani [off-list ref] 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