diff options
| author | Paul Eggert | 2012-09-06 18:27:44 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-09-06 18:27:44 -0700 |
| commit | 2fe282993cf9c84f5be424dc93d03f9705a7edd8 (patch) | |
| tree | 229edb6fe29e66984b2992f3f9fa081cd7fe8920 /src/ChangeLog | |
| parent | 845ce106c0ab157e25416964330875ad6c24b699 (diff) | |
| download | emacs-2fe282993cf9c84f5be424dc93d03f9705a7edd8.tar.gz emacs-2fe282993cf9c84f5be424dc93d03f9705a7edd8.zip | |
Signal-handler cleanup.
Emacs's signal handlers were written in the old 4.2BSD style with
sigblock and sigmask and so forth, and this led to some
inefficiencies and confusion. Rewrite these to use
pthread_sigmask etc. without copying signal sets around. Also,
get rid of the confusing macros 'SIGNAL_THREAD_CHECK' and
'signal', and instead use functions that do not attempt to take
over the system name space. This patch causes Emacs's text
segment to shrink by 0.7% on my platform, Fedora 17 x86-64.
* configure.ac (PTY_OPEN, PTY_TTY_NAME_SPRINTF):
Adjust to syssignal.h changes.
(SIGNAL_H_AB): Remove; no longer needed.
* src/alloc.c, src/emacsgtkfixed.c, src/nsfns.m, src/widget.c, src/xmenu.c:
Do not include <signal.h> or "syssignal.h", as these
modules do not use signals.
* src/atimer.c, src/callproc.c, src/data.c, src/dispnew.c, src/emacs.c:
* src/floatfns.c, src/gtkutil.c, src/keyboard.c, src/process.c, src/sound.c:
* src/sysdep.c, src/term.c, src/xterm.c:
Do not include <signal.h>, as "syssignal.h" does that for us now.
* src/atimer.c (sigmask_atimers): New function.
(block_atimers, unblock_atimers): New functions,
replacing the old macros BLOCK_ATIMERS and UNBLOCK_ATIMERS.
All uses replaced.
* src/conf_post.h [SIGNAL_H_AHB]: Do not include <signal.h>;
no longer needed here.
* src/emacs.c (main): Inspect existing signal handler with sigaction,
so that there's no need to block and unblock SIGHUP.
* src/sysdep.c (struct save_signal): New member 'action', replacing
old member 'handler'.
(save_signal_handlers, restore_signal_handlers):
Use sigaction instead of 'signal' to save and restore.
(get_set_sighandler, set_sighandler) [!WINDOWSNT]:
New function. All users of 'signal' modified to use set_sighandler
if they're writeonly, and to use sys_signal if they're read+write.
(emacs_sigaction_init, forwarded_signal): New functions.
(sys_signal): Remove. All uses replaced by calls to sigaction
and emacs_sigaction_init, or by direct calls to 'signal'.
(sys_sigmask) [!__GNUC__]: Remove; no longer needed.
(sys_sigblock, sys_sigunblock, sys_sigsetmask): Remove;
all uses replaced by pthread_sigmask etc. calls.
* src/syssignal.h: Include <signal.h>.
(emacs_sigaction_init, forwarded_signal): New decls.
(SIGMASKTYPE): Remove. All uses replaced by its definiens, sigset_t.
(SIGEMPTYMASK): Remove; all uses replaced by its definiens, empty_mask.
(sigmask, sys_sigmask): Remove; no longer needed.
(sigpause): Remove. All uses replaced by its definiens, sigsuspend.
(sigblock, sigunblock, sigfree):
(sigsetmask) [!defined sigsetmask]:
Remove. All uses replaced by pthread_sigmask.
(signal): Remove. Its remaining uses (with SIG_DFL and SIG_IGN)
no longer need to be replaced, and its typical old uses
are now done via emacs_sigaction_init and sigaction.
(sys_sigblock, sys_sigunblock, sys_sigsetmask): Remove decls.
(sys_sigdel): Remove; unused.
(NSIG): Remove a FIXME; the code's fine. Remove an unnecessary ifdef.
Fixes: debbugs:12327
Diffstat (limited to 'src/ChangeLog')
| -rw-r--r-- | src/ChangeLog | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 479fb38e60b..3bfa9e929d5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,57 @@ | |||
| 1 | 2012-09-06 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Signal-handler cleanup (Bug#12327). | ||
| 4 | Emacs's signal handlers were written in the old 4.2BSD style with | ||
| 5 | sigblock and sigmask and so forth, and this led to some | ||
| 6 | inefficiencies and confusion. Rewrite these to use | ||
| 7 | pthread_sigmask etc. without copying signal sets around. Also, | ||
| 8 | get rid of the confusing macros 'SIGNAL_THREAD_CHECK' and | ||
| 9 | 'signal', and instead use functions that do not attempt to take | ||
| 10 | over the system name space. This patch causes Emacs's text | ||
| 11 | segment to shrink by 0.7% on my platform, Fedora 17 x86-64. | ||
| 12 | * alloc.c, emacsgtkfixed.c, nsfns.m, widget.c, xmenu.c: | ||
| 13 | Do not include <signal.h> or "syssignal.h", as these | ||
| 14 | modules do not use signals. | ||
| 15 | * atimer.c, callproc.c, data.c, dispnew.c, emacs.c, floatfns.c: | ||
| 16 | * gtkutil.c, keyboard.c, process.c, sound.c, sysdep.c, term.c, xterm.c: | ||
| 17 | Do not include <signal.h>, as "syssignal.h" does that for us now. | ||
| 18 | * atimer.c (sigmask_atimers): New function. | ||
| 19 | (block_atimers, unblock_atimers): New functions, | ||
| 20 | replacing the old macros BLOCK_ATIMERS and UNBLOCK_ATIMERS. | ||
| 21 | All uses replaced. | ||
| 22 | * conf_post.h [SIGNAL_H_AHB]: Do not include <signal.h>; | ||
| 23 | no longer needed here. | ||
| 24 | * emacs.c (main): Inspect existing signal handler with sigaction, | ||
| 25 | so that there's no need to block and unblock SIGHUP. | ||
| 26 | * sysdep.c (struct save_signal): New member 'action', replacing | ||
| 27 | old member 'handler'. | ||
| 28 | (save_signal_handlers, restore_signal_handlers): | ||
| 29 | Use sigaction instead of 'signal' to save and restore. | ||
| 30 | (get_set_sighandler, set_sighandler) [!WINDOWSNT]: | ||
| 31 | New function. All users of 'signal' modified to use set_sighandler | ||
| 32 | if they're writeonly, and to use sys_signal if they're read+write. | ||
| 33 | (emacs_sigaction_init, forwarded_signal): New functions. | ||
| 34 | (sys_signal): Remove. All uses replaced by calls to sigaction | ||
| 35 | and emacs_sigaction_init, or by direct calls to 'signal'. | ||
| 36 | (sys_sigmask) [!__GNUC__]: Remove; no longer needed. | ||
| 37 | (sys_sigblock, sys_sigunblock, sys_sigsetmask): Remove; | ||
| 38 | all uses replaced by pthread_sigmask etc. calls. | ||
| 39 | * syssignal.h: Include <signal.h>. | ||
| 40 | (emacs_sigaction_init, forwarded_signal): New decls. | ||
| 41 | (SIGMASKTYPE): Remove. All uses replaced by its definiens, sigset_t. | ||
| 42 | (SIGEMPTYMASK): Remove; all uses replaced by its definiens, empty_mask. | ||
| 43 | (sigmask, sys_sigmask): Remove; no longer needed. | ||
| 44 | (sigpause): Remove. All uses replaced by its definiens, sigsuspend. | ||
| 45 | (sigblock, sigunblock, sigfree): | ||
| 46 | (sigsetmask) [!defined sigsetmask]: | ||
| 47 | Remove. All uses replaced by pthread_sigmask. | ||
| 48 | (signal): Remove. Its remaining uses (with SIG_DFL and SIG_IGN) | ||
| 49 | no longer need to be replaced, and its typical old uses | ||
| 50 | are now done via emacs_sigaction_init and sigaction. | ||
| 51 | (sys_sigblock, sys_sigunblock, sys_sigsetmask): Remove decls. | ||
| 52 | (sys_sigdel): Remove; unused. | ||
| 53 | (NSIG): Remove a FIXME; the code's fine. Remove an unnecessary ifdef. | ||
| 54 | |||
| 1 | 2012-09-06 Eli Zaretskii <eliz@gnu.org> | 55 | 2012-09-06 Eli Zaretskii <eliz@gnu.org> |
| 2 | 56 | ||
| 3 | * process.c (CAN_HANDLE_MULTIPLE_CHILDREN): Fix a typo that broke | 57 | * process.c (CAN_HANDLE_MULTIPLE_CHILDREN): Fix a typo that broke |
| @@ -50,7 +104,7 @@ | |||
| 50 | 104 | ||
| 51 | 2012-09-05 Paul Eggert <eggert@cs.ucla.edu> | 105 | 2012-09-05 Paul Eggert <eggert@cs.ucla.edu> |
| 52 | 106 | ||
| 53 | Fix race conditions with signal handlers and errno. | 107 | Fix race conditions with signal handlers and errno (Bug#12327). |
| 54 | Be more systematic about preserving errno whenever a signal | 108 | Be more systematic about preserving errno whenever a signal |
| 55 | handler returns, even if it's not in the main thread. Do this by | 109 | handler returns, even if it's not in the main thread. Do this by |
| 56 | renaming signal handlers to distinguish between signal delivery | 110 | renaming signal handlers to distinguish between signal delivery |