read dev and tcp files with specific pid ##218
Closed
shippomx wants to merge 1 commit intoeminence:masterfrom
shippomx:master
Closed
read dev and tcp files with specific pid ##218shippomx wants to merge 1 commit intoeminence:masterfrom shippomx:master
shippomx wants to merge 1 commit intoeminence:masterfrom
shippomx:master
Conversation
eminence
reviewed
Dec 3, 2022
Comment on lines
+352
to
+356
| pub fn tcp_with_pid(pid: i32) -> ProcResult<Vec<TcpNetEntry>> { | ||
| let file = FileWrapper::open(format!("/proc/{}/net/tcp", pid))?; | ||
|
|
||
| read_tcp_table(BufReader::new(file)) | ||
| } |
Owner
There was a problem hiding this comment.
I'm still not sure how this new function is different from Process::tcp()
eminence
reviewed
Dec 3, 2022
Comment on lines
+669
to
+672
| pub fn dev_status_with_pid(pid: i32) -> ProcResult<HashMap<String, DeviceStatus>> { | ||
| let file = FileWrapper::open(format!("/proc/{}/net/dev", pid))?; | ||
| read_dev_status(file) | ||
| } |
Owner
There was a problem hiding this comment.
This function should be part of the Process struct
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have to write some kata-containers metrics interface, which will use the specific /proc/{pid}/net/tcp file. And some one has mentioned this problem one yeas ago. #126.
for some mistake, i had add
libcpackage to referencepid_ttype, but this pr i removed it, and test this function inexamples/interface_stats.rs