Re: How to find the child processes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Suren,

On Fri, Feb 10, 2012 at 7:45 PM, Surenkumar Nihalani <suren@xxxxxxxxxx> 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
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux