[PATCH xserver 13/23] Remove AddEnabledDevice and AddGeneralSocket APIs

Keith Packard keithp at keithp.com
Thu May 26 23:59:48 UTC 2016


All uses of these interfaces should instead be using the NotifyFd API
instead.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 include/os.h    |  8 --------
 os/WaitFor.c    |  4 +---
 os/connection.c | 43 ++++++++-----------------------------------
 3 files changed, 9 insertions(+), 46 deletions(-)

diff --git a/include/os.h b/include/os.h
index 20224f1..51400a9 100644
--- a/include/os.h
+++ b/include/os.h
@@ -143,14 +143,6 @@ extern _X_EXPORT void CheckConnections(void);
 
 extern _X_EXPORT void CloseDownConnection(ClientPtr /*client */ );
 
-extern _X_EXPORT void AddGeneralSocket(int /*fd */ );
-
-extern _X_EXPORT void RemoveGeneralSocket(int /*fd */ );
-
-extern _X_EXPORT void AddEnabledDevice(int /*fd */ );
-
-extern _X_EXPORT void RemoveEnabledDevice(int /*fd */ );
-
 typedef void (*NotifyFdProcPtr)(int fd, int ready, void *data);
 
 #define X_NOTIFY_NONE   0
diff --git a/os/WaitFor.c b/os/WaitFor.c
index 5793427..994edf0 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -153,7 +153,6 @@ WaitForSomething(int *pClientsReady)
     int curclient;
     int selecterr;
     static int nready;
-    fd_set devicesReadable;
     CARD32 now = 0;
     Bool someReady = FALSE;
     Bool someNotifyWriteReady = FALSE;
@@ -309,14 +308,13 @@ WaitForSomething(int *pClientsReady)
                 }
             }
 
-            XFD_ANDSET(&devicesReadable, &LastSelectMask, &EnabledDevices);
             XFD_ANDSET(&clientsReadable, &LastSelectMask, &AllClients);
 
             XFD_ANDSET(&tmp_set, &LastSelectMask, &NotifyReadFds);
             if (XFD_ANYSET(&tmp_set) || someNotifyWriteReady)
                 HandleNotifyFds();
 
-            if (XFD_ANYSET(&devicesReadable) || XFD_ANYSET(&clientsReadable))
+            if (XFD_ANYSET(&clientsReadable))
                 break;
             /* check here for DDXes that queue events during Block/Wakeup */
             if (*checkForInput[0] != *checkForInput[1])
diff --git a/os/connection.c b/os/connection.c
index 488672c..cfe641a 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -47,8 +47,8 @@ SOFTWARE.
  *  Stuff to create connections --- OS dependent
  *
  *      EstablishNewConnections, CreateWellKnownSockets, ResetWellKnownSockets,
- *      CloseDownConnection, CheckConnections, AddEnabledDevice,
- *	RemoveEnabledDevice, OnlyListToOneClient,
+ *      CloseDownConnection, CheckConnections
+ *	OnlyListToOneClient,
  *      ListenToAllClients,
  *
  *      (WaitForSomething is in its own file)
@@ -121,7 +121,6 @@ SOFTWARE.
 
 static int lastfdesc;           /* maximum file descriptor */
 
-fd_set EnabledDevices;          /* mask for input devices that are on */
 fd_set NotifyReadFds;           /* mask for other file descriptors */
 fd_set NotifyWriteFds;          /* mask for other write file descriptors */
 fd_set AllSockets;              /* select on this */
@@ -1043,36 +1042,6 @@ CloseDownConnection(ClientPtr client)
         AuditF("client %d disconnected\n", client->index);
 }
 
-void
-AddGeneralSocket(int fd)
-{
-    FD_SET(fd, &AllSockets);
-    if (GrabInProgress)
-        FD_SET(fd, &SavedAllSockets);
-}
-
-void
-AddEnabledDevice(int fd)
-{
-    FD_SET(fd, &EnabledDevices);
-    AddGeneralSocket(fd);
-}
-
-void
-RemoveGeneralSocket(int fd)
-{
-    FD_CLR(fd, &AllSockets);
-    if (GrabInProgress)
-        FD_CLR(fd, &SavedAllSockets);
-}
-
-void
-RemoveEnabledDevice(int fd)
-{
-    FD_CLR(fd, &EnabledDevices);
-    RemoveGeneralSocket(fd);
-}
-
 struct notify_fd {
     struct xorg_list list;
     int fd;
@@ -1130,9 +1099,13 @@ SetNotifyFd(int fd, NotifyFdProcPtr notify, int mask, void *data)
     if (changes & X_NOTIFY_READ) {
         if (mask & X_NOTIFY_READ) {
             FD_SET(fd, &NotifyReadFds);
-            AddGeneralSocket(fd);
+            FD_SET(fd, &AllSockets);
+            if (GrabInProgress)
+                FD_SET(fd, &SavedAllSockets);
         } else {
-            RemoveGeneralSocket(fd);
+            FD_CLR(fd, &AllSockets);
+            if (GrabInProgress)
+                FD_CLR(fd, &SavedAllSockets);
             FD_CLR(fd, &NotifyReadFds);
         }
     }
-- 
2.8.0.rc3



More information about the xorg-devel mailing list