Implement GET_STACK_USAGE.

Discussed with:	mav

Approved by:	re (kib)
MFC after:	1 week
This commit is contained in:
Marius Strobl 2013-09-29 13:09:25 +00:00
parent 63442a1271
commit d1b111bea8

View File

@ -55,6 +55,17 @@ struct mdproc {
#ifdef _KERNEL
#include <machine/pcb.h>
/* Get the current kernel thread stack usage. */
#define GET_STACK_USAGE(total, used) do { \
struct thread *td = curthread; \
(total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \
(used) = (char *)td->td_kstack + \
td->td_kstack_pages * PAGE_SIZE - \
(char *)&td; \
} while (0)
struct syscall_args {
u_int code;
struct sysent *callp;