summaryrefslogtreecommitdiff
path: root/network_io
diff options
context:
space:
mode:
authorpquerna <pquerna@13f79535-47bb-0310-9956-ffa450edef68>2004-11-28 21:51:46 +0000
committerpquerna <pquerna@13f79535-47bb-0310-9956-ffa450edef68>2004-11-28 21:51:46 +0000
commite6a31572769b672d1184404b86db6e3aafc047cb (patch)
tree9e498c81f79e326a57cda2880b7141045cdf46ef /network_io
parenta8078eae8cfebff9ff97981019dcef49daea8f2f (diff)
downloadlibapr-e6a31572769b672d1184404b86db6e3aafc047cb.tar.gz
Remove the Runtime test for the different sendfile revisions on FreeBSD.
PR: 25718 Submitted By: Mike Silbersack <silby silby.com> git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@106850 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'network_io')
-rw-r--r--network_io/unix/sendrecv.c59
1 files changed, 6 insertions, 53 deletions
diff --git a/network_io/unix/sendrecv.c b/network_io/unix/sendrecv.c
index 002b6e1cc..f70c84716 100644
--- a/network_io/unix/sendrecv.c
+++ b/network_io/unix/sendrecv.c
@@ -21,9 +21,9 @@
#include "apr_arch_file_io.h"
#endif /* APR_HAS_SENDFILE */
-/* sys/sysctl.h is only needed on FreeBSD for include_hdrs_in_length() */
-#if defined(__FreeBSD__) && defined(HAVE_SYS_SYSCTL_H)
-#include <sys/sysctl.h>
+/* osreldate.h is only needed on FreeBSD for sendfile detection */
+#if defined(__FreeBSD__)
+#include <osreldate.h>
#endif
apr_status_t apr_socket_send(apr_socket_t *sock, const char *buf,
@@ -389,55 +389,6 @@ do_select:
#elif defined(__FreeBSD__)
-static int include_hdrs_in_length(void)
-{
-#ifdef HAVE_SYS_SYSCTL_H
-/* this assumes:
- * if the header exists, so does the sysctlbyname() syscall, and
- * if the header doesn't exist, the kernel is really old
- */
-
-/* see
- * http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/sys/param.h#rev1.61.2.29
- * for kernel version number
- *
- * http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/uipc_syscalls.c#rev1.65.2.10
- * for the sendfile patch
- */
-#define KERNEL_WITH_SENDFILE_LENGTH_FIX 460001
-
- typedef enum { UNKNOWN = 0,
- NEW,
- OLD
- } api_e;
-
- static api_e api;
- int kernel_version;
- apr_size_t kernel_version_size;
-
- if (api != UNKNOWN) {
- return (api == OLD);
- }
- kernel_version = 0; /* silence compiler warning */
- kernel_version_size = sizeof(kernel_version);
- if (sysctlbyname("kern.osreldate", &kernel_version,
- &kernel_version_size, NULL, NULL) == 0 &&
- kernel_version < KERNEL_WITH_SENDFILE_LENGTH_FIX) {
- api = OLD;
- return 1;
- }
- /* size of kern.osreldate's output might change in the future
- * causing the sysctlbyname to fail,
- * but if it's the future, we should use the newer API
- */
- api = NEW;
- return 0;
-#else
- /* the build system's kernel is older than 3.4. Use the old API */
- return 1;
-#endif
-}
-
/* Release 3.1 or greater */
apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file,
apr_hdtr_t * hdtr, apr_off_t * offset,
@@ -455,7 +406,8 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file,
hdtr = &no_hdtr;
}
- else if (hdtr->numheaders && include_hdrs_in_length()) {
+#if __FreeBSD_version < 460001
+ else if (hdtr->numheaders) {
/* On early versions of FreeBSD sendfile, the number of bytes to send
* must include the length of the headers. Don't look at the man page
@@ -468,6 +420,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file,
bytes_to_send += hdtr->headers[i].iov_len;
}
}
+#endif
headerstruct.headers = hdtr->headers;
headerstruct.hdr_cnt = hdtr->numheaders;