Documentation ¶
Index ¶
Constants ¶
const ( // CHeaderFileName is the name of the C header file for BPF programs for a // particular endpoint. CHeaderFileName = "ep_config.h" // PossibleCPUSysfsPath is used to retrieve the number of CPUs for per-CPU maps. PossibleCPUSysfsPath = "/sys/devices/system/cpu/possible" )
Variables ¶
This section is empty.
Functions ¶
func C2GoArray ¶
C2GoArray transforms an hexadecimal string representation into a byte slice. Example: str := "0x12, 0xff, 0x0, 0x1" fmt.Print(C2GoArray(str)) //`{0x12, 0xFF, 0x0, 0x01}`"
func GetNumPossibleCPUs ¶
GetNumPossibleCPUs returns a total number of possible CPUS, i.e. CPUs that have been allocated resources and can be brought online if they are present. The number is retrieved by parsing /sys/devices/system/cpu/possible.
See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/cpumask.h?h=v4.19#n50 for more details.
func GoArray2C ¶
GoArray2C transforms a byte slice into its hexadecimal string representation. Example: array := []byte{0x12, 0xFF, 0x0, 0x01} fmt.Print(GoArray2C(array)) // "{ 0x12, 0xff, 0x0, 0x1 }"
func GoArray2CNoSpaces ¶
GoArray2CNoSpaces does the same as GoArray2C, but no spaces are used in the final output. Example: array := []byte{0x12, 0xFF, 0x0, 0x01} fmt.Print(GoArray2CNoSpaces(array)) // "{0x12,0xff,0x0,0x1}"
func MapStringStructToSlice ¶
MapStringStructToSlice returns a slice with all keys of the given map[string]struct{}
func RequireRootPrivilege ¶
func RequireRootPrivilege(cmd string)
RequireRootPrivilege checks if the user running cmd is root. If not, it exits the program
Types ¶
This section is empty.