mirror of
https://github.com/norouter/norouter.git
synced 2025-12-24 13:17:54 +08:00
19 lines
237 B
Go
19 lines
237 B
Go
package debugutil
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"runtime"
|
|
)
|
|
|
|
func NumFDs() int {
|
|
if runtime.GOOS != "linux" {
|
|
// unimplemented
|
|
return -1
|
|
}
|
|
ents, err := ioutil.ReadDir("/proc/self/fd")
|
|
if err != nil {
|
|
return -1
|
|
}
|
|
return len(ents)
|
|
}
|