How to traverse kernel threads?
Mateusz Guzik
mjguzik at gmail.com
Sat Mar 21 23:26:28 UTC 2015
On Sat, Mar 21, 2015 at 06:11:57PM -0400, Yue Chen wrote:
> Thanks for the quick reply.
>
> What I am trying to achieve is to get the stack starting and ending address
> of a kernel module.
> I think it could be got from
>
> struct thread *td
> td->td_kstack
> td->td_kstack + td->td_kstack_pages * PAGE_SIZE
>
> So I need to get the ``td'' first.
> Maybe there is another way to get it other than traversing?
>
Kernel modules don't have stacks, presumably you mean kernel threads
created by code in modules.
But how would you go about recognising that given thread was created by
given module? I don't see starting func stored anywhere, so you would
need some crap hacks to unwind the stack by hand and even that is not
reliable (not to mention terrible).
But once more the real question is what are you trying to do. I don't
see any use for stack info of random threads.
--
Mateusz Guzik <mjguzik gmail.com>
More information about the freebsd-hackers
mailing list