Xserver 1.19 question about poll and Unix domain sockets
David Shao
davshao at gmail.com
Sat Nov 19 12:47:55 PST 2016
This patch is for pkgsrc. Something very similar should work for
ports. The wakeup_handler() now does nothing.
Instead a new callback devdInputHandlerNotify() using the same code
that used to be called from wakeup_handler(),
minus checking the fd_set, is provided to SetNotifyFd. Tested with
xf86-video-ati 7.8.0.
--- x11/modular-xorg-server.prev/patches/patch-config_devd.c
2015-07-29 21:59:49.000000000 -0700
+++ x11/modular-xorg-server/patches/patch-config_devd.c 2016-11-19
09:38:00.826168000 -0800
@@ -1,8 +1,8 @@
$NetBSD$
---- config/devd.c.orig 2015-07-30 04:46:21.648387000 +0000
+--- config/devd.c.orig 2016-11-19 17:36:01.195812000 +0000
+++ config/devd.c
-@@ -0,0 +1,535 @@
+@@ -0,0 +1,564 @@
+/*
+ * Copyright (c) 2012 Baptiste Daroussin
+ * Copyright (c) 2013, 2014 Alex Kozlov
@@ -349,11 +349,14 @@
+disconnect_devd(int sock)
+{
+ if (sock >= 0) {
-+ RemoveGeneralSocket(sock);
++ RemoveNotifyFd(sock);
+ close(sock);
+ }
+}
+
++static void
++devdInputHandlerNotify(int sock, int read, void *data);
++
+static int
+connect_devd(void)
+{
@@ -375,7 +378,7 @@
+ return -1;
+ }
+
-+ AddGeneralSocket(sock);
++ SetNotifyFd(sock, devdInputHandlerNotify, X_NOTIFY_READ, NULL);
+
+ return sock;
+}
@@ -450,15 +453,15 @@
+}
+
+static void
-+wakeup_handler(void *data, int err, void *read_mask)
++wakeup_handler(void *data, int err)
+{
++/*
+ char *line = NULL;
+ char *walk;
+
+ if (err < 0)
+ return;
+
-+ if (FD_ISSET(sock_devd, (fd_set *) read_mask)) {
+ if (socket_getline(sock_devd, &line) < 0)
+ return;
+
@@ -477,11 +480,37 @@
+ break;
+ }
+ free(line);
++*/
++}
++
++static void
++devdInputHandlerNotify(int sock, int read, void *data)
++{
++ char *line = NULL;
++ char *walk;
++
++ if (socket_getline(sock, &line) < 0)
++ return;
++
++ walk = strchr(line + 1, ' ');
++ if (walk != NULL)
++ walk[0] = '\0';
++
++ switch (*line) {
++ case DEVD_EVENT_ADD:
++ device_added(line + 1);
++ break;
++ case DEVD_EVENT_REMOVE:
++ device_removed(line + 1);
++ break;
++ default:
++ break;
+ }
++ free(line);
+}
+
+static void
-+block_handler(void *data, struct timeval **tv, void *read_mask)
++block_handler(void *data, struct timeval **tv)
+{
+}
+
More information about the Users
mailing list