]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - sig.h
Bash-5.2 patch 26: fix typo when specifying readline's custom color prefix
[thirdparty/bash.git] / sig.h
diff --git a/sig.h b/sig.h
index ed634ed7ce6c04101bd3c9583db216e3075cc8ca..0217be53d9adc89e7dd516bae6ee8f1d0b87d9c8 100644 (file)
--- a/sig.h
+++ b/sig.h
@@ -1,22 +1,22 @@
 /* sig.h -- header file for signal handler definitions. */
 
-/* Copyright (C) 1994 Free Software Foundation, Inc.
+/* Copyright (C) 1994-2021 Free Software Foundation, Inc.
 
    This file is part of GNU Bash, the Bourne Again SHell.
 
-   Bash is free software; you can redistribute it and/or modify it under
-   the terms of the GNU General Public License as published by the Free
-   Software Foundation; either version 2, or (at your option) any later
-   version.
+   Bash is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
 
-   Bash is distributed in the hope that it will be useful, but WITHOUT ANY
-   WARRANTY; without even the implied warranty of MERCHANTABILITY or
-   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-   for more details.
+   Bash is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-   You should have received a copy of the GNU General Public License along
-   with Bash; see the file COPYING.  If not, write to the Free Software
-   Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+   You should have received a copy of the GNU General Public License
+   along with Bash.  If not, see <http://www.gnu.org/licenses/>.
+*/
 
 /* Make sure that this is included *after* config.h! */
 
 
 #include "stdc.h"
 
+#include <signal.h>            /* for sig_atomic_t */
+
 #if !defined (SIGABRT) && defined (SIGIOT)
 #  define SIGABRT SIGIOT
 #endif
 
-#define sighandler RETSIGTYPE
-typedef RETSIGTYPE SigHandler ();
+#define sighandler void
+typedef void SigHandler PARAMS((int));
 
-#if defined (VOID_SIGHANDLER)
-#  define SIGRETURN(n) return
-#else
-#  define SIGRETURN(n) return(n)
-#endif /* !VOID_SIGHANDLER */
+#define SIGRETURN(n)   return
 
 /* Here is a definition for set_signal_handler () which simply expands to
    a call to signal () for non-Posix systems.  The code for set_signal_handler
@@ -44,12 +42,9 @@ typedef RETSIGTYPE SigHandler ();
 #if !defined (HAVE_POSIX_SIGNALS)
 #  define set_signal_handler(sig, handler) (SigHandler *)signal (sig, handler)
 #else
-extern SigHandler *set_signal_handler ();      /* in sig.c */
+extern SigHandler *set_signal_handler PARAMS((int, SigHandler *));     /* in sig.c */
 #endif /* _POSIX_VERSION */
 
-/* Definitions used by the job control code. */
-#if defined (JOB_CONTROL)
-
 #if !defined (SIGCHLD) && defined (SIGCLD)
 #  define SIGCHLD SIGCLD
 #endif
@@ -89,36 +84,53 @@ extern SigHandler *set_signal_handler ();   /* in sig.c */
 /* These definitions are used both in POSIX and non-POSIX implementations. */
 
 #define BLOCK_SIGNAL(sig, nvar, ovar) \
+do { \
   sigemptyset (&nvar); \
   sigaddset (&nvar, sig); \
   sigemptyset (&ovar); \
-  sigprocmask (SIG_BLOCK, &nvar, &ovar)
+  sigprocmask (SIG_BLOCK, &nvar, &ovar); \
+} while (0)
+
+#define UNBLOCK_SIGNAL(ovar) sigprocmask (SIG_SETMASK, &ovar, (sigset_t *) NULL)
 
 #if defined (HAVE_POSIX_SIGNALS)
-#  define BLOCK_CHILD(nvar, ovar) \
-       BLOCK_SIGNAL (SIGCHLD, nvar, ovar)
-#  define UNBLOCK_CHILD(ovar) \
-       sigprocmask (SIG_SETMASK, &ovar, (sigset_t *) NULL)
+#  define BLOCK_CHILD(nvar, ovar) BLOCK_SIGNAL (SIGCHLD, nvar, ovar)
+#  define UNBLOCK_CHILD(ovar) UNBLOCK_SIGNAL(ovar)
 #else /* !HAVE_POSIX_SIGNALS */
 #  define BLOCK_CHILD(nvar, ovar) ovar = sigblock (sigmask (SIGCHLD))
 #  define UNBLOCK_CHILD(ovar) sigsetmask (ovar)
 #endif /* !HAVE_POSIX_SIGNALS */
 
-#endif /* JOB_CONTROL */
+/* Extern variables */
+extern volatile sig_atomic_t sigwinch_received;
+extern volatile sig_atomic_t sigterm_received;
+
+extern int interrupt_immediately;      /* no longer used */
+extern int terminate_immediately;
 
 /* Functions from sig.c. */
-extern sighandler termination_unwind_protect __P((int));
-extern sighandler sigint_sighandler __P((int));
-extern void initialize_signals __P((void));
-extern void reinitialize_signals __P((void));
-extern void initialize_terminating_signals __P((void));
-extern void reset_terminating_signals __P((void));
-extern void throw_to_top_level __P((void));
-extern void jump_to_top_level __P((int)) __attribute__((__noreturn__));
+extern sighandler termsig_sighandler PARAMS((int));
+extern void termsig_handler PARAMS((int));
+extern sighandler sigint_sighandler PARAMS((int));
+extern void initialize_signals PARAMS((int));
+extern void initialize_terminating_signals PARAMS((void));
+extern void reset_terminating_signals PARAMS((void));
+extern void top_level_cleanup PARAMS((void));
+extern void throw_to_top_level PARAMS((void));
+extern void jump_to_top_level PARAMS((int)) __attribute__((__noreturn__));
+extern void restore_sigmask PARAMS((void));
+
+extern sighandler sigwinch_sighandler PARAMS((int));
+extern void set_sigwinch_handler PARAMS((void));
+extern void unset_sigwinch_handler PARAMS((void));
+
+extern sighandler sigterm_sighandler PARAMS((int));
 
 /* Functions defined in trap.c. */
-extern SigHandler *set_sigint_handler __P((void));
-extern SigHandler *trap_to_sighandler __P((int));
-extern sighandler trap_handler __P((int));
+extern SigHandler *set_sigint_handler PARAMS((void));
+extern SigHandler *trap_to_sighandler PARAMS((int));
+extern sighandler trap_handler PARAMS((int));
 
+extern int block_trapped_signals PARAMS((sigset_t *, sigset_t *));
+extern int unblock_trapped_signals PARAMS((sigset_t *));
 #endif /* _SIG_H_ */