2009-04-08 01:47:52 +00:00
|
|
|
.\" Hey Emacs! This file is -*- nroff -*- source.
|
|
|
|
.\"
|
|
|
|
.\" Author: KaiGai Kohei (kaigai@ak.jp.nec.com) 2009
|
|
|
|
.TH "avc_netlink_loop" "3" "30 Mar 2009" "" "SELinux API documentation"
|
|
|
|
.SH "NAME"
|
|
|
|
avc_netlink_open, avc_netlink_close, avc_netlink_acquire_fd,
|
|
|
|
avc_netlink_release_fd, avc_netlink_check_nb, avc_netlink_loop \- SELinux
|
2012-11-13 20:15:34 +00:00
|
|
|
netlink processing
|
|
|
|
.
|
2009-04-08 01:47:52 +00:00
|
|
|
.SH "SYNOPSIS"
|
|
|
|
.B #include <selinux/selinux.h>
|
2012-11-13 20:15:34 +00:00
|
|
|
.br
|
2009-04-08 01:47:52 +00:00
|
|
|
.B #include <selinux/avc.h>
|
|
|
|
.sp
|
|
|
|
.BI "int avc_netlink_open(int " blocking ");"
|
|
|
|
.sp
|
2012-11-13 20:15:34 +00:00
|
|
|
.B void avc_netlink_close(void);
|
2009-04-08 01:47:52 +00:00
|
|
|
.sp
|
2012-11-13 20:15:34 +00:00
|
|
|
.B int avc_netlink_acquire_fd(void);
|
2009-04-08 01:47:52 +00:00
|
|
|
.sp
|
2012-11-13 20:15:34 +00:00
|
|
|
.B void avc_netlink_release_fd(void);
|
2009-04-08 01:47:52 +00:00
|
|
|
.sp
|
2012-11-13 20:15:34 +00:00
|
|
|
.B void avc_netlink_loop(void);
|
2009-04-08 01:47:52 +00:00
|
|
|
.sp
|
2012-11-13 20:15:34 +00:00
|
|
|
.B int avc_netlink_check_nb(void);
|
|
|
|
.
|
2009-04-08 01:47:52 +00:00
|
|
|
.SH "DESCRIPTION"
|
|
|
|
These functions enable applications to handle notification of SELinux events
|
|
|
|
via netlink. The userspace AVC normally checks for netlink messages on each
|
|
|
|
call to
|
|
|
|
.BR avc_has_perm (3).
|
|
|
|
Applications may wish to override this behavior and check for notification
|
|
|
|
separately, for example in a
|
|
|
|
.BR select (2)
|
|
|
|
loop. These functions also permit netlink monitoring without requiring a
|
|
|
|
call to
|
|
|
|
.BR avc_open (3).
|
|
|
|
|
2012-11-13 20:15:34 +00:00
|
|
|
.BR avc_netlink_open ()
|
2009-04-08 01:47:52 +00:00
|
|
|
opens a netlink socket to receive SELinux notifications. The socket
|
|
|
|
descriptor is stored internally; use
|
|
|
|
.BR avc_netlink_acquire_fd (3)
|
|
|
|
to take ownership of it in application code. The
|
|
|
|
.I blocking
|
2010-02-26 20:18:38 +00:00
|
|
|
argument controls whether the O_NONBLOCK flag is set on the socket descriptor.
|
2009-04-08 01:47:52 +00:00
|
|
|
.BR avc_open (3)
|
2010-02-26 20:18:38 +00:00
|
|
|
calls this function internally, specifying non-blocking behavior.
|
2009-04-08 01:47:52 +00:00
|
|
|
|
2012-11-13 20:15:34 +00:00
|
|
|
.BR avc_netlink_close ()
|
2009-04-08 01:47:52 +00:00
|
|
|
closes the netlink socket. This function is called automatically by
|
|
|
|
.BR avc_destroy (3).
|
|
|
|
|
2012-11-13 20:15:34 +00:00
|
|
|
.BR avc_netlink_acquire_fd ()
|
2009-04-08 01:47:52 +00:00
|
|
|
returns the netlink socket descriptor number and informs the userspace AVC
|
|
|
|
not to check the socket descriptor automatically on calls to
|
|
|
|
.BR avc_has_perm (3).
|
|
|
|
|
2012-11-13 20:15:34 +00:00
|
|
|
.BR avc_netlink_release_fd ()
|
2009-04-08 01:47:52 +00:00
|
|
|
returns control of the netlink socket to the userspace AVC, re-enabling
|
|
|
|
automatic processing of notifications.
|
|
|
|
|
2012-11-13 20:15:34 +00:00
|
|
|
.BR avc_netlink_check_nb ()
|
2009-04-08 01:47:52 +00:00
|
|
|
checks the netlink socket for pending messages and processes them.
|
|
|
|
Callbacks for policyload and enforcing changes will be called;
|
|
|
|
see
|
|
|
|
.BR selinux_set_callback (3).
|
2010-02-26 20:18:38 +00:00
|
|
|
This function does not block.
|
2009-04-08 01:47:52 +00:00
|
|
|
|
2012-11-13 20:15:34 +00:00
|
|
|
.BR avc_netlink_loop ()
|
2009-04-08 01:47:52 +00:00
|
|
|
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.
|
2012-11-13 20:15:34 +00:00
|
|
|
.
|
2009-04-08 01:47:52 +00:00
|
|
|
.SH "RETURN VALUE"
|
2012-11-13 20:15:34 +00:00
|
|
|
.BR avc_netlink_acquire_fd ()
|
2009-04-08 01:47:52 +00:00
|
|
|
returns a non-negative file descriptor number on success. Other functions
|
2012-11-13 20:15:34 +00:00
|
|
|
with a return value return zero on success. On error, \-1 is returned and
|
2009-04-08 01:47:52 +00:00
|
|
|
.I errno
|
|
|
|
is set appropriately.
|
2012-11-13 20:15:34 +00:00
|
|
|
.
|
2009-04-08 01:47:52 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR avc_open (3),
|
|
|
|
.BR selinux_set_callback (3),
|
|
|
|
.BR selinux (8)
|