xserver: Branch 'server-1.2-branch' - 3 commits

Daniel Stone daniels at kemper.freedesktop.org
Wed Nov 8 18:10:46 EET 2006


 hw/xfree86/common/xf86.h               |    4 +
 hw/xfree86/common/xf86Events.c         |  101 ++++++++++++++++++++++++++++-----
 hw/xfree86/os-support/linux/lnx_acpi.c |    6 -
 include/os.h                           |    4 +
 os/connection.c                        |   24 +++++--
 5 files changed, 116 insertions(+), 23 deletions(-)

New commits:
diff-tree 22bccea8dcf332bf0077440b76daf6703da42da2 (from be91a981dfbc4ea9e6f1c47fafdec3132ca09923)
Author: Rich Coe <Richard.Coe at med.ge.com>
Date:   Wed Nov 8 18:10:14 2006 +0200

    CheckConnections: don't close down the server client (bug #7876)
    
    When an appgroup is shutting down, the list of clients can change, so make
    sure we're not trying to shut the server down.
    (cherry picked from b5d09d4adb8088719ff494a4281a793717046576 commit)

diff --git a/os/connection.c b/os/connection.c
index daad2ac..96ad119 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -1019,7 +1019,7 @@ CheckConnections(void)
 	FD_ZERO(&tmask);
 	FD_SET(curclient, &tmask);
 	r = Select (curclient + 1, &tmask, NULL, NULL, &notime);
-	if (r < 0)
+	if (r < 0 && GetConnectionTranslation(curclient) > 0)
 	    CloseDownClient(clients[GetConnectionTranslation(curclient)]);
     }	
 #endif
diff-tree be91a981dfbc4ea9e6f1c47fafdec3132ca09923 (from 66b2c9bd2dddf8f8410147ebf1de7a6c045d8249)
Author: Bram Verweij <amverweij at gmail.com>
Date:   Wed Nov 8 18:00:52 2006 +0200

    xfree86/linux acpi: fix tokenising
    
    Split on a space, rather on the 'video' string, as strtok takes a char,
    not a string.
    (cherry picked from 0567a6337b84fa045b5732e98203f488274aa2a2 commit)

diff --git a/hw/xfree86/os-support/linux/lnx_acpi.c b/hw/xfree86/os-support/linux/lnx_acpi.c
index aa30e72..024e6ef 100644
--- a/hw/xfree86/os-support/linux/lnx_acpi.c
+++ b/hw/xfree86/os-support/linux/lnx_acpi.c
@@ -78,7 +78,7 @@ lnxACPIGetEventFromOs(int fd, pmEvent *e
 	char *data = NULL; /* doesn't appear to be used in the kernel */
 	unsigned long int notify_l, data_l;
 
-	video = strtok(ev, "video");
+	video = strtok(ev, " ");
 
 	GFX = strtok(NULL, " ");
 #if 0
diff-tree 66b2c9bd2dddf8f8410147ebf1de7a6c045d8249 (from 58653b676d68b731c046128eade8efff9ab61582)
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Wed Nov 8 17:57:48 2006 +0200

    add 'general socket' handler, port ACPI to use it
    
    Add a general socket (not input device, but still need to be woken for it)
    handler to both the DIX and XFree86, and make XFree86's ACPI handling use
    it.  This stops DPMS waking up every time an ACPI notification comes in.

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index 4587500..5112530 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -222,6 +222,10 @@ pointer xf86AddInputHandler(int fd, Inpu
 int xf86RemoveInputHandler(pointer handler);
 void xf86DisableInputHandler(pointer handler);
 void xf86EnableInputHandler(pointer handler);
+pointer xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data);
+int xf86RemoveGeneralHandler(pointer handler);
+void xf86DisableGeneralHandler(pointer handler);
+void xf86EnableGeneralHandler(pointer handler);
 void xf86InterceptSignals(int *signo);
 void xf86InterceptSigIll(void (*sigillhandler)(void));
 Bool xf86EnableVTSwitch(Bool new);
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 831c68a..b1ee1e9 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -1636,8 +1636,8 @@ xf86VTSwitch()
 
 /* Input handler registration */
 
-_X_EXPORT pointer
-xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data)
+static pointer
+addInputHandler(int fd, InputHandlerProc proc, pointer data)
 {
     IHPtr ih;
 
@@ -1656,15 +1656,50 @@ xf86AddInputHandler(int fd, InputHandler
     ih->next = InputHandlers;
     InputHandlers = ih;
 
-    AddEnabledDevice(fd);
+    return ih;
+}
+
+_X_EXPORT pointer
+xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data)
+{   
+    IHPtr ih = addInputHandler(fd, proc, data);
+
+    if (ih)
+        AddEnabledDevice(fd);
+    return ih;
+}
+
+_X_EXPORT pointer
+xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data)
+{   
+    IHPtr ih = addInputHandler(fd, proc, data);
 
+    if (ih)
+        AddGeneralSocket(fd);
     return ih;
 }
 
+static void
+removeInputHandler(IHPtr ih)
+{
+    IHPtr p;
+
+    if (ih == InputHandlers)
+	InputHandlers = ih->next;
+    else {
+	p = InputHandlers;
+	while (p && p->next != ih)
+	    p = p->next;
+	if (ih)
+	    p->next = ih->next;
+    }
+    xfree(ih);
+}
+
 _X_EXPORT int
 xf86RemoveInputHandler(pointer handler)
 {
-    IHPtr ih, p;
+    IHPtr ih;
     int fd;
     
     if (!handler)
@@ -1675,17 +1710,27 @@ xf86RemoveInputHandler(pointer handler)
     
     if (ih->fd >= 0)
 	RemoveEnabledDevice(ih->fd);
+    removeInputHandler(ih);
+
+    return fd;
+}
+
+_X_EXPORT int
+xf86RemoveGeneralHandler(pointer handler)
+{
+    IHPtr ih;
+    int fd;
+    
+    if (!handler)
+	return -1;
+
+    ih = handler;
+    fd = ih->fd;
+    
+    if (ih->fd >= 0)
+	RemoveGeneralSocket(ih->fd);
+    removeInputHandler(ih);
 
-    if (ih == InputHandlers)
-	InputHandlers = ih->next;
-    else {
-	p = InputHandlers;
-	while (p && p->next != ih)
-	    p = p->next;
-	if (ih)
-	    p->next = ih->next;
-    }
-    xfree(ih);
     return fd;
 }
 
@@ -1704,6 +1749,20 @@ xf86DisableInputHandler(pointer handler)
 }
 
 _X_EXPORT void
+xf86DisableGeneralHandler(pointer handler)
+{
+    IHPtr ih;
+
+    if (!handler)
+	return;
+
+    ih = handler;
+    ih->enabled = FALSE;
+    if (ih->fd >= 0)
+	RemoveGeneralSocket(ih->fd);
+}
+
+_X_EXPORT void
 xf86EnableInputHandler(pointer handler)
 {
     IHPtr ih;
@@ -1717,6 +1776,20 @@ xf86EnableInputHandler(pointer handler)
 	AddEnabledDevice(ih->fd);
 }
 
+_X_EXPORT void
+xf86EnableGeneralHandler(pointer handler)
+{
+    IHPtr ih;
+
+    if (!handler)
+	return;
+
+    ih = handler;
+    ih->enabled = TRUE;
+    if (ih->fd >= 0)
+	AddGeneralSocket(ih->fd);
+}
+
 /*
  * As used currently by the DRI, the return value is ignored.
  */
diff --git a/hw/xfree86/os-support/linux/lnx_acpi.c b/hw/xfree86/os-support/linux/lnx_acpi.c
index eca76db..aa30e72 100644
--- a/hw/xfree86/os-support/linux/lnx_acpi.c
+++ b/hw/xfree86/os-support/linux/lnx_acpi.c
@@ -163,7 +163,7 @@ lnxACPIOpen(void)
 
     xf86PMGetEventFromOs = lnxACPIGetEventFromOs;
     xf86PMConfirmEventToOs = lnxACPIConfirmEventToOs;
-    ACPIihPtr = xf86AddInputHandler(fd,xf86HandlePMEvents,NULL);
+    ACPIihPtr = xf86AddGeneralHandler(fd,xf86HandlePMEvents,NULL);
     xf86MsgVerb(X_INFO,3,"Open ACPI successful (%s)\n", ACPI_SOCKET);
 
     return lnxCloseACPI;
@@ -178,7 +178,7 @@ lnxCloseACPI(void)
    ErrorF("ACPI: Closing device\n");
 #endif
     if (ACPIihPtr) {
-	fd = xf86RemoveInputHandler(ACPIihPtr);
+	fd = xf86RemoveGeneralHandler(ACPIihPtr);
 	shutdown(fd, 2);
 	close(fd);
 	ACPIihPtr = NULL;
diff --git a/include/os.h b/include/os.h
index 4c49671..fbe1592 100644
--- a/include/os.h
+++ b/include/os.h
@@ -147,6 +147,10 @@ extern void CheckConnections(void);
 
 extern void CloseDownConnection(ClientPtr /*client*/);
 
+extern void AddGeneralSocket(int /*fd*/);
+
+extern void RemoveGeneralSocket(int /*fd*/);
+
 extern void AddEnabledDevice(int /*fd*/);
 
 extern void RemoveEnabledDevice(int /*fd*/);
diff --git a/os/connection.c b/os/connection.c
index 6ca4010..daad2ac 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -1048,21 +1048,33 @@ CloseDownConnection(ClientPtr client)
 }
 
 _X_EXPORT void
+AddGeneralSocket(int fd)
+{
+    FD_SET(fd, &AllSockets);
+    if (GrabInProgress)
+        FD_SET(fd, &SavedAllSockets);
+}
+
+_X_EXPORT void
 AddEnabledDevice(int fd)
 {
     FD_SET(fd, &EnabledDevices);
-    FD_SET(fd, &AllSockets);
+    AddGeneralSocket(fd);
+}
+
+_X_EXPORT void
+RemoveGeneralSocket(int fd)
+{
+    FD_CLR(fd, &AllSockets);
     if (GrabInProgress)
-	FD_SET(fd, &SavedAllSockets);
+        FD_CLR(fd, &SavedAllSockets);
 }
 
 _X_EXPORT void
 RemoveEnabledDevice(int fd)
 {
     FD_CLR(fd, &EnabledDevices);
-    FD_CLR(fd, &AllSockets);
-    if (GrabInProgress)
-	FD_CLR(fd, &SavedAllSockets);
+    RemoveGeneralSocket(fd);
 }
 
 /*****************



More information about the xorg-commit mailing list