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 /erts/emulator/drivers/common | |
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 'erts/emulator/drivers/common')
-rw-r--r-- | erts/emulator/drivers/common/erl_efile.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/erts/emulator/drivers/common/erl_efile.h b/erts/emulator/drivers/common/erl_efile.h index bbc973d58b..ac95c1f949 100644 --- a/erts/emulator/drivers/common/erl_efile.h +++ b/erts/emulator/drivers/common/erl_efile.h @@ -32,7 +32,8 @@ #define EFILE_MODE_READ_WRITE 3 #define EFILE_MODE_APPEND 4 #define EFILE_COMPRESSED 8 -#define EFILE_NO_TRUNCATE 16 /* Special for reopening on VxWorks */ +#define EFILE_MODE_EXCL 16 +#define EFILE_NO_TRUNCATE 32 /* Special for reopening on VxWorks */ /* * Seek modes for efile_seek(). |