Implement GET_STACK_USAGE() macro to get the current kernel thread stack usage.
This implemntation made for growing down stack organization like i386/amd64 platforms have, but prefers different machine dependent version if it is present.
This commit is contained in:
parent
b3bca4a1b7
commit
cdf5b4e4f4
@ -784,6 +784,20 @@ MALLOC_DECLARE(M_ZOMBIE);
|
||||
curthread->td_pflags &= ~TDP_NOSLEEPING; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Get the current kernel thread stack usage.
|
||||
* Prefer machine dependent version if present.
|
||||
*/
|
||||
#ifndef GET_STACK_USAGE
|
||||
#define GET_STACK_USAGE(total, used) do { \
|
||||
struct thread *td = curthread; \
|
||||
(total) = td->td_kstack_pages * PAGE_SIZE; \
|
||||
(used) = (char *)td->td_kstack + \
|
||||
td->td_kstack_pages * PAGE_SIZE - \
|
||||
(char *)&td; \
|
||||
} while (0)
|
||||
#endif /* GET_STACK_USAGE */
|
||||
|
||||
#define PIDHASH(pid) (&pidhashtbl[(pid) & pidhash])
|
||||
extern LIST_HEAD(pidhashhead, proc) *pidhashtbl;
|
||||
extern u_long pidhash;
|
||||
|
Loading…
Reference in New Issue
Block a user