diff --git a/userspace/ksud/src/ksu.rs b/userspace/ksud/src/ksu.rs index 80f4d129..8cb0164c 100644 --- a/userspace/ksud/src/ksu.rs +++ b/userspace/ksud/src/ksu.rs @@ -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); } \ No newline at end of file