Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Mar 2022 11:41:18 +0000
From:      David Chisnall <theraven@FreeBSD.org>
To:        freebsd-hackers <freebsd-hackers@freebsd.org>
Subject:   Getting the current thread's stack base / size on FreeBSD
Message-ID:  <aedca5b2-277e-8fdb-1007-353aba5a5b45@FreeBSD.org>

next in thread | raw e-mail | index | archive | help

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/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?aedca5b2-277e-8fdb-1007-353aba5a5b45>