aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDan Nicolaescu2010-05-04 00:40:53 -0700
committerDan Nicolaescu2010-05-04 00:40:53 -0700
commit58eb6cf0f77547d29f4fddca922eb6f98c0ffb28 (patch)
treedc7bd97ce77e679cfb648145413039dff6ff4c92 /src
parentef03a4e61efa0003b1b6be961b58297ccfddc664 (diff)
downloademacs-58eb6cf0f77547d29f4fddca922eb6f98c0ffb28.tar.gz
emacs-58eb6cf0f77547d29f4fddca922eb6f98c0ffb28.zip
Remove BSD_PGRPS.
* s/bsd-common.h (BSD_PGRPS): Remove undef. * s/gnu-linux.h (BSD_PGRPS): Remove. * term.c (dissociate_if_controlling_tty): * sysdep.c (narrow_foreground_group, widen_foreground_group) (init_sys_modes, reset_sys_modes): * emacs.c (main): * callproc.c (Fcall_process, child_setup): Remove code depending on BSD_PGRPS.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/callproc.c6
-rw-r--r--src/emacs.c15
-rw-r--r--src/s/bsd-common.h3
-rw-r--r--src/s/gnu-linux.h5
-rw-r--r--src/sysdep.c72
-rw-r--r--src/term.c2
7 files changed, 16 insertions, 97 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 797ab693639..91da5440dd4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,15 @@
12010-05-04 Dan Nicolaescu <dann@ics.uci.edu> 12010-05-04 Dan Nicolaescu <dann@ics.uci.edu>
2 2
3 Remove BSD_PGRPS.
4 * s/bsd-common.h (BSD_PGRPS): Remove undef.
5 * s/gnu-linux.h (BSD_PGRPS): Remove.
6 * term.c (dissociate_if_controlling_tty):
7 * sysdep.c (narrow_foreground_group, widen_foreground_group)
8 (init_sys_modes, reset_sys_modes):
9 * emacs.c (main):
10 * callproc.c (Fcall_process, child_setup): Remove code depending
11 on BSD_PGRPS.
12
3 Remove POSIX_SIGNALS. 13 Remove POSIX_SIGNALS.
4 * s/usg5-4.h (POSIX_SIGNALS): 14 * s/usg5-4.h (POSIX_SIGNALS):
5 * s/netbsd.h (POSIX_SIGNALS): 15 * s/netbsd.h (POSIX_SIGNALS):
diff --git a/src/callproc.c b/src/callproc.c
index 317636d9cc8..44dd6ed7764 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -91,7 +91,7 @@ extern char **environ;
91#endif 91#endif
92 92
93#ifdef HAVE_SETPGID 93#ifdef HAVE_SETPGID
94#if !defined (USG) || defined (BSD_PGRPS) 94#if !defined (USG)
95#undef setpgrp 95#undef setpgrp
96#define setpgrp setpgid 96#define setpgrp setpgid
97#endif 97#endif
@@ -581,7 +581,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
581#ifdef HAVE_SETSID 581#ifdef HAVE_SETSID
582 setsid (); 582 setsid ();
583#endif 583#endif
584#if defined (USG) && !defined (BSD_PGRPS) 584#if defined (USG)
585 setpgrp (); 585 setpgrp ();
586#else 586#else
587 setpgrp (pid, pid); 587 setpgrp (pid, pid);
@@ -1251,7 +1251,7 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir)
1251#endif /* not MSDOS */ 1251#endif /* not MSDOS */
1252#endif /* not WINDOWSNT */ 1252#endif /* not WINDOWSNT */
1253 1253
1254#if defined(USG) && !defined(BSD_PGRPS) 1254#if defined(USG)
1255#ifndef SETPGRP_RELEASES_CTTY 1255#ifndef SETPGRP_RELEASES_CTTY
1256 setpgrp (); /* No arguments but equivalent in this case */ 1256 setpgrp (); /* No arguments but equivalent in this case */
1257#endif 1257#endif
diff --git a/src/emacs.c b/src/emacs.c
index d40ff3662f0..06c686d9950 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -81,7 +81,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
81#endif 81#endif
82 82
83#ifdef HAVE_SETPGID 83#ifdef HAVE_SETPGID
84#if !defined (USG) || defined (BSD_PGRPS) 84#if !defined (USG)
85#undef setpgrp 85#undef setpgrp
86#define setpgrp setpgid 86#define setpgrp setpgid
87#endif 87#endif
@@ -193,11 +193,6 @@ EMACS_INT emacs_priority;
193 data on the first attempt to change it inside asynchronous code. */ 193 data on the first attempt to change it inside asynchronous code. */
194int running_asynch_code; 194int running_asynch_code;
195 195
196#ifdef BSD_PGRPS
197/* See sysdep.c. */
198extern int inherited_pgroup;
199#endif
200
201#if defined(HAVE_X_WINDOWS) || defined(HAVE_NS) 196#if defined(HAVE_X_WINDOWS) || defined(HAVE_NS)
202/* If non-zero, -d was specified, meaning we're using some window system. */ 197/* If non-zero, -d was specified, meaning we're using some window system. */
203int display_arg; 198int display_arg;
@@ -1187,17 +1182,9 @@ main (int argc, char **argv)
1187 1182
1188 if (! noninteractive) 1183 if (! noninteractive)
1189 { 1184 {
1190#ifdef BSD_PGRPS
1191 if (initialized)
1192 {
1193 inherited_pgroup = EMACS_GETPGRP (0);
1194 setpgrp (0, getpid ());
1195 }
1196#else
1197#if defined (USG5) && defined (INTERRUPT_INPUT) 1185#if defined (USG5) && defined (INTERRUPT_INPUT)
1198 setpgrp (); 1186 setpgrp ();
1199#endif 1187#endif
1200#endif
1201#if defined (HAVE_GTK_AND_PTHREAD) && !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC) 1188#if defined (HAVE_GTK_AND_PTHREAD) && !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC)
1202 { 1189 {
1203 extern void malloc_enable_thread P_ ((void)); 1190 extern void malloc_enable_thread P_ ((void));
diff --git a/src/s/bsd-common.h b/src/s/bsd-common.h
index 9dad7a9b1d9..e44757f19a4 100644
--- a/src/s/bsd-common.h
+++ b/src/s/bsd-common.h
@@ -48,9 +48,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
48 48
49#define SYSV_SYSTEM_DIR 49#define SYSV_SYSTEM_DIR
50 50
51/* POSIX-style pgrp behavior. */
52#undef BSD_PGRPS
53
54#define UNEXEC unexelf.o 51#define UNEXEC unexelf.o
55 52
56/* If the system's imake configuration file defines `NeedWidePrototypes' 53/* If the system's imake configuration file defines `NeedWidePrototypes'
diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h
index 218af42bac4..b9cab20b273 100644
--- a/src/s/gnu-linux.h
+++ b/src/s/gnu-linux.h
@@ -206,11 +206,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
206#define HAVE_XRMSETDATABASE 206#define HAVE_XRMSETDATABASE
207#endif 207#endif
208 208
209/* Use BSD process groups, but use setpgid() instead of setpgrp() to
210 actually set a process group. */
211/* Interesting: only GNU/Linux defines this, but the BSDs do not... */
212/* #define BSD_PGRPS */
213
214#define NARROWPROTO 1 209#define NARROWPROTO 1
215 210
216/* Use mmap directly for allocating larger buffers. */ 211/* Use mmap directly for allocating larger buffers. */
diff --git a/src/sysdep.c b/src/sysdep.c
index 38492c1bb00..1e114655b4e 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -73,7 +73,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
73#include <errno.h> 73#include <errno.h>
74 74
75#ifdef HAVE_SETPGID 75#ifdef HAVE_SETPGID
76#if !defined (USG) || defined (BSD_PGRPS) 76#if !defined (USG)
77#undef setpgrp 77#undef setpgrp
78#define setpgrp setpgid 78#define setpgrp setpgid
79#endif 79#endif
@@ -859,65 +859,7 @@ unrequest_sigio ()
859#endif /* FASYNC */ 859#endif /* FASYNC */
860#endif /* F_SETFL */ 860#endif /* F_SETFL */
861#endif /* SIGIO */ 861#endif /* SIGIO */
862
863/* Saving and restoring the process group of Emacs's terminal. */
864
865#ifdef BSD_PGRPS
866
867/* The process group of which Emacs was a member when it initially
868 started.
869
870 If Emacs was in its own process group (i.e. inherited_pgroup ==
871 getpid ()), then we know we're running under a shell with job
872 control (Emacs would never be run as part of a pipeline).
873 Everything is fine.
874
875 If Emacs was not in its own process group, then we know we're
876 running under a shell (or a caller) that doesn't know how to
877 separate itself from Emacs (like sh). Emacs must be in its own
878 process group in order to receive SIGIO correctly. In this
879 situation, we put ourselves in our own pgroup, forcibly set the
880 tty's pgroup to our pgroup, and make sure to restore and reinstate
881 the tty's pgroup just like any other terminal setting. If
882 inherited_group was not the tty's pgroup, then we'll get a
883 SIGTTmumble when we try to change the tty's pgroup, and a CONT if
884 it goes foreground in the future, which is what should happen.
885
886 This variable is initialized in emacs.c. */
887int inherited_pgroup;
888
889/* Split off the foreground process group to Emacs alone. When we are
890 in the foreground, but not started in our own process group,
891 redirect the tty device handle FD to point to our own process
892 group. We need to be in our own process group to receive SIGIO
893 properly. */
894static void
895narrow_foreground_group (int fd)
896{
897 int me = getpid ();
898
899 setpgrp (0, inherited_pgroup);
900#if 0
901 /* XXX inherited_pgroup should not be zero here, but GTK seems to
902 mess this up. */
903 if (! inherited_pgroup)
904 abort (); /* Should not happen. */
905#endif
906 if (inherited_pgroup != me)
907 EMACS_SET_TTY_PGRP (fd, &me); /* XXX This only works on the controlling tty. */
908 setpgrp (0, me);
909}
910
911/* Set the tty to our original foreground group. */
912static void
913widen_foreground_group (int fd)
914{
915 if (inherited_pgroup != getpid ())
916 EMACS_SET_TTY_PGRP (fd, &inherited_pgroup);
917 setpgrp (0, inherited_pgroup);
918}
919 862
920#endif /* BSD_PGRPS */
921 863
922/* Getting and setting emacs_tty structures. */ 864/* Getting and setting emacs_tty structures. */
923 865
@@ -1102,15 +1044,6 @@ init_sys_modes (tty_out)
1102 if (!tty_out->output) 1044 if (!tty_out->output)
1103 return; /* The tty is suspended. */ 1045 return; /* The tty is suspended. */
1104 1046
1105#ifdef BSD_PGRPS
1106#if 0
1107 /* read_socket_hook is not global anymore. I think doing this
1108 unconditionally will not cause any problems. */
1109 if (! read_socket_hook && EQ (Vinitial_window_system, Qnil))
1110#endif
1111 narrow_foreground_group (fileno (tty_out->input));
1112#endif
1113
1114 if (! tty_out->old_tty) 1047 if (! tty_out->old_tty)
1115 tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); 1048 tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty));
1116 1049
@@ -1560,9 +1493,6 @@ reset_sys_modes (tty_out)
1560 dos_ttcooked (); 1493 dos_ttcooked ();
1561#endif 1494#endif
1562 1495
1563#ifdef BSD_PGRPS
1564 widen_foreground_group (fileno (tty_out->input));
1565#endif
1566} 1496}
1567 1497
1568#ifdef HAVE_PTYS 1498#ifdef HAVE_PTYS
diff --git a/src/term.c b/src/term.c
index bb143207758..fad6e3c80d7 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3379,7 +3379,7 @@ dissociate_if_controlling_tty (int fd)
3379 EMACS_GET_TTY_PGRP (fd, &pgid); /* If tcgetpgrp succeeds, fd is the ctty. */ 3379 EMACS_GET_TTY_PGRP (fd, &pgid); /* If tcgetpgrp succeeds, fd is the ctty. */
3380 if (pgid != -1) 3380 if (pgid != -1)
3381 { 3381 {
3382#if defined (USG) && !defined (BSD_PGRPS) 3382#if defined (USG)
3383 setpgrp (); 3383 setpgrp ();
3384 no_controlling_tty = 1; 3384 no_controlling_tty = 1;
3385#elif defined (CYGWIN) 3385#elif defined (CYGWIN)