On Fri, 9 May 2008 14:09:24 -0400, Veilleux, Jon L wrote:

>There could be someone who has the file open even though you have
>deleted it. I have run into this in the past. We had a WebSphere region
>that filled up an HFS. I deleted the file that was consuming the space,
>but it didn't get released until the WebSphere region came down. This is
>a security 'feature' of UNIX.
>
Call it "security"; call it "integrity"; call it "convenience".
I cherish the behavior and rely on it regularly.  Because:

o UNIX rename() is preemptive -- I needn't delete an existing
  file before I rename another to its name.

o UNIX rename() is atomic -- when I perform a rename() no other
  process will observe an interval, however small, when the
  file appears not to exist.

o UNIX unlink() (and rename()) have a sort of low-grade work unit
  isolation -- as you observe, when I unlink(), any other process
  (or my own) can continue to operate on that file without
  encountering an invalid mixture of versions until it closes it.

In some cases when I wish to replace a file on a server, I write
to a temporary filename; close() and rename() to the actual target
name.  This means that any other user is guaranteed to observe
either the entire new version or the entire old version with
integrity.

On many UNIX systems the tmpfile() function creates the file by
opening it, and immediately unlinks it.  This leaves only the
tiniest window during which abnormal termination of the process
leaves the temporary file dangling.  z/OS, OTOH, employs a
contrary design.  It's very easy to kill -KILL a z/OS process
and leave a residual temporary file; very difficult on other
UNIX systems.

PDSEs exhibit much of the same behavior; perhaps even worse in
some respects -- closing and deleting a single member may not
reclaim the space until the directory is closed.

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to