@@ -70,70 +70,6 @@ _Py_ReachedRecursionLimitWithMargin(PyThreadState *tstate, int margin_count)
7070# define Py_C_STACK_SIZE 4000000
7171#endif
7272
73- #if defined(__EMSCRIPTEN__ )
74-
75- // Temporary workaround to make `pthread_getattr_np` work on Emscripten.
76- // Emscripten 4.0.6 will contain a fix:
77- // https://github.com/emscripten-core/emscripten/pull/23887
78-
79- #include "emscripten/stack.h"
80-
81- #define pthread_attr_t workaround_pthread_attr_t
82- #define pthread_attr_init workaround_pthread_attr_init
83- #define pthread_getattr_np workaround_pthread_getattr_np
84- #define pthread_attr_getguardsize workaround_pthread_attr_getguardsize
85- #define pthread_attr_getstack workaround_pthread_attr_getstack
86- #define pthread_attr_destroy workaround_pthread_attr_destroy
87-
88- typedef struct {
89- void * _a_stackaddr ;
90- size_t _a_stacksize , _a_guardsize ;
91- } pthread_attr_t ;
92-
93- extern __attribute__((__visibility__ ("hidden" ))) unsigned __default_guardsize ;
94-
95- int pthread_attr_init (pthread_attr_t * a )
96- {
97- return 0 ;
98- }
99-
100- // Modified version of pthread_getattr_np from the upstream PR.
101-
102- int pthread_getattr_np (pthread_t thread , pthread_attr_t * attr ) {
103- attr -> _a_stackaddr = (void * )emscripten_stack_get_base ();
104- attr -> _a_stacksize = emscripten_stack_get_base () - emscripten_stack_get_end ();
105- attr -> _a_guardsize = __default_guardsize ;
106- return 0 ;
107- }
108-
109- // These three functions copied without any changes from Emscripten libc.
110-
111- int pthread_attr_getguardsize (const pthread_attr_t * restrict a , size_t * restrict size )
112- {
113- * size = a -> _a_guardsize ;
114- return 0 ;
115- }
116-
117- int pthread_attr_getstack (const pthread_attr_t * restrict a , void * * restrict addr , size_t * restrict size )
118- {
119- /// XXX musl is not standard-conforming? It should not report EINVAL if _a_stackaddr is zero, and it should
120- /// report EINVAL if a is null: http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_attr_getstack.html
121- if (!a ) return EINVAL ;
122- // if (!a->_a_stackaddr)
123- // return EINVAL;
124-
125- * size = a -> _a_stacksize ;
126- * addr = (void * )(a -> _a_stackaddr - * size );
127- return 0 ;
128- }
129-
130- int pthread_attr_destroy (pthread_attr_t * a )
131- {
132- return 0 ;
133- }
134-
135- #endif
136-
13773static void
13874hardware_stack_limits (uintptr_t * base , uintptr_t * top , uintptr_t sp )
13975{
0 commit comments