aboutsummaryrefslogtreecommitdiffstats
path: root/src/sysdep.c
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/sysdep.c
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/sysdep.c')
-rw-r--r--src/sysdep.c72
1 files changed, 1 insertions, 71 deletions
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