[PATCH 6/6] xfree86: Remove -keeptty

Adam Jackson ajax at redhat.com
Tue Aug 24 14:05:25 PDT 2010


This debugging option has outlived its usefulness.  If you need to send
signals to the server, use two machines and ssh.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 hw/xfree86/doc/man/Xorg.man.pre          |    5 ----
 hw/xfree86/os-support/bsd/bsd_init.c     |   37 +++++++++---------------------
 hw/xfree86/os-support/linux/lnx_init.c   |   32 +-------------------------
 hw/xfree86/os-support/sco/sco_init.c     |   16 +------------
 hw/xfree86/os-support/solaris/sun_init.c |   17 +-------------
 5 files changed, 14 insertions(+), 93 deletions(-)

diff --git a/hw/xfree86/doc/man/Xorg.man.pre b/hw/xfree86/doc/man/Xorg.man.pre
index 46d0e44..278cc48 100644
--- a/hw/xfree86/doc/man/Xorg.man.pre
+++ b/hw/xfree86/doc/man/Xorg.man.pre
@@ -268,11 +268,6 @@ is ignored if
 .I bustype
 is anything other than \(oqPCI\(cq.
 .TP 8
-.B \-keeptty
-Prevent the server from detaching its initial controlling terminal.
-This option is only useful when debugging the server.  Not all platforms
-support (or can use) this option.
-.TP 8
 .BI \-keyboard " keyboard-name"
 Use the __xconfigfile__(__filemansuffix__) file
 .B InputDevice
diff --git a/hw/xfree86/os-support/bsd/bsd_init.c b/hw/xfree86/os-support/bsd/bsd_init.c
index 13c6ec3..c8fc23e 100644
--- a/hw/xfree86/os-support/bsd/bsd_init.c
+++ b/hw/xfree86/os-support/bsd/bsd_init.c
@@ -40,7 +40,6 @@
 #include <stdlib.h>
 #include <errno.h>
 
-static Bool KeepTty = FALSE;
 static int devConsoleFd = -1;
 #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
 static int VTnum = -1;
@@ -174,20 +173,17 @@ xf86OpenConsole()
 	    FatalError("xf86OpenConsole: Server must be suid root");
 	}
 
-	if (!KeepTty)
-	{
-	    /*
-	     * detaching the controlling tty solves problems of kbd character
-	     * loss.  This is not interesting for CO driver, because it is 
-	     * exclusive.
-	     */
-	    setpgrp(0, getpid());
-	    if ((i = open("/dev/tty",O_RDWR)) >= 0)
-	    {
-		ioctl(i,TIOCNOTTY,(char *)0);
-		close(i);
-	    }
-	}
+        /*
+         * detaching the controlling tty solves problems of kbd character
+         * loss.  This is not interesting for CO driver, because it is
+         * exclusive.
+         */
+        setpgrp(0, getpid());
+        if ((i = open("/dev/tty",O_RDWR)) >= 0)
+        {
+            ioctl(i,TIOCNOTTY,(char *)0);
+            close(i);
+        }
 
 	/* detect which driver we are running on */
 	for (driver = xf86ConsTab; *driver; driver++)
@@ -717,15 +713,6 @@ xf86CloseConsole()
 int
 xf86ProcessArgument(int argc, char *argv[], int i)
 {
-	/*
-	 * Keep server from detaching from controlling tty.  This is useful 
-	 * when debugging (so the server can receive keyboard signals.
-	 */
-	if (!strcmp(argv[i], "-keeptty"))
-	{
-		KeepTty = TRUE;
-		return 1;
-	}
 #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
 	if (!strcmp(argv[i], "-sharevts"))
 	{	
@@ -754,7 +741,5 @@ xf86UseMsg()
 	ErrorF("vtXX                   use the specified VT number (1-12)\n");
 	ErrorF("-sharevts              share VTs with another X server\n");
 #endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
-	ErrorF("-keeptty               ");
-	ErrorF("don't detach controlling tty (for debugging only)\n");
 	return;
 }
diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index d2759d5..bd1922f 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -38,7 +38,6 @@
 
 #include <sys/stat.h>
 
-static Bool KeepTty = FALSE;
 static Bool VTSwitch = TRUE;
 static Bool ShareVTs = FALSE;
 static int activeVT = -1;
@@ -76,12 +75,6 @@ xf86OpenConsole(void)
     char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL };
 
     if (serverGeneration == 1) {
-
-	/* when KeepTty check if we're run with euid==0 */
-	if (KeepTty && geteuid() != 0) 
-	    FatalError("xf86OpenConsole:"
-		       " Server must be suid root for option \"KeepTTY\"\n");
-
 	/*
 	 * setup the virtual terminal manager
 	 */
@@ -119,7 +112,7 @@ xf86OpenConsole(void)
 
 	xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
 
-	if (!KeepTty) {
+        {
 	    pid_t ppid = getppid();
 	    pid_t ppgid;
 	    ppgid = getpgid(ppid);
@@ -161,18 +154,6 @@ xf86OpenConsole(void)
 	else
 	    activeVT = vts.v_active;
 
-#if 0
-	if (!KeepTty) {
-	    /*
-	     * Detach from the controlling tty to avoid char loss
-	     */
-	    if ((i = open("/dev/tty",O_RDWR)) >= 0) {
-		ioctl(i, TIOCNOTTY, 0);
-		close(i);
-	    }
-	}
-#endif
-
         if (!ShareVTs)
         {
             struct termios nTty;
@@ -284,15 +265,6 @@ xf86CloseConsole(void)
 int
 xf86ProcessArgument(int argc, char *argv[], int i)
 {
-	/*
-	 * Keep server from detaching from controlling tty.  This is useful
-	 * when debugging (so the server can receive keyboard signals.
-	 */
-	if (!strcmp(argv[i], "-keeptty"))
-	{
-		KeepTty = TRUE;
-		return 1;
-	}
         if (!strcmp(argv[i], "-novtswitch"))
         {
                 VTSwitch = FALSE;
@@ -320,8 +292,6 @@ void
 xf86UseMsg(void)
 {
 	ErrorF("vtXX                   use the specified VT number\n");
-	ErrorF("-keeptty               ");
-	ErrorF("don't detach controlling tty (for debugging only)\n");
 	ErrorF("-novtswitch            don't immediately switch to new VT\n");
 	ErrorF("-sharevts              share VTs with another X server\n");
 }
diff --git a/hw/xfree86/os-support/sco/sco_init.c b/hw/xfree86/os-support/sco/sco_init.c
index 3322ed5..87bbbda 100644
--- a/hw/xfree86/os-support/sco/sco_init.c
+++ b/hw/xfree86/os-support/sco/sco_init.c
@@ -35,7 +35,6 @@
 #include "xf86Priv.h"
 #include "xf86_OSlib.h"
 
-static Bool KeepTty = FALSE;
 static int VTnum = -1;
 static char vtdevice[48];
 static int sco_console_mode = -1;
@@ -122,9 +121,7 @@ xf86OpenConsole(void)
     }
 
     /* Disassociate from controling TTY */
-    if (!KeepTty) {
-      setpgrp();
-    }
+    setpgrp();
 
     /*
      * Now we get the current mode that the console device is in. We will
@@ -228,15 +225,6 @@ int
 xf86ProcessArgument(int argc, char *argv[], int i)
 {
   /*
-   * Keep server from detaching from controlling tty.  This is useful
-   * when debugging (so the server can receive keyboard signals).
-   */
-  if (!strcmp(argv[i], "-keeptty")) {
-    KeepTty = TRUE;
-    return 1;
-  }
-
-  /*
    * By default, the X server wants to bind itself to CPU 0. This makes
    * sure that the server has full access to the I/O ports at IOPL 3.
    * Some SMP systems have trouble with I/O on CPU's other than 0. If,
@@ -289,6 +277,4 @@ xf86UseMsg(void)
 	ErrorF("vtXX                   use the specified VT number\n");
 	ErrorF("-crt DEVICE            use the specified VT device\n");
         ErrorF("-nompxlock             dont bind X server to CPU 0\n");
-	ErrorF("-keeptty               ");
-	ErrorF("don't detach controlling tty (for debugging only)\n");
 }
diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c
index edcc60b..7576ae9 100644
--- a/hw/xfree86/os-support/solaris/sun_init.c
+++ b/hw/xfree86/os-support/solaris/sun_init.c
@@ -45,7 +45,6 @@
 #define	CONSOLE_VTNO	1
 #define	SOL_CONSOLE_DEV	"/dev/console"
 
-static Bool KeepTty = FALSE;
 static Bool Protect0 = FALSE;
 static Bool UseConsole = FALSE;
 #ifdef HAS_USL_VTS
@@ -190,9 +189,7 @@ xf86OpenConsole(void)
 
 #endif /* HAS_USL_VTS */
 
-OPENCONSOLE:
-	if (!KeepTty)
-	    setpgrp();
+	setpgrp();
 
 	if (((xf86Info.consoleFd = open(consoleDev, O_RDWR | O_NDELAY, 0)) < 0))
 	    FatalError("xf86OpenConsole: Cannot open %s (%s)\n",
@@ -359,16 +356,6 @@ int
 xf86ProcessArgument(int argc, char **argv, int i)
 {
     /*
-     * Keep server from detaching from controlling tty.  This is useful when
-     * debugging, so the server can receive keyboard signals.
-     */
-    if (!strcmp(argv[i], "-keeptty"))
-    {
-	KeepTty = TRUE;
-	return 1;
-    }
-
-    /*
      * Undocumented flag to protect page 0 from read/write to help catch NULL
      * pointer dereferences.  This is purely a debugging flag.
      */
@@ -419,7 +406,5 @@ void xf86UseMsg()
     ErrorF("vtX                    Use the specified VT number\n");
 #endif
     ErrorF("-dev <fb>              Framebuffer device\n");
-    ErrorF("-keeptty               Don't detach controlling tty\n");
-    ErrorF("                       (for debugging only)\n");
     ErrorF("-C                     Use /dev/console as the console device\n");
 }
-- 
1.7.2.1



More information about the xorg-devel mailing list