Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions sysfs/class_infiniband.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ func parseInfiniBandCounters(portPath string) (*InfiniBandCounters, error) {
name := filepath.Join(path, f.Name())
value, err := util.SysReadFile(name)
if err != nil {
if os.IsNotExist(err) || err.Error() == "operation not supported" || err.Error() == "invalid argument" {
continue
}
return nil, fmt.Errorf("failed to read file %q: %v", name, err)
}

Expand Down Expand Up @@ -331,6 +334,9 @@ func parseInfiniBandCounters(portPath string) (*InfiniBandCounters, error) {
name := filepath.Join(path, f.Name())
value, err := util.SysReadFile(name)
if err != nil {
if os.IsNotExist(err) || err.Error() == "operation not supported" || err.Error() == "invalid argument" {
continue
}
return nil, fmt.Errorf("failed to read file %q: %v", name, err)
}

Expand Down
4 changes: 4 additions & 0 deletions sysfs/class_power_supply.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package sysfs
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"

"github.com/prometheus/procfs/internal/util"
Expand Down Expand Up @@ -141,6 +142,9 @@ func parsePowerSupply(path string) (*PowerSupply, error) {
name := filepath.Join(path, f.Name())
value, err := util.SysReadFile(name)
if err != nil {
if os.IsNotExist(err) || err.Error() == "operation not supported" || err.Error() == "invalid argument" {
continue
}
return nil, fmt.Errorf("failed to read file %q: %v", name, err)
}

Expand Down
4 changes: 4 additions & 0 deletions sysfs/net_class.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package sysfs
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"

"github.com/prometheus/procfs/internal/util"
Expand Down Expand Up @@ -118,6 +119,9 @@ func (nc NetClass) parseNetClassIface(devicePath string) (*NetClassIface, error)
name := filepath.Join(devicePath, f.Name())
value, err := util.SysReadFile(name)
if err != nil {
if os.IsNotExist(err) || err.Error() == "operation not supported" || err.Error() == "invalid argument" {
continue
}
return nil, fmt.Errorf("failed to read file %q: %v", name, err)
}
vp := util.NewValueParser(value)
Expand Down