selinux_set_callback(3) — Linux manual page


selinux_set_callback(3)   SELinux API documentation  selinux_set_callback(3)

NAME         top

       selinux_set_callback - userspace SELinux callback facilities

SYNOPSIS         top

       #include <selinux/selinux.h>

       void selinux_set_callback(int type, union selinux_callback callback);

DESCRIPTION         top

       selinux_set_callback() sets the callback indicated by type to the
       value of callback, which should be passed as a function pointer cast
       to type union selinux_callback.

       All callback functions should return a negative value with errno set
       appropriately on error.

       The available values for type are:

              int (*func_log) (int type, const char *fmt, ...);

              This callback is used for logging and should process the
              printf(3) style fmt string and arguments as appropriate.  The
              type argument indicates the type of message and will be set to
              one of the following:





              int (*func_audit) (void *auditdata, security_class_t cls,
                                 char *msgbuf, size_t msgbufsize);

              This callback is used for supplemental auditing in AVC
              messages.  The auditdata and cls arguments are the values
              passed to avc_has_perm(3).  A human-readable interpretation
              should be printed to msgbuf using no more than msgbufsize

              int (*func_validate) (char **ctx);

              This callback is used for context validation.  The callback
              may optionally modify the input context by setting the target
              of the ctx pointer to a new context.  In this case, the old
              value should be freed with freecon(3).  The value of errno
              should be set to EINVAL to indicate an invalid context.

              int (*func_setenforce) (int enforcing);

              This callback is invoked when the system enforcing state
              changes.  The enforcing argument indicates the new value and
              is set to 1 for enforcing mode, and 0 for permissive mode.

              int (*func_policyload) (int seqno);

              This callback is invoked when the system security policy is
              reloaded.  The seqno argument is the current sequential number
              of the policy generation in the system.

RETURN VALUE         top


ERRORS         top


AUTHOR         top

       Eamon Walsh <>

SEE ALSO         top

       selabel_open(3), avc_init(3), avc_netlink_open(3), selinux(8)

COLOPHON         top

       This page is part of the selinux (Security-Enhanced Linux user-space
       libraries and tools) project.  Information about the project can be
       found at ⟨⟩.  If you
       have a bug report for this manual page, see
       ⟨⟩.  This
       page was obtained from the project's upstream Git repository
       ⟨⟩ on 2020-07-14.  (At that
       time, the date of the most recent commit that was found in the repos‐
       itory was 2020-07-10.)  If you discover any rendering problems in
       this HTML version of the page, or you believe there is a better or
       more up-to-date source for the page, or you have corrections or
       improvements to the information in this COLOPHON (which is not part
       of the original manual page), send a mail to

                                 20 Jun 2007         selinux_set_callback(3)

Pages that refer to this page: avc_audit(3)avc_cleanup(3)avc_destroy(3)avc_entry_ref_init(3)avc_has_perm(3)avc_has_perm_noaudit(3)avc_init(3)avc_netlink_acquire_fd(3)avc_netlink_check_nb(3)avc_netlink_close(3)avc_netlink_loop(3)avc_netlink_open(3)avc_netlink_release_fd(3)avc_open(3)avc_reset(3)checkpasswdaccess(3)checkPasswdAccess(3)security_compute_av(3)security_compute_av_flags(3)security_compute_av_flags_raw(3)security_compute_av_raw(3)security_compute_create(3)security_compute_create_name(3)security_compute_create_name_raw(3)security_compute_create_raw(3)security_compute_member(3)security_compute_member_raw(3)security_compute_relabel(3)security_compute_relabel_raw(3)security_compute_user(3)security_compute_user_raw(3)security_get_initial_context(3)security_get_initial_context_raw(3)security_validatetrans(3)selabel_close(3)selabel_lookup(3)selabel_lookup_best_match(3)selabel_lookup_best_match_raw(3)selabel_lookup_raw(3)selabel_open(3)selabel_partial_match(3)selabel_stats(3)selinux_check_access(3)selinux_check_passwd_access(3)selinux_restorecon(3)selinux_restorecon_xattr(3)selinux_set_mapping(3)file_contexts(5)file_contexts.homedirs(5)file_contexts.local(5)file_contexts.subs(5)file_contexts.subs_dist(5)media(5)selabel_db(5)selabel_file(5)selabel_media(5)selabel_x(5)sepgsql_contexts(5)x_contexts(5)