LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   get list of thread of running process using C api (in my c code) (https://www.linuxquestions.org/questions/linux-newbie-8/get-list-of-thread-of-running-process-using-c-api-in-my-c-code-785566/)

Jodha 01-29-2010 05:37 AM

get list of thread of running process using C api (in my c code)
 
In short our required is that we are creating a share library which can be loaded by a process and that share library analysis the process which load it. Since share library is in address space of the process so I need to find out how many threads created by the process and what is status of their stack trace etc.

So I am looking for a way to get list of threads in running process.

Let me know if you need more information..

neonsignal 01-29-2010 07:33 AM

The process id directories in /proc provide a fair bit of information.

First call getpid, then you can search through the process directories to find those threads that are related to the same process.

The command pstree will give you something of a feel for how thread and process ids work, before you write your own implementation.


All times are GMT -5. The time now is 09:04 AM.