From owner-freebsd-current Tue Aug 28 18:20:23 2001 Delivered-To: freebsd-current@freebsd.org Received: from midten.fast.no (midten.fast.no [213.188.8.11]) by hub.freebsd.org (Postfix) with ESMTP id 2D74837B401 for ; Tue, 28 Aug 2001 18:20:18 -0700 (PDT) (envelope-from Tor.Egge@fast.no) Received: from fast.no (IDENT:tegge@midten.fast.no [213.188.8.11]) by midten.fast.no (8.9.3/8.9.3) with ESMTP id DAA65564; Wed, 29 Aug 2001 03:20:07 +0200 (CEST) Message-Id: <200108290120.DAA65564@midten.fast.no> To: jkf@research.bell-labs.com Cc: freebsd-current@FreeBSD.ORG, mflaster@research.bell-labs.com, eran@research.bell-labs.com Subject: Re: linux threads and fclose lock problem From: Tor.Egge@fast.no In-Reply-To: Your message of "Tue, 28 Aug 2001 17:54:34 -0400 (EDT)" References: <200108282154.RAA15501@zydeco.research.bell-labs.com> X-Mailer: Mew version 1.70 on Emacs 19.34.1 Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Wed_Aug_29_03:19:39_2001)--" Content-Transfer-Encoding: 7bit Date: Wed, 29 Aug 2001 03:20:07 +0200 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG ----Next_Part(Wed_Aug_29_03:19:39_2001)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit > The following test program hangs on current from 8/20/2001. > The program hangs in the fprintf to the function testThread(), > instead of running to completion. If the call in main to fclose() > of an unrelated file descriptor is removed the program runs to > completion. > > >From tracing code, it appears that fclose.c locks the file, does some stuff, > and then *tries* to unlock the file. But while _flockfile is called, > _funlockfile is *not*. (The source for fclose.c calls FUNLOCKFILE(fp) - > don't know where FUNLOCKFILE is defined.) _funlockfile is called, but fp->_file is -1 so _funlockfile just returned. Under RELENG_4, fp->_file is set to -1 after the FUNLOCKFILE() statement. A patch for disabling uthread_file.c in the linuxthreads port for FreeBSD 5.0-CURRENT is enclosed. This causes the libc version of _flockfile to be used. - Tor Egge ----Next_Part(Wed_Aug_29_03:19:39_2001)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit ? work Index: files/uthread_file.c =================================================================== RCS file: /home/ncvs/ports/devel/linuxthreads/files/uthread_file.c,v retrieving revision 1.3 diff -u -r1.3 uthread_file.c --- files/uthread_file.c 4 Jan 2000 00:05:22 -0000 1.3 +++ files/uthread_file.c 29 Aug 2001 01:12:32 -0000 @@ -45,6 +45,8 @@ #include "spinlock.h" #include "restart.h" +#if __FreeBSD__ == 4 + /* * Weak symbols for externally visible functions in this file: */ @@ -396,3 +398,5 @@ } _SPINUNLOCK(&hash_lock); } + +#endif ----Next_Part(Wed_Aug_29_03:19:39_2001)---- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message