Source File
proc.go
Belonging Package
github.com/prometheus/procfs
package procfs
import (
)
func ( FS) () (Procs, error) {
, := os.Open(.proc.Path())
if != nil {
return Procs{},
}
defer .Close()
, := .Readdirnames(-1)
if != nil {
return Procs{}, fmt.Errorf("could not read %s: %s", .Name(), )
}
:= Procs{}
for , := range {
, := strconv.ParseInt(, 10, 64)
if != nil {
continue
}
= append(, Proc{PID: int(), fs: .proc})
}
return , nil
}
func ( Proc) () ([]*MountInfo, error) {
, := util.ReadFileNoStat(.path("mountinfo"))
if != nil {
return nil,
}
return parseMountInfo()
}
func ( Proc) () ([]string, error) {
, := os.Open(.path("fd"))
if != nil {
return nil,
}
defer .Close()
, := .Readdirnames(-1)
if != nil {
return nil, fmt.Errorf("could not read %s: %s", .Name(), )
}
return , nil
}
func ( Proc) ( ...string) string {
return .fs.Path(append([]string{strconv.Itoa(.PID)}, ...)...)
}
func ( Proc) () (ProcFDInfos, error) {
, := .fileDescriptors()
if != nil {
return nil,
}
var ProcFDInfos
for , := range {
, := .FDInfo()
if != nil {
continue
}
= append(, *)
}
return , nil
}
func ( Proc) () (ProcSchedstat, error) {
, := ioutil.ReadFile(.path("schedstat"))
if != nil {
return ProcSchedstat{},
}
return parseProcSchedstat(string())
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |