From: William A. Rowe Jr Date: Tue, 4 May 2010 17:36:57 +0000 (+0000) Subject: It is not inconvenient to return the derived filename here, let's X-Git-Tag: 2.3.6~139 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fe7d50b6a2d7f150a203c773f4760f9f92584003;p=apache It is not inconvenient to return the derived filename here, let's save the caller later hassle in looking this up, if they like. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@940979 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/util_mutex.h b/include/util_mutex.h index 935e94e998..2043e97389 100644 --- a/include/util_mutex.h +++ b/include/util_mutex.h @@ -167,20 +167,23 @@ AP_DECLARE(apr_status_t) ap_mutex_register(apr_pool_t *pconf, * stored. If this mutex is disabled, mutex will be set to NULL on * output. (That is allowed only if the AP_MUTEX_ALLOW_NONE flag is * passed to ap_mutex_register().) + * @param name The generated filename of the created mutex, or NULL if + * no file was created. Pass NULL if this result is not needed. * @param type The type name of the mutex, matching the type name passed * to ap_mutex_register(). * @param instance_id A unique string to be used in the lock filename IFF * this mutex type is multi-instance, NULL otherwise. - * @param s server_rec of main server - * @param pconf pool + * @param server server_rec of main server + * @param pool pool lifetime of the mutex * @param options combination of AP_MUTEX_* constants, or 0 for defaults * (currently none are defined for this function) */ AP_DECLARE(apr_status_t) ap_global_mutex_create(apr_global_mutex_t **mutex, + const char **name, const char *type, const char *instance_id, - server_rec *s, - apr_pool_t *pconf, + server_rec *server, + apr_pool_t *pool, apr_int32_t options); /** @@ -191,19 +194,23 @@ AP_DECLARE(apr_status_t) ap_global_mutex_create(apr_global_mutex_t **mutex, * stored. If this mutex is disabled, mutex will be set to NULL on * output. (That is allowed only if the AP_MUTEX_ALLOW_NONE flag is * passed to ap_mutex_register().) + * @param name The generated filename of the created mutex, or NULL if + * no file was created. Pass NULL if this result is not needed. * @param type The type name of the mutex, matching the type name passed * to ap_mutex_register(). * @param instance_id A unique string to be used in the lock filename IFF * this mutex type is multi-instance, NULL otherwise. - * @param s server_rec of main server - * @param pconf pool + * @param server server_rec of main server + * @param pool pool lifetime of the mutex * @param options combination of AP_MUTEX_* constants, or 0 for defaults * (currently none are defined for this function) */ AP_DECLARE(apr_status_t) ap_proc_mutex_create(apr_proc_mutex_t **mutex, + const char **name, const char *type, const char *instance_id, - server_rec *s, apr_pool_t *p, + server_rec *server, + apr_pool_t *pool, apr_int32_t options); #ifdef __cplusplus diff --git a/server/util_mutex.c b/server/util_mutex.c index 45f93b48a5..5896bf93a8 100644 --- a/server/util_mutex.c +++ b/server/util_mutex.c @@ -406,6 +406,7 @@ static void log_perms_failure(apr_status_t rv, server_rec *s, const char *type) } AP_DECLARE(apr_status_t) ap_global_mutex_create(apr_global_mutex_t **mutex, + const char **name, const char *type, const char *instance_id, server_rec *s, apr_pool_t *p, @@ -438,18 +439,21 @@ AP_DECLARE(apr_status_t) ap_global_mutex_create(apr_global_mutex_t **mutex, return rv; } + if (name) + *name = fname; + #ifdef AP_NEED_SET_MUTEX_PERMS rv = ap_unixd_set_global_mutex_perms(*mutex); if (rv != APR_SUCCESS) { log_perms_failure(rv, s, type); - return rv; } #endif - return APR_SUCCESS; + return rv; } AP_DECLARE(apr_status_t) ap_proc_mutex_create(apr_proc_mutex_t **mutex, + const char **name, const char *type, const char *instance_id, server_rec *s, apr_pool_t *p, @@ -482,13 +486,15 @@ AP_DECLARE(apr_status_t) ap_proc_mutex_create(apr_proc_mutex_t **mutex, return rv; } + if (name) + *name = fname; + #ifdef AP_NEED_SET_MUTEX_PERMS rv = ap_unixd_set_proc_mutex_perms(*mutex); if (rv != APR_SUCCESS) { log_perms_failure(rv, s, type); - return rv; } #endif - return APR_SUCCESS; + return rv; }