aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/src
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2013-11-29 10:46:36 +0100
committerLukas Larsson <[email protected]>2013-11-29 10:46:36 +0100
commit670150ff9bfdce856c327fb76c30e58039df2cba (patch)
tree575e29d27c2dca7039f5dee0f87d4fc15f2c574f /erts/preloaded/src
parent423d37395076528866c4b689c0f1e9b72dae58e1 (diff)
parentf47c818746c1df4055b1de8aabf47364f502274c (diff)
downloadotp-670150ff9bfdce856c327fb76c30e58039df2cba.tar.gz
otp-670150ff9bfdce856c327fb76c30e58039df2cba.tar.bz2
otp-670150ff9bfdce856c327fb76c30e58039df2cba.zip
Merge branch 'sv/file-osync/OTP-11498'
* sv/file-osync/OTP-11498: Add sync option to file:open/2 Conflicts: erts/preloaded/ebin/prim_file.beam
Diffstat (limited to 'erts/preloaded/src')
-rw-r--r--erts/preloaded/src/prim_file.erl6
1 files changed, 5 insertions, 1 deletions
diff --git a/erts/preloaded/src/prim_file.erl b/erts/preloaded/src/prim_file.erl
index 489e8ca4ea..5999e98340 100644
--- a/erts/preloaded/src/prim_file.erl
+++ b/erts/preloaded/src/prim_file.erl
@@ -123,9 +123,11 @@
-define(EFILE_MODE_APPEND, 4).
-define(EFILE_COMPRESSED, 8).
-define(EFILE_MODE_EXCL, 16).
+%% Note: bit 5 (32) is used internally for VxWorks
+-define(EFILE_MODE_SYNC, 64).
%% Use this mask to get just the mode bits to be passed to the driver.
--define(EFILE_MODE_MASK, 31).
+-define(EFILE_MODE_MASK, 127).
%% Seek modes for the driver's seek function.
-define(EFILE_SEEK_SET, 0).
@@ -1197,6 +1199,8 @@ open_mode([append|Rest], Mode, Portopts, Setopts) ->
Portopts, Setopts);
open_mode([exclusive|Rest], Mode, Portopts, Setopts) ->
open_mode(Rest, Mode bor ?EFILE_MODE_EXCL, Portopts, Setopts);
+open_mode([sync|Rest], Mode, Portopts, Setopts) ->
+ open_mode(Rest, Mode bor ?EFILE_MODE_SYNC, Portopts, Setopts);
open_mode([delayed_write|Rest], Mode, Portopts, Setopts) ->
open_mode([{delayed_write, 64*1024, 2000}|Rest], Mode,
Portopts, Setopts);