How to get stack bounds of current process?

Robert Watson rwatson at FreeBSD.org
Tue May 11 19:23:41 UTC 2010


On Mon, 10 May 2010, Lev Serebryakov wrote:

>  I'm proting some application from Linux, which discover its stack bounds by 
> reading and pasing "/proc/self/maps".  FreeBSD have "/prov/curproc/map", but 
> I can not find how to determine which record is for stack (I've looked into 
> implementation of proc_fs, but it doesn't contain any specail processing for 
> process stack).
>
>  How could I determine stack bounds of current process on FreeBSD 7/8/9?

The "procstat -v" command in 8.x and 9.x will give this information based on 
sysctls; we're about to integrate a libprocstat(3) library which will provide 
a public API for this information.  I'd agree with Kostik that you should 
think carefully about whether the application really needs this information 
:-).

Robert N M Watson
Computer Laboratory
University of Cambridge


More information about the freebsd-hackers mailing list