Skip to content

Commit

Permalink
Merge pull request #47 from kolyshkin/mount-pid
Browse files Browse the repository at this point in the history
mountinfo: deprecate PidMountInfo
  • Loading branch information
thaJeztah committed Oct 6, 2020
2 parents 4413637 + 3358500 commit 95f2efb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mountinfo/mountinfo_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,14 @@ func parseMountTable(filter FilterFunc) ([]*Info, error) {
return GetMountsFromReader(f, filter)
}

// PidMountInfo collects the mounts for a specific process ID. If the process
// ID is unknown, it is better to use `GetMounts` which will inspect
// "/proc/self/mountinfo" instead.
// PidMountInfo retrieves the list of mounts from a given process' mount
// namespace. Unless there is a need to get mounts from a mount namespace
// different from that of a calling process, use GetMounts.
//
// This function is Linux-specific.
//
// Deprecated: this will be removed before v1; use GetMountsFromReader with
// opened /proc/<pid>/mountinfo as an argument instead.
func PidMountInfo(pid int) ([]*Info, error) {
f, err := os.Open(fmt.Sprintf("/proc/%d/mountinfo", pid))
if err != nil {
Expand Down

0 comments on commit 95f2efb

Please sign in to comment.