1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-26 13:48:59 +08:00

Add comments with a short explanation and link to the PR request

This commit is contained in:
Alexander Blagoev 2017-05-04 14:52:34 +03:00
parent 531f9507d2
commit b32353f094

View File

@ -615,6 +615,10 @@ func processInet(file string, kind netConnectionKindType, inodes map[string][]in
return []connTmp{}, nil
}
// Read the contents of the /proc file with a single read sys call.
// This minimizes duplicates in the returned connections
// For more info:
// https://github.com/shirou/gopsutil/pull/361
contents, err := ioutil.ReadFile(file)
if err != nil {
return nil, err
@ -672,6 +676,10 @@ func processInet(file string, kind netConnectionKindType, inodes map[string][]in
}
func processUnix(file string, kind netConnectionKindType, inodes map[string][]inodeMap, filterPid int32) ([]connTmp, error) {
// Read the contents of the /proc file with a single read sys call.
// This minimizes duplicates in the returned connections
// For more info:
// https://github.com/shirou/gopsutil/pull/361
contents, err := ioutil.ReadFile(file)
if err != nil {
return nil, err