ksud: make other os build happy

This commit is contained in:
tiann 2023-01-26 12:12:25 +08:00
parent 2ebb363350
commit 080aeee5e3
No known key found for this signature in database
GPG Key ID: 6D3F65FFD9559C06

View File

@ -1,3 +1,4 @@
#![allow(dead_code, unused_mut, unused_variables)]
const KERNEL_SU_OPTION: u32 = 0xDEADBEEF;
// const CMD_GRANT_ROOT: u64 = 0;
@ -12,7 +13,6 @@ const CMD_REPORT_EVENT: u64 = 7;
const EVENT_POST_FS_DATA: u64 = 1;
const EVENT_BOOT_COMPLETED: u64 = 2;
// pub fn grant_root() -> bool {
// let mut result: i32 = 0;
// unsafe {
@ -29,6 +29,7 @@ const EVENT_BOOT_COMPLETED: u64 = 2;
pub fn get_version() -> i32 {
let mut result: i32 = 0;
#[cfg(target_os = "android")]
unsafe {
libc::prctl(
KERNEL_SU_OPTION as i32,
@ -36,10 +37,11 @@ pub fn get_version() -> i32 {
&mut result as *mut _ as *mut libc::c_void,
);
}
return result;
result
}
fn report_event(event: u64){
fn report_event(event: u64) {
#[cfg(target_os = "android")]
unsafe {
libc::prctl(
KERNEL_SU_OPTION as i32,
@ -49,10 +51,10 @@ fn report_event(event: u64){
}
}
pub fn report_post_fs_data(){
pub fn report_post_fs_data() {
report_event(EVENT_POST_FS_DATA);
}
pub fn report_boot_complete(){
pub fn report_boot_complete() {
report_event(EVENT_BOOT_COMPLETED);
}