diff options
author | Lukas Larsson <[email protected]> | 2011-11-27 17:30:06 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2011-12-02 10:39:38 +0100 |
commit | 758fab8895755b22ce02f0a6026d4d286c8a9c5a (patch) | |
tree | 74063068b58c3f1f83f5d9436d636167894e7522 /lib/kernel/src | |
parent | 4d198cb07025a8fc341a1e7fd7f9906b5fb714d6 (diff) | |
download | otp-758fab8895755b22ce02f0a6026d4d286c8a9c5a.tar.gz otp-758fab8895755b22ce02f0a6026d4d286c8a9c5a.tar.bz2 otp-758fab8895755b22ce02f0a6026d4d286c8a9c5a.zip |
Expand sendfile documentation
Diffstat (limited to 'lib/kernel/src')
-rw-r--r-- | lib/kernel/src/file.erl | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl index ef1d20b53b..19eaa7bfcc 100644 --- a/lib/kernel/src/file.erl +++ b/lib/kernel/src/file.erl @@ -106,7 +106,7 @@ -type date_time() :: calendar:datetime(). -type posix_file_advise() :: 'normal' | 'sequential' | 'random' | 'no_reuse' | 'will_need' | 'dont_need'. --type sendfile_option() :: {chunk_size, non_neg_integer()} | +-type sendfile_option() :: {chunk_size, pos_integer()} | {headers, Hdrs :: list(iodata())} | {trailers, Tlrs :: list(iodata())} | sf_nodiskio | sf_mnowait | sf_sync. @@ -1126,10 +1126,10 @@ change_time(Name, Atime, Mtime) -define(MAX_CHUNK_SIZE, (1 bsl 20)*20). %% 20 MB, has to fit in primary memory --spec sendfile(File, Sock, Offset, Bytes, Opts) -> +-spec sendfile(RawFile, Socket, Offset, Bytes, Opts) -> {'ok', non_neg_integer()} | {'error', inet:posix() | badarg | not_owner} when - File :: file:fd(), - Sock :: inet:socket(), + RawFile :: file:fd(), + Socket :: inet:socket(), Offset :: non_neg_integer(), Bytes :: non_neg_integer(), Opts :: [sendfile_option()]. @@ -1151,12 +1151,12 @@ sendfile(File, Sock, Offset, Bytes, Opts) -> lists:member(sf_sync,Opts)). %% sendfile/2 --spec sendfile(File, Sock) -> +-spec sendfile(Filename, Socket) -> {'ok', non_neg_integer()} | {'error', inet:posix() | badarg | not_owner} - when File :: file:name(), - Sock :: inet:socket(). -sendfile(File, Sock) -> - case file:open(File, [read, raw, binary]) of + when Filename :: file:name(), + Socket :: inet:socket(). +sendfile(Filename, Sock) -> + case file:open(Filename, [read, raw, binary]) of {error, Reason} -> {error, Reason}; {ok, Fd} -> |