[erlang-patches] sendfile()

Björn Gustavsson <>
Thu Oct 14 15:59:05 CEST 2010


2010/10/13 Björn Gustavsson <>:
> 2010/10/13 Tuncer Ayaz <>:
>> Please refetch for cleanups and comments.
>
> Refetched.
>
> --
> Björn Gustavsson, Erlang/OTP, Ericsson AB
>

There are some problems with the specs
(they were there before the latest update
too):

./file.erl:293: file.erl:293: The call
file:sendfile(File::pid(),SockFD::string() |
non_neg_integer(),Offset::any(),Bytes::any()) breaks the contract
(File::io_device() |
fd(),Sock::port(),Offset::non_neg_integer(),Bytes::non_neg_integer())
-> {'ok',non_neg_integer()} | {'error',posix()}

./file.erl:305: file.erl:305: The specification for file:sendfile/3
states that the function might also return {'error',atom()} |
{'ok',non_neg_integer()} but the inferred return is none()

./file.erl:312: file.erl:312: The call
file:sendfile_chunked_loop(Fd::pid() |
#file_descriptor{module::atom()},SockFD::string() |
non_neg_integer(),Offset::0,Bytes::'undefined' |
non_neg_integer(),Bytes::'undefined' |
non_neg_integer(),ChunkSize::any()) will never return since it differs
in the 2nd argument from the success typing arguments: (pid() |
#file_descriptor{module::atom() |
tuple()},port(),non_neg_integer(),any(),non_neg_integer(),non_neg_integer())

./file.erl:323: file.erl:323: Invalid type specification for function
file:sendfile_chunked_loop/6. The success typing is (pid() |
#file_descriptor{module::atom() |
tuple()},port(),non_neg_integer(),_,non_neg_integer(),non_neg_integer())
-> {'error',atom()} | {'ok',_}

./file.erl:331: file.erl:331: The call file:sendfile(Fd::pid() |
#file_descriptor{module::atom()},SockFD::string() |
non_neg_integer(),Offset0::0,ToWrite::non_neg_integer()) breaks the
contract (File::io_device() |
fd(),Sock::port(),Offset::non_neg_integer(),Bytes::non_neg_integer())
-> {'ok',non_neg_integer()} | {'error',posix()}

./file.erl:344: file.erl:344: Invalid type specification for function
file:sendfile/2. The success typing is (atom() | [atom() | [any()] |
char()],port()) -> {'error',atom()} | {'ok',non_neg_integer()}

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


More information about the erlang-patches mailing list