diff options
| author | Joakim Verona | 2012-12-08 03:36:33 +0100 |
|---|---|---|
| committer | Joakim Verona | 2012-12-08 03:36:33 +0100 |
| commit | b2be0b04729568ad263b9d54b055c95ea2a26ef1 (patch) | |
| tree | f5c539cfc889d95c250dd18e56b19e47e9a8617f | |
| parent | 2ba8afbd5ed877ca247e0461183ca72f8f15c03b (diff) | |
| parent | d983a10b9a070fd8f6d4f48ec44e5514b62feaa6 (diff) | |
| download | emacs-b2be0b04729568ad263b9d54b055c95ea2a26ef1.tar.gz emacs-b2be0b04729568ad263b9d54b055c95ea2a26ef1.zip | |
auto upstream
| -rw-r--r-- | ChangeLog | 9 | ||||
| -rw-r--r-- | admin/CPP-DEFINES | 7 | ||||
| -rw-r--r-- | admin/ChangeLog | 8 | ||||
| -rwxr-xr-x | admin/merge-gnulib | 2 | ||||
| -rw-r--r-- | configure.ac | 6 | ||||
| -rw-r--r-- | lib/gnulib.mk | 11 | ||||
| -rw-r--r-- | lib/makefile.w32-in | 4 | ||||
| -rw-r--r-- | lib/sig2str.c | 345 | ||||
| -rw-r--r-- | lib/sig2str.h | 43 | ||||
| -rw-r--r-- | m4/gnulib-comp.m4 | 9 | ||||
| -rw-r--r-- | m4/sig2str.m4 | 15 | ||||
| -rw-r--r-- | src/ChangeLog | 23 | ||||
| -rw-r--r-- | src/callproc.c | 8 | ||||
| -rw-r--r-- | src/keyboard.c | 2 | ||||
| -rw-r--r-- | src/process.c | 156 | ||||
| -rw-r--r-- | src/sysdep.c | 30 | ||||
| -rw-r--r-- | src/syssignal.h | 20 | ||||
| -rw-r--r-- | src/w32proc.c | 4 |
18 files changed, 515 insertions, 187 deletions
| @@ -1,3 +1,12 @@ | |||
| 1 | 2012-12-08 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Assume POSIX 1003.1-1988 or later for signal.h (Bug#13026). | ||
| 4 | * configure.ac (PTY_OPEN, PTY_TTY_NAME_SPRINTF): | ||
| 5 | Use SIGCHLD rather than SIGCLD. | ||
| 6 | * lib/sig2str.c, lib/sig2str.h, m4/sig2str.m4: New files, from gnulib. | ||
| 7 | * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. | ||
| 8 | * lib/makefile.w32-in (GNULIBOBJS): Add $(BUILD)/sig2str.$(O). | ||
| 9 | |||
| 1 | 2012-12-06 Glenn Morris <rgm@gnu.org> | 10 | 2012-12-06 Glenn Morris <rgm@gnu.org> |
| 2 | 11 | ||
| 3 | * configure.ac: Handle info/ files with or without ".info" extension. | 12 | * configure.ac: Handle info/ files with or without ".info" extension. |
diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES index 20c97f886dd..b71102960e6 100644 --- a/admin/CPP-DEFINES +++ b/admin/CPP-DEFINES | |||
| @@ -419,14 +419,7 @@ PTY_TTY_NAME_SPRINTF | |||
| 419 | PURESIZE | 419 | PURESIZE |
| 420 | RUN_TIME_REMAP | 420 | RUN_TIME_REMAP |
| 421 | SETUP_SLAVE_PTY | 421 | SETUP_SLAVE_PTY |
| 422 | SIGALRM | ||
| 423 | SIGCHLD | ||
| 424 | SIGHUP | ||
| 425 | SIGKILL | ||
| 426 | SIGNALS_VIA_CHARACTERS | 422 | SIGNALS_VIA_CHARACTERS |
| 427 | SIGPIPE | ||
| 428 | SIGQUIT | ||
| 429 | SIGTRAP | ||
| 430 | STDC_HEADERS | 423 | STDC_HEADERS |
| 431 | SYSTEM_PURESIZE_EXTRA | 424 | SYSTEM_PURESIZE_EXTRA |
| 432 | SYSTEM_MALLOC | 425 | SYSTEM_MALLOC |
diff --git a/admin/ChangeLog b/admin/ChangeLog index 05c1463d325..840c38aeb94 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2012-12-03 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Assume POSIX 1003.1-1988 or later for signal.h (Bug#13026). | ||
| 4 | * CPP-DEFINES (SIGALRM, SIGCHLD, SIGHUP, SIGKILL, SIGPIPE, SIGQUIT): | ||
| 5 | Remove. | ||
| 6 | (SIGTRAP): Remove this one too, as config.h no longer defines it. | ||
| 7 | * merge-gnulib (GNULIB_MODULES): Add sig2str. | ||
| 8 | |||
| 1 | 2012-11-24 Ken Brown <kbrown@cornell.edu> | 9 | 2012-11-24 Ken Brown <kbrown@cornell.edu> |
| 2 | 10 | ||
| 3 | * CPP-DEFINES (HAVE_MOUSE): Remove. | 11 | * CPP-DEFINES (HAVE_MOUSE): Remove. |
diff --git a/admin/merge-gnulib b/admin/merge-gnulib index 792818b2efe..75e7ec6b000 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib | |||
| @@ -32,7 +32,7 @@ GNULIB_MODULES=' | |||
| 32 | fcntl-h filemode getloadavg getopt-gnu gettime gettimeofday | 32 | fcntl-h filemode getloadavg getopt-gnu gettime gettimeofday |
| 33 | ignore-value intprops largefile lstat | 33 | ignore-value intprops largefile lstat |
| 34 | manywarnings mktime pselect pthread_sigmask readlink | 34 | manywarnings mktime pselect pthread_sigmask readlink |
| 35 | socklen stat-time stdalign stdarg stdbool stdio | 35 | sig2str socklen stat-time stdalign stdarg stdbool stdio |
| 36 | strftime strtoimax strtoumax symlink sys_stat | 36 | strftime strtoimax strtoumax symlink sys_stat |
| 37 | sys_time time timer-time timespec-add timespec-sub utimens | 37 | sys_time time timer-time timespec-add timespec-sub utimens |
| 38 | warnings | 38 | warnings |
diff --git a/configure.ac b/configure.ac index 154532cd024..c038b0b9bcf 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -3661,7 +3661,7 @@ case $opsys in | |||
| 3661 | AC_DEFINE(PTY_ITERATION, []) | 3661 | AC_DEFINE(PTY_ITERATION, []) |
| 3662 | dnl Not used, because PTY_ITERATION is defined. | 3662 | dnl Not used, because PTY_ITERATION is defined. |
| 3663 | AC_DEFINE(FIRST_PTY_LETTER, ['q']) | 3663 | AC_DEFINE(FIRST_PTY_LETTER, ['q']) |
| 3664 | 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); }]) | 3664 | 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); }]) |
| 3665 | dnl No need to get the pty name at all. | 3665 | dnl No need to get the pty name at all. |
| 3666 | AC_DEFINE(PTY_NAME_SPRINTF, []) | 3666 | AC_DEFINE(PTY_NAME_SPRINTF, []) |
| 3667 | dnl No need to use sprintf to get the tty name--we get that from _getpty. | 3667 | dnl No need to use sprintf to get the tty name--we get that from _getpty. |
| @@ -3672,12 +3672,12 @@ case $opsys in | |||
| 3672 | dnl On SysVr4, grantpt(3) forks a subprocess, so keep sigchld_handler() | 3672 | dnl On SysVr4, grantpt(3) forks a subprocess, so keep sigchld_handler() |
| 3673 | dnl from intercepting that death. If any child but grantpt's should die | 3673 | dnl from intercepting that death. If any child but grantpt's should die |
| 3674 | dnl within, it should be caught after sigrelse(2). | 3674 | dnl within, it should be caught after sigrelse(2). |
| 3675 | 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); }]) | 3675 | 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); }]) |
| 3676 | ;; | 3676 | ;; |
| 3677 | 3677 | ||
| 3678 | unixware ) | 3678 | unixware ) |
| 3679 | dnl Comments are as per sol2*. | 3679 | dnl Comments are as per sol2*. |
| 3680 | 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); }]) | 3680 | 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); }]) |
| 3681 | ;; | 3681 | ;; |
| 3682 | esac | 3682 | esac |
| 3683 | 3683 | ||
diff --git a/lib/gnulib.mk b/lib/gnulib.mk index 9d7cb281564..1335c80dae5 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | # the same distribution terms as the rest of that program. | 21 | # the same distribution terms as the rest of that program. |
| 22 | # | 22 | # |
| 23 | # Generated by gnulib-tool. | 23 | # Generated by gnulib-tool. |
| 24 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=at-internal --avoid=errno --avoid=fchdir --avoid=fcntl --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=openat-die --avoid=openat-h --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl-h filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub utimens warnings | 24 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=at-internal --avoid=errno --avoid=fchdir --avoid=fcntl --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=openat-die --avoid=openat-h --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl-h filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink sig2str socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub utimens warnings |
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | MOSTLYCLEANFILES += core *.stackdump | 27 | MOSTLYCLEANFILES += core *.stackdump |
| @@ -457,6 +457,15 @@ EXTRA_DIST += root-uid.h | |||
| 457 | 457 | ||
| 458 | ## end gnulib module root-uid | 458 | ## end gnulib module root-uid |
| 459 | 459 | ||
| 460 | ## begin gnulib module sig2str | ||
| 461 | |||
| 462 | |||
| 463 | EXTRA_DIST += sig2str.c sig2str.h | ||
| 464 | |||
| 465 | EXTRA_libgnu_a_SOURCES += sig2str.c | ||
| 466 | |||
| 467 | ## end gnulib module sig2str | ||
| 468 | |||
| 460 | ## begin gnulib module signal-h | 469 | ## begin gnulib module signal-h |
| 461 | 470 | ||
| 462 | BUILT_SOURCES += signal.h | 471 | BUILT_SOURCES += signal.h |
diff --git a/lib/makefile.w32-in b/lib/makefile.w32-in index 67171e07900..348fe911a2a 100644 --- a/lib/makefile.w32-in +++ b/lib/makefile.w32-in | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # -*- Makefile -*- for GNU Emacs on the Microsoft Windows API. | 1 | 2# -*- Makefile -*- for GNU Emacs on the Microsoft Windows API. |
| 2 | # Copyright (C) 2011-2012 Free Software Foundation, Inc. | 2 | # Copyright (C) 2011-2012 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | # This file is part of GNU Emacs. | 4 | # This file is part of GNU Emacs. |
| @@ -42,6 +42,7 @@ GNULIBOBJS = $(BLD)/c-ctype.$(O) \ | |||
| 42 | $(BLD)/sha1.$(O) \ | 42 | $(BLD)/sha1.$(O) \ |
| 43 | $(BLD)/sha256.$(O) \ | 43 | $(BLD)/sha256.$(O) \ |
| 44 | $(BLD)/sha512.$(O) \ | 44 | $(BLD)/sha512.$(O) \ |
| 45 | $(BLD)/sig2str.$(O) \ | ||
| 45 | $(BLD)/stat-time.$(O) \ | 46 | $(BLD)/stat-time.$(O) \ |
| 46 | $(BLD)/timespec.$(O) \ | 47 | $(BLD)/timespec.$(O) \ |
| 47 | $(BLD)/u64.$(O) \ | 48 | $(BLD)/u64.$(O) \ |
| @@ -322,4 +323,3 @@ getopt_h: | |||
| 322 | 323 | ||
| 323 | execinfo.h: execinfo.in.h | 324 | execinfo.h: execinfo.in.h |
| 324 | $(CP) execinfo.in.h $@ | 325 | $(CP) execinfo.in.h $@ |
| 325 | |||
diff --git a/lib/sig2str.c b/lib/sig2str.c new file mode 100644 index 00000000000..2f5b21cc36f --- /dev/null +++ b/lib/sig2str.c | |||
| @@ -0,0 +1,345 @@ | |||
| 1 | /* sig2str.c -- convert between signal names and numbers | ||
| 2 | |||
| 3 | Copyright (C) 2002, 2004, 2006, 2009-2012 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | This program is free software: you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU General Public License as published by | ||
| 7 | the Free Software Foundation; either version 3 of the License, or | ||
| 8 | (at your option) any later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 17 | |||
| 18 | /* Written by Paul Eggert. */ | ||
| 19 | |||
| 20 | #include <config.h> | ||
| 21 | |||
| 22 | #include <limits.h> | ||
| 23 | #include <signal.h> | ||
| 24 | #include <stdlib.h> | ||
| 25 | #include <stdio.h> | ||
| 26 | #include <string.h> | ||
| 27 | |||
| 28 | #include "sig2str.h" | ||
| 29 | |||
| 30 | #ifndef SIGRTMIN | ||
| 31 | # define SIGRTMIN 0 | ||
| 32 | # undef SIGRTMAX | ||
| 33 | #endif | ||
| 34 | #ifndef SIGRTMAX | ||
| 35 | # define SIGRTMAX (SIGRTMIN - 1) | ||
| 36 | #endif | ||
| 37 | |||
| 38 | #define NUMNAME(name) { SIG##name, #name } | ||
| 39 | |||
| 40 | /* Signal names and numbers. Put the preferred name first. */ | ||
| 41 | static struct numname { int num; char const name[8]; } numname_table[] = | ||
| 42 | { | ||
| 43 | /* Signals required by POSIX 1003.1-2001 base, listed in | ||
| 44 | traditional numeric order where possible. */ | ||
| 45 | #ifdef SIGHUP | ||
| 46 | NUMNAME (HUP), | ||
| 47 | #endif | ||
| 48 | #ifdef SIGINT | ||
| 49 | NUMNAME (INT), | ||
| 50 | #endif | ||
| 51 | #ifdef SIGQUIT | ||
| 52 | NUMNAME (QUIT), | ||
| 53 | #endif | ||
| 54 | #ifdef SIGILL | ||
| 55 | NUMNAME (ILL), | ||
| 56 | #endif | ||
| 57 | #ifdef SIGTRAP | ||
| 58 | NUMNAME (TRAP), | ||
| 59 | #endif | ||
| 60 | #ifdef SIGABRT | ||
| 61 | NUMNAME (ABRT), | ||
| 62 | #endif | ||
| 63 | #ifdef SIGFPE | ||
| 64 | NUMNAME (FPE), | ||
| 65 | #endif | ||
| 66 | #ifdef SIGKILL | ||
| 67 | NUMNAME (KILL), | ||
| 68 | #endif | ||
| 69 | #ifdef SIGSEGV | ||
| 70 | NUMNAME (SEGV), | ||
| 71 | #endif | ||
| 72 | /* On Haiku, SIGSEGV == SIGBUS, but we prefer SIGSEGV to match | ||
| 73 | strsignal.c output, so SIGBUS must be listed second. */ | ||
| 74 | #ifdef SIGBUS | ||
| 75 | NUMNAME (BUS), | ||
| 76 | #endif | ||
| 77 | #ifdef SIGPIPE | ||
| 78 | NUMNAME (PIPE), | ||
| 79 | #endif | ||
| 80 | #ifdef SIGALRM | ||
| 81 | NUMNAME (ALRM), | ||
| 82 | #endif | ||
| 83 | #ifdef SIGTERM | ||
| 84 | NUMNAME (TERM), | ||
| 85 | #endif | ||
| 86 | #ifdef SIGUSR1 | ||
| 87 | NUMNAME (USR1), | ||
| 88 | #endif | ||
| 89 | #ifdef SIGUSR2 | ||
| 90 | NUMNAME (USR2), | ||
| 91 | #endif | ||
| 92 | #ifdef SIGCHLD | ||
| 93 | NUMNAME (CHLD), | ||
| 94 | #endif | ||
| 95 | #ifdef SIGURG | ||
| 96 | NUMNAME (URG), | ||
| 97 | #endif | ||
| 98 | #ifdef SIGSTOP | ||
| 99 | NUMNAME (STOP), | ||
| 100 | #endif | ||
| 101 | #ifdef SIGTSTP | ||
| 102 | NUMNAME (TSTP), | ||
| 103 | #endif | ||
| 104 | #ifdef SIGCONT | ||
| 105 | NUMNAME (CONT), | ||
| 106 | #endif | ||
| 107 | #ifdef SIGTTIN | ||
| 108 | NUMNAME (TTIN), | ||
| 109 | #endif | ||
| 110 | #ifdef SIGTTOU | ||
| 111 | NUMNAME (TTOU), | ||
| 112 | #endif | ||
| 113 | |||
| 114 | /* Signals required by POSIX 1003.1-2001 with the XSI extension. */ | ||
| 115 | #ifdef SIGSYS | ||
| 116 | NUMNAME (SYS), | ||
| 117 | #endif | ||
| 118 | #ifdef SIGPOLL | ||
| 119 | NUMNAME (POLL), | ||
| 120 | #endif | ||
| 121 | #ifdef SIGVTALRM | ||
| 122 | NUMNAME (VTALRM), | ||
| 123 | #endif | ||
| 124 | #ifdef SIGPROF | ||
| 125 | NUMNAME (PROF), | ||
| 126 | #endif | ||
| 127 | #ifdef SIGXCPU | ||
| 128 | NUMNAME (XCPU), | ||
| 129 | #endif | ||
| 130 | #ifdef SIGXFSZ | ||
| 131 | NUMNAME (XFSZ), | ||
| 132 | #endif | ||
| 133 | |||
| 134 | /* Unix Version 7. */ | ||
| 135 | #ifdef SIGIOT | ||
| 136 | NUMNAME (IOT), /* Older name for ABRT. */ | ||
| 137 | #endif | ||
| 138 | #ifdef SIGEMT | ||
| 139 | NUMNAME (EMT), | ||
| 140 | #endif | ||
| 141 | |||
| 142 | /* USG Unix. */ | ||
| 143 | #ifdef SIGPHONE | ||
| 144 | NUMNAME (PHONE), | ||
| 145 | #endif | ||
| 146 | #ifdef SIGWIND | ||
| 147 | NUMNAME (WIND), | ||
| 148 | #endif | ||
| 149 | |||
| 150 | /* Unix System V. */ | ||
| 151 | #ifdef SIGCLD | ||
| 152 | NUMNAME (CLD), | ||
| 153 | #endif | ||
| 154 | #ifdef SIGPWR | ||
| 155 | NUMNAME (PWR), | ||
| 156 | #endif | ||
| 157 | |||
| 158 | /* GNU/Linux 2.2 and Solaris 8. */ | ||
| 159 | #ifdef SIGCANCEL | ||
| 160 | NUMNAME (CANCEL), | ||
| 161 | #endif | ||
| 162 | #ifdef SIGLWP | ||
| 163 | NUMNAME (LWP), | ||
| 164 | #endif | ||
| 165 | #ifdef SIGWAITING | ||
| 166 | NUMNAME (WAITING), | ||
| 167 | #endif | ||
| 168 | #ifdef SIGFREEZE | ||
| 169 | NUMNAME (FREEZE), | ||
| 170 | #endif | ||
| 171 | #ifdef SIGTHAW | ||
| 172 | NUMNAME (THAW), | ||
| 173 | #endif | ||
| 174 | #ifdef SIGLOST | ||
| 175 | NUMNAME (LOST), | ||
| 176 | #endif | ||
| 177 | #ifdef SIGWINCH | ||
| 178 | NUMNAME (WINCH), | ||
| 179 | #endif | ||
| 180 | |||
| 181 | /* GNU/Linux 2.2. */ | ||
| 182 | #ifdef SIGINFO | ||
| 183 | NUMNAME (INFO), | ||
| 184 | #endif | ||
| 185 | #ifdef SIGIO | ||
| 186 | NUMNAME (IO), | ||
| 187 | #endif | ||
| 188 | #ifdef SIGSTKFLT | ||
| 189 | NUMNAME (STKFLT), | ||
| 190 | #endif | ||
| 191 | |||
| 192 | /* AIX 5L. */ | ||
| 193 | #ifdef SIGDANGER | ||
| 194 | NUMNAME (DANGER), | ||
| 195 | #endif | ||
| 196 | #ifdef SIGGRANT | ||
| 197 | NUMNAME (GRANT), | ||
| 198 | #endif | ||
| 199 | #ifdef SIGMIGRATE | ||
| 200 | NUMNAME (MIGRATE), | ||
| 201 | #endif | ||
| 202 | #ifdef SIGMSG | ||
| 203 | NUMNAME (MSG), | ||
| 204 | #endif | ||
| 205 | #ifdef SIGPRE | ||
| 206 | NUMNAME (PRE), | ||
| 207 | #endif | ||
| 208 | #ifdef SIGRETRACT | ||
| 209 | NUMNAME (RETRACT), | ||
| 210 | #endif | ||
| 211 | #ifdef SIGSAK | ||
| 212 | NUMNAME (SAK), | ||
| 213 | #endif | ||
| 214 | #ifdef SIGSOUND | ||
| 215 | NUMNAME (SOUND), | ||
| 216 | #endif | ||
| 217 | |||
| 218 | /* Older AIX versions. */ | ||
| 219 | #ifdef SIGALRM1 | ||
| 220 | NUMNAME (ALRM1), /* unknown; taken from Bash 2.05 */ | ||
| 221 | #endif | ||
| 222 | #ifdef SIGKAP | ||
| 223 | NUMNAME (KAP), /* Older name for SIGGRANT. */ | ||
| 224 | #endif | ||
| 225 | #ifdef SIGVIRT | ||
| 226 | NUMNAME (VIRT), /* unknown; taken from Bash 2.05 */ | ||
| 227 | #endif | ||
| 228 | #ifdef SIGWINDOW | ||
| 229 | NUMNAME (WINDOW), /* Older name for SIGWINCH. */ | ||
| 230 | #endif | ||
| 231 | |||
| 232 | /* BeOS */ | ||
| 233 | #ifdef SIGKILLTHR | ||
| 234 | NUMNAME (KILLTHR), | ||
| 235 | #endif | ||
| 236 | |||
| 237 | /* Older HP-UX versions. */ | ||
| 238 | #ifdef SIGDIL | ||
| 239 | NUMNAME (DIL), | ||
| 240 | #endif | ||
| 241 | |||
| 242 | /* Korn shell and Bash, of uncertain vintage. */ | ||
| 243 | { 0, "EXIT" } | ||
| 244 | }; | ||
| 245 | |||
| 246 | #define NUMNAME_ENTRIES (sizeof numname_table / sizeof numname_table[0]) | ||
| 247 | |||
| 248 | /* ISDIGIT differs from isdigit, as follows: | ||
| 249 | - Its arg may be any int or unsigned int; it need not be an unsigned char | ||
| 250 | or EOF. | ||
| 251 | - It's typically faster. | ||
| 252 | POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to | ||
| 253 | isdigit unless it's important to use the locale's definition | ||
| 254 | of "digit" even when the host does not conform to POSIX. */ | ||
| 255 | #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9) | ||
| 256 | |||
| 257 | /* Convert the signal name SIGNAME to a signal number. Return the | ||
| 258 | signal number if successful, -1 otherwise. */ | ||
| 259 | |||
| 260 | static int | ||
| 261 | str2signum (char const *signame) | ||
| 262 | { | ||
| 263 | if (ISDIGIT (*signame)) | ||
| 264 | { | ||
| 265 | char *endp; | ||
| 266 | long int n = strtol (signame, &endp, 10); | ||
| 267 | if (! *endp && n <= SIGNUM_BOUND) | ||
| 268 | return n; | ||
| 269 | } | ||
| 270 | else | ||
| 271 | { | ||
| 272 | unsigned int i; | ||
| 273 | for (i = 0; i < NUMNAME_ENTRIES; i++) | ||
| 274 | if (strcmp (numname_table[i].name, signame) == 0) | ||
| 275 | return numname_table[i].num; | ||
| 276 | |||
| 277 | { | ||
| 278 | char *endp; | ||
| 279 | int rtmin = SIGRTMIN; | ||
| 280 | int rtmax = SIGRTMAX; | ||
| 281 | |||
| 282 | if (0 < rtmin && strncmp (signame, "RTMIN", 5) == 0) | ||
| 283 | { | ||
| 284 | long int n = strtol (signame + 5, &endp, 10); | ||
| 285 | if (! *endp && 0 <= n && n <= rtmax - rtmin) | ||
| 286 | return rtmin + n; | ||
| 287 | } | ||
| 288 | else if (0 < rtmax && strncmp (signame, "RTMAX", 5) == 0) | ||
| 289 | { | ||
| 290 | long int n = strtol (signame + 5, &endp, 10); | ||
| 291 | if (! *endp && rtmin - rtmax <= n && n <= 0) | ||
| 292 | return rtmax + n; | ||
| 293 | } | ||
| 294 | } | ||
| 295 | } | ||
| 296 | |||
| 297 | return -1; | ||
| 298 | } | ||
| 299 | |||
| 300 | /* Convert the signal name SIGNAME to the signal number *SIGNUM. | ||
| 301 | Return 0 if successful, -1 otherwise. */ | ||
| 302 | |||
| 303 | int | ||
| 304 | str2sig (char const *signame, int *signum) | ||
| 305 | { | ||
| 306 | *signum = str2signum (signame); | ||
| 307 | return *signum < 0 ? -1 : 0; | ||
| 308 | } | ||
| 309 | |||
| 310 | /* Convert SIGNUM to a signal name in SIGNAME. SIGNAME must point to | ||
| 311 | a buffer of at least SIG2STR_MAX bytes. Return 0 if successful, -1 | ||
| 312 | otherwise. */ | ||
| 313 | |||
| 314 | int | ||
| 315 | sig2str (int signum, char *signame) | ||
| 316 | { | ||
| 317 | unsigned int i; | ||
| 318 | for (i = 0; i < NUMNAME_ENTRIES; i++) | ||
| 319 | if (numname_table[i].num == signum) | ||
| 320 | { | ||
| 321 | strcpy (signame, numname_table[i].name); | ||
| 322 | return 0; | ||
| 323 | } | ||
| 324 | |||
| 325 | { | ||
| 326 | int rtmin = SIGRTMIN; | ||
| 327 | int rtmax = SIGRTMAX; | ||
| 328 | |||
| 329 | if (! (rtmin <= signum && signum <= rtmax)) | ||
| 330 | return -1; | ||
| 331 | |||
| 332 | if (signum <= rtmin + (rtmax - rtmin) / 2) | ||
| 333 | { | ||
| 334 | int delta = signum - rtmin; | ||
| 335 | sprintf (signame, delta ? "RTMIN+%d" : "RTMIN", delta); | ||
| 336 | } | ||
| 337 | else | ||
| 338 | { | ||
| 339 | int delta = rtmax - signum; | ||
| 340 | sprintf (signame, delta ? "RTMAX-%d" : "RTMAX", delta); | ||
| 341 | } | ||
| 342 | |||
| 343 | return 0; | ||
| 344 | } | ||
| 345 | } | ||
diff --git a/lib/sig2str.h b/lib/sig2str.h new file mode 100644 index 00000000000..75eff7d7c1a --- /dev/null +++ b/lib/sig2str.h | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | /* sig2str.h -- convert between signal names and numbers | ||
| 2 | |||
| 3 | Copyright (C) 2002, 2005, 2009-2012 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | This program is free software: you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU General Public License as published by | ||
| 7 | the Free Software Foundation; either version 3 of the License, or | ||
| 8 | (at your option) any later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 17 | |||
| 18 | /* Written by Paul Eggert. */ | ||
| 19 | |||
| 20 | #include <signal.h> | ||
| 21 | |||
| 22 | /* Don't override system declarations of SIG2STR_MAX, sig2str, str2sig. */ | ||
| 23 | #ifndef SIG2STR_MAX | ||
| 24 | |||
| 25 | # include "intprops.h" | ||
| 26 | |||
| 27 | /* Size of a buffer needed to hold a signal name like "HUP". */ | ||
| 28 | # define SIG2STR_MAX (sizeof "SIGRTMAX" + INT_STRLEN_BOUND (int) - 1) | ||
| 29 | |||
| 30 | int sig2str (int, char *); | ||
| 31 | int str2sig (char const *, int *); | ||
| 32 | |||
| 33 | #endif | ||
| 34 | |||
| 35 | /* An upper bound on signal numbers allowed by the system. */ | ||
| 36 | |||
| 37 | #if defined _sys_nsig | ||
| 38 | # define SIGNUM_BOUND (_sys_nsig - 1) | ||
| 39 | #elif defined NSIG | ||
| 40 | # define SIGNUM_BOUND (NSIG - 1) | ||
| 41 | #else | ||
| 42 | # define SIGNUM_BOUND 64 | ||
| 43 | #endif | ||
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 1d09eb8ef92..ebfbdf933f6 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 | |||
| @@ -87,6 +87,7 @@ AC_DEFUN([gl_EARLY], | |||
| 87 | # Code from module pthread_sigmask: | 87 | # Code from module pthread_sigmask: |
| 88 | # Code from module readlink: | 88 | # Code from module readlink: |
| 89 | # Code from module root-uid: | 89 | # Code from module root-uid: |
| 90 | # Code from module sig2str: | ||
| 90 | # Code from module signal-h: | 91 | # Code from module signal-h: |
| 91 | # Code from module snippet/_Noreturn: | 92 | # Code from module snippet/_Noreturn: |
| 92 | # Code from module snippet/arg-nonnull: | 93 | # Code from module snippet/arg-nonnull: |
| @@ -245,6 +246,11 @@ AC_DEFUN([gl_INIT], | |||
| 245 | gl_PREREQ_READLINK | 246 | gl_PREREQ_READLINK |
| 246 | fi | 247 | fi |
| 247 | gl_UNISTD_MODULE_INDICATOR([readlink]) | 248 | gl_UNISTD_MODULE_INDICATOR([readlink]) |
| 249 | gl_FUNC_SIG2STR | ||
| 250 | if test $ac_cv_func_sig2str = no; then | ||
| 251 | AC_LIBOBJ([sig2str]) | ||
| 252 | gl_PREREQ_SIG2STR | ||
| 253 | fi | ||
| 248 | gl_SIGNAL_H | 254 | gl_SIGNAL_H |
| 249 | gl_TYPE_SOCKLEN_T | 255 | gl_TYPE_SOCKLEN_T |
| 250 | gt_TYPE_SSIZE_T | 256 | gt_TYPE_SSIZE_T |
| @@ -681,6 +687,8 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 681 | lib/sha256.h | 687 | lib/sha256.h |
| 682 | lib/sha512.c | 688 | lib/sha512.c |
| 683 | lib/sha512.h | 689 | lib/sha512.h |
| 690 | lib/sig2str.c | ||
| 691 | lib/sig2str.h | ||
| 684 | lib/signal.in.h | 692 | lib/signal.in.h |
| 685 | lib/stat-time.c | 693 | lib/stat-time.c |
| 686 | lib/stat-time.h | 694 | lib/stat-time.h |
| @@ -760,6 +768,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 760 | m4/sha1.m4 | 768 | m4/sha1.m4 |
| 761 | m4/sha256.m4 | 769 | m4/sha256.m4 |
| 762 | m4/sha512.m4 | 770 | m4/sha512.m4 |
| 771 | m4/sig2str.m4 | ||
| 763 | m4/signal_h.m4 | 772 | m4/signal_h.m4 |
| 764 | m4/socklen.m4 | 773 | m4/socklen.m4 |
| 765 | m4/ssize_t.m4 | 774 | m4/ssize_t.m4 |
diff --git a/m4/sig2str.m4 b/m4/sig2str.m4 new file mode 100644 index 00000000000..43650b045e7 --- /dev/null +++ b/m4/sig2str.m4 | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | # serial 7 | ||
| 2 | dnl Copyright (C) 2002, 2005-2006, 2009-2012 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | AC_DEFUN([gl_FUNC_SIG2STR], | ||
| 8 | [ | ||
| 9 | AC_CHECK_FUNCS([sig2str]) | ||
| 10 | ]) | ||
| 11 | |||
| 12 | # Prerequisites of lib/sig2str.c. | ||
| 13 | AC_DEFUN([gl_PREREQ_SIG2STR], [ | ||
| 14 | : | ||
| 15 | ]) | ||
diff --git a/src/ChangeLog b/src/ChangeLog index edd6924af50..2b283a609e3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,26 @@ | |||
| 1 | 2012-12-08 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Assume POSIX 1003.1-1988 or later for signal.h (Bug#13026). | ||
| 4 | Exceptions: do not assume SIGCONT, SIGSTOP, SIGTSTP, SIGTTIN, | ||
| 5 | SIGTTOU, SIGUSR1, SIGUSR2, as Microsoft platforms lack these. | ||
| 6 | * process.c [subprocesses]: Include <c-ctype.h>, <sig2str.h>. | ||
| 7 | (deleted_pid_list, Fdelete_process, create_process) | ||
| 8 | (record_child_status_change, handle_child_signal, deliver_child_signal) | ||
| 9 | (init_process_emacs, syms_of_process): | ||
| 10 | Assume SIGCHLD is defined. | ||
| 11 | (parse_signal): Remove. All uses removed. | ||
| 12 | (abbr_to_signal): New static function. | ||
| 13 | (Fsignal_process): Use it to convert signal names to ints. | ||
| 14 | * sysdep.c (sys_suspend) [!DOS_NT]: Use kill (0, ...) rather than | ||
| 15 | kill (getpgrp (), ...). | ||
| 16 | (emacs_sigaction_init): Assume SIGCHLD is defined. | ||
| 17 | (init_signals): Assume SIGALRM, SIGCHLD, SIGHUP, SIGKILL, | ||
| 18 | SIGPIPE, and SIGQUIT are defined. Do not worry about SIGCLD any more. | ||
| 19 | * syssignal.h (EMACS_KILLPG): Remove. | ||
| 20 | All uses replaced by 'kill' with a negative pid. | ||
| 21 | (SIGCHLD): Remove definition, as we now assume SIGCHLD. | ||
| 22 | * w32proc.c (sys_kill): Support negative pids compatibly with POSIX. | ||
| 23 | |||
| 1 | 2012-12-07 Paul Eggert <eggert@cs.ucla.edu> | 24 | 2012-12-07 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 25 | ||
| 3 | * sysdep.c (get_child_status): Abort on internal error (Bug#13086). | 26 | * sysdep.c (get_child_status): Abort on internal error (Bug#13086). |
diff --git a/src/callproc.c b/src/callproc.c index e0528a791ea..70e349d0d3a 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -87,12 +87,10 @@ static int synch_process_fd; | |||
| 87 | static void | 87 | static void |
| 88 | block_child_signal (void) | 88 | block_child_signal (void) |
| 89 | { | 89 | { |
| 90 | #ifdef SIGCHLD | ||
| 91 | sigset_t blocked; | 90 | sigset_t blocked; |
| 92 | sigemptyset (&blocked); | 91 | sigemptyset (&blocked); |
| 93 | sigaddset (&blocked, SIGCHLD); | 92 | sigaddset (&blocked, SIGCHLD); |
| 94 | pthread_sigmask (SIG_BLOCK, &blocked, 0); | 93 | pthread_sigmask (SIG_BLOCK, &blocked, 0); |
| 95 | #endif | ||
| 96 | } | 94 | } |
| 97 | 95 | ||
| 98 | /* Unblock SIGCHLD. */ | 96 | /* Unblock SIGCHLD. */ |
| @@ -100,9 +98,7 @@ block_child_signal (void) | |||
| 100 | static void | 98 | static void |
| 101 | unblock_child_signal (void) | 99 | unblock_child_signal (void) |
| 102 | { | 100 | { |
| 103 | #ifdef SIGCHLD | ||
| 104 | pthread_sigmask (SIG_SETMASK, &empty_mask, 0); | 101 | pthread_sigmask (SIG_SETMASK, &empty_mask, 0); |
| 105 | #endif | ||
| 106 | } | 102 | } |
| 107 | 103 | ||
| 108 | /* If P is reapable, record it as a deleted process and kill it. | 104 | /* If P is reapable, record it as a deleted process and kill it. |
| @@ -118,7 +114,7 @@ record_kill_process (struct Lisp_Process *p) | |||
| 118 | { | 114 | { |
| 119 | p->alive = 0; | 115 | p->alive = 0; |
| 120 | record_deleted_pid (p->pid); | 116 | record_deleted_pid (p->pid); |
| 121 | EMACS_KILLPG (p->pid, SIGKILL); | 117 | kill (- p->pid, SIGKILL); |
| 122 | } | 118 | } |
| 123 | 119 | ||
| 124 | unblock_child_signal (); | 120 | unblock_child_signal (); |
| @@ -164,7 +160,7 @@ call_process_cleanup (Lisp_Object arg) | |||
| 164 | if (synch_process_pid) | 160 | if (synch_process_pid) |
| 165 | { | 161 | { |
| 166 | ptrdiff_t count = SPECPDL_INDEX (); | 162 | ptrdiff_t count = SPECPDL_INDEX (); |
| 167 | EMACS_KILLPG (synch_process_pid, SIGINT); | 163 | kill (-synch_process_pid, SIGINT); |
| 168 | record_unwind_protect (call_process_kill, make_number (0)); | 164 | record_unwind_protect (call_process_kill, make_number (0)); |
| 169 | message1 ("Waiting for process to die...(type C-g again to kill it instantly)"); | 165 | message1 ("Waiting for process to die...(type C-g again to kill it instantly)"); |
| 170 | immediate_quit = 1; | 166 | immediate_quit = 1; |
diff --git a/src/keyboard.c b/src/keyboard.c index 318ae159137..9b5e0c5865d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -10704,7 +10704,7 @@ handle_interrupt (bool in_signal_handler) | |||
| 10704 | fflush (stdout); | 10704 | fflush (stdout); |
| 10705 | reset_all_sys_modes (); | 10705 | reset_all_sys_modes (); |
| 10706 | 10706 | ||
| 10707 | #ifdef SIGTSTP /* Support possible in later USG versions */ | 10707 | #ifdef SIGTSTP |
| 10708 | /* | 10708 | /* |
| 10709 | * On systems which can suspend the current process and return to the original | 10709 | * On systems which can suspend the current process and return to the original |
| 10710 | * shell, this command causes the user to end up back at the shell. | 10710 | * shell, this command causes the user to end up back at the shell. |
diff --git a/src/process.c b/src/process.c index 007a07942e6..7b21d060cf8 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -91,6 +91,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 91 | #include <pty.h> | 91 | #include <pty.h> |
| 92 | #endif | 92 | #endif |
| 93 | 93 | ||
| 94 | #include <c-ctype.h> | ||
| 95 | #include <sig2str.h> | ||
| 96 | |||
| 94 | #endif /* subprocesses */ | 97 | #endif /* subprocesses */ |
| 95 | 98 | ||
| 96 | #include "systime.h" | 99 | #include "systime.h" |
| @@ -773,7 +776,6 @@ get_process (register Lisp_Object name) | |||
| 773 | } | 776 | } |
| 774 | 777 | ||
| 775 | 778 | ||
| 776 | #ifdef SIGCHLD | ||
| 777 | /* Fdelete_process promises to immediately forget about the process, but in | 779 | /* Fdelete_process promises to immediately forget about the process, but in |
| 778 | reality, Emacs needs to remember those processes until they have been | 780 | reality, Emacs needs to remember those processes until they have been |
| 779 | treated by the SIGCHLD handler and waitpid has been invoked on them; | 781 | treated by the SIGCHLD handler and waitpid has been invoked on them; |
| @@ -781,17 +783,14 @@ get_process (register Lisp_Object name) | |||
| 781 | 783 | ||
| 782 | Some processes created by call-process are also put onto this list. */ | 784 | Some processes created by call-process are also put onto this list. */ |
| 783 | static Lisp_Object deleted_pid_list; | 785 | static Lisp_Object deleted_pid_list; |
| 784 | #endif | ||
| 785 | 786 | ||
| 786 | void | 787 | void |
| 787 | record_deleted_pid (pid_t pid) | 788 | record_deleted_pid (pid_t pid) |
| 788 | { | 789 | { |
| 789 | #ifdef SIGCHLD | ||
| 790 | deleted_pid_list = Fcons (make_fixnum_or_float (pid), | 790 | deleted_pid_list = Fcons (make_fixnum_or_float (pid), |
| 791 | /* GC treated elements set to nil. */ | 791 | /* GC treated elements set to nil. */ |
| 792 | Fdelq (Qnil, deleted_pid_list)); | 792 | Fdelq (Qnil, deleted_pid_list)); |
| 793 | 793 | ||
| 794 | #endif | ||
| 795 | } | 794 | } |
| 796 | 795 | ||
| 797 | DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0, | 796 | DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0, |
| @@ -1581,9 +1580,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1581 | #ifndef WINDOWSNT | 1580 | #ifndef WINDOWSNT |
| 1582 | int wait_child_setup[2]; | 1581 | int wait_child_setup[2]; |
| 1583 | #endif | 1582 | #endif |
| 1584 | #ifdef SIGCHLD | ||
| 1585 | sigset_t blocked; | 1583 | sigset_t blocked; |
| 1586 | #endif | ||
| 1587 | /* Use volatile to protect variables from being clobbered by vfork. */ | 1584 | /* Use volatile to protect variables from being clobbered by vfork. */ |
| 1588 | volatile int forkin, forkout; | 1585 | volatile int forkin, forkout; |
| 1589 | volatile int pty_flag = 0; | 1586 | volatile int pty_flag = 0; |
| @@ -1680,13 +1677,11 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1680 | 1677 | ||
| 1681 | block_input (); | 1678 | block_input (); |
| 1682 | 1679 | ||
| 1683 | #ifdef SIGCHLD | ||
| 1684 | /* Block SIGCHLD until we have a chance to store the new fork's | 1680 | /* Block SIGCHLD until we have a chance to store the new fork's |
| 1685 | pid in its process structure. */ | 1681 | pid in its process structure. */ |
| 1686 | sigemptyset (&blocked); | 1682 | sigemptyset (&blocked); |
| 1687 | sigaddset (&blocked, SIGCHLD); | 1683 | sigaddset (&blocked, SIGCHLD); |
| 1688 | pthread_sigmask (SIG_BLOCK, &blocked, 0); | 1684 | pthread_sigmask (SIG_BLOCK, &blocked, 0); |
| 1689 | #endif | ||
| 1690 | 1685 | ||
| 1691 | #ifndef WINDOWSNT | 1686 | #ifndef WINDOWSNT |
| 1692 | pid = vfork (); | 1687 | pid = vfork (); |
| @@ -1794,10 +1789,8 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1794 | /* Emacs ignores SIGPIPE, but the child should not. */ | 1789 | /* Emacs ignores SIGPIPE, but the child should not. */ |
| 1795 | signal (SIGPIPE, SIG_DFL); | 1790 | signal (SIGPIPE, SIG_DFL); |
| 1796 | 1791 | ||
| 1797 | #ifdef SIGCHLD | ||
| 1798 | /* Stop blocking signals in the child. */ | 1792 | /* Stop blocking signals in the child. */ |
| 1799 | pthread_sigmask (SIG_SETMASK, &empty_mask, 0); | 1793 | pthread_sigmask (SIG_SETMASK, &empty_mask, 0); |
| 1800 | #endif | ||
| 1801 | 1794 | ||
| 1802 | if (pty_flag) | 1795 | if (pty_flag) |
| 1803 | child_setup_tty (xforkout); | 1796 | child_setup_tty (xforkout); |
| @@ -1818,9 +1811,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1818 | XPROCESS (process)->alive = 1; | 1811 | XPROCESS (process)->alive = 1; |
| 1819 | 1812 | ||
| 1820 | /* Stop blocking signals in the parent. */ | 1813 | /* Stop blocking signals in the parent. */ |
| 1821 | #ifdef SIGCHLD | ||
| 1822 | pthread_sigmask (SIG_SETMASK, &empty_mask, 0); | 1814 | pthread_sigmask (SIG_SETMASK, &empty_mask, 0); |
| 1823 | #endif | ||
| 1824 | unblock_input (); | 1815 | unblock_input (); |
| 1825 | 1816 | ||
| 1826 | if (pid < 0) | 1817 | if (pid < 0) |
| @@ -4612,7 +4603,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4612 | yielding EBADF here or at select() call above. | 4603 | yielding EBADF here or at select() call above. |
| 4613 | So, SIGHUP is ignored (see def of PTY_TTY_NAME_SPRINTF | 4604 | So, SIGHUP is ignored (see def of PTY_TTY_NAME_SPRINTF |
| 4614 | in m/ibmrt-aix.h), and here we just ignore the select error. | 4605 | in m/ibmrt-aix.h), and here we just ignore the select error. |
| 4615 | Cleanup occurs c/o status_notify after SIGCLD. */ | 4606 | Cleanup occurs c/o status_notify after SIGCHLD. */ |
| 4616 | no_avail = 1; /* Cannot depend on values returned */ | 4607 | no_avail = 1; /* Cannot depend on values returned */ |
| 4617 | #else | 4608 | #else |
| 4618 | emacs_abort (); | 4609 | emacs_abort (); |
| @@ -4810,10 +4801,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4810 | #endif /* HAVE_PTYS */ | 4801 | #endif /* HAVE_PTYS */ |
| 4811 | /* If we can detect process termination, don't consider the | 4802 | /* If we can detect process termination, don't consider the |
| 4812 | process gone just because its pipe is closed. */ | 4803 | process gone just because its pipe is closed. */ |
| 4813 | #ifdef SIGCHLD | ||
| 4814 | else if (nread == 0 && !NETCONN_P (proc) && !SERIALCONN_P (proc)) | 4804 | else if (nread == 0 && !NETCONN_P (proc) && !SERIALCONN_P (proc)) |
| 4815 | ; | 4805 | ; |
| 4816 | #endif | ||
| 4817 | else | 4806 | else |
| 4818 | { | 4807 | { |
| 4819 | /* Preserve status of processes already terminated. */ | 4808 | /* Preserve status of processes already terminated. */ |
| @@ -5676,7 +5665,7 @@ return t unconditionally. */) | |||
| 5676 | 5665 | ||
| 5677 | If we can, we try to signal PROCESS by sending control characters | 5666 | If we can, we try to signal PROCESS by sending control characters |
| 5678 | down the pty. This allows us to signal inferiors who have changed | 5667 | down the pty. This allows us to signal inferiors who have changed |
| 5679 | their uid, for which killpg would return an EPERM error. */ | 5668 | their uid, for which kill would return an EPERM error. */ |
| 5680 | 5669 | ||
| 5681 | static void | 5670 | static void |
| 5682 | process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group, | 5671 | process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group, |
| @@ -5814,7 +5803,7 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group, | |||
| 5814 | if (!NILP (current_group)) | 5803 | if (!NILP (current_group)) |
| 5815 | { | 5804 | { |
| 5816 | if (ioctl (p->infd, TIOCSIGSEND, signo) == -1) | 5805 | if (ioctl (p->infd, TIOCSIGSEND, signo) == -1) |
| 5817 | EMACS_KILLPG (gid, signo); | 5806 | kill (-gid, signo); |
| 5818 | } | 5807 | } |
| 5819 | else | 5808 | else |
| 5820 | { | 5809 | { |
| @@ -5822,7 +5811,7 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group, | |||
| 5822 | kill (gid, signo); | 5811 | kill (gid, signo); |
| 5823 | } | 5812 | } |
| 5824 | #else /* ! defined (TIOCSIGSEND) */ | 5813 | #else /* ! defined (TIOCSIGSEND) */ |
| 5825 | EMACS_KILLPG (gid, signo); | 5814 | kill (-gid, signo); |
| 5826 | #endif /* ! defined (TIOCSIGSEND) */ | 5815 | #endif /* ! defined (TIOCSIGSEND) */ |
| 5827 | } | 5816 | } |
| 5828 | 5817 | ||
| @@ -5927,6 +5916,27 @@ traffic. */) | |||
| 5927 | return process; | 5916 | return process; |
| 5928 | } | 5917 | } |
| 5929 | 5918 | ||
| 5919 | /* Return the integer value of the signal whose abbreviation is ABBR, | ||
| 5920 | or a negative number if there is no such signal. */ | ||
| 5921 | static int | ||
| 5922 | abbr_to_signal (char const *name) | ||
| 5923 | { | ||
| 5924 | int i, signo; | ||
| 5925 | char sigbuf[20]; /* Large enough for all valid signal abbreviations. */ | ||
| 5926 | |||
| 5927 | if (!strncmp (name, "SIG", 3) || !strncmp (name, "sig", 3)) | ||
| 5928 | name += 3; | ||
| 5929 | |||
| 5930 | for (i = 0; i < sizeof sigbuf; i++) | ||
| 5931 | { | ||
| 5932 | sigbuf[i] = c_toupper (name[i]); | ||
| 5933 | if (! sigbuf[i]) | ||
| 5934 | return str2sig (sigbuf, &signo) == 0 ? signo : -1; | ||
| 5935 | } | ||
| 5936 | |||
| 5937 | return -1; | ||
| 5938 | } | ||
| 5939 | |||
| 5930 | DEFUN ("signal-process", Fsignal_process, Ssignal_process, | 5940 | DEFUN ("signal-process", Fsignal_process, Ssignal_process, |
| 5931 | 2, 2, "sProcess (name or number): \nnSignal code: ", | 5941 | 2, 2, "sProcess (name or number): \nnSignal code: ", |
| 5932 | doc: /* Send PROCESS the signal with code SIGCODE. | 5942 | doc: /* Send PROCESS the signal with code SIGCODE. |
| @@ -5937,6 +5947,7 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */) | |||
| 5937 | (Lisp_Object process, Lisp_Object sigcode) | 5947 | (Lisp_Object process, Lisp_Object sigcode) |
| 5938 | { | 5948 | { |
| 5939 | pid_t pid; | 5949 | pid_t pid; |
| 5950 | int signo; | ||
| 5940 | 5951 | ||
| 5941 | if (STRINGP (process)) | 5952 | if (STRINGP (process)) |
| 5942 | { | 5953 | { |
| @@ -5966,12 +5977,11 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */) | |||
| 5966 | error ("Cannot signal process %s", SDATA (XPROCESS (process)->name)); | 5977 | error ("Cannot signal process %s", SDATA (XPROCESS (process)->name)); |
| 5967 | } | 5978 | } |
| 5968 | 5979 | ||
| 5969 | #define parse_signal(NAME, VALUE) \ | ||
| 5970 | else if (!xstrcasecmp (name, NAME)) \ | ||
| 5971 | XSETINT (sigcode, VALUE) | ||
| 5972 | |||
| 5973 | if (INTEGERP (sigcode)) | 5980 | if (INTEGERP (sigcode)) |
| 5974 | CHECK_TYPE_RANGED_INTEGER (int, sigcode); | 5981 | { |
| 5982 | CHECK_TYPE_RANGED_INTEGER (int, sigcode); | ||
| 5983 | signo = XINT (sigcode); | ||
| 5984 | } | ||
| 5975 | else | 5985 | else |
| 5976 | { | 5986 | { |
| 5977 | char *name; | 5987 | char *name; |
| @@ -5979,96 +5989,12 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */) | |||
| 5979 | CHECK_SYMBOL (sigcode); | 5989 | CHECK_SYMBOL (sigcode); |
| 5980 | name = SSDATA (SYMBOL_NAME (sigcode)); | 5990 | name = SSDATA (SYMBOL_NAME (sigcode)); |
| 5981 | 5991 | ||
| 5982 | if (!strncmp (name, "SIG", 3) || !strncmp (name, "sig", 3)) | 5992 | signo = abbr_to_signal (name); |
| 5983 | name += 3; | 5993 | if (signo < 0) |
| 5984 | |||
| 5985 | if (0) | ||
| 5986 | ; | ||
| 5987 | #ifdef SIGUSR1 | ||
| 5988 | parse_signal ("usr1", SIGUSR1); | ||
| 5989 | #endif | ||
| 5990 | #ifdef SIGUSR2 | ||
| 5991 | parse_signal ("usr2", SIGUSR2); | ||
| 5992 | #endif | ||
| 5993 | parse_signal ("term", SIGTERM); | ||
| 5994 | #ifdef SIGHUP | ||
| 5995 | parse_signal ("hup", SIGHUP); | ||
| 5996 | #endif | ||
| 5997 | parse_signal ("int", SIGINT); | ||
| 5998 | #ifdef SIGQUIT | ||
| 5999 | parse_signal ("quit", SIGQUIT); | ||
| 6000 | #endif | ||
| 6001 | parse_signal ("ill", SIGILL); | ||
| 6002 | parse_signal ("abrt", SIGABRT); | ||
| 6003 | #ifdef SIGEMT | ||
| 6004 | parse_signal ("emt", SIGEMT); | ||
| 6005 | #endif | ||
| 6006 | #ifdef SIGKILL | ||
| 6007 | parse_signal ("kill", SIGKILL); | ||
| 6008 | #endif | ||
| 6009 | parse_signal ("fpe", SIGFPE); | ||
| 6010 | #ifdef SIGBUS | ||
| 6011 | parse_signal ("bus", SIGBUS); | ||
| 6012 | #endif | ||
| 6013 | parse_signal ("segv", SIGSEGV); | ||
| 6014 | #ifdef SIGSYS | ||
| 6015 | parse_signal ("sys", SIGSYS); | ||
| 6016 | #endif | ||
| 6017 | #ifdef SIGPIPE | ||
| 6018 | parse_signal ("pipe", SIGPIPE); | ||
| 6019 | #endif | ||
| 6020 | #ifdef SIGALRM | ||
| 6021 | parse_signal ("alrm", SIGALRM); | ||
| 6022 | #endif | ||
| 6023 | #ifdef SIGURG | ||
| 6024 | parse_signal ("urg", SIGURG); | ||
| 6025 | #endif | ||
| 6026 | #ifdef SIGSTOP | ||
| 6027 | parse_signal ("stop", SIGSTOP); | ||
| 6028 | #endif | ||
| 6029 | #ifdef SIGTSTP | ||
| 6030 | parse_signal ("tstp", SIGTSTP); | ||
| 6031 | #endif | ||
| 6032 | #ifdef SIGCONT | ||
| 6033 | parse_signal ("cont", SIGCONT); | ||
| 6034 | #endif | ||
| 6035 | #ifdef SIGCHLD | ||
| 6036 | parse_signal ("chld", SIGCHLD); | ||
| 6037 | #endif | ||
| 6038 | #ifdef SIGTTIN | ||
| 6039 | parse_signal ("ttin", SIGTTIN); | ||
| 6040 | #endif | ||
| 6041 | #ifdef SIGTTOU | ||
| 6042 | parse_signal ("ttou", SIGTTOU); | ||
| 6043 | #endif | ||
| 6044 | #ifdef SIGIO | ||
| 6045 | parse_signal ("io", SIGIO); | ||
| 6046 | #endif | ||
| 6047 | #ifdef SIGXCPU | ||
| 6048 | parse_signal ("xcpu", SIGXCPU); | ||
| 6049 | #endif | ||
| 6050 | #ifdef SIGXFSZ | ||
| 6051 | parse_signal ("xfsz", SIGXFSZ); | ||
| 6052 | #endif | ||
| 6053 | #ifdef SIGVTALRM | ||
| 6054 | parse_signal ("vtalrm", SIGVTALRM); | ||
| 6055 | #endif | ||
| 6056 | #ifdef SIGPROF | ||
| 6057 | parse_signal ("prof", SIGPROF); | ||
| 6058 | #endif | ||
| 6059 | #ifdef SIGWINCH | ||
| 6060 | parse_signal ("winch", SIGWINCH); | ||
| 6061 | #endif | ||
| 6062 | #ifdef SIGINFO | ||
| 6063 | parse_signal ("info", SIGINFO); | ||
| 6064 | #endif | ||
| 6065 | else | ||
| 6066 | error ("Undefined signal name %s", name); | 5994 | error ("Undefined signal name %s", name); |
| 6067 | } | 5995 | } |
| 6068 | 5996 | ||
| 6069 | #undef parse_signal | 5997 | return make_number (kill (pid, signo)); |
| 6070 | |||
| 6071 | return make_number (kill (pid, XINT (sigcode))); | ||
| 6072 | } | 5998 | } |
| 6073 | 5999 | ||
| 6074 | DEFUN ("process-send-eof", Fprocess_send_eof, Sprocess_send_eof, 0, 1, 0, | 6000 | DEFUN ("process-send-eof", Fprocess_send_eof, Sprocess_send_eof, 0, 1, 0, |
| @@ -6150,8 +6076,6 @@ process has been transmitted to the serial port. */) | |||
| 6150 | return process; | 6076 | return process; |
| 6151 | } | 6077 | } |
| 6152 | 6078 | ||
| 6153 | #ifdef SIGCHLD | ||
| 6154 | |||
| 6155 | /* The main Emacs thread records child processes in three places: | 6079 | /* The main Emacs thread records child processes in three places: |
| 6156 | 6080 | ||
| 6157 | - Vprocess_alist, for asynchronous subprocesses, which are child | 6081 | - Vprocess_alist, for asynchronous subprocesses, which are child |
| @@ -6268,8 +6192,6 @@ deliver_child_signal (int sig) | |||
| 6268 | { | 6192 | { |
| 6269 | deliver_process_signal (sig, handle_child_signal); | 6193 | deliver_process_signal (sig, handle_child_signal); |
| 6270 | } | 6194 | } |
| 6271 | |||
| 6272 | #endif /* SIGCHLD */ | ||
| 6273 | 6195 | ||
| 6274 | 6196 | ||
| 6275 | static Lisp_Object | 6197 | static Lisp_Object |
| @@ -7118,7 +7040,6 @@ init_process_emacs (void) | |||
| 7118 | 7040 | ||
| 7119 | inhibit_sentinels = 0; | 7041 | inhibit_sentinels = 0; |
| 7120 | 7042 | ||
| 7121 | #ifdef SIGCHLD | ||
| 7122 | #ifndef CANNOT_DUMP | 7043 | #ifndef CANNOT_DUMP |
| 7123 | if (! noninteractive || initialized) | 7044 | if (! noninteractive || initialized) |
| 7124 | #endif | 7045 | #endif |
| @@ -7127,7 +7048,6 @@ init_process_emacs (void) | |||
| 7127 | emacs_sigaction_init (&action, deliver_child_signal); | 7048 | emacs_sigaction_init (&action, deliver_child_signal); |
| 7128 | sigaction (SIGCHLD, &action, 0); | 7049 | sigaction (SIGCHLD, &action, 0); |
| 7129 | } | 7050 | } |
| 7130 | #endif | ||
| 7131 | 7051 | ||
| 7132 | FD_ZERO (&input_wait_mask); | 7052 | FD_ZERO (&input_wait_mask); |
| 7133 | FD_ZERO (&non_keyboard_wait_mask); | 7053 | FD_ZERO (&non_keyboard_wait_mask); |
| @@ -7154,9 +7074,7 @@ init_process_emacs (void) | |||
| 7154 | #endif | 7074 | #endif |
| 7155 | 7075 | ||
| 7156 | Vprocess_alist = Qnil; | 7076 | Vprocess_alist = Qnil; |
| 7157 | #ifdef SIGCHLD | ||
| 7158 | deleted_pid_list = Qnil; | 7077 | deleted_pid_list = Qnil; |
| 7159 | #endif | ||
| 7160 | for (i = 0; i < MAXDESC; i++) | 7078 | for (i = 0; i < MAXDESC; i++) |
| 7161 | { | 7079 | { |
| 7162 | chan_process[i] = Qnil; | 7080 | chan_process[i] = Qnil; |
| @@ -7283,9 +7201,7 @@ syms_of_process (void) | |||
| 7283 | DEFSYM (Qlast_nonmenu_event, "last-nonmenu-event"); | 7201 | DEFSYM (Qlast_nonmenu_event, "last-nonmenu-event"); |
| 7284 | 7202 | ||
| 7285 | staticpro (&Vprocess_alist); | 7203 | staticpro (&Vprocess_alist); |
| 7286 | #ifdef SIGCHLD | ||
| 7287 | staticpro (&deleted_pid_list); | 7204 | staticpro (&deleted_pid_list); |
| 7288 | #endif | ||
| 7289 | 7205 | ||
| 7290 | #endif /* subprocesses */ | 7206 | #endif /* subprocesses */ |
| 7291 | 7207 | ||
diff --git a/src/sysdep.c b/src/sysdep.c index 9c904850401..5291c5d59aa 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -457,20 +457,15 @@ static void restore_signal_handlers (struct save_signal *); | |||
| 457 | void | 457 | void |
| 458 | sys_suspend (void) | 458 | sys_suspend (void) |
| 459 | { | 459 | { |
| 460 | #if defined (SIGTSTP) && !defined (MSDOS) | 460 | #ifndef DOS_NT |
| 461 | 461 | kill (0, SIGTSTP); | |
| 462 | { | 462 | #else |
| 463 | pid_t pgrp = getpgrp (); | ||
| 464 | EMACS_KILLPG (pgrp, SIGTSTP); | ||
| 465 | } | ||
| 466 | |||
| 467 | #else /* No SIGTSTP */ | ||
| 468 | /* On a system where suspending is not implemented, | 463 | /* On a system where suspending is not implemented, |
| 469 | instead fork a subshell and let it talk directly to the terminal | 464 | instead fork a subshell and let it talk directly to the terminal |
| 470 | while we wait. */ | 465 | while we wait. */ |
| 471 | sys_subshell (); | 466 | sys_subshell (); |
| 472 | 467 | ||
| 473 | #endif /* no SIGTSTP */ | 468 | #endif |
| 474 | } | 469 | } |
| 475 | 470 | ||
| 476 | /* Fork a subshell. */ | 471 | /* Fork a subshell. */ |
| @@ -1518,9 +1513,7 @@ emacs_sigaction_init (struct sigaction *action, signal_handler_t handler) | |||
| 1518 | /* When handling a signal, block nonfatal system signals that are caught | 1513 | /* When handling a signal, block nonfatal system signals that are caught |
| 1519 | by Emacs. This makes race conditions less likely. */ | 1514 | by Emacs. This makes race conditions less likely. */ |
| 1520 | sigaddset (&action->sa_mask, SIGALRM); | 1515 | sigaddset (&action->sa_mask, SIGALRM); |
| 1521 | #ifdef SIGCHLD | ||
| 1522 | sigaddset (&action->sa_mask, SIGCHLD); | 1516 | sigaddset (&action->sa_mask, SIGCHLD); |
| 1523 | #endif | ||
| 1524 | #ifdef SIGDANGER | 1517 | #ifdef SIGDANGER |
| 1525 | sigaddset (&action->sa_mask, SIGDANGER); | 1518 | sigaddset (&action->sa_mask, SIGDANGER); |
| 1526 | #endif | 1519 | #endif |
| @@ -1700,18 +1693,11 @@ init_signals (bool dumping) | |||
| 1700 | # ifdef SIGAIO | 1693 | # ifdef SIGAIO |
| 1701 | sys_siglist[SIGAIO] = "LAN I/O interrupt"; | 1694 | sys_siglist[SIGAIO] = "LAN I/O interrupt"; |
| 1702 | # endif | 1695 | # endif |
| 1703 | # ifdef SIGALRM | ||
| 1704 | sys_siglist[SIGALRM] = "Alarm clock"; | 1696 | sys_siglist[SIGALRM] = "Alarm clock"; |
| 1705 | # endif | ||
| 1706 | # ifdef SIGBUS | 1697 | # ifdef SIGBUS |
| 1707 | sys_siglist[SIGBUS] = "Bus error"; | 1698 | sys_siglist[SIGBUS] = "Bus error"; |
| 1708 | # endif | 1699 | # endif |
| 1709 | # ifdef SIGCLD | ||
| 1710 | sys_siglist[SIGCLD] = "Child status changed"; | ||
| 1711 | # endif | ||
| 1712 | # ifdef SIGCHLD | ||
| 1713 | sys_siglist[SIGCHLD] = "Child status changed"; | 1700 | sys_siglist[SIGCHLD] = "Child status changed"; |
| 1714 | # endif | ||
| 1715 | # ifdef SIGCONT | 1701 | # ifdef SIGCONT |
| 1716 | sys_siglist[SIGCONT] = "Continued"; | 1702 | sys_siglist[SIGCONT] = "Continued"; |
| 1717 | # endif | 1703 | # endif |
| @@ -1731,9 +1717,7 @@ init_signals (bool dumping) | |||
| 1731 | # ifdef SIGGRANT | 1717 | # ifdef SIGGRANT |
| 1732 | sys_siglist[SIGGRANT] = "Monitor mode granted"; | 1718 | sys_siglist[SIGGRANT] = "Monitor mode granted"; |
| 1733 | # endif | 1719 | # endif |
| 1734 | # ifdef SIGHUP | ||
| 1735 | sys_siglist[SIGHUP] = "Hangup"; | 1720 | sys_siglist[SIGHUP] = "Hangup"; |
| 1736 | # endif | ||
| 1737 | sys_siglist[SIGILL] = "Illegal instruction"; | 1721 | sys_siglist[SIGILL] = "Illegal instruction"; |
| 1738 | sys_siglist[SIGINT] = "Interrupt"; | 1722 | sys_siglist[SIGINT] = "Interrupt"; |
| 1739 | # ifdef SIGIO | 1723 | # ifdef SIGIO |
| @@ -1745,9 +1729,7 @@ init_signals (bool dumping) | |||
| 1745 | # ifdef SIGIOT | 1729 | # ifdef SIGIOT |
| 1746 | sys_siglist[SIGIOT] = "IOT trap"; | 1730 | sys_siglist[SIGIOT] = "IOT trap"; |
| 1747 | # endif | 1731 | # endif |
| 1748 | # ifdef SIGKILL | ||
| 1749 | sys_siglist[SIGKILL] = "Killed"; | 1732 | sys_siglist[SIGKILL] = "Killed"; |
| 1750 | # endif | ||
| 1751 | # ifdef SIGLOST | 1733 | # ifdef SIGLOST |
| 1752 | sys_siglist[SIGLOST] = "Resource lost"; | 1734 | sys_siglist[SIGLOST] = "Resource lost"; |
| 1753 | # endif | 1735 | # endif |
| @@ -1760,9 +1742,7 @@ init_signals (bool dumping) | |||
| 1760 | # ifdef SIGPHONE | 1742 | # ifdef SIGPHONE |
| 1761 | sys_siglist[SIGWIND] = "SIGPHONE"; | 1743 | sys_siglist[SIGWIND] = "SIGPHONE"; |
| 1762 | # endif | 1744 | # endif |
| 1763 | # ifdef SIGPIPE | ||
| 1764 | sys_siglist[SIGPIPE] = "Broken pipe"; | 1745 | sys_siglist[SIGPIPE] = "Broken pipe"; |
| 1765 | # endif | ||
| 1766 | # ifdef SIGPOLL | 1746 | # ifdef SIGPOLL |
| 1767 | sys_siglist[SIGPOLL] = "Pollable event occurred"; | 1747 | sys_siglist[SIGPOLL] = "Pollable event occurred"; |
| 1768 | # endif | 1748 | # endif |
| @@ -1775,9 +1755,7 @@ init_signals (bool dumping) | |||
| 1775 | # ifdef SIGPWR | 1755 | # ifdef SIGPWR |
| 1776 | sys_siglist[SIGPWR] = "Power-fail restart"; | 1756 | sys_siglist[SIGPWR] = "Power-fail restart"; |
| 1777 | # endif | 1757 | # endif |
| 1778 | # ifdef SIGQUIT | ||
| 1779 | sys_siglist[SIGQUIT] = "Quit"; | 1758 | sys_siglist[SIGQUIT] = "Quit"; |
| 1780 | # endif | ||
| 1781 | # ifdef SIGRETRACT | 1759 | # ifdef SIGRETRACT |
| 1782 | sys_siglist[SIGRETRACT] = "Need to relinquish monitor mode"; | 1760 | sys_siglist[SIGRETRACT] = "Need to relinquish monitor mode"; |
| 1783 | # endif | 1761 | # endif |
diff --git a/src/syssignal.h b/src/syssignal.h index 2bf2f046aa5..8f9b5f0546a 100644 --- a/src/syssignal.h +++ b/src/syssignal.h | |||
| @@ -54,26 +54,6 @@ char const *safe_strsignal (int) ATTRIBUTE_CONST; | |||
| 54 | # define emacs_raise(sig) raise (sig) | 54 | # define emacs_raise(sig) raise (sig) |
| 55 | #endif | 55 | #endif |
| 56 | 56 | ||
| 57 | /* On bsd, [man says] kill does not accept a negative number to kill a pgrp. | ||
| 58 | Must do that using the killpg call. */ | ||
| 59 | #ifdef BSD_SYSTEM | ||
| 60 | #define EMACS_KILLPG(gid, signo) (killpg ( (gid), (signo))) | ||
| 61 | #else | ||
| 62 | #ifdef WINDOWSNT | ||
| 63 | #define EMACS_KILLPG(gid, signo) (kill (gid, signo)) | ||
| 64 | #else | ||
| 65 | #define EMACS_KILLPG(gid, signo) (kill (-(gid), (signo))) | ||
| 66 | #endif | ||
| 67 | #endif | ||
| 68 | |||
| 69 | /* Define SIGCHLD as an alias for SIGCLD. There are many conditionals | ||
| 70 | testing SIGCHLD. */ | ||
| 71 | #ifdef SIGCLD | ||
| 72 | #ifndef SIGCHLD | ||
| 73 | #define SIGCHLD SIGCLD | ||
| 74 | #endif /* SIGCHLD */ | ||
| 75 | #endif /* ! defined (SIGCLD) */ | ||
| 76 | |||
| 77 | #ifndef HAVE_STRSIGNAL | 57 | #ifndef HAVE_STRSIGNAL |
| 78 | # define strsignal(sig) safe_strsignal (sig) | 58 | # define strsignal(sig) safe_strsignal (sig) |
| 79 | #endif | 59 | #endif |
diff --git a/src/w32proc.c b/src/w32proc.c index 0b36804b0e8..d888200c556 100644 --- a/src/w32proc.c +++ b/src/w32proc.c | |||
| @@ -2122,6 +2122,10 @@ sys_kill (int pid, int sig) | |||
| 2122 | int need_to_free = 0; | 2122 | int need_to_free = 0; |
| 2123 | int rc = 0; | 2123 | int rc = 0; |
| 2124 | 2124 | ||
| 2125 | /* Each process is in its own process group. */ | ||
| 2126 | if (pid < 0) | ||
| 2127 | pid = -pid; | ||
| 2128 | |||
| 2125 | /* Only handle signals that will result in the process dying */ | 2129 | /* Only handle signals that will result in the process dying */ |
| 2126 | if (sig != SIGINT && sig != SIGKILL && sig != SIGQUIT && sig != SIGHUP) | 2130 | if (sig != SIGINT && sig != SIGKILL && sig != SIGQUIT && sig != SIGHUP) |
| 2127 | { | 2131 | { |