aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorJoakim Verona2012-09-10 16:03:53 +0200
committerJoakim Verona2012-09-10 16:03:53 +0200
commitb035a30e5cd2f34fedc04c253eeb5a11afed8145 (patch)
treeb9350cce389602f4967bdc1beed745929155ad5d /src/keyboard.c
parent4a37733c693d59a9b83a3fb2d0c7f9461d149f60 (diff)
parenta31a4cdacb196cc96dcb9bd229edb1d635e01344 (diff)
downloademacs-b035a30e5cd2f34fedc04c253eeb5a11afed8145.tar.gz
emacs-b035a30e5cd2f34fedc04c253eeb5a11afed8145.zip
upstream
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c160
1 files changed, 91 insertions, 69 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 9d103d673b2..691a06d36cf 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 21
22#define KEYBOARD_INLINE EXTERN_INLINE 22#define KEYBOARD_INLINE EXTERN_INLINE
23 23
24#include <signal.h>
25#include <stdio.h> 24#include <stdio.h>
26#include <setjmp.h> 25#include <setjmp.h>
27#include "lisp.h" 26#include "lisp.h"
@@ -452,9 +451,8 @@ static void restore_getcjmp (jmp_buf);
452static Lisp_Object apply_modifiers (int, Lisp_Object); 451static Lisp_Object apply_modifiers (int, Lisp_Object);
453static void clear_event (struct input_event *); 452static void clear_event (struct input_event *);
454static Lisp_Object restore_kboard_configuration (Lisp_Object); 453static Lisp_Object restore_kboard_configuration (Lisp_Object);
455static void interrupt_signal (int signalnum);
456#ifdef SIGIO 454#ifdef SIGIO
457static void input_available_signal (int signo); 455static void deliver_input_available_signal (int signo);
458#endif 456#endif
459static void handle_interrupt (void); 457static void handle_interrupt (void);
460static _Noreturn void quit_throw_to_read_char (int); 458static _Noreturn void quit_throw_to_read_char (int);
@@ -462,7 +460,7 @@ static void process_special_events (void);
462static void timer_start_idle (void); 460static void timer_start_idle (void);
463static void timer_stop_idle (void); 461static void timer_stop_idle (void);
464static void timer_resume_idle (void); 462static void timer_resume_idle (void);
465static void handle_user_signal (int); 463static void deliver_user_signal (int);
466static char *find_user_signal_name (int); 464static char *find_user_signal_name (int);
467static int store_user_signal_events (void); 465static int store_user_signal_events (void);
468 466
@@ -1026,7 +1024,7 @@ restore_kboard_configuration (Lisp_Object was_locked)
1026 pop_kboard (); 1024 pop_kboard ();
1027 /* The pop should not change the kboard. */ 1025 /* The pop should not change the kboard. */
1028 if (single_kboard && current_kboard != prev) 1026 if (single_kboard && current_kboard != prev)
1029 abort (); 1027 emacs_abort ();
1030 } 1028 }
1031 return Qnil; 1029 return Qnil;
1032} 1030}
@@ -2608,13 +2606,13 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2608 Lisp_Object last = KVAR (kb, kbd_queue); 2606 Lisp_Object last = KVAR (kb, kbd_queue);
2609 /* We shouldn't get here if we were in single-kboard mode! */ 2607 /* We shouldn't get here if we were in single-kboard mode! */
2610 if (single_kboard) 2608 if (single_kboard)
2611 abort (); 2609 emacs_abort ();
2612 if (CONSP (last)) 2610 if (CONSP (last))
2613 { 2611 {
2614 while (CONSP (XCDR (last))) 2612 while (CONSP (XCDR (last)))
2615 last = XCDR (last); 2613 last = XCDR (last);
2616 if (!NILP (XCDR (last))) 2614 if (!NILP (XCDR (last)))
2617 abort (); 2615 emacs_abort ();
2618 } 2616 }
2619 if (!CONSP (last)) 2617 if (!CONSP (last))
2620 kset_kbd_queue (kb, Fcons (c, Qnil)); 2618 kset_kbd_queue (kb, Fcons (c, Qnil));
@@ -2787,7 +2785,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2787 if (current_kboard->kbd_queue_has_data) 2785 if (current_kboard->kbd_queue_has_data)
2788 { 2786 {
2789 if (!CONSP (KVAR (current_kboard, kbd_queue))) 2787 if (!CONSP (KVAR (current_kboard, kbd_queue)))
2790 abort (); 2788 emacs_abort ();
2791 c = XCAR (KVAR (current_kboard, kbd_queue)); 2789 c = XCAR (KVAR (current_kboard, kbd_queue));
2792 kset_kbd_queue (current_kboard, 2790 kset_kbd_queue (current_kboard,
2793 XCDR (KVAR (current_kboard, kbd_queue))); 2791 XCDR (KVAR (current_kboard, kbd_queue)));
@@ -2854,7 +2852,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2854 while (CONSP (XCDR (last))) 2852 while (CONSP (XCDR (last)))
2855 last = XCDR (last); 2853 last = XCDR (last);
2856 if (!NILP (XCDR (last))) 2854 if (!NILP (XCDR (last)))
2857 abort (); 2855 emacs_abort ();
2858 } 2856 }
2859 if (!CONSP (last)) 2857 if (!CONSP (last))
2860 kset_kbd_queue (kb, Fcons (c, Qnil)); 2858 kset_kbd_queue (kb, Fcons (c, Qnil));
@@ -3563,7 +3561,7 @@ kbd_buffer_store_event_hold (register struct input_event *event,
3563 struct input_event *hold_quit) 3561 struct input_event *hold_quit)
3564{ 3562{
3565 if (event->kind == NO_EVENT) 3563 if (event->kind == NO_EVENT)
3566 abort (); 3564 emacs_abort ();
3567 3565
3568 if (hold_quit && hold_quit->kind != NO_EVENT) 3566 if (hold_quit && hold_quit->kind != NO_EVENT)
3569 return; 3567 return;
@@ -3684,7 +3682,7 @@ kbd_buffer_store_event_hold (register struct input_event *event,
3684 if (immediate_quit && NILP (Vinhibit_quit)) 3682 if (immediate_quit && NILP (Vinhibit_quit))
3685 { 3683 {
3686 immediate_quit = 0; 3684 immediate_quit = 0;
3687 sigfree (); 3685 pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
3688 QUIT; 3686 QUIT;
3689 } 3687 }
3690 } 3688 }
@@ -3836,7 +3834,11 @@ kbd_buffer_get_event (KBOARD **kbp,
3836 unhold_keyboard_input (); 3834 unhold_keyboard_input ();
3837#ifdef SIGIO 3835#ifdef SIGIO
3838 if (!noninteractive) 3836 if (!noninteractive)
3839 signal (SIGIO, input_available_signal); 3837 {
3838 struct sigaction action;
3839 emacs_sigaction_init (&action, deliver_input_available_signal);
3840 sigaction (SIGIO, &action, 0);
3841 }
3840#endif /* SIGIO */ 3842#endif /* SIGIO */
3841 start_polling (); 3843 start_polling ();
3842 } 3844 }
@@ -3958,7 +3960,7 @@ kbd_buffer_get_event (KBOARD **kbp,
3958#else 3960#else
3959 /* We're getting selection request events, but we don't have 3961 /* We're getting selection request events, but we don't have
3960 a window system. */ 3962 a window system. */
3961 abort (); 3963 emacs_abort ();
3962#endif 3964#endif
3963 } 3965 }
3964 3966
@@ -4202,7 +4204,7 @@ kbd_buffer_get_event (KBOARD **kbp,
4202 else 4204 else
4203 /* We were promised by the above while loop that there was 4205 /* We were promised by the above while loop that there was
4204 something for us to read! */ 4206 something for us to read! */
4205 abort (); 4207 emacs_abort ();
4206 4208
4207 input_pending = readable_events (0); 4209 input_pending = readable_events (0);
4208 4210
@@ -4271,7 +4273,7 @@ process_special_events (void)
4271#else 4273#else
4272 /* We're getting selection request events, but we don't have 4274 /* We're getting selection request events, but we don't have
4273 a window system. */ 4275 a window system. */
4274 abort (); 4276 emacs_abort ();
4275#endif 4277#endif
4276 } 4278 }
4277 } 4279 }
@@ -5624,7 +5626,7 @@ make_lispy_event (struct input_event *event)
5624 else if (FRAMEP (event->frame_or_window)) 5626 else if (FRAMEP (event->frame_or_window))
5625 f = XFRAME (event->frame_or_window); 5627 f = XFRAME (event->frame_or_window);
5626 else 5628 else
5627 abort (); 5629 emacs_abort ();
5628 5630
5629 if (FRAME_WINDOW_P (f)) 5631 if (FRAME_WINDOW_P (f))
5630 fuzz = double_click_fuzz; 5632 fuzz = double_click_fuzz;
@@ -5731,7 +5733,7 @@ make_lispy_event (struct input_event *event)
5731 else 5733 else
5732 /* Every mouse event should either have the down_modifier or 5734 /* Every mouse event should either have the down_modifier or
5733 the up_modifier set. */ 5735 the up_modifier set. */
5734 abort (); 5736 emacs_abort ();
5735 5737
5736 { 5738 {
5737 /* Get the symbol we should use for the mouse click. */ 5739 /* Get the symbol we should use for the mouse click. */
@@ -5792,7 +5794,7 @@ make_lispy_event (struct input_event *event)
5792 else if (FRAMEP (event->frame_or_window)) 5794 else if (FRAMEP (event->frame_or_window))
5793 fr = XFRAME (event->frame_or_window); 5795 fr = XFRAME (event->frame_or_window);
5794 else 5796 else
5795 abort (); 5797 emacs_abort ();
5796 5798
5797 fuzz = FRAME_WINDOW_P (fr) 5799 fuzz = FRAME_WINDOW_P (fr)
5798 ? double_click_fuzz : double_click_fuzz / 8; 5800 ? double_click_fuzz : double_click_fuzz / 8;
@@ -5812,7 +5814,7 @@ make_lispy_event (struct input_event *event)
5812 else 5814 else
5813 /* Every wheel event should either have the down_modifier or 5815 /* Every wheel event should either have the down_modifier or
5814 the up_modifier set. */ 5816 the up_modifier set. */
5815 abort (); 5817 emacs_abort ();
5816 5818
5817 if (event->kind == HORIZ_WHEEL_EVENT) 5819 if (event->kind == HORIZ_WHEEL_EVENT)
5818 symbol_num += 2; 5820 symbol_num += 2;
@@ -5981,7 +5983,7 @@ make_lispy_event (struct input_event *event)
5981 { 5983 {
5982 char *name = find_user_signal_name (event->code); 5984 char *name = find_user_signal_name (event->code);
5983 if (!name) 5985 if (!name)
5984 abort (); 5986 emacs_abort ();
5985 return intern (name); 5987 return intern (name);
5986 } 5988 }
5987 5989
@@ -6068,7 +6070,7 @@ make_lispy_event (struct input_event *event)
6068 6070
6069 /* The 'kind' field of the event is something we don't recognize. */ 6071 /* The 'kind' field of the event is something we don't recognize. */
6070 default: 6072 default:
6071 abort (); 6073 emacs_abort ();
6072 } 6074 }
6073} 6075}
6074 6076
@@ -6245,7 +6247,7 @@ apply_modifiers_uncached (int modifiers, char *base, int base_len, int base_len_
6245 /* Only the event queue may use the `up' modifier; it should always 6247 /* Only the event queue may use the `up' modifier; it should always
6246 be turned into a click or drag event before presented to lisp code. */ 6248 be turned into a click or drag event before presented to lisp code. */
6247 if (modifiers & up_modifier) 6249 if (modifiers & up_modifier)
6248 abort (); 6250 emacs_abort ();
6249 6251
6250 if (modifiers & alt_modifier) { *p++ = 'A'; *p++ = '-'; } 6252 if (modifiers & alt_modifier) { *p++ = 'A'; *p++ = '-'; }
6251 if (modifiers & ctrl_modifier) { *p++ = 'C'; *p++ = '-'; } 6253 if (modifiers & ctrl_modifier) { *p++ = 'C'; *p++ = '-'; }
@@ -6340,7 +6342,7 @@ parse_modifiers (Lisp_Object symbol)
6340 Qnil); 6342 Qnil);
6341 6343
6342 if (modifiers & ~INTMASK) 6344 if (modifiers & ~INTMASK)
6343 abort (); 6345 emacs_abort ();
6344 XSETFASTINT (mask, modifiers); 6346 XSETFASTINT (mask, modifiers);
6345 elements = Fcons (unmodified, Fcons (mask, Qnil)); 6347 elements = Fcons (unmodified, Fcons (mask, Qnil));
6346 6348
@@ -6797,10 +6799,12 @@ gobble_input (int expected)
6797#ifdef SIGIO 6799#ifdef SIGIO
6798 if (interrupt_input) 6800 if (interrupt_input)
6799 { 6801 {
6800 SIGMASKTYPE mask; 6802 sigset_t blocked, procmask;
6801 mask = sigblock (sigmask (SIGIO)); 6803 sigemptyset (&blocked);
6804 sigaddset (&blocked, SIGIO);
6805 pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
6802 read_avail_input (expected); 6806 read_avail_input (expected);
6803 sigsetmask (mask); 6807 pthread_sigmask (SIG_SETMASK, &procmask, 0);
6804 } 6808 }
6805 else 6809 else
6806#ifdef POLL_FOR_INPUT 6810#ifdef POLL_FOR_INPUT
@@ -6809,10 +6813,12 @@ gobble_input (int expected)
6809 it's always set. */ 6813 it's always set. */
6810 if (!interrupt_input && poll_suppress_count == 0) 6814 if (!interrupt_input && poll_suppress_count == 0)
6811 { 6815 {
6812 SIGMASKTYPE mask; 6816 sigset_t blocked, procmask;
6813 mask = sigblock (sigmask (SIGALRM)); 6817 sigemptyset (&blocked);
6818 sigaddset (&blocked, SIGALRM);
6819 pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
6814 read_avail_input (expected); 6820 read_avail_input (expected);
6815 sigsetmask (mask); 6821 pthread_sigmask (SIG_SETMASK, &procmask, 0);
6816 } 6822 }
6817 else 6823 else
6818#endif 6824#endif
@@ -6848,10 +6854,12 @@ record_asynch_buffer_change (void)
6848#ifdef SIGIO 6854#ifdef SIGIO
6849 if (interrupt_input) 6855 if (interrupt_input)
6850 { 6856 {
6851 SIGMASKTYPE mask; 6857 sigset_t blocked, procmask;
6852 mask = sigblock (sigmask (SIGIO)); 6858 sigemptyset (&blocked);
6859 sigaddset (&blocked, SIGIO);
6860 pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
6853 kbd_buffer_store_event (&event); 6861 kbd_buffer_store_event (&event);
6854 sigsetmask (mask); 6862 pthread_sigmask (SIG_SETMASK, &procmask, 0);
6855 } 6863 }
6856 else 6864 else
6857#endif 6865#endif
@@ -7017,7 +7025,7 @@ tty_read_avail_input (struct terminal *terminal,
7017 7025
7018 if (terminal->type != output_termcap 7026 if (terminal->type != output_termcap
7019 && terminal->type != output_msdos_raw) 7027 && terminal->type != output_msdos_raw)
7020 abort (); 7028 emacs_abort ();
7021 7029
7022 /* XXX I think the following code should be moved to separate hook 7030 /* XXX I think the following code should be moved to separate hook
7023 functions in system-dependent files. */ 7031 functions in system-dependent files. */
@@ -7252,12 +7260,8 @@ process_pending_signals (void)
7252/* Note SIGIO has been undef'd if FIONREAD is missing. */ 7260/* Note SIGIO has been undef'd if FIONREAD is missing. */
7253 7261
7254static void 7262static void
7255input_available_signal (int signo) 7263handle_input_available_signal (int sig)
7256{ 7264{
7257 /* Must preserve main program's value of errno. */
7258 int old_errno = errno;
7259 SIGNAL_THREAD_CHECK (signo);
7260
7261#ifdef SYNC_INPUT 7265#ifdef SYNC_INPUT
7262 interrupt_input_pending = 1; 7266 interrupt_input_pending = 1;
7263 pending_signals = 1; 7267 pending_signals = 1;
@@ -7269,8 +7273,12 @@ input_available_signal (int signo)
7269#ifndef SYNC_INPUT 7273#ifndef SYNC_INPUT
7270 handle_async_input (); 7274 handle_async_input ();
7271#endif 7275#endif
7276}
7272 7277
7273 errno = old_errno; 7278static void
7279deliver_input_available_signal (int sig)
7280{
7281 handle_on_main_thread (sig, handle_input_available_signal);
7274} 7282}
7275#endif /* SIGIO */ 7283#endif /* SIGIO */
7276 7284
@@ -7312,6 +7320,7 @@ static struct user_signal_info *user_signals = NULL;
7312void 7320void
7313add_user_signal (int sig, const char *name) 7321add_user_signal (int sig, const char *name)
7314{ 7322{
7323 struct sigaction action;
7315 struct user_signal_info *p; 7324 struct user_signal_info *p;
7316 7325
7317 for (p = user_signals; p; p = p->next) 7326 for (p = user_signals; p; p = p->next)
@@ -7326,18 +7335,16 @@ add_user_signal (int sig, const char *name)
7326 p->next = user_signals; 7335 p->next = user_signals;
7327 user_signals = p; 7336 user_signals = p;
7328 7337
7329 signal (sig, handle_user_signal); 7338 emacs_sigaction_init (&action, deliver_user_signal);
7339 sigaction (sig, &action, 0);
7330} 7340}
7331 7341
7332static void 7342static void
7333handle_user_signal (int sig) 7343handle_user_signal (int sig)
7334{ 7344{
7335 int old_errno = errno;
7336 struct user_signal_info *p; 7345 struct user_signal_info *p;
7337 const char *special_event_name = NULL; 7346 const char *special_event_name = NULL;
7338 7347
7339 SIGNAL_THREAD_CHECK (sig);
7340
7341 if (SYMBOLP (Vdebug_on_event)) 7348 if (SYMBOLP (Vdebug_on_event))
7342 special_event_name = SSDATA (SYMBOL_NAME (Vdebug_on_event)); 7349 special_event_name = SSDATA (SYMBOL_NAME (Vdebug_on_event));
7343 7350
@@ -7371,8 +7378,12 @@ handle_user_signal (int sig)
7371 } 7378 }
7372 break; 7379 break;
7373 } 7380 }
7381}
7374 7382
7375 errno = old_errno; 7383static void
7384deliver_user_signal (int sig)
7385{
7386 handle_on_main_thread (sig, handle_user_signal);
7376} 7387}
7377 7388
7378static char * 7389static char *
@@ -7397,7 +7408,7 @@ store_user_signal_events (void)
7397 for (p = user_signals; p; p = p->next) 7408 for (p = user_signals; p; p = p->next)
7398 if (p->npending > 0) 7409 if (p->npending > 0)
7399 { 7410 {
7400 SIGMASKTYPE mask; 7411 sigset_t blocked, procmask;
7401 7412
7402 if (nstored == 0) 7413 if (nstored == 0)
7403 { 7414 {
@@ -7407,7 +7418,10 @@ store_user_signal_events (void)
7407 } 7418 }
7408 nstored += p->npending; 7419 nstored += p->npending;
7409 7420
7410 mask = sigblock (sigmask (p->sig)); 7421 sigemptyset (&blocked);
7422 sigaddset (&blocked, p->sig);
7423 pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
7424
7411 do 7425 do
7412 { 7426 {
7413 buf.code = p->sig; 7427 buf.code = p->sig;
@@ -7415,7 +7429,8 @@ store_user_signal_events (void)
7415 p->npending--; 7429 p->npending--;
7416 } 7430 }
7417 while (p->npending > 0); 7431 while (p->npending > 0);
7418 sigsetmask (mask); 7432
7433 pthread_sigmask (SIG_SETMASK, &procmask, 0);
7419 } 7434 }
7420 7435
7421 return nstored; 7436 return nstored;
@@ -10792,17 +10807,10 @@ clear_waiting_for_input (void)
10792 Otherwise, tell QUIT to kill Emacs. */ 10807 Otherwise, tell QUIT to kill Emacs. */
10793 10808
10794static void 10809static void
10795interrupt_signal (int signalnum) /* If we don't have an argument, some */ 10810handle_interrupt_signal (int sig)
10796 /* compilers complain in signal calls. */
10797{ 10811{
10798 /* Must preserve main program's value of errno. */
10799 int old_errno = errno;
10800 struct terminal *terminal;
10801
10802 SIGNAL_THREAD_CHECK (signalnum);
10803
10804 /* See if we have an active terminal on our controlling tty. */ 10812 /* See if we have an active terminal on our controlling tty. */
10805 terminal = get_named_tty ("/dev/tty"); 10813 struct terminal *terminal = get_named_tty ("/dev/tty");
10806 if (!terminal) 10814 if (!terminal)
10807 { 10815 {
10808 /* If there are no frames there, let's pretend that we are a 10816 /* If there are no frames there, let's pretend that we are a
@@ -10823,10 +10831,15 @@ interrupt_signal (int signalnum) /* If we don't have an argument, some */
10823 10831
10824 handle_interrupt (); 10832 handle_interrupt ();
10825 } 10833 }
10834}
10826 10835
10827 errno = old_errno; 10836static void
10837deliver_interrupt_signal (int sig)
10838{
10839 handle_on_main_thread (sig, handle_interrupt_signal);
10828} 10840}
10829 10841
10842
10830/* If Emacs is stuck because `inhibit-quit' is true, then keep track 10843/* If Emacs is stuck because `inhibit-quit' is true, then keep track
10831 of the number of times C-g has been requested. If C-g is pressed 10844 of the number of times C-g has been requested. If C-g is pressed
10832 enough times, then quit anyway. See bug#6585. */ 10845 enough times, then quit anyway. See bug#6585. */
@@ -10856,7 +10869,10 @@ handle_interrupt (void)
10856 /* If SIGINT isn't blocked, don't let us be interrupted by 10869 /* If SIGINT isn't blocked, don't let us be interrupted by
10857 another SIGINT, it might be harmful due to non-reentrancy 10870 another SIGINT, it might be harmful due to non-reentrancy
10858 in I/O functions. */ 10871 in I/O functions. */
10859 sigblock (sigmask (SIGINT)); 10872 sigset_t blocked;
10873 sigemptyset (&blocked);
10874 sigaddset (&blocked, SIGINT);
10875 pthread_sigmask (SIG_BLOCK, &blocked, 0);
10860 10876
10861 fflush (stdout); 10877 fflush (stdout);
10862 reset_all_sys_modes (); 10878 reset_all_sys_modes ();
@@ -10918,7 +10934,7 @@ handle_interrupt (void)
10918#endif /* not MSDOS */ 10934#endif /* not MSDOS */
10919 fflush (stdout); 10935 fflush (stdout);
10920 if (((c = getchar ()) & ~040) == 'Y') 10936 if (((c = getchar ()) & ~040) == 'Y')
10921 abort (); 10937 emacs_abort ();
10922 while (c != '\n') c = getchar (); 10938 while (c != '\n') c = getchar ();
10923#ifdef MSDOS 10939#ifdef MSDOS
10924 printf ("\r\nContinuing...\r\n"); 10940 printf ("\r\nContinuing...\r\n");
@@ -10927,7 +10943,7 @@ handle_interrupt (void)
10927#endif /* not MSDOS */ 10943#endif /* not MSDOS */
10928 fflush (stdout); 10944 fflush (stdout);
10929 init_all_sys_modes (); 10945 init_all_sys_modes ();
10930 sigfree (); 10946 pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
10931 } 10947 }
10932 else 10948 else
10933 { 10949 {
@@ -10940,7 +10956,7 @@ handle_interrupt (void)
10940 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 10956 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
10941 10957
10942 immediate_quit = 0; 10958 immediate_quit = 0;
10943 sigfree (); 10959 pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
10944 saved = gl_state; 10960 saved = gl_state;
10945 GCPRO4 (saved.object, saved.global_code, 10961 GCPRO4 (saved.object, saved.global_code,
10946 saved.current_syntax_table, saved.old_prop); 10962 saved.current_syntax_table, saved.old_prop);
@@ -10985,7 +11001,7 @@ quit_throw_to_read_char (int from_signal)
10985 if (!from_signal && EQ (Vquit_flag, Qkill_emacs)) 11001 if (!from_signal && EQ (Vquit_flag, Qkill_emacs))
10986 Fkill_emacs (Qnil); 11002 Fkill_emacs (Qnil);
10987 11003
10988 sigfree (); 11004 pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
10989 /* Prevent another signal from doing this before we finish. */ 11005 /* Prevent another signal from doing this before we finish. */
10990 clear_waiting_for_input (); 11006 clear_waiting_for_input ();
10991 input_pending = 0; 11007 input_pending = 0;
@@ -10999,7 +11015,7 @@ quit_throw_to_read_char (int from_signal)
10999#ifdef POLL_FOR_INPUT 11015#ifdef POLL_FOR_INPUT
11000 /* May be > 1 if in recursive minibuffer. */ 11016 /* May be > 1 if in recursive minibuffer. */
11001 if (poll_suppress_count == 0) 11017 if (poll_suppress_count == 0)
11002 abort (); 11018 emacs_abort ();
11003#endif 11019#endif
11004#endif 11020#endif
11005 if (FRAMEP (internal_last_event_frame) 11021 if (FRAMEP (internal_last_event_frame)
@@ -11357,7 +11373,7 @@ delete_kboard (KBOARD *kb)
11357 11373
11358 for (kbp = &all_kboards; *kbp != kb; kbp = &(*kbp)->next_kboard) 11374 for (kbp = &all_kboards; *kbp != kb; kbp = &(*kbp)->next_kboard)
11359 if (*kbp == NULL) 11375 if (*kbp == NULL)
11360 abort (); 11376 emacs_abort ();
11361 *kbp = kb->next_kboard; 11377 *kbp = kb->next_kboard;
11362 11378
11363 /* Prevent a dangling reference to KB. */ 11379 /* Prevent a dangling reference to KB. */
@@ -11368,7 +11384,7 @@ delete_kboard (KBOARD *kb)
11368 current_kboard = FRAME_KBOARD (XFRAME (selected_frame)); 11384 current_kboard = FRAME_KBOARD (XFRAME (selected_frame));
11369 single_kboard = 0; 11385 single_kboard = 0;
11370 if (current_kboard == kb) 11386 if (current_kboard == kb)
11371 abort (); 11387 emacs_abort ();
11372 } 11388 }
11373 11389
11374 wipe_kboard (kb); 11390 wipe_kboard (kb);
@@ -11420,17 +11436,23 @@ init_keyboard (void)
11420 SIGINT. There is special code in interrupt_signal to exit 11436 SIGINT. There is special code in interrupt_signal to exit
11421 Emacs on SIGINT when there are no termcap frames on the 11437 Emacs on SIGINT when there are no termcap frames on the
11422 controlling terminal. */ 11438 controlling terminal. */
11423 signal (SIGINT, interrupt_signal); 11439 struct sigaction action;
11440 emacs_sigaction_init (&action, deliver_interrupt_signal);
11441 sigaction (SIGINT, &action, 0);
11424#ifndef DOS_NT 11442#ifndef DOS_NT
11425 /* For systems with SysV TERMIO, C-g is set up for both SIGINT and 11443 /* For systems with SysV TERMIO, C-g is set up for both SIGINT and
11426 SIGQUIT and we can't tell which one it will give us. */ 11444 SIGQUIT and we can't tell which one it will give us. */
11427 signal (SIGQUIT, interrupt_signal); 11445 sigaction (SIGQUIT, &action, 0);
11428#endif /* not DOS_NT */ 11446#endif /* not DOS_NT */
11429 } 11447 }
11430/* Note SIGIO has been undef'd if FIONREAD is missing. */ 11448/* Note SIGIO has been undef'd if FIONREAD is missing. */
11431#ifdef SIGIO 11449#ifdef SIGIO
11432 if (!noninteractive) 11450 if (!noninteractive)
11433 signal (SIGIO, input_available_signal); 11451 {
11452 struct sigaction action;
11453 emacs_sigaction_init (&action, deliver_input_available_signal);
11454 sigaction (SIGIO, &action, 0);
11455 }
11434#endif /* SIGIO */ 11456#endif /* SIGIO */
11435 11457
11436/* Use interrupt input by default, if it works and noninterrupt input 11458/* Use interrupt input by default, if it works and noninterrupt input
@@ -11442,7 +11464,7 @@ init_keyboard (void)
11442 interrupt_input = 0; 11464 interrupt_input = 0;
11443#endif 11465#endif
11444 11466
11445 sigfree (); 11467 pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
11446 dribble = 0; 11468 dribble = 0;
11447 11469
11448 if (keyboard_init_hook) 11470 if (keyboard_init_hook)