Blame lib/c-stack.h

Packit 33f14e
/* Stack overflow handling.
Packit 33f14e
Packit 33f14e
   Copyright (C) 2002, 2004, 2008-2017 Free Software Foundation, Inc.
Packit 33f14e
Packit 33f14e
   This program is free software: you can redistribute it and/or modify
Packit 33f14e
   it under the terms of the GNU General Public License as published by
Packit 33f14e
   the Free Software Foundation; either version 3 of the License, or
Packit 33f14e
   (at your option) any later version.
Packit 33f14e
Packit 33f14e
   This program is distributed in the hope that it will be useful,
Packit 33f14e
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 33f14e
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 33f14e
   GNU General Public License for more details.
Packit 33f14e
Packit 33f14e
   You should have received a copy of the GNU General Public License
Packit 33f14e
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
Packit 33f14e
Packit 33f14e
Packit 33f14e
/* Set up ACTION so that it is invoked on C stack overflow and on other,
Packit 33f14e
   stack-unrelated, segmentation violation.
Packit 33f14e
   Return -1 (setting errno) if this cannot be done.
Packit 33f14e
Packit 33f14e
   When a stack overflow or segmentation violation occurs:
Packit 33f14e
   1) ACTION is called.  It is passed an argument equal to
Packit 33f14e
        - 0, for a stack overflow,
Packit 33f14e
        - SIGSEGV, for a segmentation violation that does not appear related
Packit 33f14e
          to stack overflow.
Packit 33f14e
      On many platforms the two cases are hard to distinguish; when in doubt,
Packit 33f14e
      zero is passed.
Packit 33f14e
   2) If ACTION returns, a message is written to standard error, and the
Packit 33f14e
      program is terminated: in the case of stack overflow, with exit code
Packit 33f14e
      exit_failure (see "exitfail.h"), otherwise through a signal SIGSEGV.
Packit 33f14e
Packit 33f14e
   A null ACTION acts like an action that does nothing.
Packit 33f14e
Packit 33f14e
   ACTION must be async-signal-safe.  ACTION together with its callees
Packit 33f14e
   must not require more than SIGSTKSZ bytes of stack space.  Also,
Packit 33f14e
   ACTION should not call longjmp, because this implementation does
Packit 33f14e
   not guarantee that it is safe to return to the original stack.
Packit 33f14e
Packit 33f14e
   This function may install a handler for the SIGSEGV signal or for the SIGBUS
Packit 33f14e
   signal or exercise other system dependent exception handling APIs.  */
Packit 33f14e
Packit 33f14e
extern int c_stack_action (void (* /*action*/) (int));