summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2015-11-11 22:02:06 -0800
committerAdam Jackson <ajax@redhat.com>2015-12-01 13:55:13 -0500
commitbf920b2390dc27947f87dd0b228518290a5ed85d (patch)
tree7a37ec4121e879fa6eb31dfc337d303a30395599 /config
parent91ea0965dd4dfeba0a914c47ad4a64768e983b1b (diff)
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 <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'config')
-rw-r--r--config/dbus-core.c16
1 files 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)