13 #ifndef __STOUT_OS_POSIX_SENDFILE_HPP__ 14 #define __STOUT_OS_POSIX_SENDFILE_HPP__ 18 #if defined(__linux__) || defined(__sun) 19 #include <sys/sendfile.h> 21 #if defined(__APPLE__) || defined(__FreeBSD__) 22 #include <sys/socket.h> 23 #include <sys/types.h> 25 #endif // __APPLE__ || __FreeBSD__ 43 int s,
int fd, off_t offset,
size_t length)
45 #if defined(__linux__) || defined(__sun) 56 #elif defined __APPLE__ 58 off_t _length =
static_cast<off_t
>(length);
60 if (::
sendfile(fd, s, offset, &_length,
nullptr, 0) < 0) {
61 if (errno == EAGAIN && _length > 0) {
68 #elif defined __FreeBSD__ 72 if (::
sendfile(fd, s, offset, length,
nullptr, &_length, 0) < 0) {
73 if (errno == EAGAIN && length > 0) {
86 #endif // __STOUT_OS_POSIX_SENDFILE_HPP__ SSIZE_T ssize_t
Definition: windows.hpp:186
Definition: posix_signalhandler.hpp:23
ErrnoError SocketError
Definition: error.hpp:33
#define SUPPRESS(signal)
Definition: signals.hpp:27
#define UNREACHABLE()
Definition: unreachable.hpp:22
Try< ssize_t, SocketError > sendfile(int s, int fd, off_t offset, size_t length)
Definition: sendfile.hpp:42
#define SIGPIPE
Definition: windows.hpp:354