On Aug 19, 2009, at 07:32, John P. Hartmann wrote:
Make that two renames if one is paranoid. Or a copy before the
pipeline.
2009/8/19 Paul Gilmartin <[email protected]>:
On Aug 19, 2009, at 03:26, Michaël Dugaleix wrote:
if (RC ...)
COPY myTemporaryFile myFile
Surely a RENAME would perform better.
I'd think a RENAME before the pipeline and an ERASE
on success should suffice.
I'll be a bit of a UNIX partisan here. The UNIX rename()
system call has two valuable features:
o It's preemptive: it simply replaces any older file with
the new name.
o It's atomic: the operation is synchronized to guarantee
that no concurrent process can pereive the absence of
the replaced file. (I.e. no "RC=28" timing window
for shared files.) But I'm most familiar with MDFS;
perhaps the work unit isolation of SFS provides similar
function.
rename() provides no status indication if an existing file
is (about to be) replaced. A programmer who considers
the replace behavior harmful can use a link-unlink sequence
instead. This is like creating an alias (which doesn't
replace) and deleting the original, leaving the alias.
-- gil