Date: Mon, 30 Dec 2013 00:43:24 +0000 (UTC) From: Marius Strobl <marius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r260065 - stable/9/sys/sparc64/include Message-ID: <201312300043.rBU0hOr4050005@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marius Date: Mon Dec 30 00:43:24 2013 New Revision: 260065 URL: http://svnweb.freebsd.org/changeset/base/260065 Log: MFC: r255937 Implement GET_STACK_USAGE. Discussed with: mav Modified: stable/9/sys/sparc64/include/proc.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/sparc64/include/proc.h ============================================================================== --- stable/9/sys/sparc64/include/proc.h Sun Dec 29 23:46:59 2013 (r260064) +++ stable/9/sys/sparc64/include/proc.h Mon Dec 30 00:43:24 2013 (r260065) @@ -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?201312300043.rBU0hOr4050005>