Subject: Re: FS clean bit, is it reliable?
To: 51482) <etorwi@etn.ericsson.se (Raymond A. Wiker>
From: Trevin Beattie <trevin@xmission.com>
List: current-users
Date: 11/04/1995 16:47:02
At 04:49 pm 11/4/95 +0100, you wrote:
>greywolf@defender.vas.viewlogic.com writes:
> > If the kernel were to keep track of something happening to init (perhaps
> > a "halt" should cause init to simply exit with status of 0?), once init
> > were to exit normally the kernel could then do the cleanup of that par-
> > ticular inode and do a few minor consistency checks before giving up the
> > ghost and going back to the monitor or the "Press any key to reboot..."
> > message.
>
>	How about simply changing the semantics of install so that,
>when it copies a file, it first unlinks the existing file? I have been
>bitten a few times when installing software over a version that is in
>use (SunOS, if that matters).
>
>	//Raymond.
>
>
Actually, a un*x system won't allow a file to be removed if the file is in
use when all links have been deleted.  This is proper POSIX behavior.  From
the POSIX Programmer's Guide (Donald Lewine; O'Reilly & Associates, Inc.):

        The unlink() function removes the link named by _path_
        and decrements the link count of the file referenced by
        the link.  When the link count goes to zero and no
        process has the file open, the space occupied by the
        file is freed and the file is no longer accessible.
-----------------------
Trevin Beattie          "Do not meddle in the affairs of wizards,
trevin@xmission.com     for you are crunchy and good with ketchup."
      {:->                                     --unknown