unlink safe before close?

Ed Gould ed at mtxinu.COM
Wed May 10 06:30:41 AEST 1989


Regarding unlinking open files and continuing to use the descriptor:

>Note that this does not apply to NFS file systems.  The "stateless"
>nature of the protocol precludes the server from knowing that a
>client thinks it still has the file open.

In a strict sense, this is true.  But, there were enough programs
doing exactly this (e.g., the C compiler) that Sun considered the
consequenses too severe.  So they developed a work-around that
covers the typical case.  When a process unlinks a file that it
has open, the *client* system notices this, and instead of sending
an unlink request to the server, it sends a rename.  The new name is
structured according to a well-defined convention that will make it
unique.  The client then removes this file when the process closes
the descriptor.

This is *not* a general solution to the problem of removing open
files.  It is a work-around that solves the most common (and
arguably the only "correct") use of this semantic.

-- 
Ed Gould                    mt Xinu, 2560 Ninth St., Berkeley, CA  94710  USA
ed at mtxinu.COM		    +1 415 644 0146

"I'll fight them as a woman, not a lady.  I'll fight them as an engineer."



More information about the Comp.unix.wizards mailing list