diff options
-rw-r--r-- | source4/include/smb_acls.h | 279 | ||||
-rw-r--r-- | source4/lib/basic.mk | 1 | ||||
-rw-r--r-- | source4/lib/sendfile.c | 382 | ||||
-rw-r--r-- | source4/ntvfs/config.m4 | 230 |
4 files changed, 0 insertions, 892 deletions
diff --git a/source4/include/smb_acls.h b/source4/include/smb_acls.h deleted file mode 100644 index 49c4406ab8..0000000000 --- a/source4/include/smb_acls.h +++ /dev/null @@ -1,279 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Portable SMB ACL interface - Copyright (C) Jeremy Allison 2000 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#error SAMBA4 clean up -#error this file should be (re)moved -#error and all unused stuff should go - -#ifndef _SMB_ACLS_H -#define _SMB_ACLS_H -#if defined(HAVE_POSIX_ACLS) - -/* This is an identity mapping (just remove the SMB_). */ - -#define SMB_ACL_TAG_T acl_tag_t -#define SMB_ACL_TYPE_T acl_type_t -#define SMB_ACL_PERMSET_T acl_permset_t -#define SMB_ACL_PERM_T acl_perm_t -#define SMB_ACL_READ ACL_READ -#define SMB_ACL_WRITE ACL_WRITE -#define SMB_ACL_EXECUTE ACL_EXECUTE - -/* Types of ACLs. */ -#define SMB_ACL_USER ACL_USER -#define SMB_ACL_USER_OBJ ACL_USER_OBJ -#define SMB_ACL_GROUP ACL_GROUP -#define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ -#define SMB_ACL_OTHER ACL_OTHER -#define SMB_ACL_MASK ACL_MASK - -#define SMB_ACL_T acl_t - -#define SMB_ACL_ENTRY_T acl_entry_t - -#define SMB_ACL_FIRST_ENTRY ACL_FIRST_ENTRY -#define SMB_ACL_NEXT_ENTRY ACL_NEXT_ENTRY - -#define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS -#define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT - -#elif defined(HAVE_TRU64_ACLS) - -/* This is for DEC/Compaq Tru64 UNIX */ - -#define SMB_ACL_TAG_T acl_tag_t -#define SMB_ACL_TYPE_T acl_type_t -#define SMB_ACL_PERMSET_T acl_permset_t -#define SMB_ACL_PERM_T acl_perm_t -#define SMB_ACL_READ ACL_READ -#define SMB_ACL_WRITE ACL_WRITE -#define SMB_ACL_EXECUTE ACL_EXECUTE - -/* Types of ACLs. */ -#define SMB_ACL_USER ACL_USER -#define SMB_ACL_USER_OBJ ACL_USER_OBJ -#define SMB_ACL_GROUP ACL_GROUP -#define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ -#define SMB_ACL_OTHER ACL_OTHER -#define SMB_ACL_MASK ACL_MASK - -#define SMB_ACL_T acl_t - -#define SMB_ACL_ENTRY_T acl_entry_t - -#define SMB_ACL_FIRST_ENTRY 0 -#define SMB_ACL_NEXT_ENTRY 1 - -#define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS -#define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT - -#elif defined(HAVE_UNIXWARE_ACLS) || defined(HAVE_SOLARIS_ACLS) -/* - * Donated by Michael Davidson <md@sco.COM> for UnixWare / OpenUNIX. - * Modified by Toomas Soome <tsoome@ut.ee> for Solaris. - */ - -/* SVR4.2 ES/MP ACLs */ -typedef int SMB_ACL_TAG_T; -typedef int SMB_ACL_TYPE_T; -typedef ushort *SMB_ACL_PERMSET_T; -typedef ushort SMB_ACL_PERM_T; -#define SMB_ACL_READ 4 -#define SMB_ACL_WRITE 2 -#define SMB_ACL_EXECUTE 1 - -/* Types of ACLs. */ -#define SMB_ACL_USER USER -#define SMB_ACL_USER_OBJ USER_OBJ -#define SMB_ACL_GROUP GROUP -#define SMB_ACL_GROUP_OBJ GROUP_OBJ -#define SMB_ACL_OTHER OTHER_OBJ -#define SMB_ACL_MASK CLASS_OBJ - -typedef struct SMB_ACL_T { - int size; - int count; - int next; - struct acl acl[1]; -} *SMB_ACL_T; - -typedef struct acl *SMB_ACL_ENTRY_T; - -#define SMB_ACL_FIRST_ENTRY 0 -#define SMB_ACL_NEXT_ENTRY 1 - -#define SMB_ACL_TYPE_ACCESS 0 -#define SMB_ACL_TYPE_DEFAULT 1 - -#elif defined(HAVE_HPUX_ACLS) - -/* - * Based on the Solaris & UnixWare code. - */ - -#undef GROUP -#include <sys/aclv.h> - -/* SVR4.2 ES/MP ACLs */ -typedef int SMB_ACL_TAG_T; -typedef int SMB_ACL_TYPE_T; -typedef ushort *SMB_ACL_PERMSET_T; -typedef ushort SMB_ACL_PERM_T; -#define SMB_ACL_READ 4 -#define SMB_ACL_WRITE 2 -#define SMB_ACL_EXECUTE 1 - -/* Types of ACLs. */ -#define SMB_ACL_USER USER -#define SMB_ACL_USER_OBJ USER_OBJ -#define SMB_ACL_GROUP GROUP -#define SMB_ACL_GROUP_OBJ GROUP_OBJ -#define SMB_ACL_OTHER OTHER_OBJ -#define SMB_ACL_MASK CLASS_OBJ - -typedef struct SMB_ACL_T { - int size; - int count; - int next; - struct acl acl[1]; -} *SMB_ACL_T; - -typedef struct acl *SMB_ACL_ENTRY_T; - -#define SMB_ACL_FIRST_ENTRY 0 -#define SMB_ACL_NEXT_ENTRY 1 - -#define SMB_ACL_TYPE_ACCESS 0 -#define SMB_ACL_TYPE_DEFAULT 1 - -#elif defined(HAVE_IRIX_ACLS) - -#define SMB_ACL_TAG_T acl_tag_t -#define SMB_ACL_TYPE_T acl_type_t -#define SMB_ACL_PERMSET_T acl_permset_t -#define SMB_ACL_PERM_T acl_perm_t -#define SMB_ACL_READ ACL_READ -#define SMB_ACL_WRITE ACL_WRITE -#define SMB_ACL_EXECUTE ACL_EXECUTE - -/* Types of ACLs. */ -#define SMB_ACL_USER ACL_USER -#define SMB_ACL_USER_OBJ ACL_USER_OBJ -#define SMB_ACL_GROUP ACL_GROUP -#define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ -#define SMB_ACL_OTHER ACL_OTHER_OBJ -#define SMB_ACL_MASK ACL_MASK - -typedef struct SMB_ACL_T { - int next; - BOOL freeaclp; - struct acl *aclp; -} *SMB_ACL_T; - -#define SMB_ACL_ENTRY_T acl_entry_t - -#define SMB_ACL_FIRST_ENTRY 0 -#define SMB_ACL_NEXT_ENTRY 1 - -#define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS -#define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT - -#elif defined(HAVE_AIX_ACLS) - -/* Donated by Medha Date, mdate@austin.ibm.com, for IBM */ - -#include <acl.h> - -typedef uint *SMB_ACL_PERMSET_T; - -struct acl_entry_link{ - struct acl_entry_link *prevp; - struct new_acl_entry *entryp; - struct acl_entry_link *nextp; - int count; -}; - -struct new_acl_entry{ - unsigned short ace_len; - unsigned short ace_type; - unsigned int ace_access; - struct ace_id ace_id[1]; -}; - -#define SMB_ACL_ENTRY_T struct new_acl_entry* -#define SMB_ACL_T struct acl_entry_link* - -#define SMB_ACL_TAG_T unsigned short -#define SMB_ACL_TYPE_T int -#define SMB_ACL_PERM_T uint -#define SMB_ACL_READ S_IRUSR -#define SMB_ACL_WRITE S_IWUSR -#define SMB_ACL_EXECUTE S_IXUSR - -/* Types of ACLs. */ -#define SMB_ACL_USER ACEID_USER -#define SMB_ACL_USER_OBJ 3 -#define SMB_ACL_GROUP ACEID_GROUP -#define SMB_ACL_GROUP_OBJ 4 -#define SMB_ACL_OTHER 5 -#define SMB_ACL_MASK 6 - - -#define SMB_ACL_FIRST_ENTRY 1 -#define SMB_ACL_NEXT_ENTRY 2 - -#define SMB_ACL_TYPE_ACCESS 0 -#define SMB_ACL_TYPE_DEFAULT 1 - -#else /* No ACLs. */ - -/* No ACLS - fake it. */ -#define SMB_ACL_TAG_T int -#define SMB_ACL_TYPE_T int -#define SMB_ACL_PERMSET_T mode_t -#define SMB_ACL_PERM_T mode_t -#define SMB_ACL_READ S_IRUSR -#define SMB_ACL_WRITE S_IWUSR -#define SMB_ACL_EXECUTE S_IXUSR - -/* Types of ACLs. */ -#define SMB_ACL_USER 0 -#define SMB_ACL_USER_OBJ 1 -#define SMB_ACL_GROUP 2 -#define SMB_ACL_GROUP_OBJ 3 -#define SMB_ACL_OTHER 4 -#define SMB_ACL_MASK 5 - -typedef struct SMB_ACL_T { - int dummy; -} *SMB_ACL_T; - -typedef struct SMB_ACL_ENTRY_T { - int dummy; -} *SMB_ACL_ENTRY_T; - -#define SMB_ACL_FIRST_ENTRY 0 -#define SMB_ACL_NEXT_ENTRY 1 - -#define SMB_ACL_TYPE_ACCESS 0 -#define SMB_ACL_TYPE_DEFAULT 1 - -#endif /* No ACLs. */ -#endif /* _SMB_ACLS_H */ diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk index 3a1f127853..865ba7342f 100644 --- a/source4/lib/basic.mk +++ b/source4/lib/basic.mk @@ -14,7 +14,6 @@ ADD_OBJ_FILES = \ lib/replace.o \ lib/signal.o \ lib/system.o \ - lib/sendfile.o \ lib/time.o \ lib/genrand.o \ lib/username.o \ diff --git a/source4/lib/sendfile.c b/source4/lib/sendfile.c deleted file mode 100644 index bcc8cb08ca..0000000000 --- a/source4/lib/sendfile.c +++ /dev/null @@ -1,382 +0,0 @@ -/* - Unix SMB/Netbios implementation. - Version 2.2.x / 3.0.x - sendfile implementations. - Copyright (C) Jeremy Allison 2002. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - * This file handles the OS dependent sendfile implementations. - * The API is such that it returns -1 on error, else returns the - * number of bytes written. - */ - -#include "includes.h" - -#if defined(LINUX_SENDFILE_API) - -#include <sys/sendfile.h> - -#ifndef MSG_MORE -#define MSG_MORE 0x8000 -#endif - -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count) -{ - size_t total=0; - ssize_t ret; - size_t hdr_len = 0; - - /* - * 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; - } - } - - total = count; - while (total) { - ssize_t nwritten; - do { -#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_SENDFILE64) - nwritten = sendfile64(tofd, fromfd, &offset, total); -#else - nwritten = sendfile(tofd, fromfd, &offset, total); -#endif - } while (nwritten == -1 && errno == EINTR); - if (nwritten == -1) - return -1; - if (nwritten == 0) - return -1; /* I think we're at EOF here... */ - total -= nwritten; - } - 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, SMB_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(SMB_OFF_T) >= 8) && (offset + count > (SMB_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); - } while (nwritten == -1 && errno == EINTR); - if (nwritten == -1) - return -1; - if (nwritten == 0) - return -1; /* I think we're at EOF here... */ - small_total -= nwritten; - } - return count + hdr_len; -} - - -#elif defined(SOLARIS_SENDFILE_API) - -/* - * Solaris sendfile code written by Pierre Belanger <belanger@pobox.com>. - */ - -#include <sys/sendfile.h> - -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count) -{ - int sfvcnt; - size_t total, xferred; - struct sendfilevec vec[2]; - ssize_t hdr_len = 0; - - if (header) { - sfvcnt = 2; - - vec[0].sfv_fd = SFV_FD_SELF; - vec[0].sfv_flag = 0; - vec[0].sfv_off = header->data; - 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; - - } else { - sfvcnt = 1; - - vec[0].sfv_fd = fromfd; - vec[0].sfv_flag = 0; - vec[0].sfv_off = offset; - vec[0].sfv_len = count; - } - - total = count + hdr_len; - - while (total) { - ssize_t nwritten; - - /* - * Although not listed in the API error returns, this is almost certainly - * a slow system call and will be interrupted by a signal with EINTR. JRA. - */ - - xferred = 0; - -#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_SENDFILEV64) - nwritten = sendfilev64(tofd, vec, sfvcnt, &xferred); -#else - nwritten = sendfilev(tofd, vec, sfvcnt, &xferred); -#endif - if (nwritten == -1 && errno == EINTR) { - if (xferred == 0) - continue; /* Nothing written yet. */ - else - nwritten = xferred; - } - - if (nwritten == -1) - return -1; - if (nwritten == 0) - return -1; /* I think we're at EOF here... */ - - /* - * If this was a short (signal interrupted) write we may need - * to subtract it from the header data, or null out the header - * data altogether if we wrote more than vec[0].sfv_len bytes. - * We move vec[1].* to vec[0].* and set sfvcnt to 1 - */ - - if (sfvcnt == 2 && nwritten >= vec[0].sfv_len) { - vec[1].sfv_off += nwritten - vec[0].sfv_len; - vec[1].sfv_len -= nwritten - vec[0].sfv_len; - - /* Move vec[1].* to vec[0].* and set sfvcnt to 1 */ - vec[0] = vec[1]; - sfvcnt = 1; - } else { - vec[0].sfv_off += nwritten; - vec[0].sfv_len -= nwritten; - } - total -= nwritten; - } - return count + hdr_len; -} - -#elif defined(HPUX_SENDFILE_API) - -#include <sys/socket.h> -#include <sys/uio.h> - -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count) -{ - size_t total=0; - struct iovec hdtrl[2]; - size_t hdr_len = 0; - - if (header) { - /* Set up the header/trailer iovec. */ - hdtrl[0].iov_base = header->data; - hdtrl[0].iov_len = hdr_len = header->length; - } else { - hdtrl[0].iov_base = NULL; - hdtrl[0].iov_len = hdr_len = 0; - } - hdtrl[1].iov_base = NULL; - hdtrl[1].iov_base = 0; - - total = count; - while (total + hdtrl[0].iov_len) { - ssize_t nwritten; - - /* - * HPUX guarantees that if any data was written before - * a signal interrupt then sendfile returns the number of - * bytes written (which may be less than requested) not -1. - * nwritten includes the header data sent. - */ - - do { -#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_SENDFILE64) - nwritten = sendfile64(tofd, fromfd, offset, total, &hdtrl[0], 0); -#else - nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0); -#endif - } while (nwritten == -1 && errno == EINTR); - if (nwritten == -1) - return -1; - if (nwritten == 0) - return -1; /* I think we're at EOF here... */ - - /* - * If this was a short (signal interrupted) write we may need - * to subtract it from the header data, or null out the header - * data altogether if we wrote more than hdtrl[0].iov_len bytes. - * We change nwritten to be the number of file bytes written. - */ - - if (hdtrl[0].iov_base && hdtrl[0].iov_len) { - if (nwritten >= hdtrl[0].iov_len) { - nwritten -= hdtrl[0].iov_len; - hdtrl[0].iov_base = NULL; - hdtrl[0].iov_len = 0; - } else { - /* iov_base is defined as a void *... */ - hdtrl[0].iov_base = ((char *)hdtrl[0].iov_base) + nwritten; - hdtrl[0].iov_len -= nwritten; - nwritten = 0; - } - } - total -= nwritten; - offset += nwritten; - } - return count + hdr_len; -} - -#elif defined(FREEBSD_SENDFILE_API) - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/uio.h> - -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count) -{ - size_t total=0; - struct sf_hdtr hdr; - struct iovec hdtrl; - size_t hdr_len = 0; - - hdr.headers = &hdtrl; - hdr.hdr_cnt = 1; - hdr.trailers = NULL; - hdr.trl_cnt = 0; - - /* Set up the header iovec. */ - if (header) { - hdtrl.iov_base = header->data; - hdtrl.iov_len = hdr_len = header->length; - } else { - hdtrl.iov_base = NULL; - hdtrl.iov_len = 0; - } - - total = count; - while (total + hdtrl.iov_len) { - SMB_OFF_T nwritten; - int ret; - - /* - * FreeBSD sendfile returns 0 on success, -1 on error. - * Remember, the tofd and fromfd are reversed..... :-). - * nwritten includes the header data sent. - */ - - do { - ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0); - } while (ret == -1 && errno == EINTR); - if (ret == -1) - return -1; - - if (nwritten == 0) - return -1; /* I think we're at EOF here... */ - - /* - * If this was a short (signal interrupted) write we may need - * to subtract it from the header data, or null out the header - * data altogether if we wrote more than hdtrl.iov_len bytes. - * We change nwritten to be the number of file bytes written. - */ - - if (hdtrl.iov_base && hdtrl.iov_len) { - if (nwritten >= hdtrl.iov_len) { - nwritten -= hdtrl.iov_len; - hdtrl.iov_base = NULL; - hdtrl.iov_len = 0; - } else { - hdtrl.iov_base += nwritten; - hdtrl.iov_len -= nwritten; - nwritten = 0; - } - } - total -= nwritten; - offset += nwritten; - } - return count + hdr_len; -} - -#else /* No sendfile implementation. Return error. */ - -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count) -{ - /* No sendfile syscall. */ - errno = ENOSYS; - return -1; -} -#endif diff --git a/source4/ntvfs/config.m4 b/source4/ntvfs/config.m4 index b5dbd7e3b7..f23610fef4 100644 --- a/source4/ntvfs/config.m4 +++ b/source4/ntvfs/config.m4 @@ -1,235 +1,5 @@ dnl # NTVFS Server subsystem -################################################# -# check for sendfile support - -with_sendfile_support=yes -AC_MSG_CHECKING(whether to check to support sendfile) -AC_ARG_WITH(sendfile-support, -[ --with-sendfile-support Check for sendfile support (default=yes)], -[ case "$withval" in - yes) - - AC_MSG_RESULT(yes); - - case "$host_os" in - *linux*) - AC_CACHE_CHECK([for linux sendfile64 support],samba_cv_HAVE_SENDFILE64,[ - AC_TRY_LINK([#include <sys/sendfile.h>], -[\ -int tofd, fromfd; -off64_t offset; -size_t total; -ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total); -], -samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)]) - - AC_CACHE_CHECK([for linux sendfile support],samba_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); -], -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_SENDFILE64" = x"yes"; then - AC_DEFINE(HAVE_SENDFILE64,1,[Whether 64-bit 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_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 - - ;; - *freebsd*) - AC_CACHE_CHECK([for freebsd sendfile support],samba_cv_HAVE_SENDFILE,[ - AC_TRY_LINK([\ -#include <sys/types.h> -#include <unistd.h> -#include <sys/socket.h> -#include <sys/uio.h>], -[\ - int fromfd, tofd, ret, total=0; - off_t offset, nwritten; - struct sf_hdtr hdr; - struct iovec hdtrl; - hdr.headers = &hdtrl; - hdr.hdr_cnt = 1; - hdr.trailers = NULL; - hdr.trl_cnt = 0; - hdtrl.iov_base = NULL; - hdtrl.iov_len = 0; - ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0); -], -samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)]) - - if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then - AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() support is available]) - AC_DEFINE(FREEBSD_SENDFILE_API,1,[Whether the FreeBSD sendfile() API is available]) - AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included]) - else - AC_MSG_RESULT(no); - fi - ;; - - *hpux*) - AC_CACHE_CHECK([for hpux sendfile64 support],samba_cv_HAVE_SENDFILE64,[ - AC_TRY_LINK([\ -#include <sys/socket.h> -#include <sys/uio.h>], -[\ - int fromfd, tofd; - size_t total=0; - struct iovec hdtrl[2]; - ssize_t nwritten; - off64_t offset; - - hdtrl[0].iov_base = 0; - hdtrl[0].iov_len = 0; - - nwritten = sendfile64(tofd, fromfd, offset, total, &hdtrl[0], 0); -], -samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)]) - if test x"$samba_cv_HAVE_SENDFILE64" = x"yes"; then - AC_DEFINE(HAVE_SENDFILE64,1,[Whether sendfile64() is available]) - AC_DEFINE(HPUX_SENDFILE_API,1,[Whether the hpux sendfile() API is available]) - AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included]) - else - AC_MSG_RESULT(no); - fi - - AC_CACHE_CHECK([for hpux sendfile support],samba_cv_HAVE_SENDFILE,[ - AC_TRY_LINK([\ -#include <sys/socket.h> -#include <sys/uio.h>], -[\ - int fromfd, tofd; - size_t total=0; - struct iovec hdtrl[2]; - ssize_t nwritten; - off_t offset; - - hdtrl[0].iov_base = 0; - hdtrl[0].iov_len = 0; - - nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0); -], -samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)]) - if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then - AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available]) - AC_DEFINE(HPUX_SENDFILE_API,1,[Whether the hpux sendfile() API is available]) - AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included]) - else - AC_MSG_RESULT(no); - fi - ;; - - *solaris*) - AC_CHECK_LIB(sendfile,sendfilev) - AC_CACHE_CHECK([for solaris sendfilev64 support],samba_cv_HAVE_SENDFILEV64,[ - AC_TRY_LINK([\ -#include <sys/sendfile.h>], -[\ - int sfvcnt; - size_t xferred; - struct sendfilevec vec[2]; - ssize_t nwritten; - int tofd; - - sfvcnt = 2; - - vec[0].sfv_fd = SFV_FD_SELF; - vec[0].sfv_flag = 0; - vec[0].sfv_off = 0; - vec[0].sfv_len = 0; - - vec[1].sfv_fd = 0; - vec[1].sfv_flag = 0; - vec[1].sfv_off = 0; - vec[1].sfv_len = 0; - nwritten = sendfilev64(tofd, vec, sfvcnt, &xferred); -], -samba_cv_HAVE_SENDFILEV64=yes,samba_cv_HAVE_SENDFILEV64=no)]) - - if test x"$samba_cv_HAVE_SENDFILEV64" = x"yes"; then - AC_DEFINE(HAVE_SENDFILEV64,1,[Whether sendfilev64() is available]) - AC_DEFINE(SOLARIS_SENDFILE_API,1,[Whether the soloris sendfile() API is available]) - AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included]) - else - AC_MSG_RESULT(no); - fi - - AC_CACHE_CHECK([for solaris sendfilev support],samba_cv_HAVE_SENDFILEV,[ - AC_TRY_LINK([\ -#include <sys/sendfile.h>], -[\ - int sfvcnt; - size_t xferred; - struct sendfilevec vec[2]; - ssize_t nwritten; - int tofd; - - sfvcnt = 2; - - vec[0].sfv_fd = SFV_FD_SELF; - vec[0].sfv_flag = 0; - vec[0].sfv_off = 0; - vec[0].sfv_len = 0; - - vec[1].sfv_fd = 0; - vec[1].sfv_flag = 0; - vec[1].sfv_off = 0; - vec[1].sfv_len = 0; - nwritten = sendfilev(tofd, vec, sfvcnt, &xferred); -], -samba_cv_HAVE_SENDFILEV=yes,samba_cv_HAVE_SENDFILEV=no)]) - - if test x"$samba_cv_HAVE_SENDFILEV" = x"yes"; then - AC_DEFINE(HAVE_SENDFILEV,1,[Whether sendfilev() is available]) - AC_DEFINE(SOLARIS_SENDFILE_API,1,[Whether the solaris sendfile() API is available]) - AC_DEFINE(WITH_SENDFILE,1,[Whether to include sendfile() support]) - else - AC_MSG_RESULT(no); - fi - ;; - - *) - ;; - esac - ;; - *) - AC_MSG_RESULT(no) - ;; - esac ], - AC_MSG_RESULT(yes) -) -# end check for sendfile support -################################################# - SMB_MODULE_MK(ntvfs_cifs, NTVFS, STATIC, ntvfs/config.mk) SMB_MODULE_MK(ntvfs_simple, NTVFS, STATIC, ntvfs/config.mk) |