You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2013/06/30 16:42:06 UTC
svn commit: r1498136 -
/subversion/trunk/subversion/libsvn_subr/named_atomic.c
Author: brane
Date: Sun Jun 30 14:42:05 2013
New Revision: 1498136
URL: http://svn.apache.org/r1498136
Log:
Disable named atomics if APR does not implement memory-mapped files.
People still use Subversion on platforms where mmap is not available.
See: http://mail-archives.apache.org/mod_mbox/subversion-dev/201306.mbox/%3C51CE9626.2000201%40gknw.net%3E
* subversion/libsvn_subr/named_atomic.c
(mutex_initialized, init_thread_mutex, delete_lock_file):
Elide when !APR_HAS_MMAP.
(svn_named_atomic__is_supported): Return FALSE when !APR_HAS_MMAP.
(svn_atomic_namespace__create): Return APR_ENOTIMPL when !APR_HAS_MMAP.
Modified:
subversion/trunk/subversion/libsvn_subr/named_atomic.c
Modified: subversion/trunk/subversion/libsvn_subr/named_atomic.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/named_atomic.c?rev=1498136&r1=1498135&r2=1498136&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/named_atomic.c (original)
+++ subversion/trunk/subversion/libsvn_subr/named_atomic.c Sun Jun 30 14:42:05 2013
@@ -251,6 +251,7 @@ struct svn_atomic_namespace__t
*/
static svn_mutex__t *thread_mutex = NULL;
+#if APR_HAS_MMAP
/* Initialization flag for the above used by svn_atomic__init_once.
*/
static volatile svn_atomic_t mutex_initialized = FALSE;
@@ -266,6 +267,7 @@ init_thread_mutex(void *baton, apr_pool_
return svn_mutex__init(&thread_mutex, USE_THREAD_MUTEX, global_pool);
}
+#endif /* APR_HAS_MMAP */
/* Utility that acquires our global mutex and converts error types.
*/
@@ -297,6 +299,7 @@ unlock(struct mutex_t *mutex, svn_error_
unlock_err));
}
+#if APR_HAS_MMAP
/* The last user to close a particular namespace should also remove the
* lock file. Failure to do so, however, does not affect further uses
* of the same namespace.
@@ -318,6 +321,7 @@ delete_lock_file(void *arg)
return status;
}
+#endif /* APR_HAS_MMAP */
/* Validate the ATOMIC parameter, i.e it's address. Correct code will
* never need this but if someone should accidentally to use a NULL or
@@ -351,7 +355,11 @@ return_atomic(svn_named_atomic__t **atom
svn_boolean_t
svn_named_atomic__is_supported(void)
{
-#ifdef _WIN32
+#if !APR_HAS_MMAP
+ return FALSE;
+#elif !defined(_WIN32)
+ return TRUE;
+#else
static svn_tristate_t result = svn_tristate_unknown;
if (result == svn_tristate_unknown)
@@ -373,9 +381,7 @@ svn_named_atomic__is_supported(void)
}
return result == svn_tristate_true;
-#else
- return TRUE;
-#endif
+#endif /* _WIN32 */
}
svn_boolean_t
@@ -389,6 +395,9 @@ svn_atomic_namespace__create(svn_atomic_
const char *name,
apr_pool_t *result_pool)
{
+#if !APR_HAS_MMAP
+ return svn_error_create(APR_ENOTIMPL, NULL, NULL);
+#else
apr_status_t apr_err;
svn_error_t *err;
apr_file_t *file;
@@ -489,6 +498,7 @@ svn_atomic_namespace__create(svn_atomic_
/* Unlock to allow other processes may access the shared memory as well.
*/
return unlock(&new_ns->mutex, err);
+#endif /* APR_HAS_MMAP */
}
svn_error_t *