• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _SELINUX_ANDROID_H_
2 #define _SELINUX_ANDROID_H_
3 
4 #include <stdbool.h>
5 #include <sys/types.h>
6 #include <unistd.h>
7 
8 #include <selinux/label.h>
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 extern struct selabel_handle* selinux_android_file_context_handle(void);
15 
16 extern struct selabel_handle* selinux_android_service_context_handle(void);
17 
18 extern void selinux_android_set_sehandle(const struct selabel_handle *hndl);
19 
20 extern int selinux_android_load_policy(void);
21 
22 extern int selinux_android_reload_policy(void);
23 
24 extern int selinux_android_setcontext(uid_t uid,
25 				      int isSystemServer,
26 				      const char *seinfo,
27 				      const char *name);
28 
29 extern int selinux_android_setfilecon(const char *pkgdir,
30 				       const char *pkgname,
31 				       const char *seinfo,
32 				       uid_t uid);
33 
34 extern int selinux_log_callback(int type, const char *fmt, ...)
35     __attribute__ ((format(printf, 2, 3)));
36 
37 #define SELINUX_ANDROID_RESTORECON_NOCHANGE 1
38 #define SELINUX_ANDROID_RESTORECON_VERBOSE  2
39 #define SELINUX_ANDROID_RESTORECON_RECURSE  4
40 #define SELINUX_ANDROID_RESTORECON_FORCE    8
41 #define SELINUX_ANDROID_RESTORECON_DATADATA 16
42 extern int selinux_android_restorecon(const char *file, unsigned int flags);
43 
44 extern int selinux_android_restorecon_pkgdir(const char *pkgdir,
45                                              const char *seinfo,
46                                              uid_t uid,
47                                              unsigned int flags);
48 
49 extern int selinux_android_seapp_context_reload(void);
50 
51 extern bool selinux_android_use_data_policy(void);
52 
53 #ifdef __cplusplus
54 }
55 #endif
56 #endif
57