diff --git a/bin/aot.rs b/bin/aot.rs index c1d9907aec4db3798e83835d0ee966ed39ef21a4..33fe3f0952be69b4e7aa27e51e544c227573450c 100644 --- a/bin/aot.rs +++ b/bin/aot.rs @@ -139,7 +139,8 @@ pub fn gen_app_rto(conf: &RtoConfig) -> i32 { } let mut args: Vec = Vec::new(); - //args.push(format!("--output={}.tmp.rto", conf.elf_path)); + args.push("--output".to_string()); + args.push(format!("{}.tmp.rto", conf.elf_path)); args.push(format!("--{}", conf.mode)); args.push(conf.elf_path.to_owned()); for lib in conf.libs.iter() { @@ -149,20 +150,24 @@ pub fn gen_app_rto(conf: &RtoConfig) -> i32 { if ret != 0 { return ret; } + ret = fs_ext::move_file(&format!("{}.tmp.rto", conf.elf_path), &format!("{}.rto", conf.elf_path)); + if ret != 0 { + return ret; + } let mut set: Vec = Vec::new(); set.push("--set-rto".to_string()); - set.push("/usr/bin/bash.rto".to_string()); + set.push(format!("{}.rto", conf.elf_path)); ret = run_child(SYSBOOST_PATH, &set); if ret != 0 { return ret; } let mut set_bash: Vec = Vec::new(); set_bash.push("--set".to_string()); - set_bash.push("/usr/bin/bash".to_string()); + set_bash.push(format!("{}", conf.elf_path)); ret = run_child(SYSBOOST_PATH, &set_bash); if ret != 0 { return ret; } - //ret = fs_ext::move_file(&format!("{}.rto", conf.elf_path), &format!("{}.tmp.rto", conf.elf_path)); + return ret; } diff --git a/bin/daemon.rs b/bin/daemon.rs index 5d404b54900cf2aeab70463c2a9781ec67c059f3..e711f4e58abdea6366a167271c85e5ee8f24df66 100644 --- a/bin/daemon.rs +++ b/bin/daemon.rs @@ -13,6 +13,7 @@ use crate::lib::fs_ext; use crate::kmod_util::set_ko_rto_flag; use crate::kmod_util::set_hpage_rto_flag; use crate::kmod_util::insmod_sysboost_ko; +use crate::kmod_util::test_kmod; use crate::config::RtoConfig; use crate::config::read_config; use crate::aot::gen_app_rto; @@ -177,7 +178,7 @@ fn refresh_all_config(rto_configs: &mut Vec) { Some(conf) => rto_configs.push(conf), None => {} } - log::error!("refresh all config {}", i); + log::info!("refresh all config {}", i); i += 1; } @@ -318,7 +319,9 @@ fn start_service() { } pub fn daemon_loop() { - insmod_sysboost_ko(); + if test_kmod() == 1 { + insmod_sysboost_ko(); + } // When rebooting, you should clean up the backup environment loop { diff --git a/bin/kmod_util.rs b/bin/kmod_util.rs index 8cbc908f85903a7afea8ec4a95c24e0f74651ef0..8d6ab98400c15b2cd36c473b2590b6d7081f4ad4 100644 --- a/bin/kmod_util.rs +++ b/bin/kmod_util.rs @@ -72,9 +72,9 @@ pub fn test_kmod() -> i32 { args.push("lsmod | grep sysboost_loader".to_string()); let ret = run_child("/usr/bin/bash", &args); if ret == 0 { - println!("sysboost_loader.ko is ready"); + log::info!("sysboost_loader.ko is ready"); } else { - println!("sysboost_loader.ko is not ready"); + log::info!("sysboost_loader.ko is not ready"); } return ret; } diff --git a/bin/main.rs b/bin/main.rs index 4158b7e047b226b5a6746be36fa65384b456b582..126c3d3ab7965b69104a36b58ff177b7aedd67f9 100644 --- a/bin/main.rs +++ b/bin/main.rs @@ -73,9 +73,9 @@ fn main() { } // start up coredump monitor - let _coredump_monitor_handle = thread::spawn(||{ - coredump_monitor_loop(); - }); + // let _coredump_monitor_handle = thread::spawn(||{ + // coredump_monitor_loop(); + // }); // daemon service gen rto ELF with config daemon_loop();