diff options
| author | Paul Eggert | 2012-11-04 19:18:32 -0800 |
|---|---|---|
| committer | Paul Eggert | 2012-11-04 19:18:32 -0800 |
| commit | dd0333b6155c9c3aabdac9418c005e2e5b4796e7 (patch) | |
| tree | 6239cffc67b6a7b0e8eb594c22ed92a4cd28b2fc /src/process.c | |
| parent | 8148369cfba2c982a87fb4eb72d024e26e193a03 (diff) | |
| download | emacs-dd0333b6155c9c3aabdac9418c005e2e5b4796e7.tar.gz emacs-dd0333b6155c9c3aabdac9418c005e2e5b4796e7.zip | |
Assume at least POSIX.1-1988 for getpgrp, setpgid, setsid.
This removes code that has been obsolete since around 1990.
* admin/CPP-DEFINES (HAVE_SETPGID, HAVE_SETSID, SETPGRP_RELEASES_CTTY):
Remove; obsolete.
* configure.ac (setpgid, setsid): Assume their existence.
(AC_FUNC_GETPGRP, SETPGRP_RELEASES_CTTY): Remove; obsolete.
* src/callproc.c (Fcall_process):
* src/emacs.c (main):
* src/process.c (create_process):
* src/term.c (dissociate_if_controlling_tty):
Assume setsid exists.
* src/callproc.c (child_setup): Assume setpgid exists and behaves as
per POSIX.1-1988 or later.
* src/conf_post.h (setpgid) [!HAVE_SETPGID]: Remove.
* src/emacs.c (shut_down_emacs):
* src/sysdep.c (sys_suspend, init_foreground_group):
Assume getpgrp behaves as per POSIX.1-1998 or later.
* src/msdos.c (setpgrp): Remove.
(tcgetpgrp, setpgid, setsid): New functions.
* src/systty.h (EMACS_GETPGRP): Remove. All callers now use getpgrp.
* src/term.c (no_controlling_tty): Remove; unused.
* src/w32proc.c (setpgrp): Remove.
(setsid, tcgetpgrp): New functions.
Fixes: debbugs:12800
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/process.c b/src/process.c index 3c0e53f7784..16600f94ce4 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -1739,7 +1739,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1739 | /* Make the pty be the controlling terminal of the process. */ | 1739 | /* Make the pty be the controlling terminal of the process. */ |
| 1740 | #ifdef HAVE_PTYS | 1740 | #ifdef HAVE_PTYS |
| 1741 | /* First, disconnect its current controlling terminal. */ | 1741 | /* First, disconnect its current controlling terminal. */ |
| 1742 | #ifdef HAVE_SETSID | ||
| 1743 | /* We tried doing setsid only if pty_flag, but it caused | 1742 | /* We tried doing setsid only if pty_flag, but it caused |
| 1744 | process_set_signal to fail on SGI when using a pipe. */ | 1743 | process_set_signal to fail on SGI when using a pipe. */ |
| 1745 | setsid (); | 1744 | setsid (); |
| @@ -1752,12 +1751,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1752 | ioctl (xforkin, TIOCSCTTY, 0); | 1751 | ioctl (xforkin, TIOCSCTTY, 0); |
| 1753 | #endif | 1752 | #endif |
| 1754 | } | 1753 | } |
| 1755 | #else /* not HAVE_SETSID */ | ||
| 1756 | /* It's very important to call setpgid here and no time | ||
| 1757 | afterwards. Otherwise, we lose our controlling tty which | ||
| 1758 | is set when we open the pty. */ | ||
| 1759 | setpgid (0, 0); | ||
| 1760 | #endif /* not HAVE_SETSID */ | ||
| 1761 | #if defined (LDISC1) | 1754 | #if defined (LDISC1) |
| 1762 | if (pty_flag && xforkin >= 0) | 1755 | if (pty_flag && xforkin >= 0) |
| 1763 | { | 1756 | { |
| @@ -1790,22 +1783,15 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1790 | ioctl (j, TIOCNOTTY, 0); | 1783 | ioctl (j, TIOCNOTTY, 0); |
| 1791 | emacs_close (j); | 1784 | emacs_close (j); |
| 1792 | } | 1785 | } |
| 1793 | #ifndef USG | ||
| 1794 | /* In order to get a controlling terminal on some versions | ||
| 1795 | of BSD, it is necessary to put the process in pgrp 0 | ||
| 1796 | before it opens the terminal. */ | ||
| 1797 | setpgid (0, 0); | ||
| 1798 | #endif | ||
| 1799 | } | 1786 | } |
| 1800 | #endif /* TIOCNOTTY */ | 1787 | #endif /* TIOCNOTTY */ |
| 1801 | 1788 | ||
| 1802 | #if !defined (DONT_REOPEN_PTY) | 1789 | #if !defined (DONT_REOPEN_PTY) |
| 1803 | /*** There is a suggestion that this ought to be a | 1790 | /*** There is a suggestion that this ought to be a |
| 1804 | conditional on TIOCSPGRP, | 1791 | conditional on TIOCSPGRP, or !defined TIOCSCTTY. |
| 1805 | or !(defined (HAVE_SETSID) && defined (TIOCSCTTY)). | ||
| 1806 | Trying the latter gave the wrong results on Debian GNU/Linux 1.1; | 1792 | Trying the latter gave the wrong results on Debian GNU/Linux 1.1; |
| 1807 | that system does seem to need this code, even though | 1793 | that system does seem to need this code, even though |
| 1808 | both HAVE_SETSID and TIOCSCTTY are defined. */ | 1794 | both TIOCSCTTY is defined. */ |
| 1809 | /* Now close the pty (if we had it open) and reopen it. | 1795 | /* Now close the pty (if we had it open) and reopen it. |
| 1810 | This makes the pty the controlling terminal of the subprocess. */ | 1796 | This makes the pty the controlling terminal of the subprocess. */ |
| 1811 | if (pty_flag) | 1797 | if (pty_flag) |