#include <selinux/avc.h>
int avc_netlink_open(int blocking);
void avc_netlink_close(void);
int avc_netlink_acquire_fd(void);
void avc_netlink_release_fd(void);
void avc_netlink_loop(void);
int avc_netlink_check_nb(void);
avc_netlink_open opens a netlink socket to receive SELinux notifications. The socket descriptor is stored internally; use avc_netlink_acquire_fd(3) to take ownership of it in application code. The blocking argument specifies whether read operations on the socket will block. avc_open(3) calls this function internally, specifying non-blocking behavior (unless threading callbacks were explicitly set using the deprecated avc_init(3) interface, in which case blocking behavior is set).
avc_netlink_close closes the netlink socket. This function is called automatically by avc_destroy(3).
avc_netlink_acquire_fd returns the netlink socket descriptor number and informs the userspace AVC not to check the socket descriptor automatically on calls to avc_has_perm(3).
avc_netlink_release_fd returns control of the netlink socket to the userspace AVC, re-enabling automatic processing of notifications.
avc_netlink_check_nb checks the netlink socket for pending messages and processes them. Callbacks for policyload and enforcing changes will be called; see selinux_set_callback(3). This function does not block unless avc_netlink_open(3) specified blocking behavior.
avc_netlink_loop enters a loop blocking on the netlink socket and processing messages as they are received. This function will not return unless an error occurs on the socket, in which case the socket is closed.