-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document Container and Command modules #79
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,12 @@ use procfs::process::Process; | |
|
||
use crate::container::{ContainerStatus, State}; | ||
|
||
/// Structure representing the container data | ||
#[derive(Debug)] | ||
pub struct Container { | ||
// State of the container | ||
pub state: State, | ||
// indicated the directory for the root path in the container | ||
pub root: PathBuf, | ||
} | ||
|
||
|
@@ -36,10 +39,12 @@ impl Container { | |
pub fn status(&self) -> ContainerStatus { | ||
self.state.status | ||
} | ||
|
||
pub fn refresh_status(&self) -> Result<Self> { | ||
let new_status = match self.pid() { | ||
Some(pid) => { | ||
// Note that Process::new does not spawn a new process | ||
// but instead creates a new Process structure, and fill | ||
// it with information about the process with given pid | ||
Comment on lines
+45
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a good comment. I, the author, didn't think anything of it, but it certainly could be misunderstood. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the first time I was looking at this while commenting create.rs, I was wondering why we create a new process here, then I checked the docs of process and found out it fills new structure. So I kept that in mind when writing this :) |
||
if let Ok(proc) = Process::new(pid.as_raw()) { | ||
use procfs::process::ProcState; | ||
match proc.stat.state().unwrap() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍