Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 07 Jan 2005 10:33:33 -0700
From:      Danny MacMillan <flowers@users.sourceforge.net>
To:        Mike Jeays <Mike.Jeays@rogers.com>
Cc:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: Remote upgrade possible?
Message-ID:  <20050107173333.GA865@procyon.nekulturny.org>
In-Reply-To: <1105100701.640.6.camel@chaucer>
References:  <BE030CE7.15722%joe@jwebmedia.com> <41DDB2A7.8020001@wilderness.dyn.dhs.org> <41DE0F6F.3040303@taborandtashell.net> <1105100701.640.6.camel@chaucer>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050107173333.GA865>