Re: Getting the current thread's stack base / size on FreeBSD

From: David Chisnall <theraven_at_FreeBSD.org>
Date: Fri, 25 Mar 2022 12:55:31 UTC
Never mind, libthr also exposes pthread_attr_get_np.  I missed it 
because it has the same semantics as the glibc version but a slightly 
different spelling.

David

On 25/03/2022 11:41, David Chisnall wrote:
> 
> Hi all,
> 
> I'm trying to get the VAVM[1] WebAssembly runtime working on FreeBSD. In 
> its platform-specific code, they need to find the base and size of the 
> current stack.  They have code for Linux and macOS, using different 
> non-standard pthread extensions, but I couldn't see a mechanism for 
> doing this on FreeBSD.  Is there an API for this?
> 
> Darwin provides a pair of _np APIs for getting these values.  Glibc 
> provides an API for getting the pthread attributes for the current 
> thread, which is a bit more general and useful.  Adding this to libthr 
> would be a fairly simple change, if it doesn't exist already.  Am I 
> missing an existing mechanism?
> 
> David
> 
> [1] https://wavm.github.io/
>