File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ _LT_AC_TRY_DLOPEN_SELF([
146
146
] )
147
147
148
148
dnl Checks for library functions.
149
- AC_CHECK_FUNCS ( getpid kill sigsetjmp pthread_getattr_np pthread_attr_get_np pthread_get_stackaddr_np pthread_attr_getstack pthread_stackseg_np gettid )
149
+ AC_CHECK_FUNCS ( getpid kill sigsetjmp pthread_getattr_np pthread_attr_get_np pthread_get_stackaddr_np pthread_stackseg_np gettid )
150
150
151
151
dnl Test whether the stack grows downwards
152
152
dnl Assumes contiguous stack
Original file line number Diff line number Diff line change @@ -95,6 +95,11 @@ ZEND_API void zend_call_stack_init(void) {
95
95
}
96
96
}
97
97
98
+ #ifdef __GNUC__
99
+ /* pthread_attr_getstackaddr/size is a deprecated interface */
100
+ # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
101
+ #endif
102
+
98
103
#ifdef __linux__
99
104
static bool zend_call_stack_is_main_thread (void ) {
100
105
# ifdef HAVE_GETTID
@@ -121,7 +126,11 @@ static bool zend_call_stack_get_linux_pthread(zend_call_stack *stack)
121
126
return false;
122
127
}
123
128
124
- error = pthread_attr_getstack (& attr , & addr , & max_size );
129
+ error = pthread_attr_getstackaddr (& attr , & addr );
130
+ if (error ) {
131
+ return false;
132
+ }
133
+ error = pthread_attr_getstacksize (& attr , & max_size );
125
134
if (error ) {
126
135
return false;
127
136
}
@@ -270,10 +279,21 @@ static bool zend_call_stack_get_freebsd_pthread(zend_call_stack *stack)
270
279
goto fail ;
271
280
}
272
281
273
- error = pthread_attr_getstack (& attr , & addr , & max_size );
282
+ error = pthread_attr_getstackaddr (& attr , & addr );
274
283
if (error ) {
275
- goto fail ;
284
+ return false ;
276
285
}
286
+ error = pthread_attr_getstacksize (& attr , & max_size );
287
+ if (error ) {
288
+ return false;
289
+ }
290
+ error = pthread_attr_getguardsize (& attr , & guard_size );
291
+ if (error ) {
292
+ return false;
293
+ }
294
+
295
+ addr = (char * )addr + guard_size ;
296
+ max_size -= guard_size ;
277
297
278
298
stack -> base = (int8_t * )addr + max_size ;
279
299
stack -> max_size = max_size ;
You can’t perform that action at this time.
0 commit comments