mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
1009e6a40b
Fixes case sensitivity issue Signed-off-by: Derek McGowan <derek@mcgstyle.net>
22 lines
441 B
Go
22 lines
441 B
Go
// +build linux freebsd
|
|
|
|
package fileutils
|
|
|
|
import (
|
|
"fmt"
|
|
"io/ioutil"
|
|
"os"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// GetTotalUsedFds Returns the number of used File Descriptors by
|
|
// reading it via /proc filesystem.
|
|
func GetTotalUsedFds() int {
|
|
if fds, err := ioutil.ReadDir(fmt.Sprintf("/proc/%d/fd", os.Getpid())); err != nil {
|
|
logrus.Errorf("Error opening /proc/%d/fd: %s", os.Getpid(), err)
|
|
} else {
|
|
return len(fds)
|
|
}
|
|
return -1
|
|
}
|