-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Assorted minor nits in libcontainer #2263
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
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 |
|---|---|---|
|
|
@@ -358,8 +358,8 @@ func getCgroupPathHelper(subsystem, cgroup string) (string, error) { | |
| return filepath.Join(mnt, relCgroup), nil | ||
| } | ||
|
|
||
| func readProcsFile(dir string) ([]int, error) { | ||
| f, err := os.Open(filepath.Join(dir, CgroupProcesses)) | ||
| func readProcsFile(file string) ([]int, error) { | ||
| f, err := os.Open(file) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
@@ -514,8 +514,8 @@ func getHugePageSizeFromFilenames(fileNames []string) ([]string, error) { | |
| } | ||
|
|
||
| // GetPids returns all pids, that were added to cgroup at path. | ||
| func GetPids(path string) ([]int, error) { | ||
| return readProcsFile(path) | ||
| func GetPids(dir string) ([]int, error) { | ||
|
Member
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. breaks compatibility if there is non-runc consumer of this function
Contributor
Author
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. Nope (I just changed the name of the parameter to be clear it's a directory, otherwise it's doing the same thing). |
||
| return readProcsFile(filepath.Join(dir, CgroupProcesses)) | ||
| } | ||
|
|
||
| // GetAllPids returns all pids, that were added to cgroup at path and to all its | ||
|
|
@@ -524,14 +524,13 @@ func GetAllPids(path string) ([]int, error) { | |
| var pids []int | ||
| // collect pids from all sub-cgroups | ||
| err := filepath.Walk(path, func(p string, info os.FileInfo, iErr error) error { | ||
| dir, file := filepath.Split(p) | ||
| if file != CgroupProcesses { | ||
| return nil | ||
| } | ||
| if iErr != nil { | ||
| return iErr | ||
| } | ||
| cPids, err := readProcsFile(dir) | ||
| if info.IsDir() || info.Name() != CgroupProcesses { | ||
| return nil | ||
| } | ||
| cPids, err := readProcsFile(p) | ||
|
Contributor
Author
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. Previous change to this code was in #332 |
||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
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.
@giuseppe PTAL