mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #12240 from avorima/fdusage_readdirnames
etcdserver: Use Readdirnames to count fds for FDUsage
This commit is contained in:
commit
76993f1fc6
@ -33,13 +33,12 @@ func FDUsage() (uint64, error) {
|
||||
}
|
||||
|
||||
// countFiles reads the directory named by dirname and returns the count.
|
||||
// This is same as stdlib "io/ioutil.ReadDir" but without sorting.
|
||||
func countFiles(dirname string) (uint64, error) {
|
||||
f, err := os.Open(dirname)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
list, err := f.Readdir(-1)
|
||||
list, err := f.Readdirnames(-1)
|
||||
f.Close()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
|
Loading…
x
Reference in New Issue
Block a user