]>
Commit | Line | Data |
---|---|---|
18106d13 JR |
1 | diff -ur mod_watch-4.3/mod_watch.c mod_watch-4.3-mutex/mod_watch.c |
2 | --- mod_watch-4.3/mod_watch.c 2011-03-28 14:15:48.017826697 +0200 | |
3 | +++ mod_watch-4.3-mutex/mod_watch.c 2011-03-28 14:07:07.613894883 +0200 | |
4 | @@ -1466,6 +1466,63 @@ | |
5 | } | |
6 | ||
7 | /* | |
8 | + * WatchMutexMech directory | |
9 | + * | |
10 | + * Mutex mechanism to use for shared memory lock. | |
11 | + */ | |
12 | +static const char * | |
13 | +WatchMutexMech(cmd_parms *cmd, void *dconf, const char *mech) | |
14 | +{ | |
15 | + if (!strcasecmp(mech, "default")) { | |
16 | + shMutexMech = APR_LOCK_DEFAULT; | |
17 | + } | |
18 | +#if APR_HAS_FCNTL_SERIALIZE | |
19 | + else if (!strcasecmp(mech, "fcntl") || !strcasecmp(mech, "file")) { | |
20 | + shMutexMech = APR_LOCK_FCNTL; | |
21 | + } | |
22 | +#endif | |
23 | +#if APR_HAS_FLOCK_SERIALIZE | |
24 | + else if (!strcasecmp(mech, "flock") || !strcasecmp(mech, "file")) { | |
25 | + shMutexMech = APR_LOCK_FLOCK; | |
26 | + } | |
27 | +#endif | |
28 | +#if APR_HAS_POSIXSEM_SERIALIZE | |
29 | + else if (!strcasecmp(mech, "posixsem") || !strcasecmp(mech, "sem")) { | |
30 | + shMutexMech = APR_LOCK_POSIXSEM; | |
31 | + } | |
32 | +#endif | |
33 | +#if APR_HAS_PROC_PTHREAD_SERIALIZE | |
34 | + else if (!strcasecmp(mech, "pthread")) { | |
35 | + shMutexMech = APR_LOCK_PROC_PTHREAD; | |
36 | + } | |
37 | +#endif | |
38 | + else { | |
39 | + return apr_pstrcat(cmd->pool, "Invalid WatchMutexMech argument ", mech, | |
40 | + " (Valid WatchMutexMech mechanisms are: default" | |
41 | +#if APR_HAS_FLOCK_SERIALIZE || APR_HAS_FCNTL_SERIALIZE | |
42 | + ", file" | |
43 | +#endif | |
44 | +#if APR_HAS_FLOCK_SERIALIZE | |
45 | + ", flock" | |
46 | +#endif | |
47 | +#if APR_HAS_FCNTL_SERIALIZE | |
48 | + ", fcntl" | |
49 | +#endif | |
50 | +#if APR_HAS_POSIXSEM_SERIALIZE | |
51 | + ", sem" | |
52 | +#endif | |
53 | +#if APR_HAS_POSIXSEM_SERIALIZE | |
54 | + ", posixsem" | |
55 | +#endif | |
56 | +#if APR_HAS_PROC_PTHREAD_SERIALIZE | |
57 | + ", pthread" | |
58 | +#endif | |
59 | + ")", NULL); | |
60 | + } | |
61 | + return (const char *) 0; | |
62 | +} | |
63 | + | |
64 | +/* | |
65 | * WatchStateDirectory directory | |
66 | * | |
67 | * Absolute or server root relative directory where support and runtime | |
68 | @@ -1645,6 +1702,11 @@ | |
69 | ), | |
70 | ||
71 | AP_INIT_TAKE1( | |
72 | + "WatchMutexMech", WatchMutexMech, NULL, RSRC_CONF, | |
73 | + "Mutex mechanism to use for shared memory lock." | |
74 | + ), | |
75 | + | |
76 | + AP_INIT_TAKE1( | |
77 | "WatchStateDirectory", WatchStateDirectory, NULL, RSRC_CONF, | |
78 | "Spool directory for any support and runtime files." | |
79 | ), | |
80 | diff -ur mod_watch-4.3/SharedHash.c mod_watch-4.3-mutex/SharedHash.c | |
81 | --- mod_watch-4.3/SharedHash.c 2011-03-28 14:15:48.017826697 +0200 | |
82 | +++ mod_watch-4.3-mutex/SharedHash.c 2011-03-28 14:06:00.950400565 +0200 | |
83 | @@ -95,6 +95,8 @@ | |
84 | const char shScanFormat[] = SH_SCAN_FORMAT; | |
85 | const char shPrintFormat[] = SH_PRINT_FORMAT; | |
86 | ||
87 | +int shMutexMech = APR_LOCK_DEFAULT; | |
88 | + | |
89 | #ifdef BOUNDARY_CHECKING | |
90 | char * | |
91 | shVerifyString(struct shTable *tp, char *str) | |
92 | @@ -509,7 +515,7 @@ | |
93 | ||
94 | rc = apr_global_mutex_create( | |
95 | (apr_global_mutex_t **) &tp->mutex, | |
96 | - tp->lockfile, APR_LOCK_DEFAULT, p | |
97 | + tp->lockfile, shMutexMech, p | |
98 | ); | |
99 | if (rc != APR_SUCCESS) { | |
100 | ap_log_error( | |
101 | diff -ur mod_watch-4.3/SharedHash.h mod_watch-4.3-mutex/SharedHash.h | |
102 | --- mod_watch-4.3/SharedHash.h 2003-03-14 10:12:48.000000000 +0100 | |
103 | +++ mod_watch-4.3-mutex/SharedHash.h 2011-03-28 14:04:55.726981348 +0200 | |
104 | @@ -110,6 +110,8 @@ | |
105 | extern "C" { | |
106 | #endif | |
107 | ||
108 | +extern int shMutexMech; | |
109 | + | |
110 | extern const char shLockFile[]; | |
111 | extern const char shScanFormat[]; | |
112 | extern const char shPrintFormat[]; |