From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain Date: Tue, 4 Aug 2009 18:25:50 -0700 From: Roman V Shaposhnik To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Message-id: <1249435550.479.16703.camel@work.SFBay.Sun.COM> Subject: [9fans] renaming to an existing file Topicbox-Message-UUID: 39390cc6-ead5-11e9-9d60-3106f5b1d025 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.