Documentation ¶
Index ¶
- Variables
- func BPF(cmd int, attr unsafe.Pointer, size uintptr) (uintptr, error)
- func CString(in []byte) string
- func ErrorWithLog(err error, log []byte, logErr error) error
- func FeatureTest(name, version string, fn func() bool) func() error
- func PossibleCPUs() (int, error)
- type DiscardZeroes
- type FD
- type Pointer
- type UnsupportedFeatureError
- type VerifierError
- type Version
Constants ¶
This section is empty.
Variables ¶
var ErrClosedFd = errors.New("use of closed file descriptor")
var ErrNotSupported = errors.New("not supported")
ErrNotSupported indicates that a feature is not supported by the current kernel.
var NativeEndian binary.ByteOrder
NativeEndian is set to either binary.BigEndian or binary.LittleEndian, depending on the host's endianness.
Functions ¶
func BPF ¶
BPF wraps SYS_BPF.
Any pointers contained in attr must use the Pointer type from this package.
func ErrorWithLog ¶
ErrorWithLog returns an error that includes logs from the kernel verifier.
logErr should be the error returned by the syscall that generated the log. It is used to check for truncation of the output.
func FeatureTest ¶
FeatureTest wraps a function so that it is run at most once.
name should identify the tested feature, while version must be in the form Major.Minor[.Patch].
Returns a descriptive UnsupportedFeatureError if the feature is not available.
func PossibleCPUs ¶
PossibleCPUs returns the max number of CPUs a system may possibly have Logical CPU numbers must be of the form 0-n
Types ¶
type DiscardZeroes ¶
type DiscardZeroes struct{}
DiscardZeroes makes sure that all written bytes are zero before discarding them.
type Pointer ¶
type Pointer struct {
// contains filtered or unexported fields
}
Pointer wraps an unsafe.Pointer to be 64bit to conform to the syscall specification.
func NewPointer ¶
NewPointer creates a 64-bit pointer from an unsafe Pointer.
func NewSlicePointer ¶
NewSlicePointer creates a 64-bit pointer from a byte slice.
func NewStringPointer ¶
NewStringPointer creates a 64-bit pointer from a string.
type UnsupportedFeatureError ¶
type UnsupportedFeatureError struct { // The minimum Linux mainline version required for this feature. // Used for the error string, and for sanity checking during testing. MinimumVersion Version // The name of the feature that isn't supported. Name string }
UnsupportedFeatureError is returned by FeatureTest() functions.
func (*UnsupportedFeatureError) Error ¶
func (ufe *UnsupportedFeatureError) Error() string
func (*UnsupportedFeatureError) Is ¶
func (ufe *UnsupportedFeatureError) Is(target error) bool
Is indicates that UnsupportedFeatureError is ErrNotSupported.
type VerifierError ¶
type VerifierError struct {
// contains filtered or unexported fields
}
VerifierError includes information from the eBPF verifier.
func (*VerifierError) Error ¶
func (le *VerifierError) Error() string
type Version ¶
type Version [3]uint16
A Version in the form Major.Minor.Patch.
func MustKernelVersion ¶
func MustKernelVersion() Version
MustKernelVersion() return the current kernel version
func NewVersion ¶
NewVersion creates a version from a string like "Major.Minor.Patch".
Patch is optional.