/* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
*/
/* * util_mutex.c: Useful functions for determining allowable * mutexes and mutex settings
*/
/* Unless the method above assumed responsibility for setting up * mutexfile and NULLing out file, presume it is a file we * are looking to use
*/ if (file) {
*mutexfile = ap_server_root_relative(pool, file); if (!*mutexfile) { return APR_BADARG;
}
}
return APR_SUCCESS;
}
typedefstruct {
apr_int32_t options; int set; int none; int omit_pid;
apr_lockmech_e mech; constchar *dir;
} mutex_cfg_t;
/* hash is created the first time a module calls ap_mutex_register(), * rather than attempting to be the REALLY_REALLY_FIRST pre-config * hook; it is cleaned up when the associated pool goes away; assume * pconf is the pool passed to ap_mutex_register()
*/ static apr_hash_t *mxcfg_by_type;
mechdir = ap_getword_conf(cmd->pool, &arg); if (*mechdir == '\0') { return"Mutex requires at least a mechanism argument ("
AP_ALL_AVAILABLE_MUTEXES_STRING ")";
}
/* "OmitPID" can appear at the end of the list, so build a list of * mutex type names while looking for "OmitPID" (anywhere) or the end
*/
type_list = apr_array_make(cmd->pool, 4, sizeof(constchar *)); while (*arg) { constchar *s = ap_getword_conf(cmd->pool, &arg);
/* MUST exist in table, or wasn't registered */
mxcfg = apr_hash_get(mxcfg_by_type, type, APR_HASH_KEY_STRING); if (!mxcfg) { return NULL;
}
/* order of precedence: * 1. Mutex directive for this mutex * 2. Mutex directive for "default" * 3. Defaults for this mutex from ap_mutex_register() * 4. Global defaults
*/
if (!newcfg->none && mutex_needs_file(newcfg->mech) && !newcfg->dir) { /* a file-based mutex mechanism was configured, but * without a mutex file directory; go back through * the chain to find the directory, store in new * mutex cfg structure
*/
newcfg = apr_pmemdup(p, newcfg, sizeof *newcfg);
/* !true if dir not already set: mxcfg->set && defcfg->dir */ if (defcfg->set && defcfg->dir) {
newcfg->dir = defcfg->dir;
} elseif (mxcfg->dir) {
newcfg->dir = mxcfg->dir;
} else {
newcfg->dir = defcfg->dir;
}
}
return newcfg;
}
staticvoid log_bad_create_options(server_rec *s, constchar *type)
{
ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(00021) "Invalid options were specified when creating the %s mutex",
type);
}
staticvoid log_unknown_type(server_rec *s, constchar *type)
{
ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(00022) "Can't create mutex of unknown type %s", type);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.