]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Get mod_file_cache to refuse to compile on systems with neither
authorJeff Trawick <trawick@apache.org>
Sat, 31 Mar 2001 11:51:16 +0000 (11:51 +0000)
committerJeff Trawick <trawick@apache.org>
Sat, 31 Mar 2001 11:51:16 +0000 (11:51 +0000)
sendfile nor mmap.

Get mod_file_cache to compile on systems with sendfile but !mmap.

Submitted by: Greg Stein

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88623 13f79535-47bb-0310-9956-ffa450edef68

modules/cache/mod_file_cache.c

index 6f662a7767d8a459801a3613fd0a7c068180ceb6..345a8e108b50bba7124e7c20c8b80af6f41fcba8 100644 (file)
 */
 
 #include "apr.h"
+
+#if !(APR_HAS_SENDFILE || APR_HAS_MMAP)
+#error mod_file_cache only works on systems with APR_HAS_SENDFILE or APR_HAS_MMAP
+#endif
+
 #include "apr_mmap.h"
 #include "apr_strings.h"
 #include "apr_hash.h"
@@ -212,6 +217,7 @@ static void cache_the_file(cmd_parms *cmd, const char *filename, int mmap)
     new_file = apr_pcalloc(cmd->pool, sizeof(a_file));
     new_file->finfo = tmp.finfo;
 
+#if APR_HAS_MMAP
     if (mmap) {
          /* MMAPFile directive. MMAP'ing the file */
         if ((rc = apr_mmap_create(&new_file->mm, fd, 0, new_file->finfo.size,
@@ -224,8 +230,9 @@ static void cache_the_file(cmd_parms *cmd, const char *filename, int mmap)
         apr_file_close(fd);
         new_file->is_mmapped = TRUE;
     }
+#endif
 #if APR_HAS_SENDFILE
-    else {
+    if (!mmap) {
         /* CacheFile directive. Caching the file handle */
         new_file->is_mmapped = FALSE;
         new_file->file = fd;
@@ -263,7 +270,7 @@ static const char *cachefilemmap(cmd_parms *cmd, void *dummy, const char *filena
 #else
     /* MMAP not supported by this OS */
     ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, cmd->server,
-                 "mod_file_cache: unable to cache file: %s. MMAP is not supported by this OS", fspec);
+                 "mod_file_cache: unable to cache file: %s. MMAP is not supported by this OS", filename);
 #endif
     return NULL;
 }