1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 * @brief Apache Mutex support library
21 * @defgroup APACHE_CORE_MUTEX Mutex Library
22 * @ingroup APACHE_CORE
30 #include "apr_global_mutex.h"
32 #if APR_HAS_FLOCK_SERIALIZE
33 # define AP_LIST_FLOCK_SERIALIZE ", 'flock:/path/to/file'"
35 # define AP_LIST_FLOCK_SERIALIZE
37 #if APR_HAS_FCNTL_SERIALIZE
38 # define AP_LIST_FCNTL_SERIALIZE ", 'fcntl:/path/to/file'"
40 # define AP_LIST_FCNTL_SERIALIZE
42 #if APR_HAS_SYSVSEM_SERIALIZE && !defined(PERCHILD_MPM)
43 # define AP_LIST_SYSVSEM_SERIALIZE ", 'sysvsem'"
45 # define AP_LIST_SYSVSEM_SERIALIZE
47 #if APR_HAS_POSIXSEM_SERIALIZE
48 # define AP_LIST_POSIXSEM_SERIALIZE ", 'posixsem'"
50 # define AP_LIST_POSIXSEM_SERIALIZE
52 #if APR_HAS_PROC_PTHREAD_SERIALIZE
53 # define AP_LIST_PTHREAD_SERIALIZE ", 'pthread'"
55 # define AP_LIST_PTHREAD_SERIALIZE
57 #if APR_HAS_FLOCK_SERIALIZE || APR_HAS_FCNTL_SERIALIZE
58 # define AP_LIST_FILE_SERIALIZE ", 'file:/path/to/file'"
60 # define AP_LIST_FILE_SERIALIZE
62 #if (APR_HAS_SYSVSEM_SERIALIZE && !defined(PERCHILD_MPM)) || APR_HAS_POSIXSEM_SERIALIZE
63 # define AP_LIST_SEM_SERIALIZE ", 'sem'"
65 # define AP_LIST_SEM_SERIALIZE
68 #define AP_ALL_AVAILABLE_MUTEXES_STRING \
69 "Mutex mechanisms are: 'none', 'default'" \
70 AP_LIST_FLOCK_SERIALIZE AP_LIST_FCNTL_SERIALIZE \
71 AP_LIST_FILE_SERIALIZE AP_LIST_PTHREAD_SERIALIZE \
72 AP_LIST_SYSVSEM_SERIALIZE AP_LIST_POSIXSEM_SERIALIZE \
75 #define AP_AVAILABLE_MUTEXES_STRING \
76 "Mutex mechanisms are: 'default'" \
77 AP_LIST_FLOCK_SERIALIZE AP_LIST_FCNTL_SERIALIZE \
78 AP_LIST_FILE_SERIALIZE AP_LIST_PTHREAD_SERIALIZE \
79 AP_LIST_SYSVSEM_SERIALIZE AP_LIST_POSIXSEM_SERIALIZE \
87 * Get Mutex config data and parse it
88 * @param arg The mutex config string
89 * @param pool The allocation pool
90 * @param mutexmech The APR mutex locking mechanism
91 * @param mutexfile The lockfile to use as required
92 * @return APR status code
93 * @fn apr_status_t ap_parse_mutex(const char *arg, apr_pool_t *pool,
94 apr_lockmech_e *mutexmech,
95 const char **mutexfile)
97 AP_DECLARE(apr_status_t) ap_parse_mutex(const char *arg, apr_pool_t *pool,
98 apr_lockmech_e *mutexmech,
99 const char **mutexfile);
106 #endif /* UTIL_MUTEX_H */