How to traverse kernel threads?

Mateusz Guzik mjguzik at gmail.com
Sat Mar 21 22:02:52 UTC 2015


On Sat, Mar 21, 2015 at 05:54:24PM -0400, Yue Chen wrote:
> Dear all,
> 
> Is there an easy way to traverse all the kernel threads (including
> modules') in a FreeBSD kernel module?
> The resulting structure would be `` struct thread * ''.
> 

Well if you read kthread_add you can see you just need to traverse
threads linked into proc0.

Chances are you also want to traverse kernel process (see kproc_create).

The real question though is what are you trying to achieve.

-- 
Mateusz Guzik <mjguzik gmail.com>


More information about the freebsd-hackers mailing list