[plt-scheme] are some of the file system functions atomic?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Jun 13 08:40:09 EDT 2008

At Thu, 12 Jun 2008 21:44:22 -0700, YC wrote:
> are functions such as open-ouput-file, make-file-or-directory-link,
> rename-file-or-directory implemented directly above the system calls such as
> open, link, and rename?
> The reason I am asking is because I need to rely on the atomic property
> (i.e. either succeed or fails) of these system calls on filesystem such as
> ext3, and need to know whether using them along is sufficient to retain the
> properties or I need to learn how to use FFI to make the system calls
> directly.

Yes, those operations are performed atomically when the OS supports it.

Currently, only the docs for `rename-file-or-directory' mention
atomicity, and in that case to clarify that there's a race condition on
the check for an existing file --- which corresponds to the fact that
the rename() system call always replaces existing files.


Posted on the users mailing list.