pkg/fileutils: deprecate GetTotalUsedFds

This function is only used internally and has no external consumers.
Mark it deprecated to be removed in the next release.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e45f20352d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-01-03 17:18:15 +01:00
parent 9cf331393c
commit bdd3a95a13
4 changed files with 10 additions and 0 deletions

View File

@@ -150,6 +150,10 @@ issues:
path: "api/types/(volume|container)/"
linters:
- revive
# FIXME temporarily suppress these until we migrated these to internal.
- text: "SA1019: fileutils\\.GetTotalUsedFds"
linters:
- staticcheck
# FIXME temporarily suppress these (see https://github.com/gotestyourself/gotest.tools/issues/272)
- text: "SA1019: (assert|cmp|is)\\.ErrorType is deprecated"
linters:

View File

@@ -14,6 +14,8 @@ import (
// "-n", and "-P" options to omit looking up user-names, host-names, and port-
// names. See [LSOF(8)].
//
// Deprecated: this function is only used internally, and will be removed in the next release.
//
// [LSOF(8)]: https://opensource.apple.com/source/lsof/lsof-49/lsof/lsof.man.auto.html
func GetTotalUsedFds() int {
output, err := exec.Command("lsof", "-lnP", "-Ff", "-p", strconv.Itoa(os.Getpid())).CombinedOutput()

View File

@@ -13,6 +13,8 @@ import (
// GetTotalUsedFds Returns the number of used File Descriptors by
// reading it via /proc filesystem.
//
// Deprecated: this function is only used internally, and will be removed in the next release.
func GetTotalUsedFds(ctx context.Context) int {
ctx, span := tracing.StartSpan(ctx, "GetTotalUsedFds")
defer span.End()

View File

@@ -4,6 +4,8 @@ import "context"
// GetTotalUsedFds Returns the number of used File Descriptors. Not supported
// on Windows.
//
// Deprecated: this function is only used internally, and will be removed in the next release.
func GetTotalUsedFds(ctx context.Context) int {
return -1
}