unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 12471@debbugs.gnu.org, lekktu@gmail.com
Subject: bug#12471: Avoid some signal-handling races, and simplify.
Date: Sat, 22 Sep 2012 14:55:23 -0700	[thread overview]
Message-ID: <505E33CB.7090709@cs.ucla.edu> (raw)
In-Reply-To: <jwv4nmpu7k6.fsf-monnier+emacs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 3189 bytes --]

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@cs.ucla.edu>
+2012-09-22  Paul Eggert  <eggert@cs.ucla.edu>
 
-	* inc/ms-w32.h (raise): New macro.
+	* inc/ms-w32.h (emacs_raise): New macro.
 
 2012-09-18  Eli Zaretskii  <eliz@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;



[-- Attachment #2: syssignaq.txt.gz --]
[-- Type: application/x-gzip, Size: 67921 bytes --]

  reply	other threads:[~2012-09-22 21:55 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-18 23:39 bug#12471: Avoid some signal-handling races, and simplify Paul Eggert
2012-09-19 16:18 ` Eli Zaretskii
2012-09-20  6:07   ` Paul Eggert
2012-09-20 17:44     ` Eli Zaretskii
2012-09-21  7:42       ` Paul Eggert
2012-09-21  8:31         ` Eli Zaretskii
2012-09-21 17:26           ` Paul Eggert
2012-09-21 17:38             ` Eli Zaretskii
2012-09-21 18:13               ` Paul Eggert
2012-09-21 18:27                 ` Eli Zaretskii
2012-09-21 19:59                   ` Paul Eggert
2012-09-22  8:02                     ` Eli Zaretskii
2012-09-22  8:47                       ` Paul Eggert
2012-09-22  9:10                         ` Eli Zaretskii
2012-09-22  9:40                           ` Paul Eggert
2012-09-22 10:07                             ` Eli Zaretskii
2012-09-22 10:55                               ` Paul Eggert
2012-09-22 11:16                                 ` Eli Zaretskii
2012-09-22 20:28                               ` Stefan Monnier
2012-09-22 21:55                                 ` Paul Eggert [this message]
2012-09-23  3:55                                   ` Eli Zaretskii
2012-09-23  3:52                                 ` Eli Zaretskii
2012-09-19 16:45 ` Jan Djärv
2012-09-19 19:58   ` Paul Eggert
2012-09-20  6:27     ` Jan Djärv
2012-09-19 21:36 ` Andy Moreton
2012-09-23  9:36 ` bug#12471: installed into trunk Paul Eggert
2012-09-23 15:22   ` Andy Moreton
2012-09-23 16:23     ` Andy Moreton
2012-09-23 17:37       ` Juanma Barranquero
2012-09-23 17:37     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=505E33CB.7090709@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=12471@debbugs.gnu.org \
    --cc=lekktu@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).