
  -spec sendfile(RawFile, Socket, Offset, Bytes, Opts) ->
                    {ok, non_neg_integer()} |
                    {error, inet:posix() | closed | badarg | not_owner}
                    when
                        RawFile :: fd(),
                        Socket ::
                            inet:socket() |
                            socket:socket() |
                            fun((iolist()) ->
                                    ok | {error, inet:posix() | closed}),
                        Offset :: non_neg_integer(),
                        Bytes :: non_neg_integer(),
                        Opts :: [sendfile_option()].

Since:
  OTP R15B

  Types:
    -type sendfile_option() ::
          {chunk_size, non_neg_integer()} | {use_threads, boolean()}.

  Sends Bytes from the file referenced by RawFile beginning at 
  Offset to Socket. Returns {ok, BytesSent} if successful,
  otherwise {error, Reason}. If Bytes is set to 0 all data
  after the specified Offset is sent.

  The file used must be opened using the raw flag, and the process
  calling sendfile must be the controlling process of the socket.
  See gen_tcp:controlling_process/2 or module socket's level 
  otp socket option controlling_process.

  If the OS used does not support non-blocking sendfile, an Erlang
  fallback using read/2 and gen_tcp:send/2 is used.

  The option list can contain the following options:

  chunk_size:
    The chunk size used by the Erlang fallback to send data. If
    using the fallback, set this to a value that comfortably fits
    in the systems memory. Default is 20 MB.
