aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/src/prim_file.erl
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-11-09 11:52:14 +0100
committerLukas Larsson <[email protected]>2011-12-01 14:10:02 +0100
commit54bdd9a15d2e130c76f76ca322af56b306d02078 (patch)
tree13a2f1d7c3d38291464d94b805b63a6feeeaee82 /erts/preloaded/src/prim_file.erl
parentbfa81856150b59ea4578e0eef79b97ab0decb8f7 (diff)
downloadotp-54bdd9a15d2e130c76f76ca322af56b306d02078.tar.gz
otp-54bdd9a15d2e130c76f76ca322af56b306d02078.tar.bz2
otp-54bdd9a15d2e130c76f76ca322af56b306d02078.zip
Implement blocking calls for sendfile
Move sendfile data to invoke data instead of file_descr. Remove usage of ready_output when doing a send. If told to send 0 bytes, file_sendfile now sends the entire file for linux.
Diffstat (limited to 'erts/preloaded/src/prim_file.erl')
-rw-r--r--erts/preloaded/src/prim_file.erl7
1 files changed, 4 insertions, 3 deletions
diff --git a/erts/preloaded/src/prim_file.erl b/erts/preloaded/src/prim_file.erl
index 0767067682..6bdf5f6e2e 100644
--- a/erts/preloaded/src/prim_file.erl
+++ b/erts/preloaded/src/prim_file.erl
@@ -547,12 +547,13 @@ write_file(_, _) ->
sendfile(#file_descriptor{module = ?MODULE, data = {Port, _}},
DestFD, Offset, Bytes, ChunkSize, Headers, Trailers,
Nodiskio, MNowait, Sync) ->
-
- drv_command(Port, <<?FILE_SENDFILE, DestFD:32, Offset:64, Bytes:64,
- ChunkSize:64,
+ drv_command(Port, <<?FILE_SENDFILE, DestFD:32,
(get_bit(Nodiskio)):1,
(get_bit(MNowait)):1,
(get_bit(Sync)):1,0:5,
+ Offset:64/unsigned,
+ Bytes:64/unsigned,
+ ChunkSize:64,
(encode_hdtl(Headers))/binary,
(encode_hdtl(Trailers))/binary>>).