mirror of
https://github.com/rancher/os.git
synced 2025-08-31 22:32:14 +00:00
Update vendor
This commit is contained in:
18
vendor/github.com/docker/containerd/osutils/fds.go
generated
vendored
Normal file
18
vendor/github.com/docker/containerd/osutils/fds.go
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// +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
|
||||
}
|
Reference in New Issue
Block a user