aboutsummaryrefslogtreecommitdiffstats
path: root/quit.h
diff options
context:
space:
mode:
Diffstat (limited to 'quit.h')
-rw-r--r--quit.h34
1 files changed, 30 insertions, 4 deletions
diff --git a/quit.h b/quit.h
index e7bf05b..704a847 100644
--- a/quit.h
+++ b/quit.h
@@ -1,6 +1,6 @@
/* quit.h -- How to handle SIGINT gracefully. */
-/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2013 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -21,9 +21,11 @@
#if !defined (_QUIT_H_)
#define _QUIT_H_
-/* Non-zero means SIGINT has already ocurred. */
-extern volatile int interrupt_state;
-extern volatile int terminating_signal;
+#include "sig.h" /* for sig_atomic_t */
+
+/* Non-zero means SIGINT has already occurred. */
+extern volatile sig_atomic_t interrupt_state;
+extern volatile sig_atomic_t terminating_signal;
/* Macro to call a great deal. SIGINT just sets the interrupt_state variable.
When it is safe, put QUIT in the code, and the "interrupt" will take
@@ -36,6 +38,12 @@ extern volatile int terminating_signal;
if (interrupt_state) throw_to_top_level (); \
} while (0)
+#define CHECK_ALRM \
+ do { \
+ if (sigalrm_seen) \
+ longjmp (alrmbuf, 1); \
+ } while (0)
+
#define SETINTERRUPT interrupt_state = 1
#define CLRINTERRUPT interrupt_state = 0
@@ -50,4 +58,22 @@ extern volatile int terminating_signal;
if (terminating_signal) termsig_handler (terminating_signal); \
} while (0)
+#define LASTSIG() \
+ (terminating_signal ? terminating_signal : (interrupt_state ? SIGINT : 0))
+
+#define CHECK_WAIT_INTR \
+ do { \
+ if (wait_signal_received && this_shell_builtin && (this_shell_builtin == wait_builtin)) \
+ longjmp (wait_intr_buf, 1); \
+ } while (0)
+
+#define RESET_SIGTERM \
+ do { \
+ sigterm_received = 0; \
+ } while (0)
+
+#define CHECK_SIGTERM \
+ do { \
+ if (sigterm_received) termsig_handler (SIGTERM); \
+ } while (0)
#endif /* _QUIT_H_ */