[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Fri Jun 15 18:22:03 MDT 2012


The branch, master has been updated
       via  7a723c6 build: Remove support for non-64bit sendfile()
      from  6440720 selftest/flapping: mark samba4.nss.test using winbind(s3dc) as flakey

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 7a723c6b386513ce58fe27469440bfc71debf685
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Jun 5 14:43:24 2012 +1000

    build: Remove support for non-64bit sendfile()
    
    Some early Linux 2.6 platforms can not handle sendfile and _FILE_OFFSET_BITS == 64
    
    This disables sendfile() on these platforms.
    
    Andrew Bartlett
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Sat Jun 16 02:21:28 CEST 2012 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 source3/configure.in   |   18 ----------
 source3/lib/sendfile.c |   87 ------------------------------------------------
 source3/wscript        |   15 --------
 3 files changed, 0 insertions(+), 120 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/configure.in b/source3/configure.in
index f2885d2..c521e2e 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 a9607fa..196ef68 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 02773c0..4710d80 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>


-- 
Samba Shared Repository


More information about the samba-cvs mailing list