Update prometheus/procfs
Fixes: https://github.com/prometheus/node_exporter/issues/1721 Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
parent
2cefe3d769
commit
baa7ab732f
51 changed files with 2699 additions and 292 deletions
21
vendor/github.com/prometheus/procfs/proc.go
generated
vendored
21
vendor/github.com/prometheus/procfs/proc.go
generated
vendored
|
|
@ -134,6 +134,27 @@ func (p Proc) CmdLine() ([]string, error) {
|
|||
return strings.Split(string(bytes.TrimRight(data, string("\x00"))), string(byte(0))), nil
|
||||
}
|
||||
|
||||
// Wchan returns the wchan (wait channel) of a process.
|
||||
func (p Proc) Wchan() (string, error) {
|
||||
f, err := os.Open(p.path("wchan"))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
data, err := ioutil.ReadAll(f)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
wchan := string(data)
|
||||
if wchan == "" || wchan == "0" {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
return wchan, nil
|
||||
}
|
||||
|
||||
// Comm returns the command name of a process.
|
||||
func (p Proc) Comm() (string, error) {
|
||||
data, err := util.ReadFileNoStat(p.path("comm"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue