-
Notifications
You must be signed in to change notification settings - Fork 119
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
Add /proc/iomem #216
Add /proc/iomem #216
Conversation
From first glance, it looks like there might be too many variants to try to enumerate all of them. So my vote is to just store them as
Let's make sure the code can handle the case when all addresses are zero. In the test, the assertions can do things like: if i am root, make sure the parsed addresses are non-zero. Also, I have no idea what's up with the CI failures. I'll look at that later |
The code already handle the 0 addresses, so it's fine I fixed CI, I was missing a colon in a docstring |
src/iomem.rs
Outdated
use super::{FileWrapper, ProcResult}; | ||
use crate::split_into_num; | ||
|
||
pub struct IoMem; |
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.
It seems a little weird to have an empty struct here. Instead of IoMem::new()
what about fn iomem() -> ProcResult<Vec<PhysicalMemoryMap>>
? This would be consistent with other functions that return a list of things (like diskstats() and locks())
One last question: the data in |
Yes we could add indentation. Should we construct a real tree, or just record the indentation index? |
I think having a tree would be best. But maybe we can leave that for a followup pull request. I don't think tracking just the indentation is the right thing to do. Something strange is going on with one of your commits: 9e7aff9. This commit somehow includes some of the |
I rebased from master, the commits look good. The present version includes the indentation. Do you want me to remove it before we settle on some kind of tree structure? |
No, we can leave it for now. But let's find something better before the next procfs release. |
Hi,
This PR adds support for parsing
/proc/iomem
The content looks like:
Some values are constant like
System RAM
,Kernel code
... but others depend on the hardware and kernel modules:vmwgfx probe
,PCI Bus xxxx
...Should we try to enumerate all of these in an enum like
MMapPath
, with a special variant holding aString
?Or we can keep it like this, with a simple
String
?Another point is that this requires root or sudo, otherwise all addresses are 0. At first I added a
panic!
in the example, but I guess this would break CI?What do you think?