diff options
| author | Paul Eggert | 2012-09-05 14:33:53 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-09-05 14:33:53 -0700 |
| commit | 20ef56dbc88f517ebf60d89577fc89870d9fe888 (patch) | |
| tree | e93c0bc49e89e86836575b2b4443c699a237621d /src/ChangeLog | |
| parent | a4e6c042f8f66c47209d76d863adbf5ea3f84a96 (diff) | |
| download | emacs-20ef56dbc88f517ebf60d89577fc89870d9fe888.tar.gz emacs-20ef56dbc88f517ebf60d89577fc89870d9fe888.zip | |
Fix race conditions with signal handlers and errno.
Be more systematic about preserving errno whenever a signal
handler returns, even if it's not in the main thread. Do this by
renaming signal handlers to distinguish between signal delivery
and signal handling. All uses changed.
* atimer.c (deliver_alarm_signal): Rename from alarm_signal_handler.
* data.c (deliver_arith_signal): Rename from arith_error.
* dispnew.c (deliver_window_change_signal): Rename from
window_change_signal.
* emacs.c (deliver_error_signal): Rename from fatal_error_signal.
(deliver_danger_signal) [SIGDANGER]: Rename from memory_warning_signal.
* keyboard.c (deliver_input_available_signal): Rename from
input_available_signal.
(deliver_user_signal): Rename from handle_user_signal.
(deliver_interrupt_signal): Rename from interrupt_signal.
* process.c (deliver_pipe_signal): Rename from send_process_trap.
(deliver_child_signal): Rename from sigchld_handler.
* atimer.c (handle_alarm_signal):
* data.c (handle_arith_signal):
* dispnew.c (handle_window_change_signal):
* emacs.c (handle_fatal_signal, handle_danger_signal):
* keyboard.c (handle_input_available_signal):
* keyboard.c (handle_user_signal, handle_interrupt_signal):
* process.c (handle_pipe_signal, handle_child_signal):
New functions, with the actual signal-handling code taken from the
original respective signal handlers, sans the sporadic attempts to
preserve errno, since that's now done by handle_on_main_thread.
* atimer.c (alarm_signal_handler): Remove unnecessary decl.
* emacs.c, floatfns.c, lisp.h: Remove unused FLOAT_CATCH_SIGKILL cruft.
* emacs.c (main_thread) [FORWARD_SIGNAL_TO_MAIN_THREAD]:
Move to sysdep.c.
(main) [FORWARD_SIGNAL_TO_MAIN_THREAD]:
Move initialization of main_thread to sysdep.c's init_signals.
* process.c (waitpid) [!WNOHANG]: #define to wait; that's good enough for
our usage, and simplifies the mainline code.
(record_child_status_change): New static function, as a helper
for handle_child_signal, and with most of the old child handler's
contents.
(CAN_HANDLE_MULTIPLE_CHILDREN): New constant.
(handle_child_signal): Use the above.
* sysdep.c (main_thread) [FORWARD_SIGNAL_TO_MAIN_THREAD]:
Moved here from emacs.c.
(init_signals) [FORWARD_SIGNAL_TO_MAIN_THREAD]: Initialize it;
code moved here from emacs.c's main function.
* sysdep.c, syssignal.h (handle_on_main_thread): New function,
replacing the old SIGNAL_THREAD_CHECK. All uses changed. This
lets callers save and restore errno properly.
Diffstat (limited to 'src/ChangeLog')
| -rw-r--r-- | src/ChangeLog | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 96e3fdd5b45..24d290e163d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,53 @@ | |||
| 1 | 2012-09-05 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Fix race conditions with signal handlers and errno. | ||
| 4 | Be more systematic about preserving errno whenever a signal | ||
| 5 | handler returns, even if it's not in the main thread. Do this by | ||
| 6 | renaming signal handlers to distinguish between signal delivery | ||
| 7 | and signal handling. All uses changed. | ||
| 8 | * atimer.c (deliver_alarm_signal): Rename from alarm_signal_handler. | ||
| 9 | * data.c (deliver_arith_signal): Rename from arith_error. | ||
| 10 | * dispnew.c (deliver_window_change_signal): Rename from | ||
| 11 | window_change_signal. | ||
| 12 | * emacs.c (deliver_error_signal): Rename from fatal_error_signal. | ||
| 13 | (deliver_danger_signal) [SIGDANGER]: Rename from memory_warning_signal. | ||
| 14 | * keyboard.c (deliver_input_available_signal): Rename from | ||
| 15 | input_available_signal. | ||
| 16 | (deliver_user_signal): Rename from handle_user_signal. | ||
| 17 | (deliver_interrupt_signal): Rename from interrupt_signal. | ||
| 18 | * process.c (deliver_pipe_signal): Rename from send_process_trap. | ||
| 19 | (deliver_child_signal): Rename from sigchld_handler. | ||
| 20 | * atimer.c (handle_alarm_signal): | ||
| 21 | * data.c (handle_arith_signal): | ||
| 22 | * dispnew.c (handle_window_change_signal): | ||
| 23 | * emacs.c (handle_fatal_signal, handle_danger_signal): | ||
| 24 | * keyboard.c (handle_input_available_signal): | ||
| 25 | * keyboard.c (handle_user_signal, handle_interrupt_signal): | ||
| 26 | * process.c (handle_pipe_signal, handle_child_signal): | ||
| 27 | New functions, with the actual signal-handling code taken from the | ||
| 28 | original respective signal handlers, sans the sporadic attempts to | ||
| 29 | preserve errno, since that's now done by handle_on_main_thread. | ||
| 30 | * atimer.c (alarm_signal_handler): Remove unnecessary decl. | ||
| 31 | * emacs.c, floatfns.c, lisp.h: Remove unused FLOAT_CATCH_SIGKILL cruft. | ||
| 32 | * emacs.c (main_thread) [FORWARD_SIGNAL_TO_MAIN_THREAD]: | ||
| 33 | Move to sysdep.c. | ||
| 34 | (main) [FORWARD_SIGNAL_TO_MAIN_THREAD]: | ||
| 35 | Move initialization of main_thread to sysdep.c's init_signals. | ||
| 36 | * process.c (waitpid) [!WNOHANG]: #define to wait; that's good enough for | ||
| 37 | our usage, and simplifies the mainline code. | ||
| 38 | (record_child_status_change): New static function, as a helper | ||
| 39 | for handle_child_signal, and with most of the old child handler's | ||
| 40 | contents. | ||
| 41 | (CAN_HANDLE_MULTIPLE_CHILDREN): New constant. | ||
| 42 | (handle_child_signal): Use the above. | ||
| 43 | * sysdep.c (main_thread) [FORWARD_SIGNAL_TO_MAIN_THREAD]: | ||
| 44 | Moved here from emacs.c. | ||
| 45 | (init_signals) [FORWARD_SIGNAL_TO_MAIN_THREAD]: Initialize it; | ||
| 46 | code moved here from emacs.c's main function. | ||
| 47 | * sysdep.c, syssignal.h (handle_on_main_thread): New function, | ||
| 48 | replacing the old SIGNAL_THREAD_CHECK. All uses changed. This | ||
| 49 | lets callers save and restore errno properly. | ||
| 50 | |||
| 1 | 2012-09-05 Dmitry Antipov <dmantipov@yandex.ru> | 51 | 2012-09-05 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 52 | ||
| 3 | Remove redundant or unused things here and there. | 53 | Remove redundant or unused things here and there. |