Now on revision 111152. ------------------------------------------------------------ revno: 111152 committer: Paul Eggert branch nick: trunk timestamp: Fri 2012-12-07 22:56:26 -0800 message: Simplify get_lim_data. * admin/CPP-DEFINES (ULIMIT_BREAK_VALUE): Remove. * configure.ac (ULIMIT_BREAK_VALUE): Remove. * src/vm-limit.c (get_lim_data): Combine RLIMIT_AS and RLIMIT_DATA methods. Remove USG and vlimit methods; no longer used these days. Add #error catchall just in case. diff: === modified file 'ChangeLog' --- ChangeLog 2012-12-08 02:30:51 +0000 +++ ChangeLog 2012-12-08 06:56:26 +0000 @@ -1,5 +1,8 @@ 2012-12-08 Paul Eggert + Simplify get_lim_data. + * configure.ac (ULIMIT_BREAK_VALUE): Remove. + Assume POSIX 1003.1-1988 or later for signal.h (Bug#13026). * configure.ac (PTY_OPEN, PTY_TTY_NAME_SPRINTF): Use SIGCHLD rather than SIGCLD. === modified file 'admin/CPP-DEFINES' --- admin/CPP-DEFINES 2012-12-08 02:30:51 +0000 +++ admin/CPP-DEFINES 2012-12-08 06:56:26 +0000 @@ -429,7 +429,6 @@ TIME_WITH_SYS_TIME TIOCSIGSEND TM_IN_SYS_TIME -ULIMIT_BREAK_VALUE UNIX98_PTYS USE_TOOLKIT_SCROLL_BARS USG_SUBTTY_WORKS === modified file 'admin/ChangeLog' --- admin/ChangeLog 2012-12-08 02:30:51 +0000 +++ admin/ChangeLog 2012-12-08 06:56:26 +0000 @@ -1,3 +1,8 @@ +2012-12-08 Paul Eggert + + Simplify get_lim_data. + * CPP-DEFINES (ULIMIT_BREAK_VALUE): Remove. + 2012-12-03 Paul Eggert Assume POSIX 1003.1-1988 or later for signal.h (Bug#13026). === modified file 'configure.ac' --- configure.ac 2012-12-08 02:30:51 +0000 +++ configure.ac 2012-12-08 06:56:26 +0000 @@ -3688,7 +3688,6 @@ esac -AH_TEMPLATE(ULIMIT_BREAK_VALUE, [Undocumented.]) AH_TEMPLATE(TAB3, [Undocumented.]) case $opsys in @@ -3700,14 +3699,6 @@ ;; gnu-linux | gnu-kfreebsd ) - dnl libc-linux/sysdeps/linux/i386/ulimit.c says that due to shared - dnl library, we cannot get the maximum address for brk. - AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[ -#ifndef __i386__ -# error "not i386" -#endif - ]], [[]])], AC_DEFINE(ULIMIT_BREAK_VALUE, [(32*1024*1024)]), []) - AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[ #ifndef __ia64__ # error "not ia64" @@ -3721,11 +3712,6 @@ AC_DEFINE(RUN_TIME_REMAP, 1, [Define if emacs.c needs to call run_time_remap; for HPUX.]) ;; - - irix6-5) - dnl Ulimit(UL_GMEMLIM) is busted... - AC_DEFINE(ULIMIT_BREAK_VALUE, [0x14000000]) - ;; esac === modified file 'src/ChangeLog' --- src/ChangeLog 2012-12-08 02:30:51 +0000 +++ src/ChangeLog 2012-12-08 06:56:26 +0000 @@ -1,5 +1,10 @@ 2012-12-08 Paul Eggert + Simplify get_lim_data. + * vm-limit.c (get_lim_data): Combine RLIMIT_AS and RLIMIT_DATA methods. + Remove USG and vlimit methods; no longer used these days. + Add #error catchall just in case. + Assume POSIX 1003.1-1988 or later for signal.h (Bug#13026). Exceptions: do not assume SIGCONT, SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU, SIGUSR1, SIGUSR2, as Microsoft platforms lack these. === modified file 'src/vm-limit.c' --- src/vm-limit.c 2012-10-17 19:02:44 +0000 +++ src/vm-limit.c 2012-12-08 06:56:26 +0000 @@ -44,46 +44,26 @@ static size_t lim_data; -#if defined (HAVE_GETRLIMIT) && defined (RLIMIT_AS) +#ifdef HAVE_GETRLIMIT + +# ifndef RLIMIT_AS +# define RLIMIT_AS RLIMIT_DATA +# endif + static void get_lim_data (void) { + /* Set LIM_DATA to the minimum of the maximum object size and the + maximum address space. Don't bother to check for values like + RLIM_INFINITY since in practice they are not much less than SIZE_MAX. */ struct rlimit rlimit; - - getrlimit (RLIMIT_AS, &rlimit); - if (rlimit.rlim_cur == RLIM_INFINITY) - lim_data = -1; - else - lim_data = rlimit.rlim_cur; -} - -#else /* not HAVE_GETRLIMIT */ - -#ifdef USG - -static void -get_lim_data (void) -{ - extern long ulimit (); - - lim_data = -1; - - /* Use the ulimit call, if we seem to have it. */ -#if !defined (ULIMIT_BREAK_VALUE) || defined (GNU_LINUX) - lim_data = ulimit (3, 0); -#endif - - /* If that didn't work, just use the macro's value. */ -#ifdef ULIMIT_BREAK_VALUE - if (lim_data == -1) - lim_data = ULIMIT_BREAK_VALUE; -#endif - - lim_data -= (long) data_space_start; -} - -#else /* not USG */ -#ifdef WINDOWSNT + lim_data + = (getrlimit (RLIMIT_AS, &rlimit) == 0 && rlimit.rlim_cur <= SIZE_MAX + ? rlimit.rlim_cur + : SIZE_MAX); +} + +#elif defined WINDOWSNT #include "w32heap.h" @@ -94,10 +74,8 @@ lim_data = reserved_heap_size; } -#else -#if !defined (BSD4_2) && !defined (CYGWIN) +#elif defined MSDOS -#ifdef MSDOS void get_lim_data (void) { @@ -135,32 +113,9 @@ get_lim_data (); return lim_data; } -#else /* not MSDOS */ -static void -get_lim_data (void) -{ - lim_data = vlimit (LIM_DATA, -1); -} -#endif /* not MSDOS */ - -#else /* BSD4_2 || CYGWIN */ - -static void -get_lim_data (void) -{ - struct rlimit XXrlimit; - - getrlimit (RLIMIT_DATA, &XXrlimit); -#ifdef RLIM_INFINITY - lim_data = XXrlimit.rlim_cur & RLIM_INFINITY; /* soft limit */ #else - lim_data = XXrlimit.rlim_cur; /* soft limit */ +# error "get_lim_data not implemented on this machine" #endif -} -#endif /* BSD4_2 */ -#endif /* not WINDOWSNT */ -#endif /* not USG */ -#endif /* not HAVE_GETRLIMIT */ /* Verify amount of memory available, complaining if we're near the end. */ ------------------------------------------------------------ revno: 111151 fixes bug: http://debbugs.gnu.org/13026 committer: Paul Eggert branch nick: trunk timestamp: Fri 2012-12-07 18:30:51 -0800 message: Assume POSIX 1003.1-1988 or later for signal.h. Exceptions: do not assume SIGCONT, SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU, SIGUSR1, SIGUSR2, as Microsoft platforms lack these. * admin/CPP-DEFINES (SIGALRM, SIGCHLD, SIGHUP, SIGKILL, SIGPIPE, SIGQUIT): Remove. (SIGTRAP): Remove this one too, as config.h no longer defines it. * admin/merge-gnulib (GNULIB_MODULES): Add sig2str. * configure.ac (PTY_OPEN, PTY_TTY_NAME_SPRINTF): Use SIGCHLD rather than SIGCLD. * lib/sig2str.c, lib/sig2str.h, m4/sig2str.m4: New files, from gnulib. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * lib/makefile.w32-in (GNULIBOBJS): Add $(BUILD)/sig2str.$(O). * src/process.c [subprocesses]: Include , . (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. (parse_signal): Remove. All uses removed. (abbr_to_signal): New static function. (Fsignal_process): Use it to convert signal names to ints. * src/sysdep.c (sys_suspend) [!DOS_NT]: Use kill (0, ...) rather than kill (getpgrp (), ...). (emacs_sigaction_init): Assume SIGCHLD is defined. (init_signals): Assume SIGALRM, SIGCHLD, SIGHUP, SIGKILL, SIGPIPE, and SIGQUIT are defined. Do not worry about SIGCLD any more. * src/syssignal.h (EMACS_KILLPG): Remove. All uses replaced by 'kill' with a negative pid. (SIGCHLD): Remove definition, as we now assume SIGCHLD. * src/w32proc.c (sys_kill): Support negative pids compatibly with POSIX. diff: === modified file 'ChangeLog' --- ChangeLog 2012-12-06 06:17:10 +0000 +++ ChangeLog 2012-12-08 02:30:51 +0000 @@ -1,3 +1,12 @@ +2012-12-08 Paul Eggert + + Assume POSIX 1003.1-1988 or later for signal.h (Bug#13026). + * configure.ac (PTY_OPEN, PTY_TTY_NAME_SPRINTF): + Use SIGCHLD rather than SIGCLD. + * lib/sig2str.c, lib/sig2str.h, m4/sig2str.m4: New files, from gnulib. + * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. + * lib/makefile.w32-in (GNULIBOBJS): Add $(BUILD)/sig2str.$(O). + 2012-12-06 Glenn Morris * configure.ac: Handle info/ files with or without ".info" extension. === modified file 'admin/CPP-DEFINES' --- admin/CPP-DEFINES 2012-11-24 17:20:49 +0000 +++ admin/CPP-DEFINES 2012-12-08 02:30:51 +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-12-08 02:30:51 +0000 @@ -1,3 +1,11 @@ +2012-12-03 Paul Eggert + + Assume POSIX 1003.1-1988 or later for signal.h (Bug#13026). + * CPP-DEFINES (SIGALRM, SIGCHLD, SIGHUP, SIGKILL, SIGPIPE, SIGQUIT): + Remove. + (SIGTRAP): Remove this one too, as config.h no longer defines it. + * merge-gnulib (GNULIB_MODULES): Add sig2str. + 2012-11-24 Ken Brown * CPP-DEFINES (HAVE_MOUSE): Remove. === modified file 'admin/merge-gnulib' --- admin/merge-gnulib 2012-11-17 22:12:47 +0000 +++ admin/merge-gnulib 2012-12-08 02:30:51 +0000 @@ -32,7 +32,7 @@ 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 + 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 === modified file 'configure.ac' --- configure.ac 2012-12-06 06:17:10 +0000 +++ configure.ac 2012-12-08 02:30:51 +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/gnulib.mk' --- lib/gnulib.mk 2012-11-30 18:25:59 +0000 +++ lib/gnulib.mk 2012-12-08 02:30:51 +0000 @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# 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 +# 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 MOSTLYCLEANFILES += core *.stackdump @@ -457,6 +457,15 @@ ## end gnulib module root-uid +## begin gnulib module sig2str + + +EXTRA_DIST += sig2str.c sig2str.h + +EXTRA_libgnu_a_SOURCES += sig2str.c + +## end gnulib module sig2str + ## begin gnulib module signal-h BUILT_SOURCES += signal.h === modified file 'lib/makefile.w32-in' --- lib/makefile.w32-in 2012-11-06 15:29:49 +0000 +++ lib/makefile.w32-in 2012-12-08 02:30:51 +0000 @@ -1,4 +1,4 @@ -# -*- Makefile -*- for GNU Emacs on the Microsoft Windows API. +2# -*- Makefile -*- for GNU Emacs on the Microsoft Windows API. # Copyright (C) 2011-2012 Free Software Foundation, Inc. # This file is part of GNU Emacs. @@ -42,6 +42,7 @@ $(BLD)/sha1.$(O) \ $(BLD)/sha256.$(O) \ $(BLD)/sha512.$(O) \ + $(BLD)/sig2str.$(O) \ $(BLD)/stat-time.$(O) \ $(BLD)/timespec.$(O) \ $(BLD)/u64.$(O) \ @@ -322,4 +323,3 @@ execinfo.h: execinfo.in.h $(CP) execinfo.in.h $@ - === added file 'lib/sig2str.c' --- lib/sig2str.c 1970-01-01 00:00:00 +0000 +++ lib/sig2str.c 2012-12-08 02:30:51 +0000 @@ -0,0 +1,345 @@ +/* sig2str.c -- convert between signal names and numbers + + Copyright (C) 2002, 2004, 2006, 2009-2012 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Paul Eggert. */ + +#include + +#include +#include +#include +#include +#include + +#include "sig2str.h" + +#ifndef SIGRTMIN +# define SIGRTMIN 0 +# undef SIGRTMAX +#endif +#ifndef SIGRTMAX +# define SIGRTMAX (SIGRTMIN - 1) +#endif + +#define NUMNAME(name) { SIG##name, #name } + +/* Signal names and numbers. Put the preferred name first. */ +static struct numname { int num; char const name[8]; } numname_table[] = + { + /* Signals required by POSIX 1003.1-2001 base, listed in + traditional numeric order where possible. */ +#ifdef SIGHUP + NUMNAME (HUP), +#endif +#ifdef SIGINT + NUMNAME (INT), +#endif +#ifdef SIGQUIT + NUMNAME (QUIT), +#endif +#ifdef SIGILL + NUMNAME (ILL), +#endif +#ifdef SIGTRAP + NUMNAME (TRAP), +#endif +#ifdef SIGABRT + NUMNAME (ABRT), +#endif +#ifdef SIGFPE + NUMNAME (FPE), +#endif +#ifdef SIGKILL + NUMNAME (KILL), +#endif +#ifdef SIGSEGV + NUMNAME (SEGV), +#endif + /* On Haiku, SIGSEGV == SIGBUS, but we prefer SIGSEGV to match + strsignal.c output, so SIGBUS must be listed second. */ +#ifdef SIGBUS + NUMNAME (BUS), +#endif +#ifdef SIGPIPE + NUMNAME (PIPE), +#endif +#ifdef SIGALRM + NUMNAME (ALRM), +#endif +#ifdef SIGTERM + NUMNAME (TERM), +#endif +#ifdef SIGUSR1 + NUMNAME (USR1), +#endif +#ifdef SIGUSR2 + NUMNAME (USR2), +#endif +#ifdef SIGCHLD + NUMNAME (CHLD), +#endif +#ifdef SIGURG + NUMNAME (URG), +#endif +#ifdef SIGSTOP + NUMNAME (STOP), +#endif +#ifdef SIGTSTP + NUMNAME (TSTP), +#endif +#ifdef SIGCONT + NUMNAME (CONT), +#endif +#ifdef SIGTTIN + NUMNAME (TTIN), +#endif +#ifdef SIGTTOU + NUMNAME (TTOU), +#endif + + /* Signals required by POSIX 1003.1-2001 with the XSI extension. */ +#ifdef SIGSYS + NUMNAME (SYS), +#endif +#ifdef SIGPOLL + NUMNAME (POLL), +#endif +#ifdef SIGVTALRM + NUMNAME (VTALRM), +#endif +#ifdef SIGPROF + NUMNAME (PROF), +#endif +#ifdef SIGXCPU + NUMNAME (XCPU), +#endif +#ifdef SIGXFSZ + NUMNAME (XFSZ), +#endif + + /* Unix Version 7. */ +#ifdef SIGIOT + NUMNAME (IOT), /* Older name for ABRT. */ +#endif +#ifdef SIGEMT + NUMNAME (EMT), +#endif + + /* USG Unix. */ +#ifdef SIGPHONE + NUMNAME (PHONE), +#endif +#ifdef SIGWIND + NUMNAME (WIND), +#endif + + /* Unix System V. */ +#ifdef SIGCLD + NUMNAME (CLD), +#endif +#ifdef SIGPWR + NUMNAME (PWR), +#endif + + /* GNU/Linux 2.2 and Solaris 8. */ +#ifdef SIGCANCEL + NUMNAME (CANCEL), +#endif +#ifdef SIGLWP + NUMNAME (LWP), +#endif +#ifdef SIGWAITING + NUMNAME (WAITING), +#endif +#ifdef SIGFREEZE + NUMNAME (FREEZE), +#endif +#ifdef SIGTHAW + NUMNAME (THAW), +#endif +#ifdef SIGLOST + NUMNAME (LOST), +#endif +#ifdef SIGWINCH + NUMNAME (WINCH), +#endif + + /* GNU/Linux 2.2. */ +#ifdef SIGINFO + NUMNAME (INFO), +#endif +#ifdef SIGIO + NUMNAME (IO), +#endif +#ifdef SIGSTKFLT + NUMNAME (STKFLT), +#endif + + /* AIX 5L. */ +#ifdef SIGDANGER + NUMNAME (DANGER), +#endif +#ifdef SIGGRANT + NUMNAME (GRANT), +#endif +#ifdef SIGMIGRATE + NUMNAME (MIGRATE), +#endif +#ifdef SIGMSG + NUMNAME (MSG), +#endif +#ifdef SIGPRE + NUMNAME (PRE), +#endif +#ifdef SIGRETRACT + NUMNAME (RETRACT), +#endif +#ifdef SIGSAK + NUMNAME (SAK), +#endif +#ifdef SIGSOUND + NUMNAME (SOUND), +#endif + + /* Older AIX versions. */ +#ifdef SIGALRM1 + NUMNAME (ALRM1), /* unknown; taken from Bash 2.05 */ +#endif +#ifdef SIGKAP + NUMNAME (KAP), /* Older name for SIGGRANT. */ +#endif +#ifdef SIGVIRT + NUMNAME (VIRT), /* unknown; taken from Bash 2.05 */ +#endif +#ifdef SIGWINDOW + NUMNAME (WINDOW), /* Older name for SIGWINCH. */ +#endif + + /* BeOS */ +#ifdef SIGKILLTHR + NUMNAME (KILLTHR), +#endif + + /* Older HP-UX versions. */ +#ifdef SIGDIL + NUMNAME (DIL), +#endif + + /* Korn shell and Bash, of uncertain vintage. */ + { 0, "EXIT" } + }; + +#define NUMNAME_ENTRIES (sizeof numname_table / sizeof numname_table[0]) + +/* ISDIGIT differs from isdigit, as follows: + - Its arg may be any int or unsigned int; it need not be an unsigned char + or EOF. + - It's typically faster. + POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to + isdigit unless it's important to use the locale's definition + of "digit" even when the host does not conform to POSIX. */ +#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9) + +/* Convert the signal name SIGNAME to a signal number. Return the + signal number if successful, -1 otherwise. */ + +static int +str2signum (char const *signame) +{ + if (ISDIGIT (*signame)) + { + char *endp; + long int n = strtol (signame, &endp, 10); + if (! *endp && n <= SIGNUM_BOUND) + return n; + } + else + { + unsigned int i; + for (i = 0; i < NUMNAME_ENTRIES; i++) + if (strcmp (numname_table[i].name, signame) == 0) + return numname_table[i].num; + + { + char *endp; + int rtmin = SIGRTMIN; + int rtmax = SIGRTMAX; + + if (0 < rtmin && strncmp (signame, "RTMIN", 5) == 0) + { + long int n = strtol (signame + 5, &endp, 10); + if (! *endp && 0 <= n && n <= rtmax - rtmin) + return rtmin + n; + } + else if (0 < rtmax && strncmp (signame, "RTMAX", 5) == 0) + { + long int n = strtol (signame + 5, &endp, 10); + if (! *endp && rtmin - rtmax <= n && n <= 0) + return rtmax + n; + } + } + } + + return -1; +} + +/* Convert the signal name SIGNAME to the signal number *SIGNUM. + Return 0 if successful, -1 otherwise. */ + +int +str2sig (char const *signame, int *signum) +{ + *signum = str2signum (signame); + return *signum < 0 ? -1 : 0; +} + +/* Convert SIGNUM to a signal name in SIGNAME. SIGNAME must point to + a buffer of at least SIG2STR_MAX bytes. Return 0 if successful, -1 + otherwise. */ + +int +sig2str (int signum, char *signame) +{ + unsigned int i; + for (i = 0; i < NUMNAME_ENTRIES; i++) + if (numname_table[i].num == signum) + { + strcpy (signame, numname_table[i].name); + return 0; + } + + { + int rtmin = SIGRTMIN; + int rtmax = SIGRTMAX; + + if (! (rtmin <= signum && signum <= rtmax)) + return -1; + + if (signum <= rtmin + (rtmax - rtmin) / 2) + { + int delta = signum - rtmin; + sprintf (signame, delta ? "RTMIN+%d" : "RTMIN", delta); + } + else + { + int delta = rtmax - signum; + sprintf (signame, delta ? "RTMAX-%d" : "RTMAX", delta); + } + + return 0; + } +} === added file 'lib/sig2str.h' --- lib/sig2str.h 1970-01-01 00:00:00 +0000 +++ lib/sig2str.h 2012-12-08 02:30:51 +0000 @@ -0,0 +1,43 @@ +/* sig2str.h -- convert between signal names and numbers + + Copyright (C) 2002, 2005, 2009-2012 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Paul Eggert. */ + +#include + +/* Don't override system declarations of SIG2STR_MAX, sig2str, str2sig. */ +#ifndef SIG2STR_MAX + +# include "intprops.h" + +/* Size of a buffer needed to hold a signal name like "HUP". */ +# define SIG2STR_MAX (sizeof "SIGRTMAX" + INT_STRLEN_BOUND (int) - 1) + +int sig2str (int, char *); +int str2sig (char const *, int *); + +#endif + +/* An upper bound on signal numbers allowed by the system. */ + +#if defined _sys_nsig +# define SIGNUM_BOUND (_sys_nsig - 1) +#elif defined NSIG +# define SIGNUM_BOUND (NSIG - 1) +#else +# define SIGNUM_BOUND 64 +#endif === modified file 'm4/gnulib-comp.m4' --- m4/gnulib-comp.m4 2012-11-30 18:25:59 +0000 +++ m4/gnulib-comp.m4 2012-12-08 02:30:51 +0000 @@ -87,6 +87,7 @@ # Code from module pthread_sigmask: # Code from module readlink: # Code from module root-uid: + # Code from module sig2str: # Code from module signal-h: # Code from module snippet/_Noreturn: # Code from module snippet/arg-nonnull: @@ -245,6 +246,11 @@ gl_PREREQ_READLINK fi gl_UNISTD_MODULE_INDICATOR([readlink]) + gl_FUNC_SIG2STR + if test $ac_cv_func_sig2str = no; then + AC_LIBOBJ([sig2str]) + gl_PREREQ_SIG2STR + fi gl_SIGNAL_H gl_TYPE_SOCKLEN_T gt_TYPE_SSIZE_T @@ -681,6 +687,8 @@ lib/sha256.h lib/sha512.c lib/sha512.h + lib/sig2str.c + lib/sig2str.h lib/signal.in.h lib/stat-time.c lib/stat-time.h @@ -760,6 +768,7 @@ m4/sha1.m4 m4/sha256.m4 m4/sha512.m4 + m4/sig2str.m4 m4/signal_h.m4 m4/socklen.m4 m4/ssize_t.m4 === added file 'm4/sig2str.m4' --- m4/sig2str.m4 1970-01-01 00:00:00 +0000 +++ m4/sig2str.m4 2012-12-08 02:30:51 +0000 @@ -0,0 +1,15 @@ +# serial 7 +dnl Copyright (C) 2002, 2005-2006, 2009-2012 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_SIG2STR], +[ + AC_CHECK_FUNCS([sig2str]) +]) + +# Prerequisites of lib/sig2str.c. +AC_DEFUN([gl_PREREQ_SIG2STR], [ + : +]) === modified file 'src/ChangeLog' --- src/ChangeLog 2012-12-07 17:53:17 +0000 +++ src/ChangeLog 2012-12-08 02:30:51 +0000 @@ -1,3 +1,26 @@ +2012-12-08 Paul Eggert + + Assume POSIX 1003.1-1988 or later for signal.h (Bug#13026). + Exceptions: do not assume SIGCONT, SIGSTOP, SIGTSTP, SIGTTIN, + SIGTTOU, SIGUSR1, SIGUSR2, as Microsoft platforms lack these. + * process.c [subprocesses]: Include , . + (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. + (parse_signal): Remove. All uses removed. + (abbr_to_signal): New static function. + (Fsignal_process): Use it to convert signal names to ints. + * sysdep.c (sys_suspend) [!DOS_NT]: Use kill (0, ...) rather than + kill (getpgrp (), ...). + (emacs_sigaction_init): Assume SIGCHLD is defined. + (init_signals): Assume SIGALRM, SIGCHLD, SIGHUP, SIGKILL, + SIGPIPE, and SIGQUIT 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-12-07 Paul Eggert * sysdep.c (get_child_status): Abort on internal error (Bug#13086). === modified file 'src/callproc.c' --- src/callproc.c 2012-12-06 07:31:58 +0000 +++ src/callproc.c 2012-12-08 02:30:51 +0000 @@ -87,12 +87,10 @@ static void block_child_signal (void) { -#ifdef SIGCHLD sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); -#endif } /* Unblock SIGCHLD. */ @@ -100,9 +98,7 @@ static void unblock_child_signal (void) { -#ifdef SIGCHLD pthread_sigmask (SIG_SETMASK, &empty_mask, 0); -#endif } /* If P is reapable, record it as a deleted process and kill it. @@ -118,7 +114,7 @@ { p->alive = 0; record_deleted_pid (p->pid); - EMACS_KILLPG (p->pid, SIGKILL); + kill (- p->pid, SIGKILL); } unblock_child_signal (); @@ -164,7 +160,7 @@ if (synch_process_pid) { ptrdiff_t count = SPECPDL_INDEX (); - EMACS_KILLPG (synch_process_pid, SIGINT); + kill (-synch_process_pid, SIGINT); record_unwind_protect (call_process_kill, make_number (0)); message1 ("Waiting for process to die...(type C-g again to kill it instantly)"); immediate_quit = 1; === modified file 'src/keyboard.c' --- src/keyboard.c 2012-12-06 13:48:11 +0000 +++ src/keyboard.c 2012-12-08 02:30:51 +0000 @@ -10688,7 +10688,7 @@ fflush (stdout); reset_all_sys_modes (); -#ifdef SIGTSTP /* Support possible in later USG versions */ +#ifdef SIGTSTP /* * 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. === modified file 'src/process.c' --- src/process.c 2012-12-06 07:31:58 +0000 +++ src/process.c 2012-12-08 02:30:51 +0000 @@ -91,6 +91,9 @@ #include #endif +#include +#include + #endif /* subprocesses */ #include "systime.h" @@ -773,7 +776,6 @@ } -#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; @@ -781,17 +783,14 @@ Some processes created by call-process are also put onto this list. */ static Lisp_Object deleted_pid_list; -#endif void record_deleted_pid (pid_t pid) { -#ifdef SIGCHLD deleted_pid_list = Fcons (make_fixnum_or_float (pid), /* GC treated elements set to nil. */ Fdelq (Qnil, deleted_pid_list)); -#endif } DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0, @@ -1581,9 +1580,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 +1677,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 #ifndef WINDOWSNT pid = vfork (); @@ -1794,10 +1789,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); @@ -1818,9 +1811,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) @@ -4612,7 +4603,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 (); @@ -4810,10 +4801,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. */ @@ -5676,7 +5665,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, @@ -5814,7 +5803,7 @@ if (!NILP (current_group)) { if (ioctl (p->infd, TIOCSIGSEND, signo) == -1) - EMACS_KILLPG (gid, signo); + kill (-gid, signo); } else { @@ -5822,7 +5811,7 @@ kill (gid, signo); } #else /* ! defined (TIOCSIGSEND) */ - EMACS_KILLPG (gid, signo); + kill (-gid, signo); #endif /* ! defined (TIOCSIGSEND) */ } @@ -5927,6 +5916,27 @@ return process; } +/* Return the integer value of the signal whose abbreviation is ABBR, + or a negative number if there is no such signal. */ +static int +abbr_to_signal (char const *name) +{ + int i, signo; + char sigbuf[20]; /* Large enough for all valid signal abbreviations. */ + + if (!strncmp (name, "SIG", 3) || !strncmp (name, "sig", 3)) + name += 3; + + for (i = 0; i < sizeof sigbuf; i++) + { + sigbuf[i] = c_toupper (name[i]); + if (! sigbuf[i]) + return str2sig (sigbuf, &signo) == 0 ? signo : -1; + } + + return -1; +} + DEFUN ("signal-process", Fsignal_process, Ssignal_process, 2, 2, "sProcess (name or number): \nnSignal code: ", doc: /* Send PROCESS the signal with code SIGCODE. @@ -5937,6 +5947,7 @@ (Lisp_Object process, Lisp_Object sigcode) { pid_t pid; + int signo; if (STRINGP (process)) { @@ -5966,12 +5977,11 @@ error ("Cannot signal process %s", SDATA (XPROCESS (process)->name)); } -#define parse_signal(NAME, VALUE) \ - else if (!xstrcasecmp (name, NAME)) \ - XSETINT (sigcode, VALUE) - if (INTEGERP (sigcode)) - CHECK_TYPE_RANGED_INTEGER (int, sigcode); + { + CHECK_TYPE_RANGED_INTEGER (int, sigcode); + signo = XINT (sigcode); + } else { char *name; @@ -5979,96 +5989,12 @@ CHECK_SYMBOL (sigcode); name = SSDATA (SYMBOL_NAME (sigcode)); - if (!strncmp (name, "SIG", 3) || !strncmp (name, "sig", 3)) - name += 3; - - 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); -#endif - parse_signal ("segv", SIGSEGV); -#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 -#ifdef SIGXCPU - parse_signal ("xcpu", SIGXCPU); -#endif -#ifdef SIGXFSZ - parse_signal ("xfsz", SIGXFSZ); -#endif -#ifdef SIGVTALRM - parse_signal ("vtalrm", SIGVTALRM); -#endif -#ifdef SIGPROF - parse_signal ("prof", SIGPROF); -#endif -#ifdef SIGWINCH - parse_signal ("winch", SIGWINCH); -#endif -#ifdef SIGINFO - parse_signal ("info", SIGINFO); -#endif - else + signo = abbr_to_signal (name); + if (signo < 0) error ("Undefined signal name %s", name); } -#undef parse_signal - - return make_number (kill (pid, XINT (sigcode))); + return make_number (kill (pid, signo)); } DEFUN ("process-send-eof", Fprocess_send_eof, Sprocess_send_eof, 0, 1, 0, @@ -6150,8 +6076,6 @@ return process; } -#ifdef SIGCHLD - /* The main Emacs thread records child processes in three places: - Vprocess_alist, for asynchronous subprocesses, which are child @@ -6268,8 +6192,6 @@ { deliver_process_signal (sig, handle_child_signal); } - -#endif /* SIGCHLD */ static Lisp_Object @@ -7118,7 +7040,6 @@ inhibit_sentinels = 0; -#ifdef SIGCHLD #ifndef CANNOT_DUMP if (! noninteractive || initialized) #endif @@ -7127,7 +7048,6 @@ emacs_sigaction_init (&action, deliver_child_signal); sigaction (SIGCHLD, &action, 0); } -#endif FD_ZERO (&input_wait_mask); FD_ZERO (&non_keyboard_wait_mask); @@ -7154,9 +7074,7 @@ #endif Vprocess_alist = Qnil; -#ifdef SIGCHLD deleted_pid_list = Qnil; -#endif for (i = 0; i < MAXDESC; i++) { chan_process[i] = Qnil; @@ -7283,9 +7201,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-12-07 17:53:17 +0000 +++ src/sysdep.c 2012-12-08 02:30:51 +0000 @@ -457,20 +457,15 @@ void sys_suspend (void) { -#if defined (SIGTSTP) && !defined (MSDOS) - - { - pid_t pgrp = getpgrp (); - EMACS_KILLPG (pgrp, SIGTSTP); - } - -#else /* No SIGTSTP */ +#ifndef DOS_NT + 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. */ @@ -1518,9 +1513,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 @@ -1700,18 +1693,11 @@ # 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 @@ -1731,9 +1717,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 @@ -1745,9 +1729,7 @@ # ifdef SIGIOT sys_siglist[SIGIOT] = "IOT trap"; # endif -# ifdef SIGKILL sys_siglist[SIGKILL] = "Killed"; -# endif # ifdef SIGLOST sys_siglist[SIGLOST] = "Resource lost"; # endif @@ -1760,9 +1742,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 @@ -1775,9 +1755,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 === modified file 'src/syssignal.h' --- src/syssignal.h 2012-10-07 02:26:03 +0000 +++ src/syssignal.h 2012-12-08 02:30:51 +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-12-06 18:36:22 +0000 +++ src/w32proc.c 2012-12-08 02:30:51 +0000 @@ -2122,6 +2122,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) { ------------------------------------------------------------ revno: 111150 committer: Paul Eggert branch nick: trunk timestamp: Fri 2012-12-07 09:53:17 -0800 message: * sysdep.c (get_child_status): Abort on internal error (Bug#13086). This will cause a production Emacs to dump core instead of infinite-looping. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-12-07 08:13:49 +0000 +++ src/ChangeLog 2012-12-07 17:53:17 +0000 @@ -1,3 +1,9 @@ +2012-12-07 Paul Eggert + + * sysdep.c (get_child_status): Abort on internal error (Bug#13086). + This will cause a production Emacs to dump core instead of + infinite-looping. + 2012-12-07 Dmitry Antipov * frame.c (make_frame): Do not set window's buffer to t. === modified file 'src/sysdep.c' --- src/sysdep.c 2012-12-03 21:42:12 +0000 +++ src/sysdep.c 2012-12-07 17:53:17 +0000 @@ -289,9 +289,12 @@ while ((pid = waitpid (child, status, options)) < 0) { - /* CHILD must be a child process that has not been reaped, and - STATUS and OPTIONS must be valid. */ - eassert (errno == EINTR); + /* Check that CHILD is a child process that has not been reaped, + and that STATUS and OPTIONS are valid. Otherwise abort, + as continuing after this internal error could cause Emacs to + become confused and kill innocent-victim processes. */ + if (errno != EINTR) + emacs_abort (); /* Note: the MS-Windows emulation of waitpid calls QUIT internally. */ ------------------------------------------------------------ revno: 111149 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2012-12-07 11:48:42 -0500 message: * lisp/hi-lock.el (hi-lock-unface-buffer): If there's no matching regexp at point, still provide some default. (hi-lock--regexps-at-point): Don't enforce a "hi-lock-" prefix on face names, since we don't use it right now. Actually return the list. (hi-lock-file-patterns, hi-lock-interactive-patterns): Use defvar-local. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-12-07 16:34:01 +0000 +++ lisp/ChangeLog 2012-12-07 16:48:42 +0000 @@ -1,3 +1,11 @@ +2012-12-07 Stefan Monnier + + * hi-lock.el (hi-lock-unface-buffer): If there's no matching regexp at + point, still provide some default. + (hi-lock--regexps-at-point): Don't enforce a "hi-lock-" prefix on face + names, since we don't use it right now. Actually return the list. + (hi-lock-file-patterns, hi-lock-interactive-patterns): Use defvar-local. + 2012-12-07 Chong Yidong * novice.el (disabled-command-function): Remove a spurious help === modified file 'lisp/hi-lock.el' --- lisp/hi-lock.el 2012-12-06 16:17:11 +0000 +++ lisp/hi-lock.el 2012-12-07 16:48:42 +0000 @@ -205,11 +205,13 @@ "Face for hi-lock mode." :group 'hi-lock-faces) -(defvar hi-lock-file-patterns nil +(defvar-local hi-lock-file-patterns nil "Patterns found in file for hi-lock. Should not be changed.") +(put 'hi-lock-file-patterns 'permanent-local t) -(defvar hi-lock-interactive-patterns nil +(defvar-local hi-lock-interactive-patterns nil "Patterns provided to hi-lock by user. Should not be changed.") +(put 'hi-lock-interactive-patterns 'permanent-local t) (define-obsolete-variable-alias 'hi-lock-face-history 'hi-lock-face-defaults "23.1") @@ -236,11 +238,6 @@ Assumption is made if `hi-lock-mode' used in the *scratch* buffer while a library is being loaded.") -(make-variable-buffer-local 'hi-lock-interactive-patterns) -(put 'hi-lock-interactive-patterns 'permanent-local t) -(make-variable-buffer-local 'hi-lock-file-patterns) -(put 'hi-lock-file-patterns 'permanent-local t) - (defvar hi-lock-menu (let ((map (make-sparse-keymap "Hi Lock"))) (define-key-after map [highlight-regexp] @@ -474,8 +471,8 @@ (let ((regexp (get-char-property (point) 'hi-lock-overlay-regexp))) (when regexp (push regexp regexps))) ;; With font-locking on, check if the cursor is on an highlighted text. - ;; Checking for hi-lock face is a good heuristic. - (and (string-match "\\`hi-lock-" (face-name (face-at-point))) + ;; Checking for hi-lock face is a good heuristic. FIXME: use "hi-lock-". + (and (string-match "\\`hi-" (face-name (face-at-point))) (let* ((hi-text (buffer-substring-no-properties (previous-single-property-change (point) 'face) @@ -486,7 +483,8 @@ (dolist (hi-lock-pattern hi-lock-interactive-patterns) (let ((regexp (car hi-lock-pattern))) (if (string-match regexp hi-text) - (push regexp regexps)))))))) + (push regexp regexps)))))) + regexps)) (defvar-local hi-lock--last-face nil) @@ -531,7 +529,8 @@ (unless hi-lock-interactive-patterns (error "No highlighting to remove")) ;; Infer the regexp to un-highlight based on cursor position. - (let* ((defaults (hi-lock--regexps-at-point))) + (let* ((defaults (or (hi-lock--regexps-at-point) + (mapcar #'car hi-lock-interactive-patterns)))) (list (completing-read (if (null defaults) "Regexp to unhighlight: " ------------------------------------------------------------ revno: 111148 fixes bug: http://debbugs.gnu.org/13043 committer: Chong Yidong branch nick: trunk timestamp: Sat 2012-12-08 00:34:01 +0800 message: * novice.el (disabled-command-function): Remove a spurious help xref. Suggested by Kelly Dean. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-12-07 16:25:28 +0000 +++ lisp/ChangeLog 2012-12-07 16:34:01 +0000 @@ -1,5 +1,8 @@ 2012-12-07 Chong Yidong + * novice.el (disabled-command-function): Remove a spurious help + xref (Bug#13043). Suggested by Kelly Dean. + * subr.el (text-clone-maintain): Fix clone overlay deletion when a syntax is specified (Bug#13025). === modified file 'lisp/novice.el' --- lisp/novice.el 2012-09-17 05:41:04 +0000 +++ lisp/novice.el 2012-12-07 16:34:01 +0000 @@ -49,7 +49,6 @@ (unless keys (setq keys (this-command-keys))) (let (char) (save-window-excursion - (help-setup-xref (list 'disabled-command-function cmd keys) nil) (with-output-to-temp-buffer "*Disabled Command*" ;; (help-buffer) (if (or (eq (aref keys 0) (if (stringp keys) ------------------------------------------------------------ revno: 111147 fixes bug: http://debbugs.gnu.org/13025 committer: Chong Yidong branch nick: trunk timestamp: Sat 2012-12-08 00:25:28 +0800 message: * subr.el (text-clone-maintain): Fix clone overlay deletion when a syntax is specified. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-12-07 15:31:43 +0000 +++ lisp/ChangeLog 2012-12-07 16:25:28 +0000 @@ -1,5 +1,8 @@ 2012-12-07 Chong Yidong + * subr.el (text-clone-maintain): Fix clone overlay deletion when a + syntax is specified (Bug#13025). + * info.el (Info-set-mode-line): Remove the file extension from Info-current-file if there is one (Bug#13016). === modified file 'lisp/subr.el' --- lisp/subr.el 2012-12-07 02:37:20 +0000 +++ lisp/subr.el 2012-12-07 16:25:28 +0000 @@ -3847,7 +3847,7 @@ (if (not (re-search-forward (overlay-get ol1 'text-clone-syntax) cend t)) ;; Mark the overlay for deletion. - (overlay-put ol1 'text-clones nil) + (setq end cbeg) (when (< (match-end 0) cend) ;; Shrink the clone at its end. (setq end (min end (match-end 0))) ------------------------------------------------------------ revno: 111146 fixes bug: http://debbugs.gnu.org/13016 committer: Chong Yidong branch nick: trunk timestamp: Fri 2012-12-07 23:31:43 +0800 message: * info.el (Info-set-mode-line): Remove file extension from Info-current-file if there is one. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-12-07 08:59:14 +0000 +++ lisp/ChangeLog 2012-12-07 15:31:43 +0000 @@ -1,3 +1,8 @@ +2012-12-07 Chong Yidong + + * info.el (Info-set-mode-line): Remove the file extension from + Info-current-file if there is one (Bug#13016). + 2012-12-07 Glenn Morris * mail/rmail.el (rmail-mime-decoded): New permanent local. === modified file 'lisp/info.el' --- lisp/info.el 2012-12-06 06:17:10 +0000 +++ lisp/info.el 2012-12-07 15:31:43 +0000 @@ -1668,7 +1668,9 @@ " (" (if (stringp Info-current-file) (replace-regexp-in-string - "%" "%%" (file-name-nondirectory Info-current-file)) + "%" "%%" + (file-name-sans-extension + (file-name-nondirectory Info-current-file))) (format "*%S*" Info-current-file)) ") " (if Info-current-node ------------------------------------------------------------ revno: 111145 committer: Glenn Morris branch nick: trunk timestamp: Fri 2012-12-07 06:19:45 -0500 message: Auto-commit of loaddefs files. diff: === modified file 'lisp/mail/rmail.el' --- lisp/mail/rmail.el 2012-12-07 08:59:14 +0000 +++ lisp/mail/rmail.el 2012-12-07 11:19:45 +0000 @@ -4581,7 +4581,7 @@ ;;; Start of automatically extracted autoloads. ;;;### (autoloads (rmail-edit-current-message) "rmailedit" "rmailedit.el" -;;;;;; "78b8b7d5c679935c118d595d473d7c5e") +;;;;;; "791ea184628feb6335fe3e29f7234934") ;;; Generated autoloads from rmailedit.el (autoload 'rmail-edit-current-message "rmailedit" "\ ------------------------------------------------------------ revno: 111144 fixes bug: http://debbugs.gnu.org/9841 committer: Glenn Morris branch nick: trunk timestamp: Fri 2012-12-07 00:59:14 -0800 message: rmail-cease-edit fixes related to "^From " escaping * mail/rmail.el (rmail-mime-decoded): New permanent local. (rmail-show-message-1): Set rmail-mime-decoded when appropriate. * mail/rmailedit.el (rmail-cease-edit): Respect rmail-mbox-format and rmail-mime-decoded. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-12-07 04:37:14 +0000 +++ lisp/ChangeLog 2012-12-07 08:59:14 +0000 @@ -1,5 +1,10 @@ 2012-12-07 Glenn Morris + * mail/rmail.el (rmail-mime-decoded): New permanent local. + (rmail-show-message-1): Set rmail-mime-decoded when appropriate. + * mail/rmailedit.el (rmail-cease-edit): Respect rmail-mbox-format + and rmail-mime-decoded. (Bug#9841) + * mail/unrmail.el (unrmail-mbox-format): New option. (Bug#6574) (batch-unrmail, unrmail): Doc fixes. (unrmail): Respect unrmail-mbox-format. === modified file 'lisp/mail/rmail.el' --- lisp/mail/rmail.el 2012-12-07 04:57:43 +0000 +++ lisp/mail/rmail.el 2012-12-07 08:59:14 +0000 @@ -100,6 +100,10 @@ "The current header display style choice, one of 'normal (selected headers) or 'full (all headers).") +(defvar rmail-mime-decoded nil + "Non-nil if message has been processed by `rmail-show-mime-function'.") +(put 'rmail-mime-decoded 'permanent-local t) ; for rmail-edit + (defgroup rmail nil "Mail reader for Emacs." :group 'mail) @@ -2768,6 +2772,7 @@ (re-search-forward "mime-version: 1.0" nil t)) (let ((rmail-buffer mbox-buf) (rmail-view-buffer view-buf)) + (set (make-local-variable 'rmail-mime-decoded) t) (funcall rmail-show-mime-function)) (setq body-start (search-forward "\n\n" nil t)) (narrow-to-region beg (point)) === modified file 'lisp/mail/rmailedit.el' --- lisp/mail/rmailedit.el 2012-09-18 07:19:25 +0000 +++ lisp/mail/rmailedit.el 2012-12-07 08:59:14 +0000 @@ -167,10 +167,25 @@ (if (or rmail-old-mime-state (not rmail-old-pruned)) (forward-line 1)) - (while (re-search-forward "^>*From " nil t) - (beginning-of-line) - (insert ">") - (forward-line)) + ;; When editing a non-MIME message, rmail-show-message-1 has unescaped + ;; ^>*From lines according to rmail-mbox-format. We are editing + ;; the message as it was displayed, and need to put the escapes when done. + ;; When editing a MIME message, we are editing the "raw" message. + ;; ^>*From lines have not been escaped, but we still need to ensure + ;; a "^From " line is escaped so as not to break later parsing (?). + ;; With ^>+From lines, we have no way of knowing whether the person + ;; doing the editing escaped them or not, so it seems best to leave + ;; them alone. (This all assumes you are using rmailmm rather than + ;; something else that behaves differently.) + (let ((fromline (if (or (eq 'mboxo rmail-mbox-format) + rmail-mime-decoded) + "^From " + "^>*From ")) + case-fold-search) + (while (re-search-forward fromline nil t) + (beginning-of-line) + (insert ">") + (forward-line))) ;; Make sure buffer ends with a blank line so as not to run this ;; message together with the following one. (goto-char (point-max)) @@ -201,6 +216,7 @@ (setq buffer-undo-list t) (rmail-variables)) ;; If text has really changed, mark message as edited. + ;; FIXME we should do the comparison before escaping From lines. (unless (and (= (length old) (- (point-max) (point-min))) (string= old (buffer-substring (point-min) (point-max)))) (setq old nil) ------------------------------------------------------------ revno: 111143 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2012-12-07 12:13:49 +0400 message: * frame.c (make_frame): Do not set window's buffer to t. * window.c (Fsplit_window_internal): Likewise. Previously it was used to indicate that the window is being set up. Now we use set_window_buffer for all new windows, so the condition in ... (Fset_window_buffer): ... is always true and can be removed. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-12-07 07:16:32 +0000 +++ src/ChangeLog 2012-12-07 08:13:49 +0000 @@ -1,5 +1,13 @@ 2012-12-07 Dmitry Antipov + * frame.c (make_frame): Do not set window's buffer to t. + * window.c (Fsplit_window_internal): Likewise. Previously it was + used to indicate that the window is being set up. Now we use + set_window_buffer for all new windows, so the condition in ... + (Fset_window_buffer): ... is always true and can be removed. + +2012-12-07 Dmitry Antipov + Convenient macro to check whether the buffer is hidden. * buffer.h (BUFFER_HIDDEN_P): New macro. * frame.c (make_frame): Use it. Adjust comment. === modified file 'src/frame.c' --- src/frame.c 2012-12-07 07:16:32 +0000 +++ src/frame.c 2012-12-07 08:13:49 +0000 @@ -348,7 +348,6 @@ { Lisp_Object buf = Fcurrent_buffer (); - wset_buffer (XWINDOW (root_window), Qt); /* If current buffer is hidden, try to find another one. */ if (BUFFER_HIDDEN_P (XBUFFER (buf))) buf = other_buffer_safely (buf); @@ -364,14 +363,11 @@ } if (mini_p) - { - wset_buffer (XWINDOW (mini_window), Qt); - set_window_buffer (mini_window, - (NILP (Vminibuffer_list) - ? get_minibuffer (0) - : Fcar (Vminibuffer_list)), - 0, 0); - } + set_window_buffer (mini_window, + (NILP (Vminibuffer_list) + ? get_minibuffer (0) + : Fcar (Vminibuffer_list)), + 0, 0); fset_root_window (f, root_window); fset_selected_window (f, root_window); === modified file 'src/window.c' --- src/window.c 2012-11-12 04:00:55 +0000 +++ src/window.c 2012-12-07 08:13:49 +0000 @@ -3250,8 +3250,7 @@ tem = w->buffer; if (NILP (tem)) error ("Window is deleted"); - else if (!EQ (tem, Qt)) - /* w->buffer is t when the window is first being set up. */ + else { if (!EQ (tem, buffer)) { @@ -3914,7 +3913,6 @@ wset_next (o, new); } - wset_buffer (n, Qt); wset_window_end_valid (n, Qnil); memset (&n->last_cursor, 0, sizeof n->last_cursor); ------------------------------------------------------------ revno: 111142 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2012-12-07 11:16:32 +0400 message: Convenient macro to check whether the buffer is hidden. * buffer.h (BUFFER_HIDDEN_P): New macro. * frame.c (make_frame): Use it. Adjust comment. * buffer.c (candidate_buffer): New function. (Fother_buffer, other_buffer_safely): Use it. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-12-06 18:36:22 +0000 +++ src/ChangeLog 2012-12-07 07:16:32 +0000 @@ -1,3 +1,11 @@ +2012-12-07 Dmitry Antipov + + Convenient macro to check whether the buffer is hidden. + * buffer.h (BUFFER_HIDDEN_P): New macro. + * frame.c (make_frame): Use it. Adjust comment. + * buffer.c (candidate_buffer): New function. + (Fother_buffer, other_buffer_safely): Use it. + 2012-12-06 Eli Zaretskii * w32proc.c (waitpid): Avoid busy-waiting when called with WNOHANG === modified file 'src/buffer.c' --- src/buffer.c 2012-11-08 21:58:55 +0000 +++ src/buffer.c 2012-12-07 07:16:32 +0000 @@ -1529,6 +1529,16 @@ return BVAR (current_buffer, name); } +/* True if B can be used as 'other-than-BUFFER' buffer. */ + +static bool +candidate_buffer (Lisp_Object b, Lisp_Object buffer) +{ + return (BUFFERP (b) && !EQ (b, buffer) + && BUFFER_LIVE_P (XBUFFER (b)) + && !BUFFER_HIDDEN_P (XBUFFER (b))); +} + DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, doc: /* Return most recently selected buffer other than BUFFER. Buffers not visible in windows are preferred to visible buffers, unless @@ -1550,9 +1560,7 @@ for (; CONSP (tail); tail = XCDR (tail)) { buf = XCAR (tail); - if (BUFFERP (buf) && !EQ (buf, buffer) - && BUFFER_LIVE_P (XBUFFER (buf)) - && (SREF (BVAR (XBUFFER (buf), name), 0) != ' ') + if (candidate_buffer (buf, buffer) /* If the frame has a buffer_predicate, disregard buffers that don't fit the predicate. */ && (NILP (pred) || !NILP (call1 (pred, buf)))) @@ -1570,9 +1578,7 @@ for (; CONSP (tail); tail = XCDR (tail)) { buf = Fcdr (XCAR (tail)); - if (BUFFERP (buf) && !EQ (buf, buffer) - && BUFFER_LIVE_P (XBUFFER (buf)) - && (SREF (BVAR (XBUFFER (buf), name), 0) != ' ') + if (candidate_buffer (buf, buffer) /* If the frame has a buffer_predicate, disregard buffers that don't fit the predicate. */ && (NILP (pred) || !NILP (call1 (pred, buf)))) @@ -1608,13 +1614,10 @@ { Lisp_Object tail, buf; - tail = Vbuffer_alist; - for (; CONSP (tail); tail = XCDR (tail)) + for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) { buf = Fcdr (XCAR (tail)); - if (BUFFERP (buf) && !EQ (buf, buffer) - && BUFFER_LIVE_P (XBUFFER (buf)) - && (SREF (BVAR (XBUFFER (buf), name), 0) != ' ')) + if (candidate_buffer (buf, buffer)) return buf; } === modified file 'src/buffer.h' --- src/buffer.h 2012-11-08 14:10:28 +0000 +++ src/buffer.h 2012-12-07 07:16:32 +0000 @@ -982,6 +982,11 @@ #define BUFFER_LIVE_P(b) (!NILP (BVAR (b, name))) +/* Convenient check whether buffer B is hidden (i.e. its name + starts with a space). Caller must ensure that B is live. */ + +#define BUFFER_HIDDEN_P(b) (SREF (BVAR (b, name), 0) == ' ') + /* Verify indirection counters. */ #define BUFFER_CHECK_INDIRECTION(b) \ === modified file 'src/frame.c' --- src/frame.c 2012-12-06 13:48:11 +0000 +++ src/frame.c 2012-12-07 07:16:32 +0000 @@ -346,13 +346,11 @@ /* Choose a buffer for the frame's root window. */ { - Lisp_Object buf; + Lisp_Object buf = Fcurrent_buffer (); wset_buffer (XWINDOW (root_window), Qt); - buf = Fcurrent_buffer (); - /* If buf is a 'hidden' buffer (i.e. one whose name starts with - a space), try to find another one. */ - if (SREF (Fbuffer_name (buf), 0) == ' ') + /* If current buffer is hidden, try to find another one. */ + if (BUFFER_HIDDEN_P (XBUFFER (buf))) buf = other_buffer_safely (buf); /* Use set_window_buffer, not Fset_window_buffer, and don't let