apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r106850 - /apr/apr/trunk/CHANGES /apr/apr/trunk/network_io/unix/sendrecv.c
Date Sun, 28 Nov 2004 21:51:48 GMT
Author: pquerna
Date: Sun Nov 28 13:51:46 2004
New Revision: 106850

URL: http://svn.apache.org/viewcvs?view=rev&rev=106850
Log:
Remove the Runtime test for the different sendfile revisions on FreeBSD.

PR: 25718
Submitted By: Mike Silbersack <silby silby.com>

Modified:
   apr/apr/trunk/CHANGES
   apr/apr/trunk/network_io/unix/sendrecv.c

Modified: apr/apr/trunk/CHANGES
Url: http://svn.apache.org/viewcvs/apr/apr/trunk/CHANGES?view=diff&rev=106850&p1=apr/apr/trunk/CHANGES&r1=106849&p2=apr/apr/trunk/CHANGES&r2=106850
==============================================================================
--- apr/apr/trunk/CHANGES	(original)
+++ apr/apr/trunk/CHANGES	Sun Nov 28 13:51:46 2004
@@ -1,5 +1,8 @@
 Changes for APR 1.1.0
 
+  *) Remove the runtime test for Sendfile versions on FreeBSD. PR 25718.
+     [Mike Silbersack <silby silby.com>, Paul Querna]
+
   *( rename the fopen defines (APR_READ, APR_WRITE, etc.) to have
      prefix APR_FOPEN_ (keeping the old defines) [Stas]
 

Modified: apr/apr/trunk/network_io/unix/sendrecv.c
Url: http://svn.apache.org/viewcvs/apr/apr/trunk/network_io/unix/sendrecv.c?view=diff&rev=106850&p1=apr/apr/trunk/network_io/unix/sendrecv.c&r1=106849&p2=apr/apr/trunk/network_io/unix/sendrecv.c&r2=106850
==============================================================================
--- apr/apr/trunk/network_io/unix/sendrecv.c	(original)
+++ apr/apr/trunk/network_io/unix/sendrecv.c	Sun Nov 28 13:51:46 2004
@@ -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 @@
 
 #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 @@
         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 @@
             bytes_to_send += hdtr->headers[i].iov_len;
         }
     }
+#endif
 
     headerstruct.headers = hdtr->headers;
     headerstruct.hdr_cnt = hdtr->numheaders;

Mime
View raw message