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

NAME

6       selinux_set_callback - userspace SELinux callback facilities
7

SYNOPSIS

9       #include <selinux/selinux.h>
10
11       void selinux_set_callback(int type, union selinux_callback callback);
12

DESCRIPTION

14       selinux_set_callback() sets the callback indicated by type to the value
15       of callback, which should be passed as a function pointer cast to  type
16       union selinux_callback.
17
18       All  callback  functions  should return a negative value with errno set
19       appropriately on error.
20
21       The available values for type are:
22
23       SELINUX_CB_LOG
24              int (*func_log) (int type, const char *fmt, ...);
25
26              This callback  is  used  for  logging  and  should  process  the
27              printf(3)  style  fmt  string and arguments as appropriate.  The
28              type argument indicates the type of message and will be  set  to
29              one of the following:
30
31              SELINUX_ERROR
32
33              SELINUX_WARNING
34
35              SELINUX_INFO
36
37              SELINUX_AVC
38
39       SELINUX_CB_AUDIT
40              int (*func_audit) (void *auditdata, security_class_t cls,
41                                 char *msgbuf, size_t msgbufsize);
42
43              This callback is used for supplemental auditing in AVC messages.
44              The auditdata  and  cls  arguments  are  the  values  passed  to
45              avc_has_perm(3).   A  human-readable  interpretation  should  be
46              printed to msgbuf using no more than msgbufsize characters.
47
48       SELINUX_CB_VALIDATE
49              int (*func_validate) (char **ctx);
50
51              This callback is used for context validation.  The callback  may
52              optionally modify the input context by setting the target of the
53              ctx pointer to a new context.   In  this  case,  the  old  value
54              should  be  freed with freecon(3).  The value of errno should be
55              set to EINVAL to indicate an invalid context.
56
57       SELINUX_CB_SETENFORCE
58              int (*func_setenforce) (int enforcing);
59
60              This  callback  is  invoked  when  the  system  enforcing  state
61              changes.   The enforcing argument indicates the new value and is
62              set to 1 for enforcing mode, and 0 for permissive mode.
63
64       SELINUX_CB_POLICYLOAD
65              int (*func_policyload) (int seqno);
66
67              This callback is invoked when  the  system  security  policy  is
68              reloaded.   The  seqno argument is the current sequential number
69              of the policy generation in the system.
70

RETURN VALUE

72       None.
73

ERRORS

75       None.
76

AUTHOR

78       Eamon Walsh <ewalsh@tycho.nsa.gov>
79

SEE ALSO

81       selabel_open(3), avc_init(3), avc_netlink_open(3), selinux(8)
82
83
84
85                                  20 Jun 2007          selinux_set_callback(3)
Impressum