From owner-freebsd-hackers@FreeBSD.ORG Tue May 11 19:23:41 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D42391065676; Tue, 11 May 2010 19:23:41 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id B00A28FC1A; Tue, 11 May 2010 19:23:41 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 4A09A46B45; Tue, 11 May 2010 15:23:41 -0400 (EDT) Date: Tue, 11 May 2010 20:23:41 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Lev Serebryakov In-Reply-To: <1127023465.20100510115708@serebryakov.spb.ru> Message-ID: References: <1127023465.20100510115708@serebryakov.spb.ru> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-hackers@freebsd.org Subject: Re: How to get stack bounds of current process? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2010 19:23:41 -0000 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