2018-09-27 00:09:59 -04:00
|
|
|
#pragma once
|
|
|
|
|
2019-03-15 06:17:37 -04:00
|
|
|
// selinuxfs paths
|
|
|
|
#define SELINUX_MNT "/sys/fs/selinux"
|
|
|
|
#define SELINUX_ENFORCE SELINUX_MNT "/enforce"
|
|
|
|
#define SELINUX_POLICY SELINUX_MNT "/policy"
|
|
|
|
#define SELINUX_LOAD SELINUX_MNT "/load"
|
|
|
|
#define SELINUX_CONTEXT SELINUX_MNT "/context"
|
|
|
|
#define SELINUX_VERSION SELINUX_MNT "/policyvers"
|
|
|
|
|
|
|
|
// sepolicy paths
|
|
|
|
#define PLAT_POLICY_DIR "/system/etc/selinux/"
|
|
|
|
#define VEND_POLICY_DIR "/vendor/etc/selinux/"
|
|
|
|
#define PROD_POLICY_DIR "/product/etc/selinux/"
|
|
|
|
#define ODM_POLICY_DIR "/odm/etc/selinux/"
|
|
|
|
#define SPLIT_PLAT_CIL PLAT_POLICY_DIR "plat_sepolicy.cil"
|
|
|
|
|
|
|
|
#define SEPOL_PROC_DOMAIN "magisk"
|
|
|
|
#define SEPOL_FILE_DOMAIN "magisk_file"
|
|
|
|
|
2018-11-03 03:06:01 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2019-03-14 06:34:22 -04:00
|
|
|
extern void (*freecon)(char *con);
|
|
|
|
extern int (*setcon)(const char *con);
|
|
|
|
extern int (*getfilecon)(const char *path, char **con);
|
|
|
|
extern int (*lgetfilecon)(const char *path, char **con);
|
|
|
|
extern int (*fgetfilecon)(int fd, char **con);
|
|
|
|
extern int (*setfilecon)(const char *path, const char *con);
|
|
|
|
extern int (*lsetfilecon)(const char *path, const char *con);
|
|
|
|
extern int (*fsetfilecon)(int fd, const char *con);
|
|
|
|
void getfilecon_at(int dirfd, const char *name, char **con);
|
|
|
|
void setfilecon_at(int dirfd, const char *name, const char *con);
|
2018-09-27 00:09:59 -04:00
|
|
|
|
2019-02-09 01:51:46 -05:00
|
|
|
void selinux_builtin_impl();
|
2018-09-27 18:26:41 -04:00
|
|
|
void dload_selinux();
|
2018-09-27 00:09:59 -04:00
|
|
|
void restorecon();
|
2019-04-24 00:13:48 -04:00
|
|
|
void restore_rootcon();
|
2018-11-03 03:06:01 -04:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|