aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/file_io_server.erl
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-11-25 12:03:58 +0100
committerLukas Larsson <[email protected]>2011-12-01 14:10:02 +0100
commit5ba916ef7ac71bd1e7e23b4c87ae6a472f14fd6c (patch)
treeb00df99199f11dbda4c5a14063b8eefe72e451c1 /lib/kernel/src/file_io_server.erl
parent8beda283543ca89052a5e7ca6491345cd9916eff (diff)
downloadotp-5ba916ef7ac71bd1e7e23b4c87ae6a472f14fd6c.tar.gz
otp-5ba916ef7ac71bd1e7e23b4c87ae6a472f14fd6c.tar.bz2
otp-5ba916ef7ac71bd1e7e23b4c87ae6a472f14fd6c.zip
Create erlang fallback for sendfile
Created erlang fallback for sendfile in gen_tcp and moved sendfile from file to gen_tcp. Also created testcases for testing all different options to sendfile. For info about how sendfile should work see the BSD man pages as they contain a more complete API than other *nixes.
Diffstat (limited to 'lib/kernel/src/file_io_server.erl')
-rw-r--r--lib/kernel/src/file_io_server.erl5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/kernel/src/file_io_server.erl b/lib/kernel/src/file_io_server.erl
index 78d3d24394..7280635f53 100644
--- a/lib/kernel/src/file_io_server.erl
+++ b/lib/kernel/src/file_io_server.erl
@@ -249,9 +249,10 @@ file_request(close,
file_request({position,At},
#state{handle=Handle,buf=Buf}=State) ->
std_reply(position(Handle, At, Buf), State);
-file_request({sendfile,DestFD,Offset,Bytes,ChunkSize},
+file_request({sendfile,DestSock,Offset,Bytes,Opts},
#state{handle=Handle}=State) ->
- case ?PRIM_FILE:sendfile(Handle, DestFD, Offset, Bytes, ChunkSize) of
+ %% gen_tcp will call prim_file:sendfile with correct arguments
+ case gen_tcp:sendfile(Handle, DestSock, Offset, Bytes, Opts) of
{error,_}=Reply ->
{stop,normal,Reply,State};
Reply ->