sendfile-util.c revision fdf5cf12c66fff254309c4252c7d635a3e7cade0
/* Copyright (c) 2002-2003 Timo Sirainen */
/* kludge a bit to remove _FILE_OFFSET_BITS definition from config.h.
It's required to be able to include sys/sendfile.h with Linux. */
#include "../../config.h"
#ifdef HAVE_LINUX_SENDFILE
#endif
#include "lib.h"
#include "sendfile-util.h"
#ifdef HAVE_LINUX_SENDFILE
#include <sys/sendfile.h>
{
/* REMEBER: uoff_t and off_t may not be of same size. */
/* make sure given offset fits into off_t */
/* 32bit off_t */
if (*offset >= 2147483647L) {
return -1;
}
} else {
/* they're most likely the same size. if not, fix this
code later */
return -1;
}
}
return ret;
}
#elif defined(HAVE_FREEBSD_SENDFILE)
{
int ret;
else {
/* out_fd wasn't a socket. behave as if sendfile()
wasn't supported at all. */
}
return -1;
}
}
#elif defined (HAVE_SOLARIS_SENDFILE)
#include <sys/sendfile.h>
#include "network.h"
{
/* NOTE: if outfd is not a socket, some Solaris versions will
kernel panic */
/* not supported, return Linux-like EINVAL so caller
sees only consistent errnos. */
}
return ret;
}
#else
{
return -1;
}
#endif