summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2015-11-11 22:02:13 -0800
committerAdam Jackson <ajax@redhat.com>2015-12-01 13:55:56 -0500
commit6a121f55381ecbb9cdaaef36ba6135890f3e006f (patch)
tree4c8d3f16eb927d230c18e24d03e5ac22917d0094
parentf933a1b38ed1c65cc39fce1ee37aa18e3022c3f0 (diff)
Xext/xselinux: Use NotifyFd interface
Replace block/wakeup handlers with SetNotifyFd. Much nicer now. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--Xext/xselinux_hooks.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/Xext/xselinux_hooks.c b/Xext/xselinux_hooks.c
index d9f2f681b..2d85928f5 100644
--- a/Xext/xselinux_hooks.c
+++ b/Xext/xselinux_hooks.c
@@ -810,15 +810,9 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
static int netlink_fd;
static void
-SELinuxBlockHandler(void *data, struct timeval **tv, void *read_mask)
+SELinuxNetlinkNotify(int fd, int ready, void *data)
{
-}
-
-static void
-SELinuxWakeupHandler(void *data, int num_fds, void *read_mask)
-{
- if (num_fds > 0 && FD_ISSET(netlink_fd, (fd_set *) read_mask))
- avc_netlink_check_nb();
+ avc_netlink_check_nb();
}
void
@@ -844,9 +838,7 @@ SELinuxFlaskReset(void)
/* Tear down SELinux stuff */
audit_close(audit_fd);
avc_netlink_release_fd();
- RemoveBlockAndWakeupHandlers(SELinuxBlockHandler, SELinuxWakeupHandler,
- NULL);
- RemoveGeneralSocket(netlink_fd);
+ RemoveNotifyFd(netlink_fd);
avc_destroy();
}
@@ -918,9 +910,7 @@ SELinuxFlaskInit(void)
FatalError("SELinux: Failed to create atom\n");
netlink_fd = avc_netlink_acquire_fd();
- AddGeneralSocket(netlink_fd);
- RegisterBlockAndWakeupHandlers(SELinuxBlockHandler, SELinuxWakeupHandler,
- NULL);
+ SetNotifyFd(netlink_fd, SELinuxNetlinkNotify, X_NOTIFY_READ, NULL);
/* Register callbacks */
ret &= AddCallback(&ClientStateCallback, SELinuxClientState, NULL);