aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2004-11-25 20:01:39 +0000
committerStefan Monnier2004-11-25 20:01:39 +0000
commit275464e7a5b740a403e65face0373ad50992887f (patch)
treeb2f058e2fe7699f4b36868fc8dcad36bc2d602dd /src
parent495bf63050e24ad68826f370bfa91ed8f26ccd89 (diff)
downloademacs-275464e7a5b740a403e65face0373ad50992887f.tar.gz
emacs-275464e7a5b740a403e65face0373ad50992887f.zip
(sys_signal): Don't use SA_RESTART if SYNC_INPUT is set.
(emacs_open, emacs_read, emacs_write): Check QUIT when interrupted.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/sysdep.c18
2 files changed, 19 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f8e17d46e30..c9196c5b707 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
12004-11-25 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * sysdep.c (sys_signal): Don't use SA_RESTART if SYNC_INPUT is set.
4 (emacs_open, emacs_read, emacs_write): Check QUIT when interrupted.
5
6 * lread.c (readchar): Check QUIT when `getc' is interrupted.
7
12004-11-24 Richard M. Stallman <rms@gnu.org> 82004-11-24 Richard M. Stallman <rms@gnu.org>
2 9
3 * coding.c (run_pre_post_conversion_on_str): Bind Qinhibit_read_only. 10 * coding.c (run_pre_post_conversion_on_str): Bind Qinhibit_read_only.
diff --git a/src/sysdep.c b/src/sysdep.c
index b120dcd950d..8ce49cd2e97 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1,6 +1,6 @@
1/* Interfaces to system-dependent kernel and library entries. 1/* Interfaces to system-dependent kernel and library entries.
2 Copyright (C) 1985, 86,87,88,93,94,95,1999,2000,01,2003 2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001,
3 Free Software Foundation, Inc. 3 2003, 2004 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -2768,12 +2768,16 @@ sys_signal (int signal_number, signal_handler_t action)
2768 struct sigaction new_action, old_action; 2768 struct sigaction new_action, old_action;
2769 sigemptyset (&new_action.sa_mask); 2769 sigemptyset (&new_action.sa_mask);
2770 new_action.sa_handler = action; 2770 new_action.sa_handler = action;
2771#if defined (SA_RESTART) && ! defined (BROKEN_SA_RESTART) 2771#if defined (SA_RESTART) && ! defined (BROKEN_SA_RESTART) && !defined(SYNC_INPUT)
2772 /* Emacs mostly works better with restartable system services. If this 2772 /* Emacs mostly works better with restartable system services. If this
2773 flag exists, we probably want to turn it on here. 2773 flag exists, we probably want to turn it on here.
2774 However, on some systems this resets the timeout of `select' 2774 However, on some systems this resets the timeout of `select'
2775 which means that `select' never finishes if it keeps getting signals. 2775 which means that `select' never finishes if it keeps getting signals.
2776 BROKEN_SA_RESTART is defined on those systems. */ 2776 BROKEN_SA_RESTART is defined on those systems. */
2777 /* It's not clear why the comment above says "mostly works better". --Stef
2778 When SYNC_INPUT is set, we don't want SA_RESTART because we need to poll
2779 for pending input so we need long-running syscalls to be interrupted
2780 after a signal that sets the interrupt_input_pending flag. */
2777 new_action.sa_flags = SA_RESTART; 2781 new_action.sa_flags = SA_RESTART;
2778#else 2782#else
2779 new_action.sa_flags = 0; 2783 new_action.sa_flags = 0;
@@ -3225,7 +3229,8 @@ emacs_open (path, oflag, mode)
3225#endif 3229#endif
3226 3230
3227 while ((rtnval = open (path, oflag, mode)) == -1 3231 while ((rtnval = open (path, oflag, mode)) == -1
3228 && (errno == EINTR)); 3232 && (errno == EINTR))
3233 QUIT;
3229 return (rtnval); 3234 return (rtnval);
3230} 3235}
3231 3236
@@ -3258,7 +3263,8 @@ emacs_read (fildes, buf, nbyte)
3258 register int rtnval; 3263 register int rtnval;
3259 3264
3260 while ((rtnval = read (fildes, buf, nbyte)) == -1 3265 while ((rtnval = read (fildes, buf, nbyte)) == -1
3261 && (errno == EINTR)); 3266 && (errno == EINTR))
3267 QUIT;
3262 return (rtnval); 3268 return (rtnval);
3263} 3269}
3264 3270
@@ -3279,7 +3285,7 @@ emacs_write (fildes, buf, nbyte)
3279 if (rtnval == -1) 3285 if (rtnval == -1)
3280 { 3286 {
3281 if (errno == EINTR) 3287 if (errno == EINTR)
3282 continue; 3288 { QUIT; continue; }
3283 else 3289 else
3284 return (bytes_written ? bytes_written : -1); 3290 return (bytes_written ? bytes_written : -1);
3285 } 3291 }