Documentation
¶
Overview ¶
* Copyright 2025 The Kubernetes 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.
Index ¶
- Constants
- Variables
- func FullPathByPID(procRoot string, pid int) (string, error)
- func OpenFile(lh logr.Logger, dir, file string, flags int) (*os.File, error)
- func PIDToString(pid int) (string, error)
- func ParseValue(lh logr.Logger, dir, file string) (int64, error)
- func PathByPID(procRoot string, pid int) (string, error)
- func ReadFile(lh logr.Logger, dir, file string) (string, error)
- func WriteFile(lh logr.Logger, dir, file, data string) error
- func WriteValue(lh logr.Logger, dir, file string, val int64) error
Constants ¶
const ( PIDSelf int = 0 MaxValue string = "max" )
Variables ¶
var (
MountPoint = "/sys/fs/cgroup"
)
var ( // TestMode is set to true by unit tests that need "fake" cgroupfs. TestMode bool )
Functions ¶
func OpenFile ¶
OpenFile opens a cgroup file in a given dir with given flags. It is supposed to be used for cgroup files only, and returns an error if the file is not a cgroup file.
Arguments dir and file are joined together to form an absolute path to a file being opened.
func PIDToString ¶
func ReadFile ¶
ReadFile reads data from a cgroup file in dir. It is supposed to be used for cgroup files only.
Types ¶
This section is empty.