From owner-freebsd-hackers Sun May 20 13:42:57 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from sharmas.dhs.org (cpe-66-1-147-119.ca.sprintbbd.net [66.1.147.119]) by hub.freebsd.org (Postfix) with ESMTP id B26BC37B422 for ; Sun, 20 May 2001 13:42:52 -0700 (PDT) (envelope-from adsharma@sharmas.dhs.org) Received: by sharmas.dhs.org (Postfix, from userid 500) id C34135E100; Sun, 20 May 2001 13:38:43 -0700 (PDT) Date: Sun, 20 May 2001 13:38:43 -0700 From: Arun Sharma To: Bill Abt Cc: pthreads-devel@dwoss.lotus.com, FreeBSD Hackers Subject: Re: [pthreads-devel] Bug in pth_native.c ? + FreeBSD port Message-ID: <20010520133843.A27038@sharmas.dhs.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.15i In-Reply-To: ; from babt@us.ibm.com on Sun, May 20, 2001 at 08:05:19AM -0400 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, May 20, 2001 at 08:05:19AM -0400, Bill Abt wrote: > Yeah, your right about slot. It should be allocated off the heap... Hmm, > that would probably explain a few inconsistencies we've seen as well. > Thanks!!!! > > As far as incorporating your changes into the release, sure!!! Another > platform/os would be great. > Ok, the patch is here: http://sharmas.dhs.org/~adsharma/ngpt-freebsd.patch.txt Rough edges: (a) @NATIVE@ needs to be substituted with pth_native.c or pth_native_freebsd.c depending on the platform. I'm not too good at autoconf. (b) The changes to pth_lib.c can probably be ignored. They're there to fix compilation errors on FreeBSD and it's not clear to me what the correct solution is. (c) This is a mysterious bug that I'm not able to solve even after fighting with it for a couple of days: - void (* volatile mctx_starting_func)(void); + static void (* volatile mctx_starting_func)(void); This variable gets corrupted on FreeBSD after a context switch. I suspect that this could be a compiler issue, but haven't been able to pin point the problem. I'm using: $ gcc -v Using builtin specs. gcc version 2.95.3 20010315 (release) Datapoints: 1. Increasing the stack size, didn't help. It also makes it unlikely that someone is accidentally stepping on the malloc'ed stack. 2. The problem disappeared after I put some debug statements in the surrounding code. This might have tickled the compiler in such a way that the problem got masked. Making the variable static makes the problem go away. This shouldn't be a problem, since all threads get bootstrapped the same way ? -Arun To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message