Signed-off-by: Vincent Batts <vbatts@redhat.com>
| ... | ... |
@@ -1,3 +1,5 @@ |
| 1 |
+// +build linux |
|
| 2 |
+ |
|
| 1 | 3 |
package mount |
| 2 | 4 |
|
| 3 | 5 |
import ( |
| ... | ... |
@@ -72,3 +74,14 @@ func parseInfoFile(r io.Reader) ([]*MountInfo, error) {
|
| 72 | 72 |
} |
| 73 | 73 |
return out, nil |
| 74 | 74 |
} |
| 75 |
+ |
|
| 76 |
+// PidMountInfo collects the mounts for a specific Pid |
|
| 77 |
+func PidMountInfo(pid int) ([]*MountInfo, error) {
|
|
| 78 |
+ f, err := os.Open(fmt.Sprintf("/proc/%d/mountinfo", pid))
|
|
| 79 |
+ if err != nil {
|
|
| 80 |
+ return nil, err |
|
| 81 |
+ } |
|
| 82 |
+ defer f.Close() |
|
| 83 |
+ |
|
| 84 |
+ return parseInfoFile(f) |
|
| 85 |
+} |