Bump procfs to v0.0.7 (#1538)

Update Prometheus procfs library to the latest release.

Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
Ben Kochie 2019-11-16 18:32:15 +01:00 committed by GitHub
commit 8a4c9c154b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 1595 additions and 171 deletions

View file

@ -15,11 +15,10 @@ package procfs
import (
"bufio"
"fmt"
"io/ioutil"
"os"
"bytes"
"regexp"
"strings"
"github.com/prometheus/procfs/internal/util"
)
// Regexp variables
@ -46,21 +45,15 @@ type ProcFDInfo struct {
// FDInfo constructor. On kernels older than 3.8, InotifyInfos will always be empty.
func (p Proc) FDInfo(fd string) (*ProcFDInfo, error) {
f, err := os.Open(p.path("fdinfo", fd))
data, err := util.ReadFileNoStat(p.path("fdinfo", fd))
if err != nil {
return nil, err
}
defer f.Close()
fdinfo, err := ioutil.ReadAll(f)
if err != nil {
return nil, fmt.Errorf("could not read %s: %s", f.Name(), err)
}
var text, pos, flags, mntid string
var inotify []InotifyInfo
scanner := bufio.NewScanner(strings.NewReader(string(fdinfo)))
scanner := bufio.NewScanner(bytes.NewReader(data))
for scanner.Scan() {
text = scanner.Text()
if rPos.MatchString(text) {