@@ -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 );
@@ -787,7 +744,7 @@ static zend_string* ZEND_FASTCALL accel_replace_string_by_shm_permanent(zend_str
787
744
788
745
static void accel_use_shm_interned_strings (void )
789
746
{
790
- BLOCK_ALL_SIGNALS ();
747
+ HANDLE_BLOCK_INTERRUPTIONS ();
791
748
SHM_UNPROTECT ();
792
749
zend_shared_alloc_lock ();
793
750
@@ -802,7 +759,7 @@ static void accel_use_shm_interned_strings(void)
802
759
803
760
zend_shared_alloc_unlock ();
804
761
SHM_PROTECT ();
805
- UNBLOCK_ALL_SIGNALS ();
762
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
806
763
}
807
764
808
765
#ifndef ZEND_WIN32
@@ -1201,7 +1158,7 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int *key_l
1201
1158
1202
1159
zend_string * str = accel_find_interned_string (cwd_str );
1203
1160
if (!str ) {
1204
- BLOCK_ALL_SIGNALS ();
1161
+ HANDLE_BLOCK_INTERRUPTIONS ();
1205
1162
SHM_UNPROTECT ();
1206
1163
zend_shared_alloc_lock ();
1207
1164
str = accel_new_interned_string (zend_string_copy (cwd_str ));
@@ -1211,7 +1168,7 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int *key_l
1211
1168
}
1212
1169
zend_shared_alloc_unlock ();
1213
1170
SHM_PROTECT ();
1214
- UNBLOCK_ALL_SIGNALS ();
1171
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
1215
1172
}
1216
1173
if (str ) {
1217
1174
char buf [32 ];
@@ -1245,7 +1202,7 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int *key_l
1245
1202
1246
1203
zend_string * str = accel_find_interned_string (ZCG (include_path ));
1247
1204
if (!str ) {
1248
- BLOCK_ALL_SIGNALS ();
1205
+ HANDLE_BLOCK_INTERRUPTIONS ();
1249
1206
SHM_UNPROTECT ();
1250
1207
zend_shared_alloc_lock ();
1251
1208
str = accel_new_interned_string (zend_string_copy (ZCG (include_path )));
@@ -1254,7 +1211,7 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int *key_l
1254
1211
}
1255
1212
zend_shared_alloc_unlock ();
1256
1213
SHM_PROTECT ();
1257
- UNBLOCK_ALL_SIGNALS ();
1214
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
1258
1215
}
1259
1216
if (str ) {
1260
1217
char buf [32 ];
@@ -1351,7 +1308,7 @@ int zend_accel_invalidate(const char *filename, size_t filename_len, zend_bool f
1351
1308
if (force ||
1352
1309
!ZCG (accel_directives ).validate_timestamps ||
1353
1310
do_validate_timestamps (persistent_script , & file_handle ) == FAILURE ) {
1354
- BLOCK_ALL_SIGNALS ();
1311
+ HANDLE_BLOCK_INTERRUPTIONS ();
1355
1312
SHM_UNPROTECT ();
1356
1313
zend_shared_alloc_lock ();
1357
1314
if (!persistent_script -> corrupted ) {
@@ -1366,7 +1323,7 @@ int zend_accel_invalidate(const char *filename, size_t filename_len, zend_bool f
1366
1323
}
1367
1324
zend_shared_alloc_unlock ();
1368
1325
SHM_PROTECT ();
1369
- UNBLOCK_ALL_SIGNALS ();
1326
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
1370
1327
}
1371
1328
}
1372
1329
@@ -1881,11 +1838,11 @@ zend_op_array *file_cache_compile_file(zend_file_handle *file_handle, int type)
1881
1838
}
1882
1839
}
1883
1840
1884
- BLOCK_ALL_SIGNALS ();
1841
+ HANDLE_BLOCK_INTERRUPTIONS ();
1885
1842
SHM_UNPROTECT ();
1886
1843
persistent_script = zend_file_cache_script_load (file_handle );
1887
1844
SHM_PROTECT ();
1888
- UNBLOCK_ALL_SIGNALS ();
1845
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
1889
1846
if (persistent_script ) {
1890
1847
/* see bug #15471 (old BTS) */
1891
1848
if (persistent_script -> script .filename ) {
@@ -2043,13 +2000,13 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
2043
2000
persistent_script = (zend_persistent_script * )bucket -> data ;
2044
2001
2045
2002
if (key && !persistent_script -> corrupted ) {
2046
- BLOCK_ALL_SIGNALS ();
2003
+ HANDLE_BLOCK_INTERRUPTIONS ();
2047
2004
SHM_UNPROTECT ();
2048
2005
zend_shared_alloc_lock ();
2049
2006
zend_accel_add_key (key , key_length , bucket );
2050
2007
zend_shared_alloc_unlock ();
2051
2008
SHM_PROTECT ();
2052
- UNBLOCK_ALL_SIGNALS ();
2009
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
2053
2010
}
2054
2011
}
2055
2012
}
@@ -2094,7 +2051,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
2094
2051
return NULL ;
2095
2052
}
2096
2053
2097
- BLOCK_ALL_SIGNALS ();
2054
+ HANDLE_BLOCK_INTERRUPTIONS ();
2098
2055
SHM_UNPROTECT ();
2099
2056
2100
2057
/* If script is found then validate_timestamps if option is enabled */
@@ -2157,17 +2114,17 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
2157
2114
/* No memory left. Behave like without the Accelerator */
2158
2115
if (ZSMMG (memory_exhausted ) || ZCSG (restart_pending )) {
2159
2116
SHM_PROTECT ();
2160
- UNBLOCK_ALL_SIGNALS ();
2117
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
2161
2118
if (ZCG (accel_directives ).file_cache ) {
2162
2119
return file_cache_compile_file (file_handle , type );
2163
2120
}
2164
2121
return accelerator_orig_compile_file (file_handle , type );
2165
2122
}
2166
2123
2167
2124
SHM_PROTECT ();
2168
- UNBLOCK_ALL_SIGNALS ();
2125
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
2169
2126
persistent_script = opcache_compile_file (file_handle , type , key , & op_array );
2170
- BLOCK_ALL_SIGNALS ();
2127
+ HANDLE_BLOCK_INTERRUPTIONS ();
2171
2128
SHM_UNPROTECT ();
2172
2129
2173
2130
/* Try and cache the script and assume that it is returned from_shared_memory.
@@ -2183,7 +2140,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
2183
2140
*/
2184
2141
if (!persistent_script ) {
2185
2142
SHM_PROTECT ();
2186
- UNBLOCK_ALL_SIGNALS ();
2143
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
2187
2144
return op_array ;
2188
2145
}
2189
2146
if (from_shared_memory ) {
@@ -2237,7 +2194,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
2237
2194
persistent_script -> dynamic_members .last_used = ZCG (request_time );
2238
2195
2239
2196
SHM_PROTECT ();
2240
- UNBLOCK_ALL_SIGNALS ();
2197
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
2241
2198
2242
2199
/* Fetch jit auto globals used in the script before execution */
2243
2200
if (persistent_script -> ping_auto_globals_mask ) {
@@ -2343,13 +2300,13 @@ static zend_string* persistent_zend_resolve_path(const char *filename, size_t fi
2343
2300
if (!persistent_script -> corrupted ) {
2344
2301
if (key ) {
2345
2302
/* add another "key" for the same bucket */
2346
- BLOCK_ALL_SIGNALS ();
2303
+ HANDLE_BLOCK_INTERRUPTIONS ();
2347
2304
SHM_UNPROTECT ();
2348
2305
zend_shared_alloc_lock ();
2349
2306
zend_accel_add_key (key , key_length , bucket );
2350
2307
zend_shared_alloc_unlock ();
2351
2308
SHM_PROTECT ();
2352
- UNBLOCK_ALL_SIGNALS ();
2309
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
2353
2310
} else {
2354
2311
ZCG (key_len ) = 0 ;
2355
2312
}
@@ -2446,7 +2403,7 @@ int accel_activate(INIT_FUNC_ARGS)
2446
2403
}
2447
2404
#endif
2448
2405
2449
- BLOCK_ALL_SIGNALS ();
2406
+ HANDLE_BLOCK_INTERRUPTIONS ();
2450
2407
SHM_UNPROTECT ();
2451
2408
2452
2409
if (ZCG (counted )) {
@@ -2505,7 +2462,7 @@ int accel_activate(INIT_FUNC_ARGS)
2505
2462
ZCG (accelerator_enabled ) = ZCSG (accelerator_enabled );
2506
2463
2507
2464
SHM_PROTECT ();
2508
- UNBLOCK_ALL_SIGNALS ();
2465
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
2509
2466
2510
2467
if (ZCG (accelerator_enabled ) && ZCSG (last_restart_time ) != ZCG (last_restart_time )) {
2511
2468
/* SHM was reinitialized. */
@@ -2928,10 +2885,6 @@ static int accel_startup(zend_extension *extension)
2928
2885
}
2929
2886
#endif
2930
2887
2931
- #ifdef HAVE_SIGPROCMASK
2932
- sigfillset (& mask_all_signals );
2933
- #endif
2934
-
2935
2888
/* no supported SAPI found - disable acceleration and stop initialization */
2936
2889
if (accel_find_sapi () == FAILURE ) {
2937
2890
accel_startup_ok = 0 ;
@@ -3204,7 +3157,7 @@ void zend_accel_schedule_restart(zend_accel_restart_reason reason)
3204
3157
zend_accel_error (ACCEL_LOG_DEBUG , "Restart Scheduled! Reason: %s" ,
3205
3158
zend_accel_restart_reason_text [reason ]);
3206
3159
3207
- BLOCK_ALL_SIGNALS ();
3160
+ HANDLE_BLOCK_INTERRUPTIONS ();
3208
3161
SHM_UNPROTECT ();
3209
3162
ZCSG (restart_pending ) = 1 ;
3210
3163
ZCSG (restart_reason ) = reason ;
@@ -3217,7 +3170,7 @@ void zend_accel_schedule_restart(zend_accel_restart_reason reason)
3217
3170
ZCSG (force_restart_time ) = 0 ;
3218
3171
}
3219
3172
SHM_PROTECT ();
3220
- UNBLOCK_ALL_SIGNALS ();
3173
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
3221
3174
}
3222
3175
3223
3176
/* this is needed because on WIN32 lock is not decreased unless ZCG(counted) is set */
@@ -4696,7 +4649,7 @@ static int accel_preload(const char *config)
4696
4649
ZCSG (preload_script ) = preload_script_in_shared_memory (script );
4697
4650
4698
4651
SHM_PROTECT ();
4699
- UNBLOCK_ALL_SIGNALS ();
4652
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
4700
4653
4701
4654
zend_string_release (filename );
4702
4655
@@ -4722,7 +4675,7 @@ static int accel_preload(const char *config)
4722
4675
accel_interned_strings_save_state ();
4723
4676
4724
4677
SHM_PROTECT ();
4725
- UNBLOCK_ALL_SIGNALS ();
4678
+ HANDLE_UNBLOCK_INTERRUPTIONS ();
4726
4679
4727
4680
zend_shared_alloc_destroy_xlat_table ();
4728
4681
0 commit comments