Introduction to Library Functions stackoverflow_install_handler(3) NAME stackoverflow_install_handler, stackoverflow_deinstall_handler - Installs and deinstall a stack overflow handler SYNOPSIS #include int stackoverflow_install_handler (stackoverflow_handler_t handler, void* extra_stack, unsigned long extra_stack_size); void stackoverflow_deinstall_handler (void); DESCRIPTION In some applications, the stack overflow handler performs some cleanup or notifies the user and then immediately ter- minates the application. In other applications, the stack overflow handler longjmps back to a central point in the application. This library supports both uses. In the second case, the handler must ensure to restore the normal signal mask (because many signals are blocked while the handler is executed), and must also call sigsegv_leave_handler() to transfer control; then only it can longjmp away. The handler is run at a moment when nothing about the global state of the program is known. Therefore it cannot use facilities that manipulate global variables or locks. In particular, it cannot use malloc(); use mmap() Instead. It cannot use fopen(); use open() instead. Etc. All global variables that are accessed by the handler should be mark OPERANDS typedef void (*stackoverflow_handler_t) (int emergency, stackoverflow_context_t scp); Stackoverflow_handler_t is the type of a stack overflow handler. Such a handler should perform a longjmp call in order to reduce the amount of stack needed. It must not return.The emergency argument is 0 when the stack could be repared, or 1 if the application should better save its state and exit now. The extra_stack argument is a pointer to a preallocated area used as a stack for executing the handler. It is typically SunOS 5.11 Last change: 13 Jan 2009 1 Introduction to Library Functions stackoverflow_install_handler(3) allocated by use of `alloca' during `main'. Its size should be sufficiently large. The extra_stack_size is the size of the extra_stack argu- ment. EXIT STATUS If success, stackoverflow_install_handler() returns 0 on success, or -1 if the system doesn't support catching stack overflow. ATTRIBUTES See attributes(5) for descriptions of the following attri- butes: ____________________________________________________________ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |_____________________________|_____________________________| | Availability | SUNWlibsigsegv | |_____________________________|_____________________________| | Interface Stability | Uncommitted | |_____________________________|_____________________________| | Standard | See standards(5). | |_____________________________|_____________________________| SEE ALSO ttributes(5), sigsegv(3), standards(5) NOTES The libsigsegv project is located at http://libsigsegv.sourceforge.net. Source for libsigsegv is available on http://opensolaris.org. SunOS 5.11 Last change: 13 Jan 2009 2 Introduction to Library Functions stackoverflow_install_handler(3) SunOS 5.11 Last change: 13 Jan 2009 3