]> arthur.barton.de Git - netatalk.git/commitdiff
Remove broken sendfile on Linux stuff, it wasn't properly used by the upper DSI layer...
authorFrank Lahm <franklahm@googlemail.com>
Mon, 21 Nov 2011 12:28:30 +0000 (13:28 +0100)
committerFrank Lahm <franklahm@googlemail.com>
Mon, 21 Nov 2011 12:28:30 +0000 (13:28 +0100)
configure.ac
libatalk/adouble/ad_sendfile.c

index fa91c6e93ec4d10e1ea3d8760b44fd3ebae71d04..af08757c6ac4dc54b1b6170debfdf014c14ce904 100644 (file)
@@ -592,7 +592,6 @@ if test x"$this_os" = "xfreebsd"; then
        AC_MSG_RESULT([ * FreeBSD specific configuration])
        AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
        AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
-
     AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
 fi
 
@@ -601,7 +600,6 @@ if test x"$this_os" = "xkfreebsd-gnu"; then
        AC_MSG_RESULT([ * GNU/kFreeBSD specific configuration])
        AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
        AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
-       AC_DEFINE(SENDFILE_FLAVOR_BSD, 1, [Define if the sendfile() function uses BSD semantics])
     AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
 fi
 
@@ -832,43 +830,8 @@ AC_ARG_ENABLE(sendfile,
 if test x"$netatalk_cv_search_sendfile" = x"yes"; then
    case "$host_os" in
    *linux*)
-       AC_DEFINE(SENDFILE_FLAVOR_LINUX,1,[Whether linux sendfile() API is available])
-       AC_MSG_CHECKING([for sendfile() syscall])
-       AC_CACHE_CHECK([for sendfile support],
-           [netatalk_cv_HAVE_SENDFILE],
-           [AC_TRY_LINK(
-               [#include <sys/sendfile.h>],
-               [int tofd, fromfd;
-                   off_t offset;
-                   size_t total;
-                   ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);],
-               [netatalk_cv_HAVE_SENDFILE=yes]
-            )]
-        )
-
-        # Try and cope with broken Linux sendfile....
-        AC_CACHE_CHECK([for broken Linux sendfile support],
-            [netatalk_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);],
-                [netatalk_cv_HAVE_SENDFILE=yes; netatalk_cv_HAVE_BROKEN_SENDFILE=yes]
-            )]
-        )
-        if test x"$netatalk_cv_HAVE_SENDFILE" = x"yes"; then
-            AC_MSG_RESULT(yes);
-        else
-            AC_MSG_RESULT(no);
-        fi
-        if test x"$netatalk_cv_HAVE_BROKEN_SENDFILE" = x"yes"; then
-            AC_DEFINE(LINUX_BROKEN_SENDFILE_API,1,[Whether Linux sendfile() is broken])
-        fi
+        AC_DEFINE(SENDFILE_FLAVOR_LINUX,1,[Whether linux sendfile() API is available])
+        AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
         ;;
 
     *solaris*)
@@ -888,7 +851,6 @@ if test x"$netatalk_cv_search_sendfile" = x"yes"; then
     esac
 
     if test x"$netatalk_cv_HAVE_SENDFILE" = x"yes"; then
-        AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available])
         AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
     fi
 fi
index 154c89d02473776968a91faec19e6f32c76d168f..20453bfd601404e94f344955aa17afb699aef3bb 100644 (file)
 #include <atalk/logger.h>
 #include "ad_private.h"
 
-#if defined(SENDFILE_FLAVOR_LINUX) && defined(LINUX_BROKEN_SENDFILE_API)
-
-extern int32_t sendfile (int fdout, int fdin, int32_t *offset, u_int32_t count);
-
-ssize_t sys_sendfile(int tofd, int fromfd, off_t *offset, size_t count)
-{
-u_int32_t small_total;
-int32_t small_offset;
-int32_t nwritten;
-
-    /*
-     * 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;
-     }
-     small_offset = (int32_t)*offset;
-     small_total = (u_int32_t)count;
-     nwritten = sendfile(tofd, fromfd, &small_offset, small_total);
-     if (nwritten > = 0)
-         *offset += nwritten;
-     
-    return nwritten;
-}
-
-#elif defined(SENDFILE_FLAVOR_LINUX)
+#if defined(SENDFILE_FLAVOR_LINUX)
 #include <sys/sendfile.h>
 
 ssize_t sys_sendfile(int tofd, int fromfd, off_t *offset, size_t count)