tracefs

package
v0.0.0-...-a55c778 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidInput = errors.New("invalid input")

	ErrInvalidMaxActive = errors.New("can only set maxactive on kretprobes")
)

Functions

func EventID

func EventID(group, name string) (uint64, error)

EventID reads a trace event's ID from tracefs given its group and name. The kernel requires group and name to be alphanumeric or underscore.

func KprobeToken

func KprobeToken(args ProbeArgs) string

KprobeToken creates the SYM[+offs] token for the tracefs api.

func RandomGroup

func RandomGroup(prefix string) (string, error)

RandomGroup generates a pseudorandom string for use as a tracefs group name. Returns an error when the output string would exceed 63 characters (kernel limitation), when rand.Read() fails or when prefix contains characters not allowed by IsValidTraceID.

func UprobeToken

func UprobeToken(args ProbeArgs) string

UprobeToken creates the PATH:OFFSET(REF_CTR_OFFSET) token for the tracefs api.

Types

type Event

type Event struct {
	// contains filtered or unexported fields
}

Event represents an entry in a tracefs probe events file.

func NewEvent

func NewEvent(args ProbeArgs) (*Event, error)

NewEvent creates a new ephemeral trace event.

Returns os.ErrNotExist if symbol is not a valid kernel symbol, or if it is not traceable with kprobes. Returns os.ErrExist if a probe with the same group and symbol already exists. Returns an error if args.RetprobeMaxActive is used on non kprobe types. Returns ErrNotSupported if the kernel is too old to support kretprobe maxactive.

func (*Event) Close

func (evt *Event) Close() error

Close removes the event from tracefs.

Returns os.ErrClosed if the event has already been closed before.

func (*Event) Group

func (evt *Event) Group() string

Group returns the tracefs group used by the event.

func (*Event) ID

func (evt *Event) ID() uint64

ID returns the tracefs ID associated with the event.

type ProbeArgs

type ProbeArgs struct {
	Type                         ProbeType
	Symbol, Group, Path          string
	Offset, RefCtrOffset, Cookie uint64
	Pid, RetprobeMaxActive       int
	Ret                          bool
}

type ProbeType

type ProbeType uint8
const (
	Kprobe ProbeType = iota // kprobe
	Uprobe                  // uprobe
)

func (ProbeType) String

func (i ProbeType) String() string

Jump to

Keyboard shortcuts

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