[PATCH xserver 24/24] Remove fd_set from Block/Wakeup handler API

Keith Packard keithp at keithp.com
Sun Sep 20 23:16:35 PDT 2015


This removes the last uses of fd_set from the server interfaces
outside of the OS layer itself.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 Xext/sleepuntil.c               | 17 +++++++----------
 Xext/sync.c                     | 12 ++++++------
 dix/dixfonts.c                  |  7 +++----
 dix/dixutils.c                  | 23 +++++++++++------------
 hw/kdrive/ephyr/ephyr.c         |  4 ++--
 hw/vfb/InitOutput.c             |  4 ++--
 hw/xfree86/common/xf86Events.c  |  2 +-
 hw/xfree86/common/xf86Init.c    |  2 +-
 hw/xfree86/common/xf86Priv.h    |  2 +-
 hw/xfree86/dri/dri.c            |  4 ++--
 hw/xfree86/dri/dri.h            |  6 ++----
 hw/xnest/Handlers.c             |  4 ++--
 hw/xnest/Handlers.h             |  5 ++---
 hw/xwayland/xwayland.c          |  2 +-
 include/dix.h                   | 26 +++++++++++++-------------
 miext/rootless/rootlessScreen.c |  4 ++--
 miext/shadow/shadow.c           |  4 ++--
 os/WaitFor.c                    |  4 ++--
 18 files changed, 62 insertions(+), 70 deletions(-)

diff --git a/Xext/sleepuntil.c b/Xext/sleepuntil.c
index 993c028..68a7a9b 100644
--- a/Xext/sleepuntil.c
+++ b/Xext/sleepuntil.c
@@ -63,14 +63,11 @@ static void ClientAwaken(ClientPtr /* client */ ,
 static int SertafiedDelete(void *  /* value */ ,
                            XID     /* id */
     );
-static void SertafiedBlockHandler(void *    /* data */ ,
-                                  OSTimePtr /* wt */ ,
-                                  void *    /* LastSelectMask */
-    );
-static void SertafiedWakeupHandler(void *   /* data */ ,
-                                   int      /* i */ ,
-                                   void *   /* LastSelectMask */
-    );
+static void SertafiedBlockHandler(void *data,
+                                  void *timeout);
+
+static void SertafiedWakeupHandler(void *data,
+                                   int i);
 
 int
 ClientSleepUntil(ClientPtr client,
@@ -154,7 +151,7 @@ SertafiedDelete(void *value, XID id)
 }
 
 static void
-SertafiedBlockHandler(void *data, OSTimePtr wt, void *LastSelectMask)
+SertafiedBlockHandler(void *data, void *wt)
 {
     SertafiedPtr pReq, pNext;
     unsigned long delay;
@@ -186,7 +183,7 @@ SertafiedBlockHandler(void *data, OSTimePtr wt, void *LastSelectMask)
 }
 
 static void
-SertafiedWakeupHandler(void *data, int i, void *LastSelectMask)
+SertafiedWakeupHandler(void *data, int i)
 {
     SertafiedPtr pReq, pNext;
     TimeStamp now;
diff --git a/Xext/sync.c b/Xext/sync.c
index 4140561..a86fc52 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -2571,8 +2571,8 @@ static XSyncValue *pnext_time;
 *** Server Block Handler
 *** code inspired by multibuffer extension (now deprecated)
  */
- /*ARGSUSED*/ static void
-ServertimeBlockHandler(void *env, struct timeval **wt, void *LastSelectMask)
+/*ARGSUSED*/ static void
+ServertimeBlockHandler(void *env, void *wt)
 {
     XSyncValue delay;
     unsigned long timeout;
@@ -2597,8 +2597,8 @@ ServertimeBlockHandler(void *env, struct timeval **wt, void *LastSelectMask)
 /*
 *** Wakeup Handler
  */
- /*ARGSUSED*/ static void
-ServertimeWakeupHandler(void *env, int rc, void *LastSelectMask)
+/*ARGSUSED*/ static void
+ServertimeWakeupHandler(void *env, int rc)
 {
     if (pnext_time) {
         GetTime();
@@ -2673,7 +2673,7 @@ IdleTimeQueryValue(void *pCounter, CARD64 * pValue_return)
 }
 
 static void
-IdleTimeBlockHandler(void *pCounter, struct timeval **wt, void *LastSelectMask)
+IdleTimeBlockHandler(void *pCounter, void *wt)
 {
     SyncCounter *counter = pCounter;
     IdleCounterPriv *priv = SysCounterGetPrivate(counter);
@@ -2766,7 +2766,7 @@ IdleTimeCheckBrackets(SyncCounter *counter, XSyncValue idle, XSyncValue *less, X
 }
 
 static void
-IdleTimeWakeupHandler(void *pCounter, int rc, void *LastSelectMask)
+IdleTimeWakeupHandler(void *pCounter, int rc)
 {
     SyncCounter *counter = pCounter;
     IdleCounterPriv *priv = SysCounterGetPrivate(counter);
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index d217d12..cca92ed 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -197,7 +197,7 @@ RemoveFontWakeup(FontPathElementPtr fpe)
 }
 
 static void
-FontWakeup(void *data, int count, void *LastSelectMask)
+FontWakeup(void *data, int count)
 {
     int i;
     FontPathElementPtr fpe;
@@ -1918,8 +1918,7 @@ _client_auth_generation(ClientPtr client)
 static int fs_handlers_installed = 0;
 static unsigned int last_server_gen;
 
-static void
-fs_block_handler(void *blockData, OSTimePtr timeout, void *readmask)
+static void fs_block_handler(void *blockData, void *timeout)
 {
     FontBlockHandlerProcPtr block_handler = blockData;
 
@@ -2004,7 +2003,7 @@ _init_fs_handlers(FontPathElementPtr fpe, FontBlockHandlerProcPtr block_handler)
 
 static void
 _remove_fs_handlers(FontPathElementPtr fpe, FontBlockHandlerProcPtr block_handler,
-                   Bool all)
+                    Bool all)
 {
     if (all) {
         /* remove the handlers if no one else is using them */
diff --git a/dix/dixutils.c b/dix/dixutils.c
index 6951b39..214b9a8 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -360,8 +360,8 @@ NoopDDA(void)
 }
 
 typedef struct _BlockHandler {
-    BlockHandlerProcPtr BlockHandler;
-    WakeupHandlerProcPtr WakeupHandler;
+    ServerBlockHandlerProcPtr BlockHandler;
+    ServerWakeupHandlerProcPtr WakeupHandler;
     void *blockData;
     Bool deleted;
 } BlockHandlerRec, *BlockHandlerPtr;
@@ -378,7 +378,7 @@ static Bool handlerDeleted;
  *  \param pReadMask  nor how it represents the det of descriptors
  */
 void
-BlockHandler(void *pTimeout, void *pReadmask)
+BlockHandler(void *timeout)
 {
     int i, j;
 
@@ -391,8 +391,8 @@ BlockHandler(void *pTimeout, void *pReadmask)
 
     for (i = 0; i < numHandlers; i++)
         if (!handlers[i].deleted)
-            (*handlers[i].BlockHandler) (handlers[i].blockData,
-                                         pTimeout, pReadmask);
+            (*handlers[i].BlockHandler) (handlers[i].blockData, timeout);
+
     if (handlerDeleted) {
         for (i = 0; i < numHandlers;)
             if (handlers[i].deleted) {
@@ -413,15 +413,14 @@ BlockHandler(void *pTimeout, void *pReadmask)
  *  \param pReadmask the resulting descriptor mask
  */
 void
-WakeupHandler(int result, void *pReadmask)
+WakeupHandler(int result)
 {
     int i, j;
 
     ++inHandler;
     for (i = numHandlers - 1; i >= 0; i--)
         if (!handlers[i].deleted)
-            (*handlers[i].WakeupHandler) (handlers[i].blockData,
-                                          result, pReadmask);
+            (*handlers[i].WakeupHandler) (handlers[i].blockData, result);
     for (i = 0; i < screenInfo.numScreens; i++)
         (*screenInfo.screens[i]->WakeupHandler) (screenInfo.screens[i], result);
     for (i = 0; i < screenInfo.numGPUScreens; i++)
@@ -445,8 +444,8 @@ WakeupHandler(int result, void *pReadmask)
  * get called until next time
  */
 Bool
-RegisterBlockAndWakeupHandlers(BlockHandlerProcPtr blockHandler,
-                               WakeupHandlerProcPtr wakeupHandler,
+RegisterBlockAndWakeupHandlers(ServerBlockHandlerProcPtr blockHandler,
+                               ServerWakeupHandlerProcPtr wakeupHandler,
                                void *blockData)
 {
     BlockHandlerPtr new;
@@ -468,8 +467,8 @@ RegisterBlockAndWakeupHandlers(BlockHandlerProcPtr blockHandler,
 }
 
 void
-RemoveBlockAndWakeupHandlers(BlockHandlerProcPtr blockHandler,
-                             WakeupHandlerProcPtr wakeupHandler,
+RemoveBlockAndWakeupHandlers(ServerBlockHandlerProcPtr blockHandler,
+                             ServerWakeupHandlerProcPtr wakeupHandler,
                              void *blockData)
 {
     int i;
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index bf921e9..f4a6724 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -356,7 +356,7 @@ ephyrInternalDamageRedisplay(ScreenPtr pScreen)
 }
 
 static void
-ephyrInternalDamageBlockHandler(void *data, OSTimePtr pTimeout, void *pRead)
+ephyrInternalDamageBlockHandler(void *data, void *timeout)
 {
     ScreenPtr pScreen = (ScreenPtr) data;
 
@@ -364,7 +364,7 @@ ephyrInternalDamageBlockHandler(void *data, OSTimePtr pTimeout, void *pRead)
 }
 
 static void
-ephyrInternalDamageWakeupHandler(void *data, int i, void *LastSelectMask)
+ephyrInternalDamageWakeupHandler(void *data, int i)
 {
     /* FIXME: Not needed ? */
 }
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index 8b867e3..2069965 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -470,7 +470,7 @@ vfbSaveScreen(ScreenPtr pScreen, int on)
 
 /* this flushes any changes to the screens out to the mmapped file */
 static void
-vfbBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadmask)
+vfbBlockHandler(void *blockData, void *timeout)
 {
     int i;
 
@@ -491,7 +491,7 @@ vfbBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadmask)
 }
 
 static void
-vfbWakeupHandler(void *blockData, int result, void *pReadmask)
+vfbWakeupHandler(void *blockData, int result)
 {
 }
 
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index b27d545..9166069 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -243,7 +243,7 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
 
 /* ARGSUSED */
 void
-xf86Wakeup(void *blockData, int err, void *pReadmask)
+xf86Wakeup(void *blockData, int err)
 {
     if (xf86VTSwitchPending())
         xf86VTSwitch();
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 017dcb6..beab281 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -938,7 +938,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
     xf86Resetting = FALSE;
     xf86Initialising = FALSE;
 
-    RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr) NoopDDA, xf86Wakeup,
+    RegisterBlockAndWakeupHandlers((ServerBlockHandlerProcPtr) NoopDDA, xf86Wakeup,
                                    NULL);
 }
 
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index 6e374eb..606e4be 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -139,7 +139,7 @@ DoShowOptions(void)
 /* xf86Events.c */
 
 extern _X_EXPORT void
-xf86Wakeup(void *blockData, int err, void *pReadmask);
+xf86Wakeup(void *blockData, int err);
 extern _X_HIDDEN int
 xf86SigWrapper(int signo);
 extern _X_EXPORT void
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index 11fbb16..3d3fd0f 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -1603,7 +1603,7 @@ DRIDestroyInfoRec(DRIInfoPtr DRIInfo)
 }
 
 void
-DRIWakeupHandler(void *wakeupData, int result, void *pReadmask)
+DRIWakeupHandler(void *wakeupData, int result)
 {
     int i;
 
@@ -1617,7 +1617,7 @@ DRIWakeupHandler(void *wakeupData, int result, void *pReadmask)
 }
 
 void
-DRIBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadmask)
+DRIBlockHandler(void *blockData, void *timeout)
 {
     int i;
 
diff --git a/hw/xfree86/dri/dri.h b/hw/xfree86/dri/dri.h
index d9793b3..98abd56 100644
--- a/hw/xfree86/dri/dri.h
+++ b/hw/xfree86/dri/dri.h
@@ -263,11 +263,9 @@ extern _X_EXPORT void DRIDestroyInfoRec(DRIInfoPtr DRIInfo);
 
 extern _X_EXPORT Bool DRIFinishScreenInit(ScreenPtr pScreen);
 
-extern _X_EXPORT void DRIWakeupHandler(void *wakeupData,
-                                       int result, void *pReadmask);
+extern _X_EXPORT void DRIWakeupHandler(void *wakeupData, int result);
 
-extern _X_EXPORT void DRIBlockHandler(void *blockData,
-                                      OSTimePtr pTimeout, void *pReadmask);
+extern _X_EXPORT void DRIBlockHandler(void *blockData, void *timeout);
 
 extern _X_EXPORT void DRIDoWakeupHandler(ScreenPtr pScreen, int result);
 
diff --git a/hw/xnest/Handlers.c b/hw/xnest/Handlers.c
index 05d559d..e90a616 100644
--- a/hw/xnest/Handlers.c
+++ b/hw/xnest/Handlers.c
@@ -32,14 +32,14 @@ is" without express or implied warranty.
 #include "Handlers.h"
 
 void
-xnestBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadMask)
+xnestBlockHandler(void *blockData, void *timout)
 {
     xnestCollectExposures();
     XFlush(xnestDisplay);
 }
 
 void
-xnestWakeupHandler(void *blockData, int result, void *pReadMask)
+xnestWakeupHandler(void *blockData, int result)
 {
     xnestCollectEvents();
 }
diff --git a/hw/xnest/Handlers.h b/hw/xnest/Handlers.h
index d4ad6d2..6ebcc8b 100644
--- a/hw/xnest/Handlers.h
+++ b/hw/xnest/Handlers.h
@@ -15,8 +15,7 @@ is" without express or implied warranty.
 #ifndef XNESTHANDLERS_H
 #define XNESTHANDLERS_H
 
-void xnestBlockHandler(void *blockData, OSTimePtr pTimeout,
-                       void *pReadMask);
-void xnestWakeupHandler(void *blockData, int result, void *pReadMask);
+void xnestBlockHandler(void *blockData, void *timeout);
+void xnestWakeupHandler(void *blockData, int result);
 
 #endif                          /* XNESTHANDLERS_H */
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 685e352..8f0c7e4 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -443,7 +443,7 @@ wakeup_handler(void *data, int err)
 }
 
 static void
-block_handler(void *data)
+block_handler(void *data, void *timeout)
 {
     struct xwl_screen *xwl_screen = data;
     int ret;
diff --git a/include/dix.h b/include/dix.h
index 921156b..693d957 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -208,28 +208,28 @@ extern _X_EXPORT int AlterSaveSetForClient(ClientPtr /*client */ ,
 
 extern _X_EXPORT void DeleteWindowFromAnySaveSet(WindowPtr /*pWin */ );
 
-extern _X_EXPORT void BlockHandler(void *pTimeout,
-                                   void *pReadmask);
+extern _X_EXPORT void BlockHandler(void *timeout);
 
-extern _X_EXPORT void WakeupHandler(int result,
-                                    void *pReadmask);
+extern _X_EXPORT void WakeupHandler(int result);
 
 void
- EnableLimitedSchedulingLatency(void);
+EnableLimitedSchedulingLatency(void);
 
 void
- DisableLimitedSchedulingLatency(void);
+DisableLimitedSchedulingLatency(void);
 
-typedef void (*WakeupHandlerProcPtr) (void *blockData,
-                                      int result,
-                                      void *pReadmask);
+typedef void (*ServerBlockHandlerProcPtr) (void *blockData,
+                                           void *timeout);
 
-extern _X_EXPORT Bool RegisterBlockAndWakeupHandlers(BlockHandlerProcPtr blockHandler,
-                                                     WakeupHandlerProcPtr wakeupHandler,
+typedef void (*ServerWakeupHandlerProcPtr) (void *blockData,
+                                            int result);
+
+extern _X_EXPORT Bool RegisterBlockAndWakeupHandlers(ServerBlockHandlerProcPtr blockHandler,
+                                                     ServerWakeupHandlerProcPtr wakeupHandler,
                                                      void *blockData);
 
-extern _X_EXPORT void RemoveBlockAndWakeupHandlers(BlockHandlerProcPtr blockHandler,
-                                                   WakeupHandlerProcPtr wakeupHandler,
+extern _X_EXPORT void RemoveBlockAndWakeupHandlers(ServerBlockHandlerProcPtr blockHandler,
+                                                   ServerWakeupHandlerProcPtr wakeupHandler,
                                                    void *blockData);
 
 extern _X_EXPORT void InitBlockAndWakeupHandlers(void);
diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c
index 4716564..2ec0ae5 100644
--- a/miext/rootless/rootlessScreen.c
+++ b/miext/rootless/rootlessScreen.c
@@ -603,7 +603,7 @@ RootlessQueueRedisplay(ScreenPtr pScreen)
  *  on select().
  */
 static void
-RootlessBlockHandler(void *pbdata, OSTimePtr pTimeout, void *pReadmask)
+RootlessBlockHandler(void *pbdata, void *ptimeout)
 {
     ScreenPtr pScreen = pbdata;
     RootlessScreenRec *screenRec = SCREENREC(pScreen);
@@ -616,7 +616,7 @@ RootlessBlockHandler(void *pbdata, OSTimePtr pTimeout, void *pReadmask)
 }
 
 static void
-RootlessWakeupHandler(void *data, int i, void *LastSelectMask)
+RootlessWakeupHandler(void *data, int result)
 {
     // nothing here
 }
diff --git a/miext/shadow/shadow.c b/miext/shadow/shadow.c
index 0dd3604a..0759298 100644
--- a/miext/shadow/shadow.c
+++ b/miext/shadow/shadow.c
@@ -65,7 +65,7 @@ shadowRedisplay(ScreenPtr pScreen)
 }
 
 static void
-shadowBlockHandler(void *data, OSTimePtr pTimeout, void *pRead)
+shadowBlockHandler(void *data, void *timeout)
 {
     ScreenPtr pScreen = (ScreenPtr) data;
 
@@ -73,7 +73,7 @@ shadowBlockHandler(void *data, OSTimePtr pTimeout, void *pRead)
 }
 
 static void
-shadowWakeupHandler(void *data, int i, void *LastSelectMask)
+shadowWakeupHandler(void *data, int result)
 {
 }
 
diff --git a/os/WaitFor.c b/os/WaitFor.c
index 4a5efb7..1140be1 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -207,7 +207,7 @@ WaitForSomething(int *pClientsReady)
             XFD_COPYSET(&AllSockets, &LastSelectMask);
         }
 
-        BlockHandler((void *) &wt, (void *) &LastSelectMask);
+        BlockHandler(&wt);
         if (NewOutputPending)
             FlushAllOutput();
         /* keep this check close to select() call to minimize race */
@@ -222,7 +222,7 @@ WaitForSomething(int *pClientsReady)
             i = Select(MaxClients, &LastSelectMask, NULL, NULL, wt);
         }
         selecterr = GetErrno();
-        WakeupHandler(i, (void *) &LastSelectMask);
+        WakeupHandler(i);
         if (i <= 0) {           /* An error or timeout occurred */
             if (dispatchException)
                 return 0;
-- 
2.5.0



More information about the xorg-devel mailing list