From 6142a2a24aa03d552a96429197e2db3b2514a124 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 14 Oct 2022 00:50:24 +0200 Subject: [PATCH] sys: remove unused GetOpenFds() This was no longer used since 058eea362a94ff8152dc5c62f3c5c2494372e8ba (v1.0.0-alpha0), and there's no external users. Signed-off-by: Sebastiaan van Stijn --- sys/fds.go | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 sys/fds.go diff --git a/sys/fds.go b/sys/fds.go deleted file mode 100644 index a71a9cd7e..000000000 --- a/sys/fds.go +++ /dev/null @@ -1,35 +0,0 @@ -//go:build !windows && !darwin -// +build !windows,!darwin - -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package sys - -import ( - "os" - "path/filepath" - "strconv" -) - -// GetOpenFds returns the number of open fds for the process provided by pid -func GetOpenFds(pid int) (int, error) { - dirs, err := os.ReadDir(filepath.Join("/proc", strconv.Itoa(pid), "fd")) - if err != nil { - return -1, err - } - return len(dirs), nil -}