stackoverflow_deinstall_handler - Installs and deinstalls a stack overflow handler
#include <sigsegv.h> int stackoverflow_install_handler (stackoverflow_handler_t handler, void* extra_stack, size_t extra_stack_size); void stackoverflow_deinstall_handler (void);
Library Functions Manual stackoverflow_install_handler(3)
NAME
stackoverflow_install_handler, stackoverflow_deinstall_handler -
Installs and deinstalls a stack overflow handler
SYNOPSIS
#include <sigsegv.h>
int stackoverflow_install_handler (stackoverflow_handler_t
handler, void* extra_stack,
size_t 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 terminates 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 manipu-
late 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 marked
'volatile'.
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 repaired, 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 typically comes from a static vari-
able or from heap-allocated memoty; placing it on the main stack may
fail on some operating systems.
The extra_stack_size is the size of the extra_stack argument. On most
platforms, 16 kB are sufficient.
EXIT STATUS
On success, stackoverflow_install_handler() returns 0. If the system
doesn't support catching stack overflow it returns -1.
COPYRIGHT
Copyright 1998-1999, 2002-2012, 2016-2021 Bruno Haible
<bruno@clisp.org>
Copyright 2002-2005, 2009 Paolo Bonzini <bonzini@gnu.org>
Copyright 2008-2010 Eric Blake <ebb9@byu.net>
Copyright 2002-2021 Free Software Foundation, Inc.
GNU libsigsegv library and manual pages are licensed under GNU GPL ver-
sion 2 or later <https://gnu.org/licenses/gpl-2.0.html>. This is free
software: you are free to change and redistribute it. There is NO WAR-
RANTY, to the extent permitted by law.
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
+---------------+--------------------+
|ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+---------------+--------------------+
|Availability | library/libsigsegv |
+---------------+--------------------+
|Stability | Uncommitted |
+---------------+--------------------+
SEE ALSO
attributes(7), sigsegv(3), standards(7)
NOTES
Source code for open source software components in Oracle Solaris can
be found at https://www.oracle.com/downloads/opensource/solaris-source-
code-downloads.html.
This software was built from source available at
https://github.com/oracle/solaris-userland. The original community
source was downloaded from https://ftp.gnu.org/gnu/libsigsegv/lib-
sigsegv-2.13.tar.gz.
Further information about this software can be found on the open source
community website at https://www.gnu.org/software/libsigsegv.
Solaris 11.4 17 June 2021
stackoverflow_install_handler(3)