1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

pkg/mount: mountinfo from specified pid

Signed-off-by: Vincent Batts <vbatts@redhat.com>
This commit is contained in:
Vincent Batts 2014-10-31 16:28:20 -04:00
parent 0f9f5f3fdf
commit 64e7a1722d

View file

@ -1,3 +1,5 @@
// +build linux
package mount
import (
@ -72,3 +74,14 @@ func parseInfoFile(r io.Reader) ([]*MountInfo, error) {
}
return out, nil
}
// PidMountInfo collects the mounts for a specific Pid
func PidMountInfo(pid int) ([]*MountInfo, error) {
f, err := os.Open(fmt.Sprintf("/proc/%d/mountinfo", pid))
if err != nil {
return nil, err
}
defer f.Close()
return parseInfoFile(f)
}