Overview
| Artifact ID: | d7c3b224550c7d7f561bb5e33f517a38e23a1589 |
|---|---|
| Ticket: | 746378ffffffffffffffffffffffffffffffffff
experimental unix stack check patch... |
| User & Date: | mistachkin on 2003-06-01 11:24:49 |
Changes
- icomment:
File Added - 51837: unixStackCheckV3.zip Logged In: YES user_id=113501 Been working on this patch to fine tune it a bit more. The defines still need to be made more portable by using configure. In my opinion, here is how it should work: On FreeBSD with threads enabled, the pthread library function pthread_attr_get_np function should be used to check the maximum stack size for each thread. The reason for this is that getrlimit for RLIMIT_STACK is horribly broken when pthreads are used. On FreeBSD with threads disabled, the getrlimit function should be used to check the maximum stack size. So far, on all other tested operating systems (Linux, Solaris, OpenBSD) it looks like the getrlimit function should be used, regardless of whether or not threads are enabled. On Linux, there is a function that is could be a good candidate for checking the maximum stack size, pthread_getattr_np. However, it does not seem to report the correct stack size (at least on the version of Linux I tested on), making it worse than useless. Please note that this patch is thread safe whether or not it uses pthreads to get the stack size. I am unsure about NetBSD and other platforms not mentioned here. It would also be nice if there was a way to explicitly specify the stack checking behavior from configure, such as --disable-stack-check (old way) and --enable- stack-check (new way), etc.
- login: "mistachkin"
- mimetype: "text/plain"
- priority changed to: "7 High"
- username: "mistachkin"