[erlang-patches] [PATCH] Support opening files in exclusive mode

Björn Gustavsson <>
Mon May 3 07:41:45 CEST 2010


On Fri, Apr 30, 2010 at 6:22 PM, Michael Santos
<> wrote:
> 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]).

Thanks! Will include in 'pu'.

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB


More information about the erlang-patches mailing list