diff options
author | Jeremy Allison <jra@samba.org> | 2002-10-01 05:54:40 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2002-10-01 05:54:40 +0000 |
commit | 88e481ec13505f7e870a2172db3d4edf5ce47caf (patch) | |
tree | 53182ad8b674dbe40d08527dd59379fff89d1ab5 /source3 | |
parent | 88fad685d4c0e123ab0f85d8b081ae770569218e (diff) | |
download | samba-88e481ec13505f7e870a2172db3d4edf5ce47caf.tar.gz samba-88e481ec13505f7e870a2172db3d4edf5ce47caf.tar.bz2 samba-88e481ec13505f7e870a2172db3d4edf5ce47caf.zip |
Fix Solaris sendfile detection. Add small fixes to sendfile code.
Jeremy.
(This used to be commit 7ba5636897ea57669c62d22bb399bcfe5e3a9907)
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 4e7b81d1ca..c29dfacfe2 100755 --- a/source3/configure +++ b/source3/configure @@ -85,7 +85,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 @@ -13878,24 +13878,26 @@ fi ################################################# # check for sendfile support -echo $ac_n "checking whether to support sendfile""... $ac_c" 1>&6 -echo "configure:13883: checking whether to support sendfile" >&5 +echo $ac_n "checking whether to check for support sendfile""... $ac_c" 1>&6 +echo "configure:13883: 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:13893: checking for linux sendfile64 support" >&5 +echo "configure:13895: 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 13899 "configure" +#line 13901 "configure" #include "confdefs.h" #include <sys/sendfile.h> int main() { @@ -13907,7 +13909,7 @@ ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total); ; return 0; } EOF -if { (eval echo configure:13911: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* samba_cv_HAVE_SENDFILE64=yes else @@ -13922,13 +13924,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:13926: checking for linux sendfile support" >&5 +echo "configure:13928: 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 13932 "configure" +#line 13934 "configure" #include "confdefs.h" #include <sys/sendfile.h> int main() { @@ -13940,7 +13942,7 @@ ssize_t nwritten = sendfile(tofd, fromfd, &offset, total); ; return 0; } EOF -if { (eval echo configure:13944: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* samba_cv_HAVE_SENDFILE=yes else @@ -13956,13 +13958,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:13960: checking for broken linux sendfile support" >&5 +echo "configure:13962: 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 13966 "configure" +#line 13968 "configure" #include "confdefs.h" \ #if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64) @@ -13978,7 +13980,7 @@ ssize_t nwritten = sendfile(tofd, fromfd, &offset, total); ; return 0; } EOF -if { (eval echo configure:13982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13984: \"$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 @@ -14034,13 +14036,13 @@ EOF ;; *freebsd*) echo $ac_n "checking for freebsd sendfile support""... $ac_c" 1>&6 -echo "configure:14038: checking for freebsd sendfile support" >&5 +echo "configure:14040: 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 14044 "configure" +#line 14046 "configure" #include "confdefs.h" \ #include <sys/types.h> @@ -14062,7 +14064,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:14066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* samba_cv_HAVE_SENDFILE=yes else @@ -14096,13 +14098,13 @@ EOF *hpux*) echo $ac_n "checking for hpux sendfile64 support""... $ac_c" 1>&6 -echo "configure:14100: checking for hpux sendfile64 support" >&5 +echo "configure:14102: 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 14106 "configure" +#line 14108 "configure" #include "confdefs.h" \ #include <sys/socket.h> @@ -14122,7 +14124,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:14126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* samba_cv_HAVE_SENDFILE64=yes else @@ -14153,13 +14155,13 @@ EOF fi echo $ac_n "checking for hpux sendfile support""... $ac_c" 1>&6 -echo "configure:14157: checking for hpux sendfile support" >&5 +echo "configure:14159: 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 14163 "configure" +#line 14165 "configure" #include "confdefs.h" \ #include <sys/socket.h> @@ -14179,7 +14181,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:14183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* samba_cv_HAVE_SENDFILE=yes else @@ -14213,13 +14215,13 @@ EOF *solaris*) LIBS="$LIBS -lsendfile" echo $ac_n "checking for solaris sendfilev64 support""... $ac_c" 1>&6 -echo "configure:14217: checking for solaris sendfilev64 support" >&5 +echo "configure:14219: 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 14223 "configure" +#line 14225 "configure" #include "confdefs.h" \ #include <sys/sendfile.h> @@ -14229,6 +14231,7 @@ int main() { size_t xferred; struct sendfilevec vec[2]; ssize_t nwritten; + int tofd; sfvcnt = 2; @@ -14245,7 +14248,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:14249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14252: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* samba_cv_HAVE_SENDFILEV64=yes else @@ -14277,13 +14280,13 @@ EOF fi echo $ac_n "checking for solaris sendfilev support""... $ac_c" 1>&6 -echo "configure:14281: checking for solaris sendfilev support" >&5 +echo "configure:14284: 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 14287 "configure" +#line 14290 "configure" #include "confdefs.h" \ #include <sys/sendfile.h> @@ -14293,6 +14296,7 @@ int main() { size_t xferred; struct sendfilevec vec[2]; ssize_t nwritten; + int tofd; sfvcnt = 2; @@ -14309,7 +14313,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:14313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14317: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* samba_cv_HAVE_SENDFILEV=yes else @@ -14362,7 +14366,7 @@ fi # (WINBIND_STARGETS) and shared libraries (WINBIND_LTARGETS). echo $ac_n "checking whether to build winbind""... $ac_c" 1>&6 -echo "configure:14366: checking whether to build winbind" >&5 +echo "configure:14370: checking whether to build winbind" >&5 # Initially, the value of $host_os decides whether winbind is supported @@ -14458,20 +14462,20 @@ fi # [#include <pwd.h>]) echo $ac_n "checking whether struct passwd has pw_comment""... $ac_c" 1>&6 -echo "configure:14462: checking whether struct passwd has pw_comment" >&5 +echo "configure:14466: 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 14468 "configure" +#line 14472 "configure" #include "confdefs.h" #include <pwd.h> int main() { struct passwd p; p.pw_comment; ; return 0; } EOF -if { (eval echo configure:14475: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:14479: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_passwd_pw_comment=yes else @@ -14496,20 +14500,20 @@ fi # [#include <pwd.h>]) echo $ac_n "checking whether struct passwd has pw_age""... $ac_c" 1>&6 -echo "configure:14500: checking whether struct passwd has pw_age" >&5 +echo "configure:14504: 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 14506 "configure" +#line 14510 "configure" #include "confdefs.h" #include <pwd.h> int main() { struct passwd p; p.pw_age; ; return 0; } EOF -if { (eval echo configure:14513: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:14517: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_passwd_pw_age=yes else @@ -14548,7 +14552,7 @@ fi if test x"$INCLUDED_POPT" != x"yes"; then echo $ac_n "checking for poptGetContext in -lpopt""... $ac_c" 1>&6 -echo "configure:14552: checking for poptGetContext in -lpopt" >&5 +echo "configure:14556: 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 @@ -14556,7 +14560,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpopt $LIBS" cat > conftest.$ac_ext <<EOF -#line 14560 "configure" +#line 14564 "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 @@ -14567,7 +14571,7 @@ int main() { poptGetContext() ; return 0; } EOF -if { (eval echo configure:14571: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14575: \"$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 @@ -14591,7 +14595,7 @@ fi fi echo $ac_n "checking whether to use included popt""... $ac_c" 1>&6 -echo "configure:14595: checking whether to use included popt" >&5 +echo "configure:14599: 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)' @@ -14637,16 +14641,16 @@ fi # final configure stuff echo $ac_n "checking configure summary""... $ac_c" 1>&6 -echo "configure:14641: checking configure summary" >&5 +echo "configure:14645: 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 14646 "configure" +#line 14650 "configure" #include "confdefs.h" #include "${srcdir-.}/tests/summary.c" EOF -if { (eval echo configure:14650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:14654: \"$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 cd9c8ecbaf..01743d7d2f 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -2716,12 +2716,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,[ @@ -2867,6 +2869,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; @@ -2899,6 +2902,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; |