• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * This file describes the callbacks passed to selinux_init() and available
3  * for use from the library code.  They all have default implementations.
4  */
5 #ifndef _SELINUX_CALLBACKS_H_
6 #define _SELINUX_CALLBACKS_H_
7 
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include <selinux/selinux.h>
12 
13 #include "selinux_internal.h"
14 
15 /* callback pointers */
16 extern int __attribute__ ((format(printf, 2, 3)))
17 (*selinux_log_direct) (int type, const char *, ...) ;
18 
19 extern int
20 (*selinux_audit) (void *, security_class_t, char *, size_t) ;
21 
22 extern int
23 (*selinux_validate)(char **ctx) ;
24 
25 extern int
26 (*selinux_netlink_setenforce) (int enforcing) ;
27 
28 extern int
29 (*selinux_netlink_policyload) (int seqno) ;
30 
31 /* Thread-safe selinux_log() function */
32 extern pthread_mutex_t log_mutex;
33 
34 #define selinux_log(type, ...) do { \
35 	__pthread_mutex_lock(&log_mutex); \
36 	selinux_log_direct(type, __VA_ARGS__); \
37 	__pthread_mutex_unlock(&log_mutex); \
38 } while(0)
39 
40 #endif				/* _SELINUX_CALLBACKS_H_ */
41