GNU bug report logs - #12471
Avoid some signal-handling races, and simplify.

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Tue, 18 Sep 2012 23:42:02 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 12471 <at> debbugs.gnu.org, lekktu <at> gmail.com, Eli Zaretskii <eliz <at> gnu.org>
Subject: bug#12471: Avoid some signal-handling races, and simplify.
Date: Sat, 22 Sep 2012 14:55:23 -0700
[Message part 1 (text/plain, inline)]
On 09/22/2012 01:28 PM, Stefan Monnier wrote:
> Maybe a better solution is to use `emacs_raise' which can then
> either use `raise' (on POSIX hosts) or something else (on Windows
> hosts).

I still don't see why that helps, but since you and
Eli both seem to prefer that sort of solution I wrote an additional
patch to do it that way, as follows.  Updated total
patch (compressed) attached.

=== modified file 'nt/ChangeLog'
--- nt/ChangeLog	2012-09-21 18:10:25 +0000
+++ nt/ChangeLog	2012-09-22 21:44:27 +0000
@@ -1,6 +1,6 @@
-2012-09-21  Paul Eggert  <eggert <at> cs.ucla.edu>
+2012-09-22  Paul Eggert  <eggert <at> cs.ucla.edu>
 
-	* inc/ms-w32.h (raise): New macro.
+	* inc/ms-w32.h (emacs_raise): New macro.
 
 2012-09-18  Eli Zaretskii  <eliz <at> gnu.org>
 

=== modified file 'nt/inc/ms-w32.h'
--- nt/inc/ms-w32.h	2012-09-21 18:10:25 +0000
+++ nt/inc/ms-w32.h	2012-09-22 21:44:27 +0000
@@ -200,10 +200,12 @@
 /* Subprocess calls that are emulated.  */
 #define spawnve sys_spawnve
 #define wait    sys_wait
-#define raise   sys_raise
 #define kill    sys_kill
 #define signal  sys_signal
 
+/* Internal signals.  */
+#define emacs_raise(sig) kill (getpid (), sig)
+
 /* termcap.c calls that are emulated.  */
 #define tputs   sys_tputs
 #define tgetstr sys_tgetstr

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2012-09-22 21:13:11 +0000
+++ src/ChangeLog	2012-09-22 21:44:27 +0000
@@ -40,7 +40,7 @@
 	(terminate_due_to_signal): Rename from fatal_error_backtrace, since
 	it doesn't always backtrace.  All uses changed.  No need to reset
 	signal to default, since sigaction and/or die does that for us now.
-	Use raise (FOO), not kill (getpid (), FOO).
+	Use emacs_raise (FOO), not kill (getpid (), FOO).
 	(main): Check more-accurately whether we're dumping.
 	Move fatal-error setup to sysdep.c
 	* floatfns.c: Do not include "syssignal.h"; no longer needed.
@@ -124,7 +124,7 @@
 	(emacs_backtrace): Output backtrace for the appropriate thread,
 	which is not necessarily the main thread.
 	* syssignal.h: Include <stdbool.h>.
-	* w32proc.c (sys_raise): New function.
+	(emacs_raise): New macro.
 	* xterm.c (x_connection_signal): Remove; no longer needed
 	now that we use sigaction.
 	(x_connection_closed): No need to mess with sigmask now.

=== modified file 'src/emacs.c'
--- src/emacs.c	2012-09-22 21:13:11 +0000
+++ src/emacs.c	2012-09-22 21:44:27 +0000
@@ -311,7 +311,7 @@
   }
 #endif
 
-  raise (sig);
+  emacs_raise (sig);
 
   /* This shouldn't be executed, but it prevents a warning.  */
   exit (1);

=== modified file 'src/syssignal.h'
--- src/syssignal.h	2012-09-18 21:00:00 +0000
+++ src/syssignal.h	2012-09-22 21:44:27 +0000
@@ -40,6 +40,10 @@
 # define NSIG NSIG_MINIMUM
 #endif
 
+#ifndef emacs_raise
+# define emacs_raise(sig) raise (sig)
+#endif
+
 /* On bsd, [man says] kill does not accept a negative number to kill a pgrp.
    Must do that using the killpg call.  */
 #ifdef BSD_SYSTEM

=== modified file 'src/w32proc.c'
--- src/w32proc.c	2012-09-21 18:10:25 +0000
+++ src/w32proc.c	2012-09-22 21:44:27 +0000
@@ -1421,12 +1421,6 @@
 }
 
 int
-sys_raise (int sig)
-{
-  sys_kill (getpid (), sig);
-}
-
-int
 sys_kill (int pid, int sig)
 {
   child_process *cp;


[syssignaq.txt.gz (application/x-gzip, attachment)]

This bug report was last modified 12 years and 245 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.