utils

package
v0.0.0-...-97d2b70 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Copyright © 2020 GUILLAUME FOURNIER

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

This section is empty.

Variables

View Source
var ByteOrder binary.ByteOrder

ByteOrder - host byte order

Functions

func Bytes

func Bytes(str string) []byte

Bytes - No copy string to bytes conversion

func GetCgroupFromPid

func GetCgroupFromPid(pid uint32) uint64

GetCgroupFromPid - Returns the cgroup of a process

func GetCommFromPid

func GetCommFromPid(pid uint32) string

GetCommFromPid - Returns the comm of a process

func GetHostByteOrder

func GetHostByteOrder() binary.ByteOrder

GetHostByteOrder - Returns the host byte order

func GetMntnsFromPid

func GetMntnsFromPid(pid uint32) uint64

GetMntnsFromPid - Returns the mount namespace of a process

func GetNetnsFromPid

func GetNetnsFromPid(pid uint32) uint64

GetNetnsFromPid - Returns the network namespace of a process

func GetPidnsFromPid

func GetPidnsFromPid(pid uint32) uint64

GetPidnsFromPid - Returns the pid namespace of a process

func GetPpid

func GetPpid(pid uint32) uint32

GetPpid is a fallback to read the parent PID from /proc. Some kernel versions, like 4.13.0 return 0 getting the parent PID from the current task, so we need to use this fallback to have the parent PID in any kernel.

func GetUsernsFromPid

func GetUsernsFromPid(pid uint32) uint64

GetUsernsFromPid - Returns the user namespace of a process

func InterfaceToBytes

func InterfaceToBytes(data interface{}, byteOrder binary.ByteOrder) ([]byte, error)

InterfaceToBytes - Tranforms an interface into a C bytes array

func String

func String(bytes []byte) string

String - No copy bytes to string conversion

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL