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>
This commit is contained in:
parent
f933a1b38e
commit
6a121f5538
|
@ -810,15 +810,9 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
|
||||||
static int netlink_fd;
|
static int netlink_fd;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SELinuxBlockHandler(void *data, struct timeval **tv, void *read_mask)
|
SELinuxNetlinkNotify(int fd, int ready, void *data)
|
||||||
{
|
{
|
||||||
}
|
avc_netlink_check_nb();
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -844,9 +838,7 @@ SELinuxFlaskReset(void)
|
||||||
/* Tear down SELinux stuff */
|
/* Tear down SELinux stuff */
|
||||||
audit_close(audit_fd);
|
audit_close(audit_fd);
|
||||||
avc_netlink_release_fd();
|
avc_netlink_release_fd();
|
||||||
RemoveBlockAndWakeupHandlers(SELinuxBlockHandler, SELinuxWakeupHandler,
|
RemoveNotifyFd(netlink_fd);
|
||||||
NULL);
|
|
||||||
RemoveGeneralSocket(netlink_fd);
|
|
||||||
|
|
||||||
avc_destroy();
|
avc_destroy();
|
||||||
}
|
}
|
||||||
|
@ -918,9 +910,7 @@ SELinuxFlaskInit(void)
|
||||||
FatalError("SELinux: Failed to create atom\n");
|
FatalError("SELinux: Failed to create atom\n");
|
||||||
|
|
||||||
netlink_fd = avc_netlink_acquire_fd();
|
netlink_fd = avc_netlink_acquire_fd();
|
||||||
AddGeneralSocket(netlink_fd);
|
SetNotifyFd(netlink_fd, SELinuxNetlinkNotify, X_NOTIFY_READ, NULL);
|
||||||
RegisterBlockAndWakeupHandlers(SELinuxBlockHandler, SELinuxWakeupHandler,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
/* Register callbacks */
|
/* Register callbacks */
|
||||||
ret &= AddCallback(&ClientStateCallback, SELinuxClientState, NULL);
|
ret &= AddCallback(&ClientStateCallback, SELinuxClientState, NULL);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user