diff options
Diffstat (limited to 'vendor/github.com/prometheus/procfs/proc.go')
-rw-r--r-- | vendor/github.com/prometheus/procfs/proc.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/github.com/prometheus/procfs/proc.go b/vendor/github.com/prometheus/procfs/proc.go index 330e472..9f97b6e 100644 --- a/vendor/github.com/prometheus/procfs/proc.go +++ b/vendor/github.com/prometheus/procfs/proc.go | |||
@@ -134,6 +134,27 @@ func (p Proc) CmdLine() ([]string, error) { | |||
134 | return strings.Split(string(bytes.TrimRight(data, string("\x00"))), string(byte(0))), nil | 134 | return strings.Split(string(bytes.TrimRight(data, string("\x00"))), string(byte(0))), nil |
135 | } | 135 | } |
136 | 136 | ||
137 | // Wchan returns the wchan (wait channel) of a process. | ||
138 | func (p Proc) Wchan() (string, error) { | ||
139 | f, err := os.Open(p.path("wchan")) | ||
140 | if err != nil { | ||
141 | return "", err | ||
142 | } | ||
143 | defer f.Close() | ||
144 | |||
145 | data, err := ioutil.ReadAll(f) | ||
146 | if err != nil { | ||
147 | return "", err | ||
148 | } | ||
149 | |||
150 | wchan := string(data) | ||
151 | if wchan == "" || wchan == "0" { | ||
152 | return "", nil | ||
153 | } | ||
154 | |||
155 | return wchan, nil | ||
156 | } | ||
157 | |||
137 | // Comm returns the command name of a process. | 158 | // Comm returns the command name of a process. |
138 | func (p Proc) Comm() (string, error) { | 159 | func (p Proc) Comm() (string, error) { |
139 | data, err := util.ReadFileNoStat(p.path("comm")) | 160 | data, err := util.ReadFileNoStat(p.path("comm")) |