Store the unsafe stack pointer in a thread-local variable on Linux for now, until it gets incorporated into glibc.
Use getrlimit to determine the stack size for the main thread
Use syscall(SYS_mmap, ...) on all platforms except Darwin, use MAP_STACK and MAP_GROWSDOWN mmap flags whenever they are available.
Applied various feedback from David Chisnall and Kostya Serebryany