File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,9 @@ typedef int boolean_t;
51
51
# include <sys/sysctl.h>
52
52
# include <sys/user.h>
53
53
#endif
54
+ #ifdef __HAIKU__
55
+ # include <kernel/OS.h>
56
+ #endif
54
57
#ifdef __linux__
55
58
#include <sys/syscall.h>
56
59
#endif
@@ -503,6 +506,32 @@ static bool zend_call_stack_get_openbsd(zend_call_stack *stack)
503
506
return false;
504
507
}
505
508
#endif /* defined(__OpenBSD__) */
509
+ #if defined(__HAIKU__ )
510
+ static bool zend_call_stack_get_haiku (zend_call_stack * stack )
511
+ {
512
+ thread_id id ;
513
+ thread_info ti ;
514
+ size_t guard_size ;
515
+
516
+ // unlikely, main thread ought to be always available but we never know
517
+ if ((id = find_thread (NULL )) == B_NAME_NOT_FOUND || get_thread_info (id , & ti ) != B_OK ) {
518
+ return false;
519
+ }
520
+
521
+ // USER_STACK_GUARD_SIZE
522
+ guard_size = sysconf (_SC_PAGESIZE ) * 4 ;
523
+
524
+ stack -> base = ti .stack_base ;
525
+ stack -> max_size = ((size_t )ti .stack_end - (size_t )ti .stack_base ) - guard_size ;
526
+
527
+ return true;
528
+ }
529
+ #else
530
+ static bool zend_call_stack_get_haiku (zend_call_stack * stack )
531
+ {
532
+ return false;
533
+ }
534
+ #endif /* defined(__HAIKU__) */
506
535
507
536
/** Get the stack information for the calling thread */
508
537
ZEND_API bool zend_call_stack_get (zend_call_stack * stack )
@@ -527,6 +556,10 @@ ZEND_API bool zend_call_stack_get(zend_call_stack *stack)
527
556
return true;
528
557
}
529
558
559
+ if (zend_call_stack_get_haiku (stack )) {
560
+ return true;
561
+ }
562
+
530
563
return false;
531
564
}
532
565
Original file line number Diff line number Diff line change @@ -86,6 +86,9 @@ static inline size_t zend_call_stack_default_size(void)
86
86
}
87
87
return 512 * 1024 ;
88
88
#endif
89
+ #ifdef __HAIKU__
90
+ return 64 * 4096 ;
91
+ #endif
89
92
90
93
return 2 * 1024 * 1024 ;
91
94
}
You can’t perform that action at this time.
0 commit comments