[mapserver-commits] r12337 - in trunk/mapserver/mapcache: . src

svn at osgeo.org svn at osgeo.org
Fri Aug 26 07:17:55 EDT 2011


Author: tbonfort
Date: 2011-08-26 04:17:55 -0700 (Fri, 26 Aug 2011)
New Revision: 12337

Modified:
   trunk/mapserver/mapcache/Makefile.inc.in
   trunk/mapserver/mapcache/configure.in
   trunk/mapserver/mapcache/src/lock.c
Log:
fix reference to wrong layer name in tms capabilities
thomas.bonfort | 2011-03-11 14:53:42 +0100 (Fri, 11 Mar 2011)

Modified: trunk/mapserver/mapcache/Makefile.inc.in
===================================================================
--- trunk/mapserver/mapcache/Makefile.inc.in	2011-08-26 11:17:50 UTC (rev 12336)
+++ trunk/mapserver/mapcache/Makefile.inc.in	2011-08-26 11:17:55 UTC (rev 12337)
@@ -1,5 +1,6 @@
 TARGETS=@TARGETS@ geocache_seed
 APXS=@APXS@
+HTTPD=@HTTPD@
 CC=@CC@
 APACHECTL=@APACHECTL@
 CFLAGS=@APR_CFLAGS@ @CFLAGS@ 
@@ -42,7 +43,7 @@
 CAIRO_LIB=@CAIRO_LIB@
 CAIRO_ENABLED=@CAIRO_ENABLED@
 
-MISC_ENABLED=@MISC_ENABLED@
+MISC_ENABLED=@MISC_ENABLED@ -DTHREADED_MPM=$(shell $(HTTPD) -V | grep "Server MPM" | grep -q "Prefork"; echo $$?)
 
 INCLUDES=-I../include $(MISC_ENABLED) $(CAIRO_ENABLED) $(CAIRO_INC) $(CURL_CFLAGS) $(PNG_INC) $(JPEG_INC) $(GDAL_INC) $(GDAL_ENABLED) $(APR_INC) $(APU_INC) $(MEMCACHE_ENABLED) $(PCRE_CFLAGS) $(PCRE_ENABLED)
 LIBS=$(CURL_LIBS) $(CAIRO_LIB) $(PNG_LIB) $(JPEG_LIB) $(GDAL_LIB) $(APR_LIBS) $(APU_LIBS) $(PCRE_LIBS)

Modified: trunk/mapserver/mapcache/configure.in
===================================================================
--- trunk/mapserver/mapcache/configure.in	2011-08-26 11:17:50 UTC (rev 12336)
+++ trunk/mapserver/mapcache/configure.in	2011-08-26 11:17:55 UTC (rev 12337)
@@ -81,6 +81,10 @@
     AC_SUBST(APXS_INC,-I`$APXS -q INCLUDEDIR`)
     AC_SUBST(APXS_LIBS,`$APXS -q LIBS`)
     AC_SUBST(APXS_LDFLAGS,`$APXS -q LDFLAGS`)
+    SBINDIR=`$APXS -q SBINDIR`
+    TARGET=`$APXS -q TARGET`
+    HTTPD="$SBINDIR/$TARGET"
+    AC_SUBST(HTTPD,"$HTTPD")
     
 ])
 

Modified: trunk/mapserver/mapcache/src/lock.c
===================================================================
--- trunk/mapserver/mapcache/src/lock.c	2011-08-26 11:17:50 UTC (rev 12336)
+++ trunk/mapserver/mapcache/src/lock.c	2011-08-26 11:17:55 UTC (rev 12337)
@@ -18,9 +18,11 @@
 #include <apr_file_io.h>
 #include <apr_strings.h>
 
+#if THREADED_MPM
+#include <unistd.h>
+#endif
 
 
-
 #ifdef USE_SEMLOCK
 #include <semaphore.h>
 #include <errno.h>
@@ -125,13 +127,14 @@
    char errmsg[120];
    apr_file_t *lock;
    apr_status_t rv;
-   rv = apr_file_open(&lock,lockname,APR_WRITE|APR_CREATE|APR_EXCL|APR_SHARELOCK|APR_XTHREAD,APR_OS_DEFAULT,ctx->pool);
+   rv = apr_file_open(&lock,lockname,APR_WRITE|APR_CREATE|APR_EXCL,APR_OS_DEFAULT,ctx->pool);
    if(rv!=APR_SUCCESS) {
       ctx->set_error(ctx,500, "failed to create lockfile %s: %s",
             lockname, apr_strerror(rv,errmsg,120));
       return;
    }
-
+#if THREADED_MPM
+#else
    /* we aquire an exclusive (i.e. write) lock on the file. For this to work, the file has to be opened with APR_WRITE mode */
    rv = apr_file_lock(lock,APR_FLOCK_EXCLUSIVE|APR_FLOCK_NONBLOCK);
    if(rv!=APR_SUCCESS) {
@@ -139,6 +142,7 @@
             lockname, apr_strerror(rv,errmsg,120));
       return;
    }
+#endif
    mt->lock = lock;
 #endif
 }
@@ -171,11 +175,15 @@
       return;
    }
    apr_file_t *lock = (apr_file_t*)mt->lock;
+   mt->lock = NULL;
+#if THREADED_MPM
+#else
    rv = apr_file_unlock(lock);
    if(rv!=APR_SUCCESS) {
       ctx->set_error(ctx,500, "failed to unlock lockfile %s: %s",
             lockname, apr_strerror(rv,errmsg,120));
    }
+#endif
    rv = apr_file_close(lock);
    if(rv!=APR_SUCCESS) {
       ctx->set_error(ctx,500, "failed to close lockfile %s: %s",
@@ -219,7 +227,7 @@
    apr_status_t rv;
    char errmsg[120];
    apr_file_t *lock;
-   rv = apr_file_open(&lock,lockname,APR_READ|APR_SHARELOCK|APR_XTHREAD,APR_OS_DEFAULT,ctx->pool);
+   rv = apr_file_open(&lock,lockname,APR_READ,APR_OS_DEFAULT,ctx->pool);
    if(APR_STATUS_IS_ENOENT(rv)) {
       /* the lock file does not exist, the metatile is not locked */
       return GEOCACHE_FALSE;
@@ -231,6 +239,10 @@
                apr_strerror(rv,errmsg,120));
          return GEOCACHE_FALSE;
       } else {
+#if THREADED_MPM
+         apr_file_close(lock);
+         return GEOCACHE_TRUE;
+#else
          /* the file exists, which means there probably is a lock. make sure it isn't locked anyhow */
          rv = apr_file_lock(lock,APR_FLOCK_SHARED|APR_FLOCK_NONBLOCK);
          if(rv != APR_SUCCESS) {
@@ -263,7 +275,7 @@
             }
             return GEOCACHE_FALSE;
          }
-
+#endif
       }
    }
 #endif
@@ -306,7 +318,7 @@
    char errmsg[120];
    apr_file_t *lock;
    apr_status_t rv;
-   rv = apr_file_open(&lock,lockname,APR_READ|APR_SHARELOCK|APR_XTHREAD,APR_OS_DEFAULT,ctx->pool);
+   rv = apr_file_open(&lock,lockname,APR_READ,APR_OS_DEFAULT,ctx->pool);
    if(rv != APR_SUCCESS) {
       if(APR_STATUS_IS_ENOENT(rv)) {
          /* the lock file does not exist, it might have been removed since we checked.
@@ -319,7 +331,16 @@
          return;
       }
    }
-   
+#if THREADED_MPM
+   apr_file_close(lock);
+   while(!APR_STATUS_IS_ENOENT(rv)) {
+      usleep(500000);
+      rv = apr_file_open(&lock,lockname,APR_READ,APR_OS_DEFAULT,ctx->pool);
+      if(rv == APR_SUCCESS) {
+         apr_file_close(lock);
+      }
+   }
+#else
    rv = apr_file_lock(lock,APR_FLOCK_SHARED);
    if(rv!=APR_SUCCESS) {
       ctx->set_error(ctx,500, "lock_wait: failed to aquire a shared lock on lockfile %s: %s",
@@ -330,6 +351,7 @@
       ctx->set_error(ctx,500, "lock_wait: failed to close lockfile %s: %s",
             lockname, apr_strerror(rv,errmsg,120));
    }
+#endif
 
 #endif
 }



More information about the mapserver-commits mailing list