From 8247c60d3b72d15a668b43ab4dfbf714ab0c4751 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Mon, 4 Dec 2006 12:27:09 +0000 Subject: [PATCH] (handle_USR1_signal, handle_USR2_signal): Replace by... (handle_user_signal): ... this, which generates two USER_SIGNAL_EVENTs first with code == 0 [signal] and one with code == sig number. (main): Use it as handler for SIGUR1 and SIGUSR2. --- src/emacs.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/src/emacs.c b/src/emacs.c index 1377a3d6b37..6f3301b4c83 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -361,9 +361,9 @@ pthread_t main_thread; #endif -#ifdef SIGUSR1 +#if defined (SIGUSR1) || defined (SIGUSR2) SIGTYPE -handle_USR1_signal (sig) +handle_user_signal (sig) int sig; { struct input_event buf; @@ -374,25 +374,10 @@ handle_USR1_signal (sig) buf.frame_or_window = selected_frame; kbd_buffer_store_event (&buf); -} -#endif /* SIGUSR1 */ - -#ifdef SIGUSR2 -SIGTYPE -handle_USR2_signal (sig) - int sig; -{ - struct input_event buf; - - SIGNAL_THREAD_CHECK (sig); - bzero (&buf, sizeof buf); - buf.kind = USER_SIGNAL_EVENT; - buf.code = 1; - buf.frame_or_window = selected_frame; - + buf.code = sig; kbd_buffer_store_event (&buf); } -#endif /* SIGUSR2 */ +#endif /* Handle bus errors, invalid instruction, etc. */ SIGTYPE @@ -1226,10 +1211,10 @@ main (argc, argv signal (SIGILL, fatal_error_signal); signal (SIGTRAP, fatal_error_signal); #ifdef SIGUSR1 - signal (SIGUSR1, handle_USR1_signal); -#ifdef SIGUSR2 - signal (SIGUSR2, handle_USR2_signal); + signal (SIGUSR1, handle_user_signal); #endif +#ifdef SIGUSR2 + signal (SIGUSR2, handle_user_signal); #endif #ifdef SIGABRT signal (SIGABRT, fatal_error_signal); -- 2.39.5