kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* How to find the child processes?
       [not found] <6089e33a-29ad-4df9-aac8-006e9b42fbfa@mail5.gatech.edu>
@ 2012-02-11  3:45 ` Surenkumar Nihalani
  2012-02-11  5:12   ` Dave Hylands
  0 siblings, 1 reply; 2+ messages in thread
From: Surenkumar Nihalani @ 2012-02-11  3:45 UTC (permalink / raw)
  To: kernelnewbies

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? 

Thanks, 
Suren Nihalani. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120210/c4ef9e0b/attachment.html 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* How to find the child processes?
  2012-02-11  3:45 ` How to find the child processes? Surenkumar Nihalani
@ 2012-02-11  5:12   ` Dave Hylands
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Hylands @ 2012-02-11  5:12 UTC (permalink / raw)
  To: kernelnewbies

Hi Suren,

On Fri, Feb 10, 2012 at 7:45 PM, Surenkumar Nihalani <suren@gatech.edu> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-11  5:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <6089e33a-29ad-4df9-aac8-006e9b42fbfa@mail5.gatech.edu>
2012-02-11  3:45 ` How to find the child processes? Surenkumar Nihalani
2012-02-11  5:12   ` Dave Hylands

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).