From owner-freebsd-current@FreeBSD.ORG Fri Apr 6 11:52:47 2007 Return-Path: X-Original-To: current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D7E3216A403 for ; Fri, 6 Apr 2007 11:52:47 +0000 (UTC) (envelope-from davidt@yadt.co.uk) Received: from outcold.yadt.co.uk (outcold.yadt.co.uk [81.187.204.178]) by mx1.freebsd.org (Postfix) with ESMTP id 8678D13C4AE for ; Fri, 6 Apr 2007 11:52:47 +0000 (UTC) (envelope-from davidt@yadt.co.uk) Received: from localhost (localhost [127.0.0.1]) by outcold.yadt.co.uk (Postfix) with ESMTP id 9B9181DD510 for ; Fri, 6 Apr 2007 12:30:53 +0100 (BST) X-Virus-Scanned: amavisd-new at yadt.co.uk Received: from outcold.yadt.co.uk ([127.0.0.1]) by localhost (outcold.yadt.co.uk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id x134M0zztfVz for ; Fri, 6 Apr 2007 12:30:48 +0100 (BST) Received: by outcold.yadt.co.uk (Postfix, from userid 1001) id 4CCE11DD500; Fri, 6 Apr 2007 12:30:48 +0100 (BST) Date: Fri, 6 Apr 2007 12:30:48 +0100 From: David Taylor To: FreeBSD Current Message-ID: <20070406113048.GA49739@outcold.yadt.co.uk> Mail-Followup-To: FreeBSD Current References: <46128475.9060602@FreeBSD.org> <4613D6F3.4080701@mac.com> <461434A6.3080001@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <461434A6.3080001@FreeBSD.org> User-Agent: Mutt/1.4.2.2i Cc: Subject: Re: Surviving /dev/null disappearance X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2007 11:52:47 -0000 On Wed, 04 Apr 2007, Maxim Sobolev wrote: > Chuck Swiger wrote: > >Andrew Pantyukhin wrote: > >>On 4/3/07, Maxim Sobolev wrote: > >>>Patch ld(1) to detect the condition and don't unlink the device node? > >> > >>Yes, but there has to be a generic solution, so that > >>we don't reinvent the wheel for every one of the > >>thousands apps that may do this. > >> > >>Isn't there some safety-net wrapper function that > >>refuses to remove device nodes and maybe some other > >>types of files? > > > >Why not set a filesystem flag like schg on device nodes under a devfs > >tree...? > > Well, I suspect that it may cause ld(1) fail instead. What we want it to > do is to not perform unlink(2) before open(2) when -o argument is device > node. I think calling ld with it's output set to a device node is basically pilot error. ld unlinks files rather than truncating them for good reasons --- to avoid overwriting libraries that are in use (the unlinked file is still around on disk until the last fd referencing it is closed). -- David Taylor