From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1GXiCL-0003vk-9D for garchives@archives.gentoo.org; Wed, 11 Oct 2006 17:48:53 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.8/8.13.6) with SMTP id k9BHk1JW027875; Wed, 11 Oct 2006 17:46:01 GMT Received: from bullet.espersunited.com (adsl-70-234-122-249.dsl.tul2ok.sbcglobal.net [70.234.122.249]) by robin.gentoo.org (8.13.8/8.13.6) with ESMTP id k9BHh58F002015 for ; Wed, 11 Oct 2006 17:43:06 GMT Received: from camille.espersunited.com (camille.espersunited.com [70.234.122.250]) by bullet.espersunited.com (8.13.7/8.13.7) with ESMTP id k9BHh40V017572 for ; Wed, 11 Oct 2006 12:43:04 -0500 Subject: Re: [gentoo-user] Dumb question From: Michael Sullivan To: gentoo-user@lists.gentoo.org In-Reply-To: References: <452C714D.2030008@gt.rr.com> Content-Type: text/plain Date: Wed, 11 Oct 2006 12:43:04 -0500 Message-Id: <1160588584.14476.28.camel@camille.gateway.2wire.net> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 X-Mailer: Evolution 2.6.2 Content-Transfer-Encoding: 7bit X-Archives-Salt: c231b91b-eba7-48e2-afd5-6bdbd000bb6f X-Archives-Hash: fec4873e6af0e38d0ce7e917dede7173 On Wed, 2006-10-11 at 12:23 -0400, Daniel Barkalow wrote: > On Tue, 10 Oct 2006, Anthony E. Caudel wrote: > > > I have been using Gentoo for more than 2 years now and have always > > wondered (but never asked - That's the "dumb" part) how Gentoo manages > > to update a package that happens to be running at the time. > > > > Given that the old version (the one running) is deleted, how does it > > manage to keep standing if you just cut its legs off? > > Userspace technically never "deletes" anything in the UNIX model; it > either "truncates" it (not what's going on here) or it "unlinks" it. > "Unlink" causes the file not to have the filename any more, and the kernel > gets rid of files which aren't in use and have no name (of course, nobody > can tell when or if this happens, aside from the disk not filling up, > because there would be no way to look at the file anyway). > > If you look at /proc//maps for a program you've upgraded, you'll > probably find funny notations in there, indicating that the file it's > using is not the file that currently has that filename. > > ("truncate" and otherwise openning the file for writing actually affect > the file, not the filename, and would therefore cause programs to crash if > you overwrote them.) > > Technical terms: the file itself is called an "inode", and the name is a > "dentry" (actually, the last part of the path, which is all that goes away > in a single operation, is the dentry). A dentry stores the inode number of > the inode at that path, and "unlink" removes the dentry. What's actually > happening in an upgrade is "rename", which, as a single operation, unlinks > any dentry with the destination path, links the source inode to the > destination dentry, and unlinks the source dentry. This means that no > program can see the path empty or with half of a file or see the file with > two names. > > -Daniel > *This .sig left intentionally blank* Wow, files can exist without file names. I think I found a topic for discussion in philosophy class... -- gentoo-user@gentoo.org mailing list