1selinux_set_callback(3) SELinux API documentation selinux_set_callback(3)
2
3
4
6 selinux_set_callback - userspace SELinux callback facilities.
7
9 #include <selinux/selinux.h>
10
11 void selinux_set_callback(int type, union selinux_callback callback);
12
13
15 selinux_set_callback sets the callback indicated by type to the value
16 of callback, which should be passed as a function pointer cast to type
17 union selinux_callback.
18
19 All callback functions should return a negative value with errno set
20 appropriately on error.
21
22 The available values for type are:
23
24 SELINUX_CB_LOG
25 int (*func_log) (int type, const char *fmt, ...);
26
27 This callback is used for logging and should process the
28 printf(3) style fmt string and arguments as appropriate. The
29 type argument indicates the type of message and will be set to
30 one of the following:
31
32 SELINUX_ERROR
33
34 SELINUX_WARNING
35
36 SELINUX_INFO
37
38 SELINUX_AVC
39
40
41 SELINUX_CB_AUDIT
42 int (*func_audit) (void *auditdata, security_class_t cls,
43 char *msgbuf, size_t msgbufsize);
44
45 This callback is used for supplemental auditing in AVC messages.
46 The auditdata and cls arguments are the values passed to
47 avc_has_perm(3). A human-readable interpretation should be
48 printed to msgbuf using no more than msgbufsize characters.
49
50
51 SELINUX_CB_VALIDATE
52 int (*func_validate) (security_context_t *ctx);
53
54 This callback is used for context validation. The callback may
55 optionally modify the input context by setting the target of the
56 ctx pointer to a new context. In this case, the old value
57 should be freed with freecon(3). The value of errno should be
58 set to EINVAL to indicate an invalid context.
59
60
61 SELINUX_CB_SETENFORCE
62 int (*func_setenforce) (int enforcing);
63
64 This callback is invoked when the system enforcing state
65 changes. The enforcing argument indicates the new value and is
66 set to 1 for enforcing mode, and 0 for permissive mode.
67
68
69 SELINUX_CB_POLICYLOAD
70 int (*func_policyload) (int seqno);
71
72 This callback is invoked when the system security policy is
73 reloaded. The seqno argument is the current sequential number
74 of the policy generation in the system.
75
76
78 None.
79
80
82 None.
83
84
86 Eamon Walsh <ewalsh@tycho.nsa.gov>
87
88
90 selabel_open(3), avc_init(3), avc_netlink_open(3), selinux(8)
91
92
93
94
95 20 Jun 2007 selinux_set_callback(3)