open-src/xserver/xorg/6942816.patch
changeset 1088 1c99106ccbe0
parent 1087 a8aa060182e1
child 1089 590b35f0ad83
--- a/open-src/xserver/xorg/6942816.patch	Wed Mar 09 16:02:37 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-diff -urp -x '*~' -x '*.orig' hw/xfree86/os-support/solaris/sun_init.c hw/xfree86/os-support/solaris/sun_init.c
---- hw/xfree86/os-support/solaris/sun_init.c	2010-04-15 14:27:02.090461037 +0800
-+++ hw/xfree86/os-support/solaris/sun_init.c	2010-04-15 14:27:04.834098942 +0800
-@@ -33,11 +33,24 @@
- # include <sys/kd.h>
- #endif
- 
-+/*
-+ * Applications see VT number as consecutive integers starting from 1.
-+ * VT number			VT device
-+ * -------------------------------------------------------
-+ *     1             :          /dev/vt/0 (Alt + Ctrl + F1)
-+ *     2             :          /dev/vt/2 (Alt + Ctrl + F2)
-+ *     3             :          /dev/vt/3 (Alt + Ctrl + F3)
-+ *  ... ...
-+ */
-+#define	CONSOLE_VTNO	1
-+#define	SOL_CONSOLE_DEV	"/dev/console"
-+
- /* For use of VT_SETDISPLOGIN in dtlogin.c */
- extern int xf86ConsoleFd;
- 
- static Bool KeepTty = FALSE;
- static Bool Protect0 = FALSE;
-+static Bool UseConsole = FALSE;
- #ifdef HAS_USL_VTS
- static int VTnum = -1;
- static int xf86StartVT = -1;
-@@ -96,7 +109,6 @@ xf86OpenConsole(void)
- 	}
- 
- #ifdef HAS_USL_VTS
--
- 	/*
- 	 * Setup the virtual terminal manager
- 	 */
-@@ -115,8 +127,30 @@ xf86OpenConsole(void)
- 		vtEnabled = 0;
- 	    }
- 	}
-+#endif /*  HAS_USL_VTS */
- 
-+	if (UseConsole)
-+	{
-+	    strlcpy(consoleDev, SOL_CONSOLE_DEV, sizeof(consoleDev));
-+
-+#ifdef HAS_USL_VTS
-+	    xf86Info.vtno = CONSOLE_VTNO;
- 
-+	    if (vtEnabled == 0)
-+	    {
-+		xf86StartVT = 0;
-+	    }
-+	    else
-+	    {
-+		if (ioctl(fd, VT_GETSTATE, &vtinfo) < 0)
-+		    FatalError("xf86OpenConsole: Cannot determine current VT\n");
-+		xf86StartVT = vtinfo.v_active;
-+	    }
-+#endif /*  HAS_USL_VTS */
-+	    goto OPENCONSOLE;
-+	}
-+		
-+#ifdef HAS_USL_VTS
- 	if (vtEnabled == 0)
- 	{
- 	    /* VT not enabled - kernel too old or Sparc platforms
-@@ -126,32 +160,31 @@ xf86OpenConsole(void)
- 	    xf86StartVT = 0;
- 	    xf86Info.vtno = 0;
- 	    strlcpy(consoleDev, xf86SolarisFbDev, sizeof(consoleDev));
-+	    goto OPENCONSOLE;
- 	}
--	else
--	{
--	    if (ioctl(fd, VT_GETSTATE, &vtinfo) < 0)
--		FatalError("xf86OpenConsole: Cannot determine current VT\n");
- 
--	    xf86StartVT = vtinfo.v_active;
-+	if (ioctl(fd, VT_GETSTATE, &vtinfo) < 0)
-+	    FatalError("xf86OpenConsole: Cannot determine current VT\n");
- 
--	    if (VTnum != -1)
--	    {
--		xf86Info.vtno = VTnum;
--		from = X_CMDLINE;
--	    }
--	    else
-+	xf86StartVT = vtinfo.v_active;
-+
-+	if (VTnum != -1)
-+	{
-+	    xf86Info.vtno = VTnum;
-+	    from = X_CMDLINE;
-+	}
-+	else
-+	{
-+	    if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) ||
-+		(xf86Info.vtno == -1))
- 	    {
--		if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) ||
--		    (xf86Info.vtno == -1))
--		{
--		    FatalError("xf86OpenConsole: Cannot find a free VT\n");
--		}
-+		FatalError("xf86OpenConsole: Cannot find a free VT\n");
- 	    }
--
--	    xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
--	    snprintf(consoleDev, PATH_MAX, "/dev/vt/%d", xf86Info.vtno);
- 	}
- 
-+	xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
-+	snprintf(consoleDev, PATH_MAX, "/dev/vt/%d", xf86Info.vtno);
-+
- 	if (fd != -1)
- 	{
- 	    close(fd);
-@@ -159,6 +192,7 @@ xf86OpenConsole(void)
- 
- #endif /* HAS_USL_VTS */
- 
-+OPENCONSOLE:
- 	if (!KeepTty)
- 	    setpgrp();
- 
-@@ -166,11 +200,10 @@ xf86OpenConsole(void)
- 	    FatalError("xf86OpenConsole: Cannot open %s (%s)\n",
- 		       consoleDev, strerror(errno));
- 
--#ifdef HAS_USL_VTS
--
--	/* Change ownership of the vt */
-+	/* Change ownership of the vt or console */
- 	chown(consoleDev, getuid(), getgid());
- 
-+#ifdef HAS_USL_VTS
- 	if (vtEnabled)
- 	{
- 	    /*
-@@ -182,6 +215,11 @@ xf86OpenConsole(void)
- 	    if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
- 		xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
- 
-+	    if (strcmp(display, "0") == 0)
-+		if (ioctl(xf86Info.consoleFd, VT_SET_CONSUSER) != 0)
-+		    xf86Msg(X_WARNING,
-+			"xf86OpenConsole: VT_SET_CONSUSER failed\n");
-+
- 	    if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
- 		FatalError("xf86OpenConsole: VT_GETMODE failed\n");
- 
-@@ -225,6 +263,11 @@ xf86OpenConsole(void)
- 	    if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
- 		xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
- 
-+	    if (strcmp(display, "0") == 0)
-+		if (ioctl(xf86Info.consoleFd, VT_SET_CONSUSER) != 0)
-+		    xf86Msg(X_WARNING,
-+			"xf86OpenConsole: VT_SET_CONSUSER failed\n");
-+
- 	    /*
- 	     * If the server doesn't have the VT when the reset occurs,
- 	     * this is to make sure we don't continue until the activate
-@@ -335,6 +378,15 @@ xf86ProcessArgument(int argc, char **arg
- 	return 1;
-     }
- 
-+    /*
-+     * Use /dev/console as the console device.
-+     */  
-+    if (!strcmp(argv[i], "-C"))
-+    {
-+	UseConsole = TRUE;
-+	return 1;
-+    }
-+
- #ifdef HAS_USL_VTS
- 
-     if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
-@@ -369,4 +421,5 @@ void xf86UseMsg()
-     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");
- }