vt.patch revision 851
766N/Adiff -urp -x '*~' -x '*.orig' dix/main.c dix/main.c
851N/A--- dix/main.c 2009-12-02 18:58:25.228885721 -0800
851N/A+++ dix/main.c 2009-12-02 18:58:27.293238950 -0800
766N/A@@ -79,6 +79,8 @@ Equipment Corporation.
851N/A #include <version-config.h>
766N/A #endif
766N/A
766N/A+#include <sys/stat.h>
766N/A+#include <stdio.h>
766N/A #include <X11/X.h>
766N/A #include <X11/Xos.h> /* for unistd.h */
766N/A #include <X11/Xproto.h>
851N/A@@ -125,6 +127,30 @@ extern void Dispatch(void);
851N/A
851N/A extern void InitProcVectors(void);
766N/A
766N/A+#if defined(sun)
766N/A+extern const char * GetAuthFilename(void);
766N/A+
766N/A+#define LOCK_PREFIX "/var/xauth/"
766N/A+
766N/A+/*
766N/A+ * Setup /var/xauth/$DISPLAY, which is a symlink to the
766N/A+ * actually auth file.
766N/A+ */
766N/A+static void
766N/A+SetupXauthFile(char *filename)
766N/A+{
766N/A+ struct stat buf;
766N/A+ char sym_authfile[40];
766N/A+
766N/A+ snprintf(sym_authfile, 40, LOCK_PREFIX "%s", display);
766N/A+
766N/A+ mkdir(LOCK_PREFIX, S_IRWXU);
766N/A+
766N/A+ remove(sym_authfile);
766N/A+ symlink(filename, sym_authfile);
766N/A+}
766N/A+#endif
766N/A+
766N/A #ifdef XQUARTZ
766N/A #include <pthread.h>
766N/A
851N/A@@ -139,6 +165,9 @@ int main(int argc, char *argv[], char *e
766N/A {
766N/A int i;
766N/A HWEventQueueType alwaysCheckForInput[2];
766N/A+#if defined(sun)
766N/A+ char *xauthfile = NULL;
766N/A+#endif
766N/A
766N/A display = "0";
766N/A
851N/A@@ -154,6 +183,12 @@ int main(int argc, char *argv[], char *e
766N/A
766N/A ProcessCommandLine(argc, argv);
766N/A
766N/A+#if defined(sun)
766N/A+ xauthfile = GetAuthFilename();
766N/A+ if (xauthfile)
766N/A+ SetupXauthFile(xauthfile);
766N/A+#endif
766N/A+
766N/A alwaysCheckForInput[0] = 0;
766N/A alwaysCheckForInput[1] = 1;
766N/A while(1)
766N/Adiff -urp -x '*~' -x '*.orig' hw/xfree86/common/xf86Events.c hw/xfree86/common/xf86Events.c
851N/A--- hw/xfree86/common/xf86Events.c 2009-11-22 16:33:40.000000000 -0800
851N/A+++ hw/xfree86/common/xf86Events.c 2009-12-02 18:58:27.293764193 -0800
851N/A@@ -202,8 +202,16 @@ xf86ProcessActionEvent(ActionEvent actio
766N/A vtno--;
766N/A #endif
851N/A #if defined(sun)
851N/A- if (vtno == xf86Info.vtno)
778N/A+ if (vtno == xf86Info.vtno) {
851N/A break;
778N/A+ } else {
778N/A+ struct vt_stat state;
778N/A+ if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &state) < 0)
778N/A+ break;
778N/A+
778N/A+ if ((state.v_state & (1 << vtno)) == 0)
778N/A+ break;
778N/A+ }
851N/A
851N/A xf86Info.vtRequestsPending = TRUE;
851N/A xf86Info.vtPendingNum = vtno;
851N/Adiff -urp -x '*~' -x '*.orig' hw/xfree86/os-support/solaris/sun_VTsw.c hw/xfree86/os-support/solaris/sun_VTsw.c
851N/A--- hw/xfree86/os-support/solaris/sun_VTsw.c 2009-10-27 23:56:22.000000000 -0700
851N/A+++ hw/xfree86/os-support/solaris/sun_VTsw.c 2009-12-02 18:58:27.294750205 -0800
851N/A@@ -44,17 +44,27 @@
851N/A * Handle the VT-switching interface for Solaris/OpenSolaris
851N/A */
851N/A
851N/A+static int xf86VTPruneDoor = 0;
766N/A+
851N/A void
851N/A-xf86VTRequest(int sig)
851N/A+xf86VTRelease(int sig)
851N/A {
851N/A if (xf86Info.vtPendingNum != -1)
851N/A {
851N/A- ioctl(xf86Info.consoleFd, VT_RELDISP, 1);
851N/A- xf86Info.vtPendingNum = -1;
766N/A-
851N/A+ xf86VTPruneDoor = 1;
851N/A+ xf86Info.vtRequestsPending = TRUE;
851N/A return;
851N/A }
766N/A
851N/A+ ioctl(xf86Info.consoleFd, VT_RELDISP, 1);
851N/A+ xf86Info.vtPendingNum = -1;
851N/A+
851N/A+ return;
851N/A+}
766N/A+
851N/A+void
851N/A+xf86VTAcquire(int sig)
851N/A+{
851N/A xf86Info.vtRequestsPending = TRUE;
851N/A return;
851N/A }
851N/A@@ -74,6 +84,12 @@ xf86VTSwitchAway(void)
851N/A
851N/A xf86Info.vtRequestsPending = FALSE;
766N/A
851N/A+ if (xf86VTPruneDoor) {
851N/A+ xf86VTPruneDoor = 0;
851N/A+ ioctl(xf86Info.consoleFd, VT_RELDISP, 1);
851N/A+ return (TRUE);
851N/A+ }
851N/A+
851N/A vt_door_arg.vt_ev = VT_EV_HOTKEYS;
851N/A vt_door_arg.vt_num = xf86Info.vtPendingNum;
851N/A door_arg.data_ptr = (char *)&vt_door_arg;
766N/Adiff -urp -x '*~' -x '*.orig' hw/xfree86/os-support/solaris/sun_init.c hw/xfree86/os-support/solaris/sun_init.c
851N/A--- hw/xfree86/os-support/solaris/sun_init.c 2009-10-27 23:56:22.000000000 -0700
851N/A+++ hw/xfree86/os-support/solaris/sun_init.c 2009-12-02 18:58:27.294287421 -0800
851N/A@@ -33,12 +33,17 @@
766N/A # include <sys/kd.h>
766N/A #endif
766N/A
766N/A+/* For use of VT_SETDISPLOGIN in dtlogin.c */
766N/A+extern int xf86ConsoleFd;
766N/A+
766N/A static Bool KeepTty = FALSE;
766N/A static Bool Protect0 = FALSE;
766N/A #ifdef HAS_USL_VTS
766N/A static int VTnum = -1;
766N/A static int xf86StartVT = -1;
851N/A static int vtEnabled = 0;
778N/A+extern void xf86VTAcquire(int);
778N/A+extern void xf86VTRelease(int);
778N/A #endif
778N/A
851N/A /* Device to open as xf86Info.consoleFd */
851N/A@@ -137,7 +142,8 @@ xf86OpenConsole(void)
851N/A else
851N/A {
851N/A if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) ||
851N/A- (xf86Info.vtno == -1)) {
766N/A+ (xf86Info.vtno == -1))
766N/A+ {
851N/A FatalError("xf86OpenConsole: Cannot find a free VT\n");
851N/A }
851N/A }
851N/A@@ -146,7 +152,8 @@ xf86OpenConsole(void)
851N/A snprintf(consoleDev, PATH_MAX, "/dev/vt/%d", xf86Info.vtno);
766N/A }
766N/A
851N/A- if (fd != -1) {
766N/A+ if (fd != -1)
766N/A+ {
851N/A close(fd);
851N/A }
766N/A
851N/A@@ -178,17 +185,20 @@ xf86OpenConsole(void)
851N/A if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
851N/A FatalError("xf86OpenConsole: VT_GETMODE failed\n");
766N/A
851N/A- OsSignal(SIGUSR1, xf86VTRequest);
778N/A+ OsSignal(SIGUSR1, xf86VTAcquire);
778N/A+ OsSignal(SIGUSR2, xf86VTRelease);
766N/A
851N/A VT.mode = VT_PROCESS;
851N/A- VT.relsig = SIGUSR1;
851N/A VT.acqsig = SIGUSR1;
778N/A+ VT.relsig = SIGUSR2;
766N/A
851N/A if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
851N/A FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n");
851N/A
851N/A if (ioctl(xf86Info.consoleFd, VT_SETDISPINFO, atoi(display)) < 0)
851N/A xf86Msg(X_WARNING, "xf86OpenConsole: VT_SETDISPINFO failed\n");
778N/A+
766N/A+ xf86ConsoleFd = xf86Info.consoleFd;
851N/A }
766N/A #endif
766N/A
851N/A@@ -204,7 +214,8 @@ xf86OpenConsole(void)
766N/A else /* serverGeneration != 1 */
766N/A {
766N/A #ifdef HAS_USL_VTS
851N/A- if (vtEnabled) {
766N/A+ if (vtEnabled)
766N/A+ {
851N/A /*
851N/A * Now re-get the VT
851N/A */
851N/A@@ -285,7 +296,8 @@ xf86CloseConsole(void)
851N/A #endif
766N/A
766N/A #ifdef HAS_USL_VTS
851N/A- if (vtEnabled == 1) {
766N/A+ if (vtEnabled)
851N/A+ {
851N/A if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1)
766N/A {
851N/A VT.mode = VT_AUTO; /* Set default vt handling */