mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 22:37:14 +08:00
libct/cgroups/fs2/statHugeTlb: error message nits
1. Don't wrap the error from fscommon.GetCgroupParamUint as it already contains the file name. 2. Don't put file name when wrapping the error from ioutil.ReadFile since it already has it. 3. Don't reconstruct file name, use existing one since it's available. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -43,7 +43,7 @@ func statHugeTlb(dirPath string, stats *cgroups.Stats) error {
|
||||
usage := strings.Join([]string{"hugetlb", pagesize, "current"}, ".")
|
||||
value, err := fscommon.GetCgroupParamUint(dirPath, usage)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to parse hugetlb.%s.current file", pagesize)
|
||||
return err
|
||||
}
|
||||
hugetlbStats.Usage = value
|
||||
|
||||
@@ -51,11 +51,11 @@ func statHugeTlb(dirPath string, stats *cgroups.Stats) error {
|
||||
filePath := filepath.Join(dirPath, fileName)
|
||||
contents, err := ioutil.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to parse hugetlb.%s.events file", pagesize)
|
||||
return errors.Wrap(err, "failed to read stats")
|
||||
}
|
||||
_, value, err = fscommon.GetCgroupParamKeyValue(string(contents))
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to parse hugetlb.%s.events file", pagesize)
|
||||
return errors.Wrap(err, "failed to parse "+fileName)
|
||||
}
|
||||
hugetlbStats.Failcnt = value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user