I've just realized that in 9P the wstat would refuse
to rename an entry if a target name already exists. 

So how can I atomically replace one file with another
one, so that during the operation clients opening
it would not fail?

In POSIX rename gives you such an atomicity:
-----------------------------------------------------------------------
If the old argument points to the pathname of a file that is not a
directory, the new argument shall not point to the pathname of a
directory. If the link named by the new argument exists, it shall be
removed and old renamed to new. In this case, a link named new shall
remain visible to other processes throughout the renaming operation and
refer either to the file referred to by new or old before the operation
began.
------------------------------------------------------------------------

How can I achieve the same result with 9P?

Thanks,
Roman.


Reply via email to