From nobody Fri Mar 25 12:55:31 2022 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CBD311A435EF for ; Fri, 25 Mar 2022 12:55:33 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KQ2BY5RJNz4vMt for ; Fri, 25 Mar 2022 12:55:33 +0000 (UTC) (envelope-from theraven@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648212933; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ld/kBh3oocoPfrW7B3rHXs4WsDF6OK307CxGfg59ojs=; b=taH0wxG/GcTPxS/+WPjxeHBNN1jS1QxDce09InRUxkgdrajUzXrjbOA/OEARTJ5ZYNwcOY UlTQn3Ao5MMYsV7CgFVFH4gCxNicbMN7v5JagHEunw67GG4XYHBEMCU+xELd1s8X8MUJMQ 5o4fsaBceekSTJ+SStXUxTrM5rVRAGb4y2Xx4MnGKm+CP/NxUEcOEMBY02/aa/CQCpu0VA W9ORoz4ZL2sdMOPuBWdQeO7vPrmkylDhXL3DLxWt1tTZxM7wSvCk1zHxQ7mLg1MabxEoSu ceZprs9jravQHrIYc5Yoc17NeNzVJfpDTc6k4xIfKpVXc6y5tQH1005KqfkPPQ== Received: from smtp.theravensnest.org (smtp.theravensnest.org [45.77.103.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: theraven) by smtp.freebsd.org (Postfix) with ESMTPSA id 9476BCFB9 for ; Fri, 25 Mar 2022 12:55:33 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from [192.168.1.202] (host86-134-184-31.range86-134.btcentralplus.com [86.134.184.31]) by smtp.theravensnest.org (Postfix) with ESMTPSA id 96A532F6E6 for ; Fri, 25 Mar 2022 12:55:32 +0000 (GMT) Message-ID: <69e08ba5-210d-eaab-2ba0-170360b307d4@FreeBSD.org> Date: Fri, 25 Mar 2022 12:55:31 +0000 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: Getting the current thread's stack base / size on FreeBSD Content-Language: en-GB To: freebsd-hackers@freebsd.org References: From: David Chisnall In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648212933; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ld/kBh3oocoPfrW7B3rHXs4WsDF6OK307CxGfg59ojs=; b=LUDePOb4pR3s+zWShsoZv06Ym8aG13Xez6YBKG4waSnv4Ehnav3DXCuPNJ6UIy+zwdsQZ4 7SLRmTYT6kF6+8eD/20AZzf6gPeMsfa/cA4FhysoIrvjoGzt+Bp3gwooVlk2JH3gkTbPSf 7VJLQFweVbR3N3g+O2Azsw5Bru9AYoPwODsasmHyCU/47LWnF9kECuRcwVbVFqVVDtPewA miZc0NMZ0W/VCgyIdQ2LE8eil5D7UvHoXhRenXWEtOCovrtloNcaoiDZ9KqEsnB3ou06Uk gbj2aj3QSlrjTyX0onLwg1jPnRRNQCQhJ//rqbKubb1XBERBZL3JyVr3cIT96w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648212933; a=rsa-sha256; cv=none; b=R4q/zP9d1SgxveHTP1boHtqynsfojmLEZp2qSWIfzROMImEMBX4LwleXkSHsgYcxEWGrdo w4aB60RUw2JHPPJR3/HY0ZEUhhrmTZ1CzVKTdk1u1bVqLP8mItEgtg3BfbnoC43nGXxwxT 2YhSW8DU7NyjVzh96Dmye3kdoNKdq+LsXRKYM6gVRrp/Mfj6mYLYo+QwxIYg+qNIShylvs d2Mixh7K1+9ff7haoX9oWLHD3Och2INHszAAikmrtqTwUOWUGnw/79S6e/oQOW45QtVjpJ KdATwXNS++fIvhghjSNkner+PX3KUPRqPRUrCwTCkgx4ZCv0GKpB82kGoFajxg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N 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/ >