strutils

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSize added in v1.0.0

func ParseSize(str string) (int, error)

func UTF8FromBPFBytes

func UTF8FromBPFBytes(b []byte) string

UTF8FromBPFBytes transforms bpf (C) strings to valid utf-8 strings

NB(kkourt): strings we get from BPF/kernel are C strings: null-terminated sequence of bytes. They may or may not be valid utf-8 strings. This is true for pathnames (cwd, binary) as well as program arguments. Many of these fields, however, are represented as the protobuf string type, which always has to be utf-8 encoded.

This function ensures that by replacing all invalid runes with '�'.

Note that this approach means that we loose information. Alternatively, we could use strconf.Quote() or similar to quote the strings but this would add overhead and it will also break the way we 've been representing strings up until now. A better solution would be to update the fields in the proto description to be bytes, and let the proto clients (e.g., tetra CLI and JSON writer) choose their preffered approach.

Types

This section is empty.

Jump to

Keyboard shortcuts

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