From owner-freebsd-questions@FreeBSD.ORG Fri Jan 7 17:34:16 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0AEEF16A4CE for ; Fri, 7 Jan 2005 17:34:16 +0000 (GMT) Received: from pd2mo3so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id C49D943D2F for ; Fri, 7 Jan 2005 17:34:15 +0000 (GMT) (envelope-from flowers@users.sourceforge.net) Received: from pd4mr5so.prod.shaw.ca (pd4mr5so-qfe3.prod.shaw.ca [10.0.141.50])2004))freebsd-questions@freebsd.org; Fri, 07 Jan 2005 10:33:33 -0700 (MST) Received: from pn2ml1so.prod.shaw.ca ([10.0.121.145]) by pd4mr5so.prod.shaw.ca (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 2004)) with ESMTP id <0I9Y00CWEJFX5K10@pd4mr5so.prod.shaw.ca> for freebsd-questions@freebsd.org; Fri, 07 Jan 2005 10:33:33 -0700 (MST) Received: from procyon.nekulturny.org (S0106000c41b2b9a3.cg.shawcable.net [68.144.45.143]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 2003)) with ESMTP id <0I9Y00K7JJFXPD@l-daemon> for freebsd-questions@freebsd.org; Fri, 07 Jan 2005 10:33:33 -0700 (MST) Date: Fri, 07 Jan 2005 10:33:33 -0700 From: Danny MacMillan In-reply-to: <1105100701.640.6.camel@chaucer> To: Mike Jeays Message-id: <20050107173333.GA865@procyon.nekulturny.org> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline References: <41DDB2A7.8020001@wilderness.dyn.dhs.org> <41DE0F6F.3040303@taborandtashell.net> <1105100701.640.6.camel@chaucer> User-Agent: Mutt/1.5.6i cc: Laurence Sanford cc: tkelly-freebsd-questions@taborandtashell.net cc: FreeBSD Mailing List Subject: Re: Remote upgrade possible? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jan 2005 17:34:16 -0000 On Fri, Jan 07, 2005 at 07:25:02AM -0500, Mike Jeays wrote: > On Thu, 2005-01-06 at 23:26, Tabor Kelly wrote: > > > > I routinely use 'portupgrade -rRN' in xterm, in X-Windows to > > install new ports on my box. The second to last time I did this, > > one of the ports what was upgraded was xterm. And it worked! Can > > anybody explain to my why nothing bad happened? Am I running a > > risk when I do this? > > This seems pretty safe to me. When xterm gets invoked, the whole of the > code gets loaded into memory for execution, and there is no reason why > it would look at the disk copy again. If you upgrade the xterm binary, I haven't looked at the code, but your assertion is extremely unlikely. I really want to say "impossible" but as I said, I haven't looked at the code. If FreeBSD loaded entire executable images into RAM when starting new processes, it would perform very poorly. What is more likely is that the kernel keeps the image file open during program execution. When the xterm binary is replaced, the old binary is still on disk in its old location, it just doesn't have any directory entries pointing to it. Since the kernel still has the file open it won't be overwritten. Hence the kernel can and will still load pages from the old image. This is a function of the same behaviour that causes df and du output to differ in some cases. The lsof(8) utility seems to bear this out, as each process seems to keep each image (program and shared object files) open during execution. A new instance of xterm would use the new, upgraded binary. -- Danny