@@ -118,49 +118,6 @@ zend_bool file_cache_only = 0; /* process uses file cache only */
118
118
zend_bool fallback_process = 0 ; /* process uses file cache fallback */
119
119
#endif
120
120
121
- #ifdef HAVE_SIGPROCMASK
122
- static sigset_t mask_all_signals ;
123
-
124
- # if ZEND_DEBUG
125
- # ifdef ZTS
126
- ZEND_TLS int _signals_masked = 0 ;
127
- # else
128
- static int _signals_masked = 0 ;
129
- # endif
130
- # define DEBUG_BLOCK_ALL_SIGNALS () _signals_masked += 1
131
- # define DEBUG_UNBLOCK_ALL_SIGNALS () \
132
- if (--_signals_masked) \
133
- zend_error_noreturn(E_ERROR, "Cannot nest BLOCK_ALL_SIGNALS; it is not re-entrant")
134
- # else
135
- # define DEBUG_BLOCK_ALL_SIGNALS () do {} while (0)
136
- # define DEBUG_UNBLOCK_ALL_SIGNALS () do {} while (0)
137
- # endif
138
-
139
- # define BLOCK_ALL_SIGNALS () \
140
- sigset_t _oldmask; \
141
- DEBUG_BLOCK_ALL_SIGNALS(); \
142
- MASK_ALL_SIGNALS()
143
- # define UNBLOCK_ALL_SIGNALS () \
144
- DEBUG_UNBLOCK_ALL_SIGNALS(); \
145
- UNMASK_ALL_SIGNALS()
146
-
147
- # ifdef ZTS
148
- # define MASK_ALL_SIGNALS () \
149
- tsrm_sigmask(SIG_BLOCK, &mask_all_signals, &_oldmask)
150
- # define UNMASK_ALL_SIGNALS () \
151
- tsrm_sigmask(SIG_SETMASK, &_oldmask, NULL)
152
- # else
153
- # define MASK_ALL_SIGNALS () \
154
- sigprocmask(SIG_BLOCK, &mask_all_signals, &_oldmask)
155
- # define UNMASK_ALL_SIGNALS () \
156
- sigprocmask(SIG_SETMASK, &_oldmask, NULL)
157
- # endif
158
-
159
- #else
160
- # define BLOCK_ALL_SIGNALS () do {} while(0)
161
- # define UNBLOCK_ALL_SIGNALS () do {} while(0)
162
- #endif
163
-
164
121
static zend_op_array * (* accelerator_orig_compile_file )(zend_file_handle * file_handle , int type );
165
122
static int (* accelerator_orig_zend_stream_open_function )(const char * filename , zend_file_handle * handle );
166
123
static zend_string * (* accelerator_orig_zend_resolve_path )(const char * filename , size_t filename_len );
@@ -788,7 +745,7 @@ static zend_string* ZEND_FASTCALL accel_replace_string_by_shm_permanent(zend_str
788
745
789
746
static void accel_use_shm_interned_strings (void )
790
747
{
791
- BLOCK_ALL_SIGNALS ();
748
+ HANDLE_BLOCK_INTERRUPTIONS ();
792
749
SHM_UNPROTECT ();
793
750
zend_shared_alloc_lock ();
794
751
@@ -803,7 +760,7 @@ static void accel_use_shm_interned_strings(void)
803
760
804
761
zend_shared_alloc_unlock ();
805
762
SHM_PROTECT ();
806
- UNBLOCK_ALL_SIGNALS ();
763
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
807
764
}
808
765
809
766
#ifndef ZEND_WIN32
@@ -1202,7 +1159,7 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int *key_l
1202
1159
1203
1160
zend_string * str = accel_find_interned_string (cwd_str );
1204
1161
if (!str ) {
1205
- BLOCK_ALL_SIGNALS ();
1162
+ HANDLE_BLOCK_INTERRUPTIONS ();
1206
1163
SHM_UNPROTECT ();
1207
1164
zend_shared_alloc_lock ();
1208
1165
str = accel_new_interned_string (zend_string_copy (cwd_str ));
@@ -1212,7 +1169,7 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int *key_l
1212
1169
}
1213
1170
zend_shared_alloc_unlock ();
1214
1171
SHM_PROTECT ();
1215
- UNBLOCK_ALL_SIGNALS ();
1172
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
1216
1173
}
1217
1174
if (str ) {
1218
1175
char buf [32 ];
@@ -1246,7 +1203,7 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int *key_l
1246
1203
1247
1204
zend_string * str = accel_find_interned_string (ZCG (include_path ));
1248
1205
if (!str ) {
1249
- BLOCK_ALL_SIGNALS ();
1206
+ HANDLE_BLOCK_INTERRUPTIONS ();
1250
1207
SHM_UNPROTECT ();
1251
1208
zend_shared_alloc_lock ();
1252
1209
str = accel_new_interned_string (zend_string_copy (ZCG (include_path )));
@@ -1255,7 +1212,7 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int *key_l
1255
1212
}
1256
1213
zend_shared_alloc_unlock ();
1257
1214
SHM_PROTECT ();
1258
- UNBLOCK_ALL_SIGNALS ();
1215
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
1259
1216
}
1260
1217
if (str ) {
1261
1218
char buf [32 ];
@@ -1352,7 +1309,7 @@ int zend_accel_invalidate(const char *filename, size_t filename_len, zend_bool f
1352
1309
if (force ||
1353
1310
!ZCG (accel_directives ).validate_timestamps ||
1354
1311
do_validate_timestamps (persistent_script , & file_handle ) == FAILURE ) {
1355
- BLOCK_ALL_SIGNALS ();
1312
+ HANDLE_BLOCK_INTERRUPTIONS ();
1356
1313
SHM_UNPROTECT ();
1357
1314
zend_shared_alloc_lock ();
1358
1315
if (!persistent_script -> corrupted ) {
@@ -1367,7 +1324,7 @@ int zend_accel_invalidate(const char *filename, size_t filename_len, zend_bool f
1367
1324
}
1368
1325
zend_shared_alloc_unlock ();
1369
1326
SHM_PROTECT ();
1370
- UNBLOCK_ALL_SIGNALS ();
1327
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
1371
1328
}
1372
1329
}
1373
1330
@@ -1948,11 +1905,11 @@ zend_op_array *file_cache_compile_file(zend_file_handle *file_handle, int type)
1948
1905
}
1949
1906
}
1950
1907
1951
- BLOCK_ALL_SIGNALS ();
1908
+ HANDLE_BLOCK_INTERRUPTIONS ();
1952
1909
SHM_UNPROTECT ();
1953
1910
persistent_script = zend_file_cache_script_load (file_handle );
1954
1911
SHM_PROTECT ();
1955
- UNBLOCK_ALL_SIGNALS ();
1912
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
1956
1913
if (persistent_script ) {
1957
1914
/* see bug #15471 (old BTS) */
1958
1915
if (persistent_script -> script .filename ) {
@@ -2111,13 +2068,13 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
2111
2068
persistent_script = (zend_persistent_script * )bucket -> data ;
2112
2069
2113
2070
if (key && !persistent_script -> corrupted ) {
2114
- BLOCK_ALL_SIGNALS ();
2071
+ HANDLE_BLOCK_INTERRUPTIONS ();
2115
2072
SHM_UNPROTECT ();
2116
2073
zend_shared_alloc_lock ();
2117
2074
zend_accel_add_key (key , key_length , bucket );
2118
2075
zend_shared_alloc_unlock ();
2119
2076
SHM_PROTECT ();
2120
- UNBLOCK_ALL_SIGNALS ();
2077
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
2121
2078
}
2122
2079
}
2123
2080
}
@@ -2162,7 +2119,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
2162
2119
return NULL ;
2163
2120
}
2164
2121
2165
- BLOCK_ALL_SIGNALS ();
2122
+ HANDLE_BLOCK_INTERRUPTIONS ();
2166
2123
SHM_UNPROTECT ();
2167
2124
2168
2125
/* If script is found then validate_timestamps if option is enabled */
@@ -2225,17 +2182,17 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
2225
2182
/* No memory left. Behave like without the Accelerator */
2226
2183
if (ZSMMG (memory_exhausted ) || ZCSG (restart_pending )) {
2227
2184
SHM_PROTECT ();
2228
- UNBLOCK_ALL_SIGNALS ();
2185
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
2229
2186
if (ZCG (accel_directives ).file_cache ) {
2230
2187
return file_cache_compile_file (file_handle , type );
2231
2188
}
2232
2189
return accelerator_orig_compile_file (file_handle , type );
2233
2190
}
2234
2191
2235
2192
SHM_PROTECT ();
2236
- UNBLOCK_ALL_SIGNALS ();
2193
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
2237
2194
persistent_script = opcache_compile_file (file_handle , type , key , & op_array );
2238
- BLOCK_ALL_SIGNALS ();
2195
+ HANDLE_BLOCK_INTERRUPTIONS ();
2239
2196
SHM_UNPROTECT ();
2240
2197
2241
2198
/* Try and cache the script and assume that it is returned from_shared_memory.
@@ -2251,7 +2208,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
2251
2208
*/
2252
2209
if (!persistent_script ) {
2253
2210
SHM_PROTECT ();
2254
- UNBLOCK_ALL_SIGNALS ();
2211
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
2255
2212
return op_array ;
2256
2213
}
2257
2214
if (from_shared_memory ) {
@@ -2306,7 +2263,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
2306
2263
persistent_script -> dynamic_members .last_used = ZCG (request_time );
2307
2264
2308
2265
SHM_PROTECT ();
2309
- UNBLOCK_ALL_SIGNALS ();
2266
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
2310
2267
2311
2268
/* Fetch jit auto globals used in the script before execution */
2312
2269
if (persistent_script -> ping_auto_globals_mask ) {
@@ -2412,13 +2369,13 @@ static zend_string* persistent_zend_resolve_path(const char *filename, size_t fi
2412
2369
if (!persistent_script -> corrupted ) {
2413
2370
if (key ) {
2414
2371
/* add another "key" for the same bucket */
2415
- BLOCK_ALL_SIGNALS ();
2372
+ HANDLE_BLOCK_INTERRUPTIONS ();
2416
2373
SHM_UNPROTECT ();
2417
2374
zend_shared_alloc_lock ();
2418
2375
zend_accel_add_key (key , key_length , bucket );
2419
2376
zend_shared_alloc_unlock ();
2420
2377
SHM_PROTECT ();
2421
- UNBLOCK_ALL_SIGNALS ();
2378
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
2422
2379
} else {
2423
2380
ZCG (key_len ) = 0 ;
2424
2381
}
@@ -2515,7 +2472,7 @@ int accel_activate(INIT_FUNC_ARGS)
2515
2472
}
2516
2473
#endif
2517
2474
2518
- BLOCK_ALL_SIGNALS ();
2475
+ HANDLE_BLOCK_INTERRUPTIONS ();
2519
2476
SHM_UNPROTECT ();
2520
2477
2521
2478
if (ZCG (counted )) {
@@ -2574,7 +2531,7 @@ int accel_activate(INIT_FUNC_ARGS)
2574
2531
ZCG (accelerator_enabled ) = ZCSG (accelerator_enabled );
2575
2532
2576
2533
SHM_PROTECT ();
2577
- UNBLOCK_ALL_SIGNALS ();
2534
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
2578
2535
2579
2536
if (ZCG (accelerator_enabled ) && ZCSG (last_restart_time ) != ZCG (last_restart_time )) {
2580
2537
/* SHM was reinitialized. */
@@ -3001,10 +2958,6 @@ static int accel_startup(zend_extension *extension)
3001
2958
}
3002
2959
#endif
3003
2960
3004
- #ifdef HAVE_SIGPROCMASK
3005
- sigfillset (& mask_all_signals );
3006
- #endif
3007
-
3008
2961
/* no supported SAPI found - disable acceleration and stop initialization */
3009
2962
if (accel_find_sapi () == FAILURE ) {
3010
2963
accel_startup_ok = 0 ;
@@ -3277,7 +3230,7 @@ void zend_accel_schedule_restart(zend_accel_restart_reason reason)
3277
3230
zend_accel_error (ACCEL_LOG_DEBUG , "Restart Scheduled! Reason: %s" ,
3278
3231
zend_accel_restart_reason_text [reason ]);
3279
3232
3280
- BLOCK_ALL_SIGNALS ();
3233
+ HANDLE_BLOCK_INTERRUPTIONS ();
3281
3234
SHM_UNPROTECT ();
3282
3235
ZCSG (restart_pending ) = 1 ;
3283
3236
ZCSG (restart_reason ) = reason ;
@@ -3290,7 +3243,7 @@ void zend_accel_schedule_restart(zend_accel_restart_reason reason)
3290
3243
ZCSG (force_restart_time ) = 0 ;
3291
3244
}
3292
3245
SHM_PROTECT ();
3293
- UNBLOCK_ALL_SIGNALS ();
3246
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
3294
3247
}
3295
3248
3296
3249
/* this is needed because on WIN32 lock is not decreased unless ZCG(counted) is set */
0 commit comments