aboutsummaryrefslogtreecommitdiffstats
path: root/src/sysdep.c
diff options
context:
space:
mode:
authorPaul Eggert2012-12-07 18:30:51 -0800
committerPaul Eggert2012-12-07 18:30:51 -0800
commitd983a10b9a070fd8f6d4f48ec44e5514b62feaa6 (patch)
tree1b7353b39c508615eb0d2cf4475fdfabf8ef6ce0 /src/sysdep.c
parent9cdde1e2dfdd7b1a4e52294bca1467dc7a48c77a (diff)
downloademacs-d983a10b9a070fd8f6d4f48ec44e5514b62feaa6.tar.gz
emacs-d983a10b9a070fd8f6d4f48ec44e5514b62feaa6.zip
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 <c-ctype.h>, <sig2str.h>. (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. Fixes: debbugs:13026
Diffstat (limited to 'src/sysdep.c')
-rw-r--r--src/sysdep.c30
1 files changed, 4 insertions, 26 deletions
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 *);
457void 457void
458sys_suspend (void) 458sys_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