1
0
mirror of https://github.com/rancher/os.git synced 2025-07-06 03:26:12 +00:00
os/vendor/github.com/docker/containerd/osutils/fds.go
Darren Shepherd a14846152b Update vendor
2016-05-31 18:14:32 -07:00

19 lines
355 B
Go

// +build !windows,!darwin
package osutils
import (
"io/ioutil"
"path/filepath"
"strconv"
)
// GetOpenFds returns the number of open fds for the process provided by pid
func GetOpenFds(pid int) (int, error) {
dirs, err := ioutil.ReadDir(filepath.Join("/proc", strconv.Itoa(pid), "fd"))
if err != nil {
return -1, err
}
return len(dirs), nil
}