diff options
Diffstat (limited to 'source3')
-rwxr-xr-x | source3/configure | 86 | ||||
-rw-r--r-- | source3/configure.in | 8 | ||||
-rw-r--r-- | source3/lib/sendfile.c | 5 |
3 files changed, 53 insertions, 46 deletions
diff --git a/source3/configure b/source3/configure index ae8640f945..0ecbadc2a4 100755 --- a/source3/configure +++ b/source3/configure @@ -87,7 +87,7 @@ ac_help="$ac_help ac_help="$ac_help --with-acl-support Include ACL support (default=no)" ac_help="$ac_help - --with-sendfile-support Include sendfile support (default=no)" + --with-sendfile-support Check for sendfile support (default=no)" ac_help="$ac_help --with-winbind Build winbind (default, if supported by OS)" ac_help="$ac_help @@ -13905,24 +13905,26 @@ fi ################################################# # check for sendfile support -echo $ac_n "checking whether to support sendfile""... $ac_c" 1>&6 -echo "configure:13910: checking whether to support sendfile" >&5 +echo $ac_n "checking whether to check for support sendfile""... $ac_c" 1>&6 +echo "configure:13910: checking whether to check for support sendfile" >&5 # Check whether --with-sendfile-support or --without-sendfile-support was given. if test "${with_sendfile_support+set}" = set; then withval="$with_sendfile_support" case "$withval" in yes) + echo "$ac_t""yes" 1>&6; + case "$host_os" in *linux*) echo $ac_n "checking for linux sendfile64 support""... $ac_c" 1>&6 -echo "configure:13920: checking for linux sendfile64 support" >&5 +echo "configure:13922: checking for linux sendfile64 support" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_SENDFILE64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 13926 "configure" +#line 13928 "configure" #include "confdefs.h" #include <sys/sendfile.h> int main() { @@ -13934,7 +13936,7 @@ ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total); ; return 0; } EOF -if { (eval echo configure:13938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* samba_cv_HAVE_SENDFILE64=yes else @@ -13949,13 +13951,13 @@ fi echo "$ac_t""$samba_cv_HAVE_SENDFILE64" 1>&6 echo $ac_n "checking for linux sendfile support""... $ac_c" 1>&6 -echo "configure:13953: checking for linux sendfile support" >&5 +echo "configure:13955: checking for linux sendfile support" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_SENDFILE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 13959 "configure" +#line 13961 "configure" #include "confdefs.h" #include <sys/sendfile.h> int main() { @@ -13967,7 +13969,7 @@ ssize_t nwritten = sendfile(tofd, fromfd, &offset, total); ; return 0; } EOF -if { (eval echo configure:13971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13973: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* samba_cv_HAVE_SENDFILE=yes else @@ -13983,13 +13985,13 @@ echo "$ac_t""$samba_cv_HAVE_SENDFILE" 1>&6 # Try and cope with broken Linux sendfile.... echo $ac_n "checking for broken linux sendfile support""... $ac_c" 1>&6 -echo "configure:13987: checking for broken linux sendfile support" >&5 +echo "configure:13989: checking for broken linux sendfile support" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_BROKEN_LINUX_SENDFILE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 13993 "configure" +#line 13995 "configure" #include "confdefs.h" \ #if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64) @@ -14005,7 +14007,7 @@ ssize_t nwritten = sendfile(tofd, fromfd, &offset, total); ; return 0; } EOF -if { (eval echo configure:14009: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* samba_cv_HAVE_BROKEN_LINUX_SENDFILE=yes else @@ -14061,13 +14063,13 @@ EOF ;; *freebsd*) echo $ac_n "checking for freebsd sendfile support""... $ac_c" 1>&6 -echo "configure:14065: checking for freebsd sendfile support" >&5 +echo "configure:14067: checking for freebsd sendfile support" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_SENDFILE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 14071 "configure" +#line 14073 "configure" #include "confdefs.h" \ #include <sys/types.h> @@ -14089,7 +14091,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:14093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14095: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* samba_cv_HAVE_SENDFILE=yes else @@ -14123,13 +14125,13 @@ EOF *hpux*) echo $ac_n "checking for hpux sendfile64 support""... $ac_c" 1>&6 -echo "configure:14127: checking for hpux sendfile64 support" >&5 +echo "configure:14129: checking for hpux sendfile64 support" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_SENDFILE64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 14133 "configure" +#line 14135 "configure" #include "confdefs.h" \ #include <sys/socket.h> @@ -14149,7 +14151,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:14153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* samba_cv_HAVE_SENDFILE64=yes else @@ -14180,13 +14182,13 @@ EOF fi echo $ac_n "checking for hpux sendfile support""... $ac_c" 1>&6 -echo "configure:14184: checking for hpux sendfile support" >&5 +echo "configure:14186: checking for hpux sendfile support" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_SENDFILE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 14190 "configure" +#line 14192 "configure" #include "confdefs.h" \ #include <sys/socket.h> @@ -14206,7 +14208,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:14210: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* samba_cv_HAVE_SENDFILE=yes else @@ -14240,13 +14242,13 @@ EOF *solaris*) LIBS="$LIBS -lsendfile" echo $ac_n "checking for solaris sendfilev64 support""... $ac_c" 1>&6 -echo "configure:14244: checking for solaris sendfilev64 support" >&5 +echo "configure:14246: checking for solaris sendfilev64 support" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_SENDFILEV64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 14250 "configure" +#line 14252 "configure" #include "confdefs.h" \ #include <sys/sendfile.h> @@ -14256,6 +14258,7 @@ int main() { size_t xferred; struct sendfilevec vec[2]; ssize_t nwritten; + int tofd; sfvcnt = 2; @@ -14272,7 +14275,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:14276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14279: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* samba_cv_HAVE_SENDFILEV64=yes else @@ -14304,13 +14307,13 @@ EOF fi echo $ac_n "checking for solaris sendfilev support""... $ac_c" 1>&6 -echo "configure:14308: checking for solaris sendfilev support" >&5 +echo "configure:14311: checking for solaris sendfilev support" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_SENDFILEV'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 14314 "configure" +#line 14317 "configure" #include "confdefs.h" \ #include <sys/sendfile.h> @@ -14320,6 +14323,7 @@ int main() { size_t xferred; struct sendfilevec vec[2]; ssize_t nwritten; + int tofd; sfvcnt = 2; @@ -14336,7 +14340,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:14340: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* samba_cv_HAVE_SENDFILEV=yes else @@ -14389,7 +14393,7 @@ fi # (WINBIND_STARGETS) and shared libraries (WINBIND_LTARGETS). echo $ac_n "checking whether to build winbind""... $ac_c" 1>&6 -echo "configure:14393: checking whether to build winbind" >&5 +echo "configure:14397: checking whether to build winbind" >&5 # Initially, the value of $host_os decides whether winbind is supported @@ -14485,20 +14489,20 @@ fi # [#include <pwd.h>]) echo $ac_n "checking whether struct passwd has pw_comment""... $ac_c" 1>&6 -echo "configure:14489: checking whether struct passwd has pw_comment" >&5 +echo "configure:14493: checking whether struct passwd has pw_comment" >&5 if eval "test \"`echo '$''{'samba_cv_passwd_pw_comment'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 14495 "configure" +#line 14499 "configure" #include "confdefs.h" #include <pwd.h> int main() { struct passwd p; p.pw_comment; ; return 0; } EOF -if { (eval echo configure:14502: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:14506: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_passwd_pw_comment=yes else @@ -14523,20 +14527,20 @@ fi # [#include <pwd.h>]) echo $ac_n "checking whether struct passwd has pw_age""... $ac_c" 1>&6 -echo "configure:14527: checking whether struct passwd has pw_age" >&5 +echo "configure:14531: checking whether struct passwd has pw_age" >&5 if eval "test \"`echo '$''{'samba_cv_passwd_pw_age'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 14533 "configure" +#line 14537 "configure" #include "confdefs.h" #include <pwd.h> int main() { struct passwd p; p.pw_age; ; return 0; } EOF -if { (eval echo configure:14540: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:14544: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_passwd_pw_age=yes else @@ -14575,7 +14579,7 @@ fi if test x"$INCLUDED_POPT" != x"yes"; then echo $ac_n "checking for poptGetContext in -lpopt""... $ac_c" 1>&6 -echo "configure:14579: checking for poptGetContext in -lpopt" >&5 +echo "configure:14583: checking for poptGetContext in -lpopt" >&5 ac_lib_var=`echo popt'_'poptGetContext | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -14583,7 +14587,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpopt $LIBS" cat > conftest.$ac_ext <<EOF -#line 14587 "configure" +#line 14591 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -14594,7 +14598,7 @@ int main() { poptGetContext() ; return 0; } EOF -if { (eval echo configure:14598: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14602: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -14618,7 +14622,7 @@ fi fi echo $ac_n "checking whether to use included popt""... $ac_c" 1>&6 -echo "configure:14622: checking whether to use included popt" >&5 +echo "configure:14626: checking whether to use included popt" >&5 if test x"$INCLUDED_POPT" = x"yes"; then echo "$ac_t""yes" 1>&6 BUILD_POPT='$(POPT_OBJS)' @@ -14664,16 +14668,16 @@ fi # final configure stuff echo $ac_n "checking configure summary""... $ac_c" 1>&6 -echo "configure:14668: checking configure summary" >&5 +echo "configure:14672: checking configure summary" >&5 if test "$cross_compiling" = yes; then echo "configure: warning: cannot run when cross-compiling" 1>&2 else cat > conftest.$ac_ext <<EOF -#line 14673 "configure" +#line 14677 "configure" #include "confdefs.h" #include "${srcdir-.}/tests/summary.c" EOF -if { (eval echo configure:14677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:14681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then echo "$ac_t""yes" 1>&6 else diff --git a/source3/configure.in b/source3/configure.in index f19a8ed18c..e9ad6af93e 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -2733,12 +2733,14 @@ samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)]) ################################################# # check for sendfile support -AC_MSG_CHECKING(whether to support sendfile) +AC_MSG_CHECKING(whether to check for support sendfile) AC_ARG_WITH(sendfile-support, -[ --with-sendfile-support Include sendfile support (default=no)], +[ --with-sendfile-support Check for sendfile support (default=no)], [ case "$withval" in yes) + AC_MSG_RESULT(yes); + case "$host_os" in *linux*) AC_CACHE_CHECK([for linux sendfile64 support],samba_cv_HAVE_SENDFILE64,[ @@ -2884,6 +2886,7 @@ samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)]) size_t xferred; struct sendfilevec vec[2]; ssize_t nwritten; + int tofd; sfvcnt = 2; @@ -2916,6 +2919,7 @@ samba_cv_HAVE_SENDFILEV64=yes,samba_cv_HAVE_SENDFILEV64=no)]) size_t xferred; struct sendfilevec vec[2]; ssize_t nwritten; + int tofd; sfvcnt = 2; diff --git a/source3/lib/sendfile.c b/source3/lib/sendfile.c index d2ecf3f94a..ccebd25cc1 100644 --- a/source3/lib/sendfile.c +++ b/source3/lib/sendfile.c @@ -144,7 +144,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T of #elif defined(SOLARIS_SENDFILE_API) /* - * Solaris sendfile code written by Pierre Belanger <belanger@yahoo.com>. + * Solaris sendfile code written by Pierre Belanger <belanger@pobox.com>. */ #include <sys/sendfile.h> @@ -162,14 +162,13 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T of vec[0].sfv_fd = SFV_FD_SELF; vec[0].sfv_flag = 0; vec[0].sfv_off = header->data; - vec[0].sfv_len = header->length; + vec[0].sfv_len = hdr_len = header->length; vec[1].sfv_fd = fromfd; vec[1].sfv_flag = 0; vec[1].sfv_off = offset; vec[1].sfv_len = count; - hdr_len = header->length; } else { sfvcnt = 1; |