summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/configure.in18
-rw-r--r--source3/lib/sendfile.c87
-rwxr-xr-xsource3/wscript15
3 files changed, 0 insertions, 120 deletions
diff --git a/source3/configure.in b/source3/configure.in
index f2885d2ef4..c521e2e9f8 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -5484,28 +5484,10 @@ ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
],
samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
-# Try and cope with broken Linux sendfile....
- AC_CACHE_CHECK([for broken linux sendfile support],samba_cv_HAVE_BROKEN_LINUX_SENDFILE,[
- AC_TRY_LINK([\
-#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
-#undef _FILE_OFFSET_BITS
-#endif
-#include <sys/sendfile.h>],
-[\
-int tofd, fromfd;
-off_t offset;
-size_t total;
-ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
-],
-samba_cv_HAVE_BROKEN_LINUX_SENDFILE=yes,samba_cv_HAVE_BROKEN_LINUX_SENDFILE=no)])
-
if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available])
AC_DEFINE(LINUX_SENDFILE_API,1,[Whether linux sendfile() API is available])
AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
- elif test x"$samba_cv_HAVE_BROKEN_LINUX_SENDFILE" = x"yes"; then
- AC_DEFINE(LINUX_BROKEN_SENDFILE_API,1,[Whether (linux) sendfile() is broken])
- AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile should be used])
else
AC_MSG_RESULT(no);
fi
diff --git a/source3/lib/sendfile.c b/source3/lib/sendfile.c
index a9607fa825..196ef6889b 100644
--- a/source3/lib/sendfile.c
+++ b/source3/lib/sendfile.c
@@ -89,93 +89,6 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset
return count + hdr_len;
}
-#elif defined(LINUX_BROKEN_SENDFILE_API)
-
-/*
- * We must use explicit 32 bit types here. This code path means Linux
- * won't do proper 64-bit sendfile. JRA.
- */
-
-extern int32 sendfile (int out_fd, int in_fd, int32 *offset, uint32 count);
-
-
-#ifndef MSG_MORE
-#define MSG_MORE 0x8000
-#endif
-
-ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset, size_t count)
-{
- size_t total=0;
- ssize_t ret;
- ssize_t hdr_len = 0;
- uint32 small_total = 0;
- int32 small_offset;
-
- /*
- * Fix for broken Linux 2.4 systems with no working sendfile64().
- * If the offset+count > 2 GB then pretend we don't have the
- * system call sendfile at all. The upper layer catches this
- * and uses a normal read. JRA.
- */
-
- if ((sizeof(off_t) >= 8) && (offset + count > (off_t)0x7FFFFFFF)) {
- errno = ENOSYS;
- return -1;
- }
-
- /*
- * Send the header first.
- * Use MSG_MORE to cork the TCP output until sendfile is called.
- */
-
- if (header) {
- hdr_len = header->length;
- while (total < hdr_len) {
- ret = sys_send(tofd, header->data + total,hdr_len - total, MSG_MORE);
- if (ret == -1)
- return -1;
- total += ret;
- }
- }
-
- small_total = (uint32)count;
- small_offset = (int32)offset;
-
- while (small_total) {
- int32 nwritten;
- do {
- nwritten = sendfile(tofd, fromfd, &small_offset, small_total);
-#if defined(EWOULDBLOCK)
- } while (nwritten == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
-#else
- } while (nwritten == -1 && (errno == EINTR || errno == EAGAIN));
-#endif
- if (nwritten == -1) {
- if (errno == ENOSYS || errno == EINVAL) {
- /* Ok - we're in a world of pain here. We just sent
- * the header, but the sendfile failed. We have to
- * emulate the sendfile at an upper layer before we
- * disable it's use. So we do something really ugly.
- * We set the errno to a strange value so we can detect
- * this at the upper level and take care of it without
- * layer violation. JRA.
- */
- errno = EINTR; /* Normally we can never return this. */
- }
- return -1;
- }
- if (nwritten == 0) {
- /*
- * EOF, return a short read
- */
- return hdr_len + (((uint32)count) - small_total);
- }
- small_total -= nwritten;
- }
- return count + hdr_len;
-}
-
-
#elif defined(SOLARIS_SENDFILE_API)
/*
diff --git a/source3/wscript b/source3/wscript
index 02773c0350..4710d8059f 100755
--- a/source3/wscript
+++ b/source3/wscript
@@ -961,25 +961,10 @@ main() {
headers='sys/sendfile.h',
msg='Checking for linux sendfile support')
- # Try and cope with broken Linux sendfile....
- conf.CHECK_CODE('''#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
- #undef _FILE_OFFSET_BITS
- #endif
- #include <sys/sendfile.h>
- int tofd, fromfd;
- off_t offset;
- size_t total;
- ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
- ''',
- '_HAVE_BROKEN_LINUX_SENDFILE',
- msg='Checking for broken linux sendfile support')
if conf.CONFIG_SET('_HAVE_SENDFILE'):
conf.DEFINE('HAVE_SENDFILE', '1')
conf.DEFINE('LINUX_SENDFILE_API', '1')
conf.DEFINE('WITH_SENDFILE', '1')
- elif conf.CONFIG_SET('_HAVE_BROKEN_LINUX_SENDFILE'):
- conf.DEFINE('LINUX_BROKEN_SENDFILE_API', '1')
- conf.DEFINE('WITH_SENDFILE', '1')
elif (host_os.rfind('freebsd') > -1) or (host_os.rfind('dragonfly') > -1):
conf.CHECK_CODE('''
#include <sys/types.h>