Date: Sun, 29 Sep 2013 13:09:25 +0000 (UTC) From: Marius Strobl <marius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255937 - head/sys/sparc64/include Message-ID: <201309291309.r8TD9PSI079113@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marius Date: Sun Sep 29 13:09:25 2013 New Revision: 255937 URL: http://svnweb.freebsd.org/changeset/base/255937 Log: Implement GET_STACK_USAGE. Discussed with: mav Approved by: re (kib) MFC after: 1 week Modified: head/sys/sparc64/include/proc.h Modified: head/sys/sparc64/include/proc.h ============================================================================== --- head/sys/sparc64/include/proc.h Sun Sep 29 13:05:22 2013 (r255936) +++ head/sys/sparc64/include/proc.h Sun Sep 29 13:09:25 2013 (r255937) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309291309.r8TD9PSI079113>