Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Unable to read history on latest Cygwin

On Thu, 17 Dec 2009, Wayne Davison wrote:

[appologies for cross-posting to both lists.  I wanted to ensure this
thread carried over to zsh-workers where PeterS. moved it to, if there
are future discussions.]

On Thu, Dec 17, 2009 at 12:04 AM, Peter A. Castro <doctor@xxxxxxxxxxxx>wrote:

Hmm...atomic in the sense that the open vectors through the symlink to the
real file?

No, atomic as in no two people can think they were successful in creating it
-- one must succeed, and everyone else must fail.  A file created
*without*O_EXCL succeeds for everyone, but sadly, O_EXCL does not always work
correctly (e.g. older NFS don't always support it). Thus, what matters is if
the chosen idiom can safely be used as a single-success locking method or
not.  For O_EXCL, cygwin just needs to have implemented that right.  For
symlinks, it will depend on how the creating of the (symlink-emulating) file
is created in the cygwin code.

Ah, I understand.  Cygwin relies on the underlying mechanisms available
from MS Windows file API.  From reviewing Cygwin code, it appears it is
using the native support for exclusive file locking, so, I beleve that,
yes, it does what you want (ie: only one process can exclusively open a
file using O_EXCL).

Creating symlinks, however, may not be atomic.  I'll have to check code
on that, but the symlink is really just an ordinary file.  I'll have to
check weither it's created with exclusive locks or not.


Peter A. Castro <doctor@xxxxxxxxxxxx> or <Peter.Castro@xxxxxxxxxx>
	"Cats are just autistic Dogs" -- Dr. Tony Attwood

Messages sorted by: Reverse Date, Date, Thread, Author