From owner-freebsd-threads@FreeBSD.ORG Wed Sep 19 16:12:43 2007 Return-Path: Delivered-To: threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AAE516A418 for ; Wed, 19 Sep 2007 16:12:43 +0000 (UTC) (envelope-from sean@chittenden.org) Received: from smtp2.joyent.net (smtp2.joyent.net [8.12.32.84]) by mx1.freebsd.org (Postfix) with ESMTP id 5C3C613C442 for ; Wed, 19 Sep 2007 16:12:43 +0000 (UTC) (envelope-from sean@chittenden.org) Received: from [10.0.0.51] (bigip_float [10.12.32.12]) by smtp2.joyent.net (Postfix) with ESMTP id 0A9E9E924 for ; Wed, 19 Sep 2007 08:41:47 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v752.3) Content-Transfer-Encoding: 7bit Message-Id: <22249390-ABCD-4993-977C-02D7AEB0CE69@chittenden.org> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: threads@freebsd.org From: Sean Chittenden Date: Wed, 19 Sep 2007 08:41:46 -0700 X-Mailer: Apple Mail (2.752.3) Cc: Subject: Programatic way to determine the contents of struct pthread_*_t... X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Sep 2007 16:12:43 -0000 Howdy. What's the best way to programatically gain access to the contents of the various struct pthread_*_t members? In OS-X and Linux, the contents are defined in /usr/include/*/_*pthreads.h, but that doesn't appear to be the case for FreeBSD at the moment. I'm in the process of porting D's Tango runtime to FreeBSD[1] and it appears that due to FreeBSD's multi-thread model, this is a bit problematic. Is there an obvious (or not so obvious) magic woobie stick that I can shake at this problem? I'm mostly done with the port at this point, but am a bit perplexed as to how to approach the poking at internals problem since D's runtime environment is possibly tied to my kernel configuration. Less than keen on that reality. Can I safely assume that libthr is now king of the hill and isn't about to be dethroned anytime soon? Having looked at src/lib/lib(thr|pthread)/thread/thr_private.h - the sizes are different, the contents are different, etc. Given other platforms have this publicly defined in userspace and we don't... is this going to get kicked over to userland again at somepoint or are we always going to be indirectly passing around pthread_*_t structs? Thoughts/suggestions? Thanks in advance! -sc [1] D is a slick language and very much worth a hander if you haven't poked at it before. Tango is an alternate standard class library and runtime environment for D that has many performance advantages over the stock runtime environment. Tango Info: http://www.dsource.org/projects/tango D Info: http://www.digitalmars.com/d/ PS Very aware of the dangers/stupidity associated with poking at the contents of structures, but for the time being, that's how tango works for threading compatibilities. If there's a #define that specifies the version number of the pthreads structures, I'd love to make use of it as a safety belt. -- Sean Chittenden sean@chittenden.org