xserver: Branch 'master' - 3 commits

Alan Coopersmith alanc at kemper.freedesktop.org
Fri Apr 24 00:24:09 PDT 2009


 configure.ac                              |    2 -
 hw/xfree86/dixmods/extmod/xf86vmode.c     |   16 ++++-------
 hw/xfree86/loader/sdksyms.sh              |    2 -
 hw/xfree86/os-support/shared/sigio.c      |   42 +++++++++++++++++++++++++-----
 hw/xfree86/os-support/solaris/Makefile.am |    3 +-
 include/xorg-config.h.in                  |    3 ++
 6 files changed, 49 insertions(+), 19 deletions(-)

New commits:
commit 64b7f96dca23d2b33e0b8a8785d628d9a2f50e7b
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Fri Apr 24 00:14:12 2009 -0700

    Add SIGIO/SIGPOLL support for Solaris
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>

diff --git a/configure.ac b/configure.ac
index ef50627..f0317bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -113,7 +113,7 @@ AM_CONDITIONAL(XSERVER_DTRACE, [test "x$WDTRACE" != "xno"])
 
 AC_HEADER_DIRENT
 AC_HEADER_STDC
-AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h])
+AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h])
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
diff --git a/hw/xfree86/os-support/shared/sigio.c b/hw/xfree86/os-support/shared/sigio.c
index 54c02cc..2565782 100644
--- a/hw/xfree86/os-support/shared/sigio.c
+++ b/hw/xfree86/os-support/shared/sigio.c
@@ -63,6 +63,10 @@
 # include "xf86_OSlib.h"
 # include "inputstr.h"
 
+#ifdef HAVE_STROPTS_H
+# include <stropts.h>
+#endif
+
 /*
  * Linux libc5 defines FASYNC, but not O_ASYNC.  Don't know if it is
  * functional or not.
@@ -139,6 +143,7 @@ xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *closure)
     struct sigaction osa;
     int	i;
     int blocked;
+    int installed = FALSE;
 
     for (i = 0; i < MAX_FUNCS; i++)
     {
@@ -147,15 +152,30 @@ xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *closure)
 	    if (xf86IsPipe (fd))
 		return 0;
 	    blocked = xf86BlockSIGIO();
+#ifdef O_ASYNC
 	    if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) {
-		xf86Msg(X_WARNING, "fcntl(%d, O_ASYNC): %s\n", 
+		xf86Msg(X_WARNING, "fcntl(%d, O_ASYNC): %s\n",
 			fd, strerror(errno));
-		xf86UnblockSIGIO(blocked);
-		return 0;
+	    } else {
+		if (fcntl(fd, F_SETOWN, getpid()) != -1) {
+		    xf86Msg(X_WARNING, "fcntl(%d, F_SETOWN): %s\n",
+			    fd, strerror(errno));
+		} else {
+		    installed = TRUE;
+		}
 	    }
-	    if (fcntl(fd, F_SETOWN, getpid()) == -1) {
-		xf86Msg(X_WARNING, "fcntl(%d, F_SETOWN): %s\n", 
-			fd, strerror(errno));
+#endif
+#ifdef I_SETSIG /* System V Streams - used on Solaris for input devices */
+	    if (!installed && isastream(fd)) {
+		if (ioctl(fd, I_SETSIG, S_INPUT | S_ERROR | S_HANGUP) == -1) {
+		    xf86Msg(X_WARNING, "fcntl(%d, I_SETSIG): %s\n",
+			    fd, strerror(errno));
+		} else {
+		    installed = TRUE;
+		}
+	    }
+#endif
+	    if (!installed) {
 		xf86UnblockSIGIO(blocked);
 		return 0;
 	    }
@@ -221,7 +241,17 @@ xf86RemoveSIGIOHandler(int fd)
     }
     if (ret)
     {
+#ifdef O_ASYNC
 	fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_ASYNC);
+#endif
+#ifdef I_SETSIG
+	if (isastream(fd)) {
+	    if (ioctl(fd, I_SETSIG, 0) == -1) {
+		xf86Msg(X_WARNING, "fcntl(%d, I_SETSIG, 0): %s\n",
+			fd, strerror(errno));
+	    }
+	}
+#endif
 	xf86SigIOMax = max;
 	xf86SigIOMaxFd = maxfd;
 	if (!max)
diff --git a/hw/xfree86/os-support/solaris/Makefile.am b/hw/xfree86/os-support/solaris/Makefile.am
index a4ef67b..bcb9874 100644
--- a/hw/xfree86/os-support/solaris/Makefile.am
+++ b/hw/xfree86/os-support/solaris/Makefile.am
@@ -21,7 +21,8 @@ noinst_LTLIBRARIES = libsolaris.la
 libsolaris_la_SOURCES = sun_init.c \
 	sun_vid.c sun_bell.c $(AGP_SRC) sun_apm.c \
 	$(srcdir)/../shared/kmod_noop.c \
-	$(srcdir)/../shared/posix_tty.c $(srcdir)/../shared/sigiostubs.c \
+	$(srcdir)/../shared/posix_tty.c \
+	$(srcdir)/../shared/sigio.c \
 	$(srcdir)/../shared/stdResource.c \
 	$(srcdir)/../shared/vidmem.c \
 	$(VTSW_SRC)
diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in
index f9b77d0..ebeb44a 100644
--- a/include/xorg-config.h.in
+++ b/include/xorg-config.h.in
@@ -54,6 +54,9 @@
 /* Solaris 8 or later? */
 #undef __SOL8__
 
+/* Define to 1 if you have the <stropts.h> header file. */
+#undef HAVE_STROPTS_H
+
 /* Define to 1 if you have the <sys/kd.h> header file. */
 #undef HAVE_SYS_KD_H
 
commit 0c467b1f990f156a34d5ef117bd825df6b633114
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Fri Apr 24 00:05:28 2009 -0700

    Add casts to generated entries in sdksyms.c to silence type mismatch warnings
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>

diff --git a/hw/xfree86/loader/sdksyms.sh b/hw/xfree86/loader/sdksyms.sh
index be0b0ee..b320661 100755
--- a/hw/xfree86/loader/sdksyms.sh
+++ b/hw/xfree86/loader/sdksyms.sh
@@ -399,7 +399,7 @@ BEGIN {
 	sub(/[^a-zA-Z0-9_].*/, "", symbol);
 
 	#print;
-	printf("    &%s,\n", symbol);
+	printf("    (void *) &%s,\n", symbol);
     }
 }
 
commit 7d0f7518c2235a9dc783029971259ddaada2db20
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Thu Apr 23 08:42:38 2009 -0700

    Fix byte swapping of XF86VidMode{Get,Set}GammaRamp
    
    Fixes OpenSolaris Bug 8315:
    Xorg segfaults when screensaver fades in cross-endian xdmcp session
    <http://defect.opensolaris.org/bz/show_bug.cgi?id=8315>
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>

diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index ea8089e..10b9ed3 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -1541,6 +1541,7 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client)
 {
     CARD16 *ramp = NULL;
     int n, length, i;
+    size_t ramplen;
     xXF86VidModeGetGammaRampReply rep;
     REQUEST(xXF86VidModeGetGammaRampReq);
 
@@ -1555,7 +1556,8 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client)
     length = (stuff->size + 1) & ~1;
 
     if(stuff->size) {
-        if(!(ramp = xalloc(length * 3 * sizeof(CARD16))))
+	ramplen = length * 3 * sizeof(CARD16);
+	if (!(ramp = xalloc(ramplen)))
 	    return BadAlloc;
    
         if (!VidModeGetGammaRamp(stuff->screen, stuff->size, 
@@ -1573,13 +1575,12 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client)
 	swaps(&rep.sequenceNumber, n);
 	swapl(&rep.length, n);
 	swaps(&rep.size, n);
-	for(i = 0; i < length * 3; i++)
-	    swaps(&ramp[i],n);
+	SwapShorts(ramp, length * 3);
     }
     WriteToClient(client, sizeof(xXF86VidModeGetGammaRampReply), (char *)&rep);
 
     if(stuff->size) {
-	WriteToClient(client, rep.length << 2, (char*)ramp);
+	WriteToClient(client, ramplen, (char*)ramp);
         xfree(ramp);
     }
 
@@ -2060,7 +2061,6 @@ SProcXF86VidModeGetGamma(ClientPtr client)
 static int
 SProcXF86VidModeSetGammaRamp(ClientPtr client)
 {
-    CARD16 *ramp;
     int length, n;
     REQUEST(xXF86VidModeSetGammaRampReq);
     swaps(&stuff->length, n);
@@ -2069,11 +2069,7 @@ SProcXF86VidModeSetGammaRamp(ClientPtr client)
     swaps(&stuff->screen, n);
     length = ((stuff->size + 1) & ~1) * 6;
     REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length);
-    ramp = (CARD16*)&stuff[1];
-    while(length--) {
-	swaps(ramp, n);
-	ramp++;
-    }
+    SwapRestS(stuff);
     return ProcXF86VidModeSetGammaRamp(client);
 }
 


More information about the xorg-commit mailing list