mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-08 18:26:48 +00:00
当找不到内核日志缓冲区的时候,重试 (#491)
This commit is contained in:
parent
45626c859f
commit
dcf232f378
@ -53,7 +53,7 @@ impl AppBackend {
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct BackendData {
|
||||
pub(crate) struct BackendData {
|
||||
kernel_metadata: Option<loader::KernelMetadata>,
|
||||
/// Path to the QEMU shm which contains the kernel memory.
|
||||
kmem_path: Option<PathBuf>,
|
||||
|
@ -30,7 +30,7 @@ pub struct MMLogMonitor {
|
||||
}
|
||||
|
||||
impl MMLogMonitor {
|
||||
pub fn new(shared_data: Arc<Mutex<BackendData>>) -> Arc<Self> {
|
||||
pub(crate) fn new(shared_data: Arc<Mutex<BackendData>>) -> Arc<Self> {
|
||||
let guard = shared_data.lock().unwrap();
|
||||
let mm_log_buffer_symbol: Option<Symbol> = guard
|
||||
.kernel_metadata
|
||||
@ -153,7 +153,20 @@ impl MMMonitorThread {
|
||||
pub fn run(&mut self) {
|
||||
info!("MMMonitorThread::run(): kmem_path: {:?}", self.kmem_path);
|
||||
|
||||
let mut kmem_file = self.open_kmem_file().expect("Failed to open kmem file.");
|
||||
let mut kmem_file = {
|
||||
let mut file: File;
|
||||
loop {
|
||||
let f = self.open_kmem_file();
|
||||
if f.is_ok() {
|
||||
file = f.unwrap();
|
||||
break;
|
||||
} else {
|
||||
log::error!("Failed to open kmem file, error: {:?}", f.unwrap_err());
|
||||
std::thread::sleep(std::time::Duration::from_secs(1));
|
||||
}
|
||||
}
|
||||
file
|
||||
};
|
||||
|
||||
info!("Channel header loaded!");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user