mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-24 09:53:24 +00:00
Fix unwrap panic of dropped VMAR in PID status
This commit is contained in:
@ -99,10 +99,9 @@ impl FileOps for StatusFileOps {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
{
|
||||
let vmar = process.lock_root_vmar();
|
||||
let anon = vmar.unwrap().get_rss_counter(RssType::RSS_ANONPAGES) * (PAGE_SIZE / 1024);
|
||||
let file = vmar.unwrap().get_rss_counter(RssType::RSS_FILEPAGES) * (PAGE_SIZE / 1024);
|
||||
if let Some(vmar_ref) = process.lock_root_vmar().as_ref() {
|
||||
let anon = vmar_ref.get_rss_counter(RssType::RSS_ANONPAGES) * (PAGE_SIZE / 1024);
|
||||
let file = vmar_ref.get_rss_counter(RssType::RSS_FILEPAGES) * (PAGE_SIZE / 1024);
|
||||
let rss = anon + file;
|
||||
writeln!(
|
||||
status_output,
|
||||
|
@ -87,6 +87,13 @@ impl ProcessVmarGuard<'_> {
|
||||
self.inner.as_ref().unwrap()
|
||||
}
|
||||
|
||||
/// Returns a reference to the process VMAR if it exists.
|
||||
///
|
||||
/// Returns `None` if the process has exited and its VMAR has been dropped.
|
||||
pub fn as_ref(&self) -> Option<&Vmar<Full>> {
|
||||
self.inner.as_ref()
|
||||
}
|
||||
|
||||
/// Sets a new VMAR for the binding process.
|
||||
///
|
||||
/// If the `new_vmar` is `None`, this method will remove the
|
||||
|
Reference in New Issue
Block a user