diff options
| author | Richard M. Stallman | 1997-12-21 02:06:32 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-12-21 02:06:32 +0000 |
| commit | 7317d9e8fc29204a4afd6274e05ed934753e59c0 (patch) | |
| tree | 7e271325b125aaf0f2b2c67bed92966615ab6ad2 /src | |
| parent | 045226c75c2c5cb8eac13dd356dfa5d96fde1ce4 (diff) | |
| download | emacs-7317d9e8fc29204a4afd6274e05ed934753e59c0.tar.gz emacs-7317d9e8fc29204a4afd6274e05ed934753e59c0.zip | |
(Vsignal_USR1_hook, Vsignal_USR2_hook): New variables.
(syms_of_emacs): Set up Lisp variables.
(handle_USR1_signal, handle_USR2_signal): New signal handlers.
(main): Set up signal handlers.
Diffstat (limited to 'src')
| -rw-r--r-- | src/emacs.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/emacs.c b/src/emacs.c index 7e43d6ad949..359e91523fe 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -76,6 +76,14 @@ Lisp_Object Vinstallation_directory; | |||
| 76 | /* Hook run by `kill-emacs' before it does really anything. */ | 76 | /* Hook run by `kill-emacs' before it does really anything. */ |
| 77 | Lisp_Object Vkill_emacs_hook; | 77 | Lisp_Object Vkill_emacs_hook; |
| 78 | 78 | ||
| 79 | #ifdef SIGUSR1 | ||
| 80 | /* Hooks for signal USR1 and USR2 handing */ | ||
| 81 | Lisp_Object Vsignal_USR1_hook; | ||
| 82 | #ifdef SIGUSR2 | ||
| 83 | Lisp_Object Vsignal_USR2_hook; | ||
| 84 | #endif | ||
| 85 | #endif | ||
| 86 | |||
| 79 | /* Set nonzero after Emacs has started up the first time. | 87 | /* Set nonzero after Emacs has started up the first time. |
| 80 | Prevents reinitialization of the Lisp world and keymaps | 88 | Prevents reinitialization of the Lisp world and keymaps |
| 81 | on subsequent starts. */ | 89 | on subsequent starts. */ |
| @@ -165,6 +173,41 @@ int fatal_error_code; | |||
| 165 | /* Nonzero if handling a fatal error already */ | 173 | /* Nonzero if handling a fatal error already */ |
| 166 | int fatal_error_in_progress; | 174 | int fatal_error_in_progress; |
| 167 | 175 | ||
| 176 | #ifdef SIGUSR1 | ||
| 177 | int SIGUSR1_in_progress=0; | ||
| 178 | SIGTYPE | ||
| 179 | handle_USR1_signal (sig) | ||
| 180 | int sig; | ||
| 181 | { | ||
| 182 | if (! SIGUSR1_in_progress) | ||
| 183 | { | ||
| 184 | SIGUSR1_in_progress = 1; | ||
| 185 | |||
| 186 | if (!NILP (Vrun_hooks) && !noninteractive) | ||
| 187 | call1 (Vrun_hooks, intern ("signal-USR1-hook")); | ||
| 188 | |||
| 189 | SIGUSR1_in_progress = 0; | ||
| 190 | } | ||
| 191 | } | ||
| 192 | #ifdef SIGUSR2 | ||
| 193 | int SIGUSR2_in_progress=0; | ||
| 194 | SIGTYPE | ||
| 195 | handle_USR2_signal (sig) | ||
| 196 | int sig; | ||
| 197 | { | ||
| 198 | if (! SIGUSR2_in_progress) | ||
| 199 | { | ||
| 200 | SIGUSR2_in_progress = 1; | ||
| 201 | |||
| 202 | if (!NILP (Vrun_hooks) && !noninteractive) | ||
| 203 | call1 (Vrun_hooks, intern ("signal-USR2-hook")); | ||
| 204 | |||
| 205 | SIGUSR2_in_progress = 0; | ||
| 206 | } | ||
| 207 | } | ||
| 208 | #endif | ||
| 209 | #endif | ||
| 210 | |||
| 168 | /* Handle bus errors, illegal instruction, etc. */ | 211 | /* Handle bus errors, illegal instruction, etc. */ |
| 169 | SIGTYPE | 212 | SIGTYPE |
| 170 | fatal_error_signal (sig) | 213 | fatal_error_signal (sig) |
| @@ -817,6 +860,12 @@ the Bugs section of the Emacs manual or the file BUGS.\n", argv[0]); | |||
| 817 | signal (SIGQUIT, fatal_error_signal); | 860 | signal (SIGQUIT, fatal_error_signal); |
| 818 | signal (SIGILL, fatal_error_signal); | 861 | signal (SIGILL, fatal_error_signal); |
| 819 | signal (SIGTRAP, fatal_error_signal); | 862 | signal (SIGTRAP, fatal_error_signal); |
| 863 | #ifdef SIGUSR1 | ||
| 864 | signal (SIGUSR1, handle_USR1_signal); | ||
| 865 | #ifdef SIGUSR2 | ||
| 866 | signal (SIGUSR2, handle_USR2_signal); | ||
| 867 | #endif | ||
| 868 | #endif | ||
| 820 | #ifdef SIGABRT | 869 | #ifdef SIGABRT |
| 821 | signal (SIGABRT, fatal_error_signal); | 870 | signal (SIGABRT, fatal_error_signal); |
| 822 | #endif | 871 | #endif |
| @@ -1706,6 +1755,18 @@ expect to be able to interact with the user. To ask for confirmation,\n\ | |||
| 1706 | see `kill-emacs-query-functions' instead."); | 1755 | see `kill-emacs-query-functions' instead."); |
| 1707 | Vkill_emacs_hook = Qnil; | 1756 | Vkill_emacs_hook = Qnil; |
| 1708 | 1757 | ||
| 1758 | #ifdef SIGUSR1 | ||
| 1759 | DEFVAR_LISP ("signal-USR1-hook", &Vsignal_USR1_hook, | ||
| 1760 | "Hook to be run whenever emacs recieves a USR1 signal"); | ||
| 1761 | Vsignal_USR1_hook = Qnil; | ||
| 1762 | #ifdef SIGUSR2 | ||
| 1763 | DEFVAR_LISP ("signal-USR2-hook", &Vsignal_USR2_hook, | ||
| 1764 | "Hook to be run whenever emacs recieves a USR2 signal"); | ||
| 1765 | Vsignal_USR2_hook = Qnil; | ||
| 1766 | #endif | ||
| 1767 | #endif | ||
| 1768 | |||
| 1769 | |||
| 1709 | DEFVAR_INT ("emacs-priority", &emacs_priority, | 1770 | DEFVAR_INT ("emacs-priority", &emacs_priority, |
| 1710 | "Priority for Emacs to run at.\n\ | 1771 | "Priority for Emacs to run at.\n\ |
| 1711 | This value is effective only if set before Emacs is dumped,\n\ | 1772 | This value is effective only if set before Emacs is dumped,\n\ |