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

Keith Packard keithp at keithp.com
Wed May 18 21:51:53 UTC 2016


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/dmx/dmxsync.c                |  4 ++--
 hw/dmx/input/dmxinputinit.c     |  4 ++--
 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          |  4 ++--
 include/dix.h                   | 26 +++++++++++++-------------
 miext/rootless/rootlessScreen.c |  4 ++--
 miext/shadow/shadow.c           |  4 ++--
 os/WaitFor.c                    |  4 ++--
 20 files changed, 67 insertions(+), 75 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 4c59fea..323b9db 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -2556,8 +2556,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;
@@ -2582,8 +2582,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();
@@ -2658,7 +2658,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);
@@ -2751,7 +2751,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 d357820..53a7a36 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 *pTimeout)
 {
     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, pTimeout);
+
     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/dmx/dmxsync.c b/hw/dmx/dmxsync.c
index 81dbbc6..1bc2423 100644
--- a/hw/dmx/dmxsync.c
+++ b/hw/dmx/dmxsync.c
@@ -99,13 +99,13 @@ dmxSyncCallback(OsTimerPtr timer, CARD32 time, void *arg)
 }
 
 static void
-dmxSyncBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadMask)
+dmxSyncBlockHandler(void *blockData, void *timeout)
 {
     TimerForce(dmxSyncTimer);
 }
 
 static void
-dmxSyncWakeupHandler(void *blockData, int result, void *pReadMask)
+dmxSyncWakeupHandler(void *blockData, int result)
 {
 }
 
diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index cdefd9a..e10e426 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -633,7 +633,7 @@ dmxCollectAll(DMXInputInfo * dmxInput)
 }
 
 static void
-dmxBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadMask)
+dmxBlockHandler(void *blockData, void *timeout)
 {
     DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t) blockData];
     static unsigned long generation = 0;
@@ -662,7 +662,7 @@ dmxSwitchReturn(void *p)
 }
 
 static void
-dmxWakeupHandler(void *blockData, int result, void *pReadMask)
+dmxWakeupHandler(void *blockData, int result)
 {
     DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t) blockData];
     int i;
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index 2e7c86c..1a410ca 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -337,7 +337,7 @@ ephyrInternalDamageRedisplay(ScreenPtr pScreen)
 }
 
 static void
-ephyrInternalDamageBlockHandler(void *data, OSTimePtr pTimeout, void *pRead)
+ephyrInternalDamageBlockHandler(void *data, void *timeout)
 {
     ScreenPtr pScreen = (ScreenPtr) data;
 
@@ -345,7 +345,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 01bb631..d7bfd70 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -471,7 +471,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;
 
@@ -492,7 +492,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 6f8d763..b12766f 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 c5aeb16..36d448d 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -871,7 +871,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 81f7294..c1f8a18 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -137,7 +137,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 b62b232..6e7283c 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -1605,7 +1605,7 @@ DRIDestroyInfoRec(DRIInfoPtr DRIInfo)
 }
 
 void
-DRIWakeupHandler(void *wakeupData, int result, void *pReadmask)
+DRIWakeupHandler(void *wakeupData, int result)
 {
     int i;
 
@@ -1619,7 +1619,7 @@ DRIWakeupHandler(void *wakeupData, int result, void *pReadmask)
 }
 
 void
-DRIBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadmask)
+DRIBlockHandler(void *blockData, void *pTimeout)
 {
     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 151e044..8323453 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -477,12 +477,12 @@ socket_handler(int fd, int ready, void *data)
 }
 
 static void
-wakeup_handler(void *data, int err, void *pRead)
+wakeup_handler(void *data, int err)
 {
 }
 
 static void
-block_handler(void *data, OSTimePtr pTimeout, void *pRead)
+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 f63606a..ae9719a 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 e839d61..5793427 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -208,7 +208,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 */
@@ -223,7 +223,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.8.0.rc3



More information about the xorg-devel mailing list