sigsegv_deinstall_handler - stall a global SIGSEGV handler
#include <sigsegv.h> int sigsegv_install_handler (sigsegv_handler_t handler); void sigsegv_deinstall_handler (void);
Library Functions Manual sigsegv_install_handler(3) NAME sigsegv_install_handler, sigsegv_deinstall_handler - Install and dein- stall a global SIGSEGV handler SYNOPSIS #include <sigsegv.h> int sigsegv_install_handler (sigsegv_handler_t handler); void sigsegv_deinstall_handler (void); DESCRIPTION Pageable virtual memory is usually done in the operating system's ker- nel. This library helps in implementing the others. Installing a page fault handler is usually more efficient than doing access checks in software at every access, because it's effectively the hardware (the MMU) which checks whether a page is present or not. Note that if you use system calls (like read()) to write into write- protected pages, the system will react by returning -1 and setting errno to EFAULT, instead of signalling SIGSEGV and restarting the sys- tem call. In this case, the program has to do what the SIGSEGV handler would do, and then restart the read() operation. Sigsegv_install_handler installs a global SIGSEGV handler. This should be called once only, and it ignores any previously installed SIGSEGV handler. Sigsegv_deinstall_handler deinstalls the global SIGSEGV handler. This goes back to the state where no SIGSEGV handler is installed. OPERANDS typedef int (*sigsegv_handler_t) (void* fault_address, int serious); Sigsegv_handler_t is the type of a global SIGSEGV handler. The fault address is passed as an argument. The access type (read access or write access) is not passed; your handler has to know itself how to distin- guish these two cases. If the second argument is 0, it means that it could also be a stack overflow, or 1, meaning the handler should seri- ously try to fix the fault. The return value should be nonzero if the handler has done its job and no other handler should be called, or 0 if the handler declines responsibility for the given address. 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'. EXIT STATUS If success, sigsegv_install_handler returns 0, or -1 if the system doesn't support catching SIGSEGV. 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 sigsegv_install_handler(3)