Skip to content

Commit 3358500

Browse files
committed
mountinfo: deprecate PidMountInfo
Function PidMountInfo is not named correctly (it should be PID not Pid, and we already have mountinfo in the package name so it's tautological), and can not accept FilterFunc. Besides, there are not too many users of this function (I was only able to found one, see [1]) and users can switch to GetMountsFromReader. Depreate this function. The plan is to remove it before v1.0. [1] DataDog/datadog-agent@406d98801434dedc87 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
1 parent 9cdf5ed commit 3358500

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

mountinfo/mountinfo_linux.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,14 @@ func parseMountTable(filter FilterFunc) ([]*Info, error) {
148148
return GetMountsFromReader(f, filter)
149149
}
150150

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

0 commit comments

Comments
 (0)