]>
Commit | Line | Data |
---|---|---|
0cb5ea8c ER |
1 | --- php-5.2.6/sapi/cgi/fpm/fpm_php.c 2008-11-03 21:14:16.462343387 +0200 |
2 | +++ php-5.2.6-zts/sapi/cgi/fpm/fpm_php.c 2008-11-03 20:48:33.138185064 +0200 | |
3 | @@ -19,7 +19,7 @@ | |
4 | #include "fpm_cleanup.h" | |
5 | #include "fpm_worker_pool.h" | |
6 | ||
7 | -static int zend_ini_alter_master(char *name, int name_length, char *new_value, int new_value_length, int stage) | |
8 | +static int zend_ini_alter_master(char *name, int name_length, char *new_value, int new_value_length, int stage TSRMLS_DC) | |
9 | { | |
10 | zend_ini_entry *ini_entry; | |
11 | char *duplicate; | |
12 | @@ -32,7 +32,7 @@ | |
13 | ||
14 | if (!ini_entry->on_modify | |
15 | || ini_entry->on_modify(ini_entry, duplicate, new_value_length, | |
16 | - ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage) == SUCCESS) { | |
17 | + ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC) == SUCCESS) { | |
18 | ini_entry->value = duplicate; | |
19 | ini_entry->value_length = new_value_length; | |
20 | } else { | |
21 | @@ -42,7 +42,7 @@ | |
22 | return SUCCESS; | |
23 | } | |
24 | ||
25 | -static void fpm_php_disable(char *value, int (*zend_disable)(char *, uint)) | |
26 | +static void fpm_php_disable(char *value, int (*zend_disable)(char *, uint TSRMLS_DC) TSRMLS_DC) | |
27 | { | |
28 | char *s = 0, *e = value; | |
29 | ||
30 | @@ -52,7 +52,7 @@ | |
31 | case ',': | |
32 | if (s) { | |
33 | *e = '\0'; | |
34 | - zend_disable(s, e - s); | |
35 | + zend_disable(s, e - s TSRMLS_CC); | |
36 | s = 0; | |
37 | } | |
38 | break; | |
39 | @@ -66,11 +66,11 @@ | |
40 | } | |
41 | ||
42 | if (s) { | |
43 | - zend_disable(s, e - s); | |
44 | + zend_disable(s, e - s TSRMLS_CC); | |
45 | } | |
46 | } | |
47 | ||
48 | -static int fpm_php_apply_defines(struct fpm_worker_pool_s *wp) | |
49 | +static int fpm_php_apply_defines(struct fpm_worker_pool_s *wp TSRMLS_DC) | |
50 | { | |
51 | struct key_value_s *kv; | |
52 | ||
53 | @@ -89,29 +89,29 @@ | |
54 | zval filename; | |
55 | ZVAL_STRINGL(&filename, value, value_len, 0); | |
56 | #if (PHP_MAJOR_VERSION >= 5) | |
57 | - php_dl(&filename, MODULE_PERSISTENT, &zv, 1); | |
58 | + php_dl(&filename, MODULE_PERSISTENT, &zv, 1 TSRMLS_CC); | |
59 | #else | |
60 | - php_dl(&filename, MODULE_PERSISTENT, &zv); | |
61 | + php_dl(&filename, MODULE_PERSISTENT, &zv TSRMLS_CC); | |
62 | #endif | |
63 | #endif | |
64 | continue; | |
65 | } | |
66 | ||
67 | - zend_ini_alter_master(name, name_len + 1, value, value_len, PHP_INI_STAGE_ACTIVATE); | |
68 | + zend_ini_alter_master(name, name_len + 1, value, value_len, PHP_INI_STAGE_ACTIVATE TSRMLS_CC); | |
69 | ||
70 | if (!strcmp(name, "disable_functions") && *value) { | |
71 | char *v = strdup(value); | |
72 | #if (PHP_MAJOR_VERSION >= 5) | |
73 | PG(disable_functions) = v; | |
74 | #endif | |
75 | - fpm_php_disable(v, zend_disable_function); | |
76 | + fpm_php_disable(v, zend_disable_function TSRMLS_CC); | |
77 | } | |
78 | else if (!strcmp(name, "disable_classes") && *value) { | |
79 | char *v = strdup(value); | |
80 | #if (PHP_MAJOR_VERSION >= 5) | |
81 | PG(disable_classes) = v; | |
82 | #endif | |
83 | - fpm_php_disable(v, zend_disable_class); | |
84 | + fpm_php_disable(v, zend_disable_class TSRMLS_CC); | |
85 | } | |
86 | } | |
87 | ||
88 | @@ -127,24 +127,24 @@ | |
89 | return 0; | |
90 | } | |
91 | ||
92 | -char *fpm_php_script_filename() | |
93 | +char *fpm_php_script_filename(TSRMLS_D) | |
94 | { | |
95 | return SG(request_info).path_translated; | |
96 | } | |
97 | ||
98 | -char *fpm_php_request_method() | |
99 | +char *fpm_php_request_method(TSRMLS_D) | |
100 | { | |
101 | return (char *) SG(request_info).request_method; | |
102 | } | |
103 | ||
104 | -size_t fpm_php_content_length() | |
105 | +size_t fpm_php_content_length(TSRMLS_D) | |
106 | { | |
107 | return SG(request_info).content_length; | |
108 | } | |
109 | ||
110 | -static void fpm_php_cleanup(int which, void *arg) | |
111 | +static void fpm_php_cleanup(int which, void *arg TSRMLS_DC) | |
112 | { | |
113 | - php_module_shutdown(); | |
114 | + php_module_shutdown(TSRMLS_C); | |
115 | sapi_shutdown(); | |
116 | } | |
117 | ||
118 | @@ -155,14 +155,15 @@ | |
119 | ||
120 | int fpm_php_init_main() | |
121 | { | |
122 | + // XXX unable to pass TSRMLS_CC to the cleanup func! | |
123 | fpm_cleanup_add(FPM_CLEANUP_PARENT, fpm_php_cleanup, 0); | |
124 | ||
125 | return 0; | |
126 | } | |
127 | ||
128 | -int fpm_php_init_child(struct fpm_worker_pool_s *wp) | |
129 | +int fpm_php_init_child(struct fpm_worker_pool_s *wp TSRMLS_DC) | |
130 | { | |
131 | - if (0 > fpm_php_apply_defines(wp) || | |
132 | + if (0 > fpm_php_apply_defines(wp TSRMLS_CC) || | |
133 | 0 > fpm_php_set_allowed_clients(wp)) { | |
134 | return -1; | |
135 | } | |
136 | --- php-5.2.6-zts/sapi/cgi/fpm/fpm_php.h 2008-11-03 20:46:17.348139255 +0200 | |
137 | +++ php-5.2.6/sapi/cgi/fpm/fpm_php.h 2008-11-03 21:40:41.811143906 +0200 | |
138 | @@ -6,10 +6,11 @@ | |
139 | #define FPM_PHP_H 1 | |
140 | ||
141 | #include "fpm_worker_pool.h" | |
142 | +#include "TSRM.h" | |
143 | ||
144 | #include "build-defs.h" /* for PHP_ defines */ | |
145 | ||
146 | -int fpm_php_init_child(struct fpm_worker_pool_s *wp); | |
147 | +int fpm_php_init_child(struct fpm_worker_pool_s *wp TSRMLS_DC); | |
148 | char *fpm_php_script_filename(); | |
149 | char *fpm_php_request_method(); | |
150 | size_t fpm_php_content_length(); | |
151 | --- php-5.2.6/sapi/cgi/fpm/fpm_php_trace.c 2008-11-03 21:14:16.462343387 +0200 | |
152 | +++ php-5.2.6-zts/sapi/cgi/fpm/fpm_php_trace.c 2008-11-03 20:47:26.611462721 +0200 | |
153 | @@ -35,7 +35,7 @@ | |
154 | #endif | |
155 | ||
156 | ||
157 | -static int fpm_php_trace_dump(struct fpm_child_s *child, FILE *slowlog) | |
158 | +static int fpm_php_trace_dump(struct fpm_child_s *child, FILE *slowlog TSRMLS_DC) | |
159 | { | |
160 | int callers_limit = 20; | |
161 | pid_t pid = child->pid; | |
162 | @@ -131,7 +131,7 @@ | |
163 | return 0; | |
164 | } | |
165 | ||
166 | -void fpm_php_trace(struct fpm_child_s *child) | |
167 | +void fpm_php_trace(struct fpm_child_s *child TSRMLS_DC) | |
168 | { | |
169 | FILE *slowlog; | |
170 | ||
171 | @@ -148,7 +148,7 @@ | |
172 | goto done1; | |
173 | } | |
174 | ||
175 | - if (0 > fpm_php_trace_dump(child, slowlog)) { | |
176 | + if (0 > fpm_php_trace_dump(child, slowlog TSRMLS_CC)) { | |
177 | fprintf(slowlog, "+++ dump failed\n"); | |
178 | } | |
179 | ||
180 | --- php-5.2.6/sapi/cgi/fpm/fpm_php_trace.h 2008-11-03 21:14:16.462343387 +0200 | |
181 | +++ php-5.2.6-zts/sapi/cgi/fpm/fpm_php_trace.h 2008-11-03 20:47:38.411626098 +0200 | |
182 | @@ -7,7 +7,7 @@ | |
183 | ||
184 | struct fpm_child_s; | |
185 | ||
186 | -void fpm_php_trace(struct fpm_child_s *); | |
187 | +void fpm_php_trace(struct fpm_child_s *child TSRMLS_DC); | |
188 | ||
189 | #endif | |
190 | ||
98afe1ff ER |
191 | --- php-5.2.6/sapi/cgi/fpm/fpm_children.c 2008-11-03 21:47:04.141104879 +0200 |
192 | +++ php-5.2.6-zts/sapi/cgi/fpm/fpm_children.c 2008-11-03 21:45:17.088199172 +0200 | |
193 | @@ -32,7 +32,7 @@ | |
194 | static time_t *last_faults; | |
195 | static int fault; | |
196 | ||
197 | -static int fpm_children_make(struct fpm_worker_pool_s *wp, int in_event_loop); | |
198 | +static int fpm_children_make(struct fpm_worker_pool_s *wp, int in_event_loop TSRMLS_DC); | |
199 | ||
200 | static void fpm_children_cleanup(int which, void *arg) | |
201 | { | |
202 | @@ -127,7 +127,7 @@ | |
203 | return child; | |
204 | } | |
205 | ||
206 | -static void fpm_child_init(struct fpm_worker_pool_s *wp) | |
207 | +static void fpm_child_init(struct fpm_worker_pool_s *wp TSRMLS_DC) | |
208 | { | |
209 | fpm_globals.max_requests = wp->config->max_requests; | |
210 | ||
211 | @@ -135,7 +135,7 @@ | |
212 | 0 > fpm_unix_init_child(wp) || | |
213 | 0 > fpm_signals_init_child() || | |
214 | 0 > fpm_env_init_child(wp) || | |
215 | - 0 > fpm_php_init_child(wp)) { | |
216 | + 0 > fpm_php_init_child(wp TSRMLS_CC)) { | |
217 | ||
218 | zlog(ZLOG_STUFF, ZLOG_ERROR, "child failed to initialize (pool %s)", wp->config->name); | |
219 | exit(255); | |
220 | @@ -154,7 +154,7 @@ | |
221 | return 0; | |
222 | } | |
223 | ||
224 | -void fpm_children_bury() | |
225 | +void fpm_children_bury(TSRMLS_D) | |
226 | { | |
227 | int status; | |
228 | pid_t pid; | |
229 | @@ -246,7 +246,7 @@ | |
230 | } | |
231 | } | |
232 | ||
233 | - fpm_children_make(wp, 1 /* in event loop */); | |
234 | + fpm_children_make(wp, 1 /* in event loop */ TSRMLS_CC); | |
235 | ||
236 | if (fpm_globals.is_child) { | |
237 | break; | |
238 | @@ -308,7 +308,7 @@ | |
239 | fpm_child_link(child); | |
240 | } | |
241 | ||
242 | -static int fpm_children_make(struct fpm_worker_pool_s *wp, int in_event_loop) | |
243 | +static int fpm_children_make(struct fpm_worker_pool_s *wp, int in_event_loop TSRMLS_DC) | |
244 | { | |
245 | int enough = 0; | |
246 | pid_t pid; | |
247 | @@ -333,7 +333,7 @@ | |
248 | if (in_event_loop) { | |
249 | fpm_event_exit_loop(); | |
250 | } | |
251 | - fpm_child_init(wp); | |
252 | + fpm_child_init(wp TSRMLS_CC); | |
253 | return 0; | |
254 | ||
255 | case -1 : | |
256 | @@ -357,9 +357,9 @@ | |
257 | return 1; /* we are done */ | |
258 | } | |
259 | ||
260 | -int fpm_children_create_initial(struct fpm_worker_pool_s *wp) | |
261 | +int fpm_children_create_initial(struct fpm_worker_pool_s *wp TSRMLS_DC) | |
262 | { | |
263 | - return fpm_children_make(wp, 0 /* not in event loop yet */); | |
264 | + return fpm_children_make(wp, 0 /* not in event loop yet */ TSRMLS_CC); | |
265 | } | |
266 | ||
267 | int fpm_children_init_main() | |
268 | --- php-5.2.6/sapi/cgi/fpm/fpm_children.h 2008-11-03 21:47:04.141104879 +0200 | |
269 | +++ php-5.2.6-zts/sapi/cgi/fpm/fpm_children.h 2008-11-03 21:45:49.607859881 +0200 | |
270 | @@ -9,9 +9,10 @@ | |
271 | #include <sys/types.h> | |
272 | #include <event.h> | |
273 | ||
274 | +#include "TSRM.h" | |
275 | #include "fpm_worker_pool.h" | |
276 | ||
277 | -int fpm_children_create_initial(struct fpm_worker_pool_s *wp); | |
278 | +int fpm_children_create_initial(struct fpm_worker_pool_s *wp TSRMLS_DC); | |
279 | int fpm_children_free(struct fpm_child_s *child); | |
280 | void fpm_children_bury(); | |
281 | int fpm_children_init_main(); | |
282 | --- php-5.2.6/sapi/cgi/fpm/fpm_clock.c 2008-11-03 21:47:04.141104879 +0200 | |
283 | +++ php-5.2.6-zts/sapi/cgi/fpm/fpm_clock.c 2008-11-03 21:46:02.415277547 +0200 | |
284 | @@ -13,7 +13,7 @@ | |
285 | ||
286 | ||
287 | /* posix monotonic clock - preferred source of time */ | |
288 | -#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) | |
289 | +#if 0 && defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) | |
290 | ||
291 | static int monotonic_works; | |
292 | ||
91fbb6f9 ER |
293 | --- php-5.2.6/sapi/cgi/fpm/fpm.c 2008-11-03 22:08:17.285352817 +0200 |
294 | +++ php-5.2.6-zts/sapi/cgi/fpm/fpm.c 2008-11-03 22:07:14.678692152 +0200 | |
295 | @@ -56,7 +56,7 @@ | |
296 | ||
297 | /* children: return listening socket | |
298 | parent: never return */ | |
299 | -int fpm_run(int *max_requests) | |
300 | +int fpm_run(int *max_requests TSRMLS_DC) | |
301 | { | |
302 | struct fpm_worker_pool_s *wp; | |
303 | ||
304 | @@ -64,7 +64,7 @@ | |
305 | for (wp = fpm_worker_all_pools; wp; wp = wp->next) { | |
306 | int is_parent; | |
307 | ||
308 | - is_parent = fpm_children_create_initial(wp); | |
309 | + is_parent = fpm_children_create_initial(wp TSRMLS_CC); | |
310 | ||
311 | if (!is_parent) { | |
312 | goto run_child; | |
313 | --- php-5.2.6/sapi/cgi/fpm/fpm.h 2008-11-03 22:08:17.288686240 +0200 | |
314 | +++ php-5.2.6-zts/sapi/cgi/fpm/fpm.h 2008-11-03 22:06:06.847658292 +0200 | |
315 | @@ -6,8 +6,9 @@ | |
316 | #define FPM_H 1 | |
317 | ||
318 | #include <unistd.h> | |
319 | +#include "TSRM.h" | |
320 | ||
321 | -int fpm_run(int *max_requests); | |
322 | +int fpm_run(int *max_requests TSRMLS_DC); | |
323 | int fpm_init(int argc, char **argv, char *config); | |
324 | ||
325 | struct fpm_globals_s { | |
326 | --- php-5.2.6/sapi/cgi/cgi_main.c~ 2008-11-03 22:09:38.000000000 +0200 | |
327 | +++ php-5.2.6/sapi/cgi/cgi_main.c 2008-11-03 22:13:01.700949038 +0200 | |
328 | @@ -1604,7 +1604,7 @@ | |
329 | return FAILURE; | |
330 | } | |
331 | ||
332 | - fcgi_fd = fpm_run(&max_requests); | |
333 | + fcgi_fd = fpm_run(&max_requests TSRMLS_CC); | |
334 | ||
335 | fcgi_set_is_fastcgi(fastcgi = 1); | |
336 | } |