From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#13026: Assume POSIX 1003.1-1988 or later for signal.h. Date: Wed, 28 Nov 2012 22:52:31 -0800 Organization: UCLA Computer Science Department Message-ID: <50B7062F.1010901@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1354171993 29868 80.91.229.3 (29 Nov 2012 06:53:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 29 Nov 2012 06:53:13 +0000 (UTC) To: 13026@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Nov 29 07:53:25 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Tdxzw-0005bk-K9 for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Nov 2012 07:53:24 +0100 Original-Received: from localhost ([::1]:50552 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tdxzk-0001It-VM for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Nov 2012 01:53:12 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:44076) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tdxzf-0001I2-J8 for bug-gnu-emacs@gnu.org; Thu, 29 Nov 2012 01:53:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tdxzd-0007aX-3A for bug-gnu-emacs@gnu.org; Thu, 29 Nov 2012 01:53:07 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34232) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tdxzc-0007aP-W0 for bug-gnu-emacs@gnu.org; Thu, 29 Nov 2012 01:53:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Tdy1V-0006Tv-Sj for bug-gnu-emacs@gnu.org; Thu, 29 Nov 2012 01:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 29 Nov 2012 06:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13026 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.135417208924894 (code B ref -1); Thu, 29 Nov 2012 06:55:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Nov 2012 06:54:49 +0000 Original-Received: from localhost ([127.0.0.1]:44483 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tdy1H-0006TR-By for submit@debbugs.gnu.org; Thu, 29 Nov 2012 01:54:49 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:48646) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tdy1B-0006TG-FL for submit@debbugs.gnu.org; Thu, 29 Nov 2012 01:54:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TdxzD-0007QC-Vv for submit@debbugs.gnu.org; Thu, 29 Nov 2012 01:52:42 -0500 Original-Received: from lists.gnu.org ([208.118.235.17]:60114) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TdxzD-0007Py-SU for submit@debbugs.gnu.org; Thu, 29 Nov 2012 01:52:39 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:43977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TdxzA-0001Gv-M4 for bug-gnu-emacs@gnu.org; Thu, 29 Nov 2012 01:52:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tdxz7-0007Ij-NW for bug-gnu-emacs@gnu.org; Thu, 29 Nov 2012 01:52:36 -0500 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:51442) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tdxz7-0007IP-96 for bug-gnu-emacs@gnu.org; Thu, 29 Nov 2012 01:52:33 -0500 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 884A139E8105 for ; Wed, 28 Nov 2012 22:52:31 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IufS46udfe65 for ; Wed, 28 Nov 2012 22:52:29 -0800 (PST) Original-Received: from [192.168.1.3] (pool-71-189-154-249.lsanca.fios.verizon.net [71.189.154.249]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 9428639E8008 for ; Wed, 28 Nov 2012 22:52:29 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:67581 Archived-At: Tags: patch Attached is a proposed patch to simplify Emacs by assuming POSIX 1003.1-1988 or later for signal.h, which I'd like to install soon. This patch is relative to trunk bzr 111026. Tested on Fedora 17. === modified file 'ChangeLog' --- ChangeLog 2012-11-27 03:10:32 +0000 +++ ChangeLog 2012-11-29 06:46:35 +0000 @@ -1,3 +1,9 @@ +2012-11-29 Paul Eggert + + Assume POSIX 1003.1-1988 or later for signal.h. + * configure.ac (PTY_OPEN, PTY_TTY_NAME_SPRINTF): + Use SIGCHLD rather than SIGCLD. + 2012-11-27 Eli Zaretskii * make-dist (nt): Adjust to changes in names of the *.manifest files. === modified file 'admin/CPP-DEFINES' --- admin/CPP-DEFINES 2012-11-24 17:20:49 +0000 +++ admin/CPP-DEFINES 2012-11-29 06:46:35 +0000 @@ -419,14 +419,7 @@ PURESIZE RUN_TIME_REMAP SETUP_SLAVE_PTY -SIGALRM -SIGCHLD -SIGHUP -SIGKILL SIGNALS_VIA_CHARACTERS -SIGPIPE -SIGQUIT -SIGTRAP STDC_HEADERS SYSTEM_PURESIZE_EXTRA SYSTEM_MALLOC === modified file 'admin/ChangeLog' --- admin/ChangeLog 2012-11-24 17:20:49 +0000 +++ admin/ChangeLog 2012-11-29 06:46:35 +0000 @@ -1,3 +1,10 @@ +2012-11-29 Paul Eggert + + Assume POSIX 1003.1-1988 or later for signal.h. + * CPP-DEFINES (SIGALRM, SIGCHLD, SIGHUP, SIGKILL, SIGPIPE, SIGQUIT): + Remove. + (SIGTRAP): Remove this one too, as config.h no longer defines it. + 2012-11-24 Ken Brown * CPP-DEFINES (HAVE_MOUSE): Remove. === modified file 'configure.ac' --- configure.ac 2012-11-27 03:10:32 +0000 +++ configure.ac 2012-11-29 06:46:35 +0000 @@ -3600,7 +3600,7 @@ AC_DEFINE(PTY_ITERATION, []) dnl Not used, because PTY_ITERATION is defined. AC_DEFINE(FIRST_PTY_LETTER, ['q']) - AC_DEFINE(PTY_OPEN, [ { struct sigaction ocstat, cstat; struct stat stb; char * name; sigemptyset(&cstat.sa_mask); cstat.sa_handler = SIG_DFL; cstat.sa_flags = 0; sigaction(SIGCLD, &cstat, &ocstat); name = _getpty (&fd, O_RDWR | O_NDELAY, 0600, 0); sigaction(SIGCLD, &ocstat, (struct sigaction *)0); if (name == 0) return -1; if (fd < 0) return -1; if (fstat (fd, &stb) < 0) return -1; strcpy (pty_name, name); }]) + AC_DEFINE(PTY_OPEN, [ { struct sigaction ocstat, cstat; struct stat stb; char * name; sigemptyset(&cstat.sa_mask); cstat.sa_handler = SIG_DFL; cstat.sa_flags = 0; sigaction(SIGCHLD, &cstat, &ocstat); name = _getpty (&fd, O_RDWR | O_NDELAY, 0600, 0); sigaction(SIGCHLD, &ocstat, (struct sigaction *)0); if (name == 0) return -1; if (fd < 0) return -1; if (fstat (fd, &stb) < 0) return -1; strcpy (pty_name, name); }]) dnl No need to get the pty name at all. AC_DEFINE(PTY_NAME_SPRINTF, []) dnl No need to use sprintf to get the tty name--we get that from _getpty. @@ -3611,12 +3611,12 @@ dnl On SysVr4, grantpt(3) forks a subprocess, so keep sigchld_handler() dnl from intercepting that death. If any child but grantpt's should die dnl within, it should be caught after sigrelse(2). - AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) + AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) ;; unixware ) dnl Comments are as per sol2*. - AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1) fatal("could not grant slave pty"); if (unlockpt(fd) == -1) fatal("could not unlock slave pty"); if (!(ptyname = ptsname(fd))) fatal ("could not enable slave pty"); snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) + AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1) fatal("could not grant slave pty"); if (unlockpt(fd) == -1) fatal("could not unlock slave pty"); if (!(ptyname = ptsname(fd))) fatal ("could not enable slave pty"); snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) ;; esac === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2012-11-27 05:17:07 +0000 +++ lib-src/ChangeLog 2012-11-29 06:46:35 +0000 @@ -1,3 +1,8 @@ +2012-11-29 Paul Eggert + + Assume POSIX 1003.1-1988 or later for signal.h. + * emacsclient.c (main): Assume SIGSTOP is defined. + 2012-11-27 Paul Eggert Assume POSIX 1003.1-1988 or later for errno.h (Bug#12968). === modified file 'lib-src/emacsclient.c' --- lib-src/emacsclient.c 2012-11-21 21:06:52 +0000 +++ lib-src/emacsclient.c 2012-11-29 06:46:35 +0000 @@ -1801,7 +1801,6 @@ needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; exit_status = EXIT_FAILURE; } -#ifdef SIGSTOP else if (strprefix ("-suspend ", p)) { /* -suspend: Suspend this terminal, i.e., stop the process. */ @@ -1810,7 +1809,6 @@ needlf = 0; kill (0, SIGSTOP); } -#endif else { /* Unknown command. */ === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-29 06:00:21 +0000 +++ src/ChangeLog 2012-11-29 06:47:50 +0000 @@ -1,3 +1,30 @@ +2012-11-29 Paul Eggert + + Assume POSIX 1003.1-1988 or later for signal.h. + * keyboard.c (stuff_buffered_input, handle_interrupt): + Assume SIGTSTP is defined. + * process.c (deleted_pid_list, Fdelete_process, create_process) + (record_child_status_change, handle_child_signal, deliver_child_signal) + (init_process_emacs, syms_of_process): + Assume SIGCHLD is defined. + (process_send_signal, Fcontinue_process): Assume SIGCONT is defined. + (Fstop_process): Assume SIGTSTP is defined. + (Fsignal_process): Assume SIGUSR1, SIGUSR2, SIGHUP, SIGQUIT, + SIGKILL, SIGPIPE, SIGALRM, SIGSTOP, SIGTSTP, SIGCONT, SIGCHLD, + SIGTTIN and SIGTTOU are defined. + * sysdep.c (stuff_char, sys_suspend): Assume SIGTSTP is defined. + (sys_suspend) [!MSDOS]: Use kill (0, ...) rather than + kill (getpgrp (), ...). + (tcsetpgrp_without_stopping): Assume SIGTTOU is defined. + (emacs_sigaction_init): Assume SIGCHLD is defined. + (init_signals): Assume SIGALRM, SIGCHLD, SIGCONT, SIGHUP, SIGKILL, + SIGPIPE, SIGQUIT, SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU, SIGUSR1 and + SIGUSR2 are defined. Do not worry about SIGCLD any more. + * syssignal.h (EMACS_KILLPG): Remove. All uses replaced by 'kill' + with a negative pid. + (SIGCHLD): Remove definition, as we now assume SIGCHLD. + * w32proc.c (sys_kill): Support negative pids compatibly with POSIX. + 2012-11-29 Dmitry Antipov * xdisp.c (window_outdated): Remove eassert since it hits === modified file 'src/callproc.c' --- src/callproc.c 2012-11-29 00:36:22 +0000 +++ src/callproc.c 2012-11-29 06:46:35 +0000 @@ -97,7 +97,7 @@ CONS_TO_INTEGER (Fcar (fdpid), int, fd); CONS_TO_INTEGER (Fcdr (fdpid), pid_t, pid); emacs_close (fd); - EMACS_KILLPG (pid, SIGKILL); + kill (-pid, SIGKILL); synch_process_alive = 0; return Qnil; } @@ -134,7 +134,7 @@ return Qnil; } - if (EMACS_KILLPG (pid, SIGINT) == 0) + if (kill (-pid, SIGINT) == 0) { ptrdiff_t count = SPECPDL_INDEX (); record_unwind_protect (call_process_kill, fdpid); === modified file 'src/keyboard.c' --- src/keyboard.c 2012-11-27 05:17:07 +0000 +++ src/keyboard.c 2012-11-29 06:46:35 +0000 @@ -10552,8 +10552,7 @@ void stuff_buffered_input (Lisp_Object stuffstring) { -#ifdef SIGTSTP /* stuff_char is defined if SIGTSTP. */ - register unsigned char *p; + unsigned char *p; if (STRINGP (stuffstring)) { @@ -10584,7 +10583,6 @@ } input_pending = 0; -#endif /* SIGTSTP */ } void @@ -10689,22 +10687,13 @@ fflush (stdout); reset_all_sys_modes (); -#ifdef SIGTSTP /* Support possible in later USG versions */ /* - * On systems which can suspend the current process and return to the original - * shell, this command causes the user to end up back at the shell. + * Cause the user to end up back at the shell. * The "Auto-save" and "Abort" questions are not asked until * the user elects to return to emacs, at which point he can save the current * job and either dump core or continue. */ sys_suspend (); -#else - /* Perhaps should really fork an inferior shell? - But that would not provide any way to get back - to the original shell, ever. */ - printf ("No support for stopping a process on this operating system;\n"); - printf ("you can continue or abort.\n"); -#endif /* not SIGTSTP */ #ifdef MSDOS /* We must remain inside the screen area when the internal terminal is used. Note that [Enter] is not echoed by dos. */ === modified file 'src/process.c' --- src/process.c 2012-11-27 05:17:07 +0000 +++ src/process.c 2012-11-29 06:46:35 +0000 @@ -773,13 +773,11 @@ } -#ifdef SIGCHLD /* Fdelete_process promises to immediately forget about the process, but in reality, Emacs needs to remember those processes until they have been treated by the SIGCHLD handler and waitpid has been invoked on them; otherwise they might fill up the kernel's process table. */ static Lisp_Object deleted_pid_list; -#endif DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0, doc: /* Delete PROCESS: kill it and forget about it immediately. @@ -802,7 +800,6 @@ } else if (p->infd >= 0) { -#ifdef SIGCHLD Lisp_Object symbol; pid_t pid = p->pid; @@ -820,7 +817,6 @@ deleted_pid_list = Fdelete (make_fixnum_or_float (pid), deleted_pid_list); else -#endif { Fkill_process (process, Qnil); /* Do this now, since remove_process will make the @@ -1578,9 +1574,7 @@ #ifndef WINDOWSNT int wait_child_setup[2]; #endif -#ifdef SIGCHLD sigset_t blocked; -#endif /* Use volatile to protect variables from being clobbered by vfork. */ volatile int forkin, forkout; volatile int pty_flag = 0; @@ -1680,13 +1674,11 @@ block_input (); -#ifdef SIGCHLD /* Block SIGCHLD until we have a chance to store the new fork's pid in its process structure. */ sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); -#endif #if HAVE_WORKING_VFORK /* child_setup must clobber environ on systems with true vfork. @@ -1800,10 +1792,8 @@ /* Emacs ignores SIGPIPE, but the child should not. */ signal (SIGPIPE, SIG_DFL); -#ifdef SIGCHLD /* Stop blocking signals in the child. */ pthread_sigmask (SIG_SETMASK, &empty_mask, 0); -#endif if (pty_flag) child_setup_tty (xforkout); @@ -1828,9 +1818,7 @@ XPROCESS (process)->alive = 1; /* Stop blocking signals in the parent. */ -#ifdef SIGCHLD pthread_sigmask (SIG_SETMASK, &empty_mask, 0); -#endif unblock_input (); if (pid < 0) @@ -4622,7 +4610,7 @@ yielding EBADF here or at select() call above. So, SIGHUP is ignored (see def of PTY_TTY_NAME_SPRINTF in m/ibmrt-aix.h), and here we just ignore the select error. - Cleanup occurs c/o status_notify after SIGCLD. */ + Cleanup occurs c/o status_notify after SIGCHLD. */ no_avail = 1; /* Cannot depend on values returned */ #else emacs_abort (); @@ -4820,10 +4808,8 @@ #endif /* HAVE_PTYS */ /* If we can detect process termination, don't consider the process gone just because its pipe is closed. */ -#ifdef SIGCHLD else if (nread == 0 && !NETCONN_P (proc) && !SERIALCONN_P (proc)) ; -#endif else { /* Preserve status of processes already terminated. */ @@ -5686,7 +5672,7 @@ If we can, we try to signal PROCESS by sending control characters down the pty. This allows us to signal inferiors who have changed - their uid, for which killpg would return an EPERM error. */ + their uid, for which kill would return an EPERM error. */ static void process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group, @@ -5791,7 +5777,6 @@ switch (signo) { -#ifdef SIGCONT case SIGCONT: p->raw_status_new = 0; pset_status (p, Qrun); @@ -5802,7 +5787,7 @@ redisplay_preserve_echo_area (13); } break; -#endif /* ! defined (SIGCONT) */ + case SIGINT: case SIGQUIT: case SIGKILL: @@ -5824,7 +5809,7 @@ if (!NILP (current_group)) { if (ioctl (p->infd, TIOCSIGSEND, signo) == -1) - EMACS_KILLPG (gid, signo); + kill (-gid, signo); } else { @@ -5832,7 +5817,7 @@ kill (gid, signo); } #else /* ! defined (TIOCSIGSEND) */ - EMACS_KILLPG (gid, signo); + kill (-gid, signo); #endif /* ! defined (TIOCSIGSEND) */ } @@ -5893,11 +5878,8 @@ pset_command (p, Qt); return process; } -#ifndef SIGTSTP - error ("No SIGTSTP support"); -#else + process_send_signal (process, SIGTSTP, current_group, 0); -#endif return process; } @@ -5929,11 +5911,8 @@ pset_command (p, Qnil); return process; } -#ifdef SIGCONT - process_send_signal (process, SIGCONT, current_group, 0); -#else - error ("No SIGCONT support"); -#endif + + process_send_signal (process, SIGCONT, current_group, 0); return process; } @@ -5994,28 +5973,18 @@ if (0) ; -#ifdef SIGUSR1 parse_signal ("usr1", SIGUSR1); -#endif -#ifdef SIGUSR2 parse_signal ("usr2", SIGUSR2); -#endif parse_signal ("term", SIGTERM); -#ifdef SIGHUP parse_signal ("hup", SIGHUP); -#endif parse_signal ("int", SIGINT); -#ifdef SIGQUIT parse_signal ("quit", SIGQUIT); -#endif parse_signal ("ill", SIGILL); parse_signal ("abrt", SIGABRT); #ifdef SIGEMT parse_signal ("emt", SIGEMT); #endif -#ifdef SIGKILL parse_signal ("kill", SIGKILL); -#endif parse_signal ("fpe", SIGFPE); #ifdef SIGBUS parse_signal ("bus", SIGBUS); @@ -6024,33 +5993,17 @@ #ifdef SIGSYS parse_signal ("sys", SIGSYS); #endif -#ifdef SIGPIPE parse_signal ("pipe", SIGPIPE); -#endif -#ifdef SIGALRM parse_signal ("alrm", SIGALRM); -#endif #ifdef SIGURG parse_signal ("urg", SIGURG); #endif -#ifdef SIGSTOP parse_signal ("stop", SIGSTOP); -#endif -#ifdef SIGTSTP parse_signal ("tstp", SIGTSTP); -#endif -#ifdef SIGCONT parse_signal ("cont", SIGCONT); -#endif -#ifdef SIGCHLD parse_signal ("chld", SIGCHLD); -#endif -#ifdef SIGTTIN parse_signal ("ttin", SIGTTIN); -#endif -#ifdef SIGTTOU parse_signal ("ttou", SIGTTOU); -#endif #ifdef SIGIO parse_signal ("io", SIGIO); #endif @@ -6214,7 +6167,6 @@ void record_child_status_change (pid_t pid, int w) { -#ifdef SIGCHLD /* Record at most one child only if we already know one child that has exited. */ @@ -6303,11 +6255,8 @@ if (input_available_clear_time) *input_available_clear_time = make_emacs_time (0, 0); } -#endif } -#ifdef SIGCHLD - static void handle_child_signal (int sig) { @@ -6319,8 +6268,6 @@ { deliver_process_signal (sig, handle_child_signal); } - -#endif /* SIGCHLD */ static Lisp_Object @@ -7169,7 +7116,6 @@ inhibit_sentinels = 0; -#ifdef SIGCHLD #ifndef CANNOT_DUMP if (! noninteractive || initialized) #endif @@ -7178,7 +7124,6 @@ emacs_sigaction_init (&action, deliver_child_signal); sigaction (SIGCHLD, &action, 0); } -#endif FD_ZERO (&input_wait_mask); FD_ZERO (&non_keyboard_wait_mask); @@ -7205,9 +7150,7 @@ #endif Vprocess_alist = Qnil; -#ifdef SIGCHLD deleted_pid_list = Qnil; -#endif for (i = 0; i < MAXDESC; i++) { chan_process[i] = Qnil; @@ -7334,9 +7277,7 @@ DEFSYM (Qlast_nonmenu_event, "last-nonmenu-event"); staticpro (&Vprocess_alist); -#ifdef SIGCHLD staticpro (&deleted_pid_list); -#endif #endif /* subprocesses */ === modified file 'src/sysdep.c' --- src/sysdep.c 2012-11-27 03:10:32 +0000 +++ src/sysdep.c 2012-11-29 06:46:35 +0000 @@ -213,8 +213,6 @@ } -#ifdef SIGTSTP - /* Arrange for character C to be read as the next input from the terminal. XXX What if we have multiple ttys? @@ -233,8 +231,6 @@ error ("Cannot stuff terminal input characters in this version of Unix"); #endif /* no TIOCSTI */ } - -#endif /* SIGTSTP */ void init_baud_rate (int fd) @@ -428,20 +424,15 @@ void sys_suspend (void) { -#if defined (SIGTSTP) && !defined (MSDOS) - - { - pid_t pgrp = getpgrp (); - EMACS_KILLPG (pgrp, SIGTSTP); - } - -#else /* No SIGTSTP */ +#ifndef MSDOS + kill (0, SIGTSTP); +#else /* On a system where suspending is not implemented, instead fork a subshell and let it talk directly to the terminal while we wait. */ sys_subshell (); -#endif /* no SIGTSTP */ +#endif } /* Fork a subshell. */ @@ -702,14 +693,12 @@ static void tcsetpgrp_without_stopping (int fd, pid_t pgid) { -#ifdef SIGTTOU signal_handler_t handler; block_input (); handler = signal (SIGTTOU, SIG_IGN); tcsetpgrp (fd, pgid); signal (SIGTTOU, handler); unblock_input (); -#endif } /* Split off the foreground process group to Emacs alone. When we are @@ -1491,9 +1480,7 @@ /* When handling a signal, block nonfatal system signals that are caught by Emacs. This makes race conditions less likely. */ sigaddset (&action->sa_mask, SIGALRM); -#ifdef SIGCHLD sigaddset (&action->sa_mask, SIGCHLD); -#endif #ifdef SIGDANGER sigaddset (&action->sa_mask, SIGDANGER); #endif @@ -1673,21 +1660,12 @@ # ifdef SIGAIO sys_siglist[SIGAIO] = "LAN I/O interrupt"; # endif -# ifdef SIGALRM sys_siglist[SIGALRM] = "Alarm clock"; -# endif # ifdef SIGBUS sys_siglist[SIGBUS] = "Bus error"; # endif -# ifdef SIGCLD - sys_siglist[SIGCLD] = "Child status changed"; -# endif -# ifdef SIGCHLD sys_siglist[SIGCHLD] = "Child status changed"; -# endif -# ifdef SIGCONT sys_siglist[SIGCONT] = "Continued"; -# endif # ifdef SIGDANGER sys_siglist[SIGDANGER] = "Swap space dangerously low"; # endif @@ -1704,9 +1682,7 @@ # ifdef SIGGRANT sys_siglist[SIGGRANT] = "Monitor mode granted"; # endif -# ifdef SIGHUP sys_siglist[SIGHUP] = "Hangup"; -# endif sys_siglist[SIGILL] = "Illegal instruction"; sys_siglist[SIGINT] = "Interrupt"; # ifdef SIGIO @@ -1718,9 +1694,7 @@ # ifdef SIGIOT sys_siglist[SIGIOT] = "IOT trap"; # endif -# ifdef SIGKILL sys_siglist[SIGKILL] = "Killed"; -# endif # ifdef SIGLOST sys_siglist[SIGLOST] = "Resource lost"; # endif @@ -1733,9 +1707,7 @@ # ifdef SIGPHONE sys_siglist[SIGWIND] = "SIGPHONE"; # endif -# ifdef SIGPIPE sys_siglist[SIGPIPE] = "Broken pipe"; -# endif # ifdef SIGPOLL sys_siglist[SIGPOLL] = "Pollable event occurred"; # endif @@ -1748,9 +1720,7 @@ # ifdef SIGPWR sys_siglist[SIGPWR] = "Power-fail restart"; # endif -# ifdef SIGQUIT sys_siglist[SIGQUIT] = "Quit"; -# endif # ifdef SIGRETRACT sys_siglist[SIGRETRACT] = "Need to relinquish monitor mode"; # endif @@ -1761,9 +1731,7 @@ # ifdef SIGSOUND sys_siglist[SIGSOUND] = "Sound completed"; # endif -# ifdef SIGSTOP sys_siglist[SIGSTOP] = "Stopped (signal)"; -# endif # ifdef SIGSTP sys_siglist[SIGSTP] = "Stopped (user)"; # endif @@ -1777,24 +1745,14 @@ # ifdef SIGTRAP sys_siglist[SIGTRAP] = "Trace/breakpoint trap"; # endif -# ifdef SIGTSTP sys_siglist[SIGTSTP] = "Stopped (user)"; -# endif -# ifdef SIGTTIN sys_siglist[SIGTTIN] = "Stopped (tty input)"; -# endif -# ifdef SIGTTOU sys_siglist[SIGTTOU] = "Stopped (tty output)"; -# endif # ifdef SIGURG sys_siglist[SIGURG] = "Urgent I/O condition"; # endif -# ifdef SIGUSR1 sys_siglist[SIGUSR1] = "User defined signal 1"; -# endif -# ifdef SIGUSR2 sys_siglist[SIGUSR2] = "User defined signal 2"; -# endif # ifdef SIGVTALRM sys_siglist[SIGVTALRM] = "Virtual timer expired"; # endif @@ -1861,12 +1819,8 @@ sigaction (SIGFPE, &action, 0); } -#ifdef SIGUSR1 add_user_signal (SIGUSR1, "sigusr1"); -#endif -#ifdef SIGUSR2 add_user_signal (SIGUSR2, "sigusr2"); -#endif sigaction (SIGABRT, &thread_fatal_action, 0); #ifdef SIGPRE sigaction (SIGPRE, &thread_fatal_action, 0); === modified file 'src/syssignal.h' --- src/syssignal.h 2012-10-07 02:26:03 +0000 +++ src/syssignal.h 2012-11-29 06:46:35 +0000 @@ -54,26 +54,6 @@ # 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 -#define EMACS_KILLPG(gid, signo) (killpg ( (gid), (signo))) -#else -#ifdef WINDOWSNT -#define EMACS_KILLPG(gid, signo) (kill (gid, signo)) -#else -#define EMACS_KILLPG(gid, signo) (kill (-(gid), (signo))) -#endif -#endif - -/* Define SIGCHLD as an alias for SIGCLD. There are many conditionals - testing SIGCHLD. */ -#ifdef SIGCLD -#ifndef SIGCHLD -#define SIGCHLD SIGCLD -#endif /* SIGCHLD */ -#endif /* ! defined (SIGCLD) */ - #ifndef HAVE_STRSIGNAL # define strsignal(sig) safe_strsignal (sig) #endif === modified file 'src/w32proc.c' --- src/w32proc.c 2012-11-27 03:10:32 +0000 +++ src/w32proc.c 2012-11-29 06:46:35 +0000 @@ -2139,6 +2139,10 @@ int need_to_free = 0; int rc = 0; + /* Each process is in its own process group. */ + if (pid < 0) + pid = -pid; + /* Only handle signals that will result in the process dying */ if (sig != SIGINT && sig != SIGKILL && sig != SIGQUIT && sig != SIGHUP) {