1avc_netlink_loop(3)        SELinux API documentation       avc_netlink_loop(3)
2
3
4

NAME

6       avc_netlink_open,       avc_netlink_close,      avc_netlink_acquire_fd,
7       avc_netlink_release_fd,   avc_netlink_check_nb,   avc_netlink_loop    -
8       SELinux netlink processing.
9

SYNOPSIS

11       #include <selinux/selinux.h>
12
13       #include <selinux/avc.h>
14
15       int avc_netlink_open(int blocking);
16
17       void avc_netlink_close(void);
18
19       int avc_netlink_acquire_fd(void);
20
21       void avc_netlink_release_fd(void);
22
23       void avc_netlink_loop(void);
24
25       int avc_netlink_check_nb(void);
26
27

DESCRIPTION

29       These  functions  enable applications to handle notification of SELinux
30       events via netlink.  The userspace AVC normally checks for netlink mes‐
31       sages  on each call to avc_has_perm(3).  Applications may wish to over‐
32       ride this behavior and check for notification separately,  for  example
33       in  a  select(2)  loop.  These functions also permit netlink monitoring
34       without requiring a call to avc_open(3).
35
36       avc_netlink_open opens a netlink socket to  receive  SELinux  notifica‐
37       tions.     The    socket   descriptor   is   stored   internally;   use
38       avc_netlink_acquire_fd(3) to take ownership of it in application  code.
39       The  blocking  argument  controls whether the O_NONBLOCK flag is set on
40       the socket descriptor.  avc_open(3)  calls  this  function  internally,
41       specifying non-blocking behavior.
42
43       avc_netlink_close  closes  the netlink socket.  This function is called
44       automatically by avc_destroy(3).
45
46       avc_netlink_acquire_fd returns the netlink socket descriptor number and
47       informs  the userspace AVC not to check the socket descriptor automati‐
48       cally on calls to avc_has_perm(3).
49
50       avc_netlink_release_fd returns control of the  netlink  socket  to  the
51       userspace AVC, re-enabling automatic processing of notifications.
52
53       avc_netlink_check_nb checks the netlink socket for pending messages and
54       processes them.  Callbacks for policyload and enforcing changes will be
55       called; see selinux_set_callback(3).  This function does not block.
56
57       avc_netlink_loop  enters a loop blocking on the netlink socket and pro‐
58       cessing messages as they are received.  This function will  not  return
59       unless  an  error  occurs  on  the  socket, in which case the socket is
60       closed.
61
62

RETURN VALUE

64       avc_netlink_acquire_fd returns a non-negative file descriptor number on
65       success.   Other  functions with a return value return zero on success.
66       On error, -1 is returned and errno is set appropriately.
67
68

SEE ALSO

70       avc_open(3), selinux_set_callback(3), selinux(8)
71
72
73
74                                  30 Mar 2009              avc_netlink_loop(3)
Impressum