@@ -10,6 +10,8 @@ use log::LevelFilter;
1010use  crate :: defs:: KSUD_VERBOSE_LOG_FILE ; 
1111use  crate :: { apk_sign,  assets,  debug,  defs,  init_event,  ksucalls,  module,  utils} ; 
1212
13+ use  std:: ffi:: CString ; 
14+ 
1315/// KernelSU userspace cli 
1416#[ derive( Parser ,  Debug ) ]  
1517#[ command( author,  version = defs:: VERSION_NAME ,  about,  long_about = None ) ]  
@@ -29,6 +31,11 @@ enum Commands {
2931        command :  Module , 
3032    } , 
3133
34+     /// Add custom try umount path 
35+ AddTryUmount  {   
36+         path :  PathBuf ,   
37+     } , 
38+ 
3239    /// Trigger `post-fs-data` event 
3340PostFsData , 
3441
@@ -309,6 +316,22 @@ pub fn run() -> Result<()> {
309316                Module :: List  => module:: list_modules ( ) , 
310317            } 
311318        } 
319+ 	Commands :: AddTryUmount  {  path }  => {   
320+ 	    match  CString :: new ( path. to_string_lossy ( ) . as_ref ( ) )  {   
321+ 		std:: result:: Result :: Ok ( c_path)  => {   
322+ 		    let  mut  dummy:  u32  = 0 ;   
323+ 		    unsafe  {   
324+ 		        libc:: prctl ( 0xDEADBEEFu32  as  i32 ,  10001 ,  c_path. as_ptr ( )  as  libc:: c_ulong ,    
325+ 		                   & mut  dummy as  * mut  u32  as  libc:: c_ulong ,    
326+ 		                   & mut  dummy as  * mut  u32  as  libc:: c_ulong ) ;   
327+ 		    }   
328+ 		}   
329+ 		std:: result:: Result :: Err ( e)  => {   
330+ 		    eprintln ! ( "Failed to create CString: {}" ,  e) ;   
331+ 		}   
332+ 	    }   
333+ 	    Ok ( ( ) )   
334+ 	} 
312335        Commands :: Install  {  magiskboot }  => utils:: install ( magiskboot) , 
313336        Commands :: Uninstall  {  magiskboot }  => utils:: uninstall ( magiskboot) , 
314337        Commands :: Sepolicy  {  command }  => match  command { 
0 commit comments