aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorPaul Eggert2012-11-04 19:18:32 -0800
committerPaul Eggert2012-11-04 19:18:32 -0800
commitdd0333b6155c9c3aabdac9418c005e2e5b4796e7 (patch)
tree6239cffc67b6a7b0e8eb594c22ed92a4cd28b2fc /src/term.c
parent8148369cfba2c982a87fb4eb72d024e26e193a03 (diff)
downloademacs-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/term.c')
-rw-r--r--src/term.c35
1 files changed, 2 insertions, 33 deletions
diff --git a/src/term.c b/src/term.c
index ffc559469e6..578c701858f 100644
--- a/src/term.c
+++ b/src/term.c
@@ -133,10 +133,6 @@ enum no_color_bit
133 133
134static int max_frame_cols; 134static int max_frame_cols;
135 135
136/* Non-zero if we have dropped our controlling tty and therefore
137 should not open a frame on stdout. */
138static int no_controlling_tty;
139
140 136
141 137
142#ifdef HAVE_GPM 138#ifdef HAVE_GPM
@@ -2918,36 +2914,9 @@ set_tty_hooks (struct terminal *terminal)
2918static void 2914static void
2919dissociate_if_controlling_tty (int fd) 2915dissociate_if_controlling_tty (int fd)
2920{ 2916{
2921#ifndef DOS_NT
2922 pid_t pgid = tcgetpgrp (fd); /* If tcgetpgrp succeeds, fd is the ctty. */ 2917 pid_t pgid = tcgetpgrp (fd); /* If tcgetpgrp succeeds, fd is the ctty. */
2923 if (pgid != -1) 2918 if (0 <= pgid)
2924 { 2919 setsid ();
2925#if defined (USG5)
2926 setpgrp ();
2927 no_controlling_tty = 1;
2928#elif defined (CYGWIN)
2929 setsid ();
2930 no_controlling_tty = 1;
2931#else
2932#ifdef TIOCNOTTY /* Try BSD ioctls. */
2933 sigset_t blocked;
2934 sigemptyset (&blocked);
2935 sigaddset (&blocked, SIGTTOU);
2936 pthread_sigmask (SIG_BLOCK, &blocked, 0);
2937 fd = emacs_open (DEV_TTY, O_RDWR, 0);
2938 if (fd != -1 && ioctl (fd, TIOCNOTTY, 0) != -1)
2939 {
2940 no_controlling_tty = 1;
2941 }
2942 if (fd != -1)
2943 emacs_close (fd);
2944 pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
2945#else
2946# error "Unknown system."
2947#endif /* ! TIOCNOTTY */
2948#endif /* ! USG */
2949 }
2950#endif /* !DOS_NT */
2951} 2920}
2952 2921
2953/* Create a termcap display on the tty device with the given name and 2922/* Create a termcap display on the tty device with the given name and