[24.0] pkg/fileutils: switch to use containerd log pkg
(very) partial backport of74da6a6363
andab35df454d
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
2435d75b89
commit
cd44aba8db
1 changed files with 3 additions and 3 deletions
|
@ -1,20 +1,20 @@
|
|||
//go:build linux || freebsd
|
||||
// +build linux freebsd
|
||||
|
||||
package fileutils // import "github.com/docker/docker/pkg/fileutils"
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/containerd/containerd/log"
|
||||
)
|
||||
|
||||
// GetTotalUsedFds Returns the number of used File Descriptors by
|
||||
// reading it via /proc filesystem.
|
||||
func GetTotalUsedFds() int {
|
||||
if fds, err := os.ReadDir(fmt.Sprintf("/proc/%d/fd", os.Getpid())); err != nil {
|
||||
logrus.Errorf("Error opening /proc/%d/fd: %s", os.Getpid(), err)
|
||||
log.G(context.TODO()).Errorf("Error opening /proc/%d/fd: %s", os.Getpid(), err)
|
||||
} else {
|
||||
return len(fds)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue