Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
util_mutex.h
Go to the documentation of this file.
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 
26 #ifndef UTIL_MUTEX_H
27 #define UTIL_MUTEX_H
28 
29 #include "httpd.h"
30 #include "http_config.h"
31 #include "apr_global_mutex.h"
32 
33 #if APR_HAS_FLOCK_SERIALIZE
34 # define AP_LIST_FLOCK_SERIALIZE ", 'flock:/path/to/file'"
35 #else
36 # define AP_LIST_FLOCK_SERIALIZE
37 #endif
38 #if APR_HAS_FCNTL_SERIALIZE
39 # define AP_LIST_FCNTL_SERIALIZE ", 'fcntl:/path/to/file'"
40 #else
41 # define AP_LIST_FCNTL_SERIALIZE
42 #endif
43 #if APR_HAS_SYSVSEM_SERIALIZE
44 # define AP_LIST_SYSVSEM_SERIALIZE ", 'sysvsem'"
45 #else
46 # define AP_LIST_SYSVSEM_SERIALIZE
47 #endif
48 #if APR_HAS_POSIXSEM_SERIALIZE
49 # define AP_LIST_POSIXSEM_SERIALIZE ", 'posixsem'"
50 #else
51 # define AP_LIST_POSIXSEM_SERIALIZE
52 #endif
53 #if APR_HAS_PROC_PTHREAD_SERIALIZE
54 # define AP_LIST_PTHREAD_SERIALIZE ", 'pthread'"
55 #else
56 # define AP_LIST_PTHREAD_SERIALIZE
57 #endif
58 #if APR_HAS_FLOCK_SERIALIZE || APR_HAS_FCNTL_SERIALIZE
59 # define AP_LIST_FILE_SERIALIZE ", 'file:/path/to/file'"
60 #else
61 # define AP_LIST_FILE_SERIALIZE
62 #endif
63 #if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_POSIXSEM_SERIALIZE
64 # define AP_LIST_SEM_SERIALIZE ", 'sem'"
65 #else
66 # define AP_LIST_SEM_SERIALIZE
67 #endif
68 
69 #define AP_ALL_AVAILABLE_MUTEXES_STRING \
70  "Mutex mechanisms are: 'none', 'default'" \
71  AP_LIST_FLOCK_SERIALIZE AP_LIST_FCNTL_SERIALIZE \
72  AP_LIST_FILE_SERIALIZE AP_LIST_PTHREAD_SERIALIZE \
73  AP_LIST_SYSVSEM_SERIALIZE AP_LIST_POSIXSEM_SERIALIZE \
74  AP_LIST_SEM_SERIALIZE
75 
76 #define AP_AVAILABLE_MUTEXES_STRING \
77  "Mutex mechanisms are: 'default'" \
78  AP_LIST_FLOCK_SERIALIZE AP_LIST_FCNTL_SERIALIZE \
79  AP_LIST_FILE_SERIALIZE AP_LIST_PTHREAD_SERIALIZE \
80  AP_LIST_SYSVSEM_SERIALIZE AP_LIST_POSIXSEM_SERIALIZE \
81  AP_LIST_SEM_SERIALIZE
82 
83 #ifdef __cplusplus
84 extern "C" {
85 #endif
86 
99  apr_lockmech_e *mutexmech,
100  const char **mutexfile);
101 
102 /* private function to process the Mutex directive */
103 AP_DECLARE_NONSTD(const char *) ap_set_mutex(cmd_parms *cmd, void *dummy,
104  const char *arg);
105 
106 /* private function to initialize Mutex infrastructure */
108 
113 #define AP_MUTEX_ALLOW_NONE 1 /* allow "none" as mutex implementation;
114  * respected only on ap_mutex_register()
115  */
116 #define AP_MUTEX_DEFAULT_NONE 2 /* default to "none" for this mutex;
117  * respected only on ap_mutex_register()
118  */
119 
157  const char *type,
158  const char *default_dir,
159  apr_lockmech_e default_mech,
160  apr_int32_t options);
161 
182  const char **name,
183  const char *type,
184  const char *instance_id,
185  server_rec *server,
186  apr_pool_t *pool,
187  apr_int32_t options);
188 
209  const char **name,
210  const char *type,
211  const char *instance_id,
212  server_rec *server,
213  apr_pool_t *pool,
214  apr_int32_t options);
215 
217 
218 #ifdef __cplusplus
219 }
220 #endif
221 
222 #endif /* UTIL_MUTEX_H */
223 
#define AP_CORE_DECLARE(x)
Definition: macros.h:3
void ap_mutex_init(apr_pool_t *p)
Apache Configuration.
Definition: apr_arch_file_io.h:107
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:552
#define AP_DECLARE(x)
Definition: macros.h:1
Definition: apr_arch_proc_mutex.h:27
#define AP_DECLARE_NONSTD(x)
Definition: macros.h:2
const char * ap_set_mutex(cmd_parms *cmd, void *dummy, const char *arg)
Definition: apr_arch_global_mutex.h:23
Definition: http_config.h:295
APR Global Locking Routines.
apr_status_t ap_mutex_register(apr_pool_t *pconf, const char *type, const char *default_dir, apr_lockmech_e default_mech, apr_int32_t options)
HTTP Daemon routines.
A structure to store information for each virtual server.
Definition: httpd.h:1303
apr_lockmech_e
Definition: apr_proc_mutex.h:46
apr_pool_t * p
apr_status_t ap_proc_mutex_create(apr_proc_mutex_t **mutex, const char **name, const char *type, const char *instance_id, server_rec *server, apr_pool_t *pool, apr_int32_t options)
apr_status_t ap_global_mutex_create(apr_global_mutex_t **mutex, const char **name, const char *type, const char *instance_id, server_rec *server, apr_pool_t *pool, apr_int32_t options)
apr_status_t ap_parse_mutex(const char *arg, apr_pool_t *pool, apr_lockmech_e *mutexmech, const char **mutexfile)
void ap_dump_mutexes(apr_pool_t *p, server_rec *s, apr_file_t *out)
const char * name
Definition: mod_dav.h:726
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
int apr_status_t
Definition: apr_errno.h:44
int apr_int32_t
Definition: apr.h:333