zend_call_stack.c: AIX backend - #22906
Conversation
|
question: do you need to update |
Good point; looks like based on measuring (on PASE), it looks like 192 KB for threads (IBM claims 96, but I think that's for 32-bit, so ifdef). For the main thread, I think AIX sets a 32 MB stack limit in ulimit by default (which, ulimit could be measured as a fallback path perhaps), but I can't find a consistent source for that. PASE seems to default to unlimited which caps at 256 MB. |
|
Once you re done, Zend/stack_limits would need to be run (and stack_limits_010.phpt will need an update for sure). Nice to bring AIX support regardless 👍🏼. |
The annoying thing is that the exact stack size returned for the main thread seems annoyingly variable between systems (at least on PASE with its default unlimited stack size) and thus I can't use an exact size. Not sure what the best strategy for that test is; round to some close enough number like page size? |
|
ah right ... in that case, the simplest would be to test ranges unless @arnaud-lb has a better suggestion :) |
What is the size reported by In |
(FWIW, if I try capping the stack value to AIX's default value of 32 MB, I also get the same variance, just capped at i.e. |
|
Let's skip this test on AIX/PASE for now then |
It needs an environment variable set, so it'll be skipped automatically, but I can add an explicit one in case |
|
A condition based on |
Uses pthread_getthrds_np (so requires pthread linked, by default on ZTS, needs to be added for NTS). The stack size part is weird, but works in testing. An alternative approach is using procfs, but I didn't bother with this due to it not working on PASE (and the pthread approach works for the main thread too).
...and pass a NULL register buffer, since this is only used with suspended threads. something that'll never happen if we invoke it on ourself. We still need to pass the size though.
Zero out the pthread struct, check if the pointers are nil, add extra comment about stackaddr
AIX adjusts the top address of the stack on the main thread in an unpredictable way, and this is used to calculate the size for the main thread.
2f6751d to
b143bd1
Compare
Uses pthread_getthrds_np (so requires pthread linked, by default on ZTS, needs to be added for NTS). The stack size part is weird, but works in testing.
An alternative approach is using procfs, but I didn't bother with this due to it not working on PASE (and the pthread approach works for the main thread too).