diff options
author | Michael Santos <[email protected]> | 2010-04-30 12:22:11 -0400 |
---|---|---|
committer | Raimo Niskanen <[email protected]> | 2010-06-04 10:47:56 +0200 |
commit | 4bd026cccb2c22279dd9c88e704642c5a65d3c53 (patch) | |
tree | 5c801bf9813b575eb302039f78b07b50364b6696 /lib/kernel/src/file.erl | |
parent | cbd1378ee1fde835e55614bac9290b281bafe49a (diff) | |
download | otp-4bd026cccb2c22279dd9c88e704642c5a65d3c53.tar.gz otp-4bd026cccb2c22279dd9c88e704642c5a65d3c53.tar.bz2 otp-4bd026cccb2c22279dd9c88e704642c5a65d3c53.zip |
Support opening files in exclusive mode
Add an option that atomically tests for the existence of a file and
creates it if the file does not exist, by passing the O_EXCL flag
to open() on Unix and CREATE_NEW flag on Windows. Support for O_EXCL
varies across platforms and filesystems.
{ok, Fd} = file:open("/tmp/foo", [write,exclusive]),
{error, eexist} = file:open("/tmp/foo", [write,exclusive]).
Diffstat (limited to 'lib/kernel/src/file.erl')
-rw-r--r-- | lib/kernel/src/file.erl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl index a37614e424..1ba329a12b 100644 --- a/lib/kernel/src/file.erl +++ b/lib/kernel/src/file.erl @@ -81,7 +81,7 @@ -type mode() :: 'read' | 'write' | 'append' | 'raw' | 'binary' | {'delayed_write', non_neg_integer(), non_neg_integer()} | 'delayed_write' | {'read_ahead', pos_integer()} | - 'read_ahead' | 'compressed'. + 'read_ahead' | 'compressed' | 'exclusive'. -type name() :: string() | atom() | [name()]. -type posix() :: atom(). -type bindings() :: any(). |