evbuffer_add_file

Copy data from a file into the evbuffer for writing to a socket.

This function avoids unnecessary data copies between userland and kernel. If sendfile is available and the EVBUFFER_FLAG_DRAINS_TO_FD flag is set, it uses those functions. Otherwise, it tries to use mmap (or CreateFileMapping on Windows).

The function owns the resulting file descriptor and will close it when finished transferring data.

The results of using evbuffer_remove() or evbuffer_pullup() on evbuffers whose data was added using this function are undefined.

@param outbuf the output buffer @param fd the file descriptor @param offset the offset from which to read data @param length how much data to read @return 0 if successful, or -1 if an error occurred

extern (C) nothrow
int
evbuffer_add_file

Meta