void selinux_set_callback(int type, union selinux_callback callback);
All callback functions should return a negative value with errno set appropriately on error.
The available values for type are:
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:
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 characters.
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.
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.
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.