From bf920b2390dc27947f87dd0b228518290a5ed85d Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 11 Nov 2015 22:02:06 -0800 Subject: config: Use NotifyFd for dbus interface This uses the NotifyFd interface to monitor the dbus socket rather than a block/wakeup handler. Reviewed-by: Adam Jackson Signed-off-by: Keith Packard --- config/dbus-core.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/config/dbus-core.c b/config/dbus-core.c index 8351ea4b3..3c85ad788 100644 --- a/config/dbus-core.c +++ b/config/dbus-core.c @@ -48,11 +48,11 @@ static struct dbus_core_info bus_info; static CARD32 reconnect_timer(OsTimerPtr timer, CARD32 time, void *arg); static void -wakeup_handler(void *data, int num_fds, void *read_mask) +socket_handler(int fd, int ready, void *data) { struct dbus_core_info *info = data; - if (info->connection && num_fds > 0 && FD_ISSET(info->fd, (fd_set *) read_mask)) { + if (info->connection) { do { dbus_connection_read_write_dispatch(info->connection, 0); } while (info->connection && @@ -62,11 +62,6 @@ wakeup_handler(void *data, int num_fds, void *read_mask) } } -static void -block_handler(void *data, struct timeval **tv, void *read_mask) -{ -} - /** * Disconnect (if we haven't already been forcefully disconnected), clean up * after ourselves, and call all registered disconnect hooks. @@ -87,9 +82,8 @@ teardown(void) if (bus_info.connection) dbus_connection_unref(bus_info.connection); - RemoveBlockAndWakeupHandlers(block_handler, wakeup_handler, &bus_info); if (bus_info.fd != -1) - RemoveGeneralSocket(bus_info.fd); + RemoveNotifyFd(bus_info.fd); bus_info.fd = -1; bus_info.connection = NULL; @@ -162,9 +156,7 @@ connect_to_bus(void) } dbus_error_free(&error); - AddGeneralSocket(bus_info.fd); - - RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, &bus_info); + SetNotifyFd(bus_info.fd, socket_handler, X_NOTIFY_READ, &bus_info); for (hook = bus_info.hooks; hook; hook = hook->next) { if (hook->connect) -- cgit v1.2.3