kernel: Rewrite kernle version code management

Co-authored-by: lamadaemon <i@lama.icu>
Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
This commit is contained in:
ShirkNeko
2025-06-24 23:16:16 +08:00
parent f57fe79c5d
commit 2c2698f6bc
53 changed files with 234 additions and 122 deletions

View File

@@ -345,4 +345,10 @@ NativeBridgeNP(getSusfsFeatureStatus, jobject) {
GetEnvironment()->SetBooleanField(env, obj, statusSusSuField, status.status_sus_su);
return obj;
}
NativeBridgeNP(getFullVersion, jstring) {
char buff[255] = { 0 };
get_full_version((char *) &buff);
return GetEnvironment()->NewStringUTF(env, buff);
}

View File

@@ -30,6 +30,9 @@
#define CMD_IS_UID_SHOULD_UMOUNT 13
#define CMD_IS_SU_ENABLED 14
#define CMD_ENABLE_SU 15
#define CMD_GET_VERSION_FULL 30
#define CMD_ENABLE_KPM 100
#define CMD_HOOK_TYPE 101
#define CMD_GET_SUSFS_FEATURE_STATUS 102
@@ -60,12 +63,16 @@ int get_version() {
int32_t version = -1;
int32_t lkm = 0;
ksuctl(CMD_GET_VERSION, &version, &lkm);
if (!is_lkm && lkm != 0) {
if (!is_lkm && lkm == 1) {
is_lkm = true;
}
return version;
}
void get_full_version(char* buff) {
ksuctl(CMD_GET_VERSION_FULL, buff, NULL);
}
bool get_allow_list(int *uids, int *size) {
return ksuctl(CMD_GET_SU_LIST, uids, size);
}

View File

@@ -10,6 +10,8 @@
bool become_manager(const char *);
void get_full_version(char* buff);
int get_version();
bool get_allow_list(int *uids, int *size);