From owner-freebsd-threads@FreeBSD.ORG Tue Apr 29 14:59:18 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4F07037B401 for ; Tue, 29 Apr 2003 14:59:18 -0700 (PDT) Received: from haldjas.folklore.ee (Haldjas.folklore.ee [193.40.6.121]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3CD5F43F75 for ; Tue, 29 Apr 2003 14:59:17 -0700 (PDT) (envelope-from narvi@haldjas.folklore.ee) Received: from haldjas.folklore.ee (localhost [127.0.0.1]) by haldjas.folklore.ee (8.12.3/8.11.3) with ESMTP id h3TLxF6U080344; Wed, 30 Apr 2003 00:59:16 +0300 (EEST) (envelope-from narvi@haldjas.folklore.ee) Received: from localhost (narvi@localhost)h3TLxFjB080341; Wed, 30 Apr 2003 00:59:15 +0300 (EEST) Date: Wed, 30 Apr 2003 00:59:15 +0300 (EEST) From: Narvi To: Daniel Eischen In-Reply-To: Message-ID: <20030429234505.X40030-100000@haldjas.folklore.ee> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org Subject: Re: Question about rtld-elf. Anyone?.. Anyone? X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Apr 2003 21:59:18 -0000 On Tue, 29 Apr 2003, Daniel Eischen wrote: > On Tue, 29 Apr 2003, Daniel Eischen wrote: > > > On Tue, 29 Apr 2003, Narvi wrote: > > > > > > No, you would see the problem as soon as you tried to use a function that > > > used a locked structure, depending on how the dynamic linker did thinks > > > this might include any fiunction, including exec* - threads + forking > > > gives you really fascinating problems. How do you know that say malloc > > > state was consistent at the moment you forked? You really need > > > per-subsystem cleanups so that you won't occasionaly fail miserably. Its > > > not really the threads lib that can / should track locks, unless it comes > > > with its own copy of the subsystems. > > In regards to inconsistent data (and not the state of the locks)... > > You could have use an atfork() handler to reinitialize any > inconsistent data. POSIX already defines pthread_atfork(), > and the kernel has at_fork(9) for kernel modules. Perhaps > pthread_atfork() could be utilized by libc, being careful > to detect the potential for threads first. > Well, i think we should gurantee something about the sanity of libc internals to the forked process. I think it would be more efficent to use a specific cleanup function that fork() implicitly knows about instead of a number of actual calls to pthread_atfork. You could probaby set things up so with rtld that the cleanups happen lazily so that there is no overhead for immediate / near-immediate exec with no acess to functions that would need the cleanup, but I don't think its an immediate concern. > -- > Dan Eischen >