sharedobjs

package
v0.0.0-...-b5ed7c0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamicSymbolsLoader

type DynamicSymbolsLoader interface {
	GetDynamicSymbols(info ObjInfo) (map[string]bool, error)
	GetExportedSymbols(info ObjInfo) (map[string]bool, error)
	GetImportedSymbols(info ObjInfo) (map[string]bool, error)
	GetLocalSymbols(info ObjInfo) (map[string]bool, error)
}

type HostSymbolsLoader

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

HostSymbolsLoader is responsible for efficient reading of shared object's symbols. The logic of the loader here is used on absolute paths, so container relative paths won't work here. This object operation requires the CAP_DAC_OVERRIDE to access files across the system.

func InitHostSymbolsLoader

func InitHostSymbolsLoader(cacheSize int) *HostSymbolsLoader

func (*HostSymbolsLoader) GetDynamicSymbols

func (soLoader *HostSymbolsLoader) GetDynamicSymbols(soInfo ObjInfo) (map[string]bool, error)

GetDynamicSymbols returns the union of imported and exported symbols of the shared object. The returned map is freshly allocated on every call and is safe for the caller to mutate.

func (*HostSymbolsLoader) GetExportedSymbols

func (soLoader *HostSymbolsLoader) GetExportedSymbols(soInfo ObjInfo) (map[string]bool, error)

GetExportedSymbols returns the exported symbols of the shared object.

The returned map is freshly built per call from the cached internal store; callers may freely retain or mutate it.

func (*HostSymbolsLoader) GetImportedSymbols

func (soLoader *HostSymbolsLoader) GetImportedSymbols(soInfo ObjInfo) (map[string]bool, error)

GetImportedSymbols returns the imported symbols of the shared object.

The returned map is freshly built per call from the cached internal store; callers may freely retain or mutate it.

func (*HostSymbolsLoader) GetLocalSymbols

func (soLoader *HostSymbolsLoader) GetLocalSymbols(soInfo ObjInfo) (map[string]bool, error)

GetLocalSymbols returns the local symbols of the shared object.

The returned map is freshly built per call from the cached internal store; callers may freely retain or mutate it.

type ObjID

type ObjID struct {
	Inode  uint64
	Device uint32
	Ctime  uint64
}

ObjID is the unique identification of a SO in the system

type ObjInfo

type ObjInfo struct {
	Id      ObjID
	Path    string
	MountNS uint32
}

ObjInfo is the information of an SO needed to examine it

type SymbolCategory

type SymbolCategory uint8

SymbolCategory is a bitmask describing how a symbol participates in a shared object: it may be Local, Imported, Exported, or any combination.

Using a bitmask keeps a single map entry per symbol name even when the same name belongs to multiple categories (e.g. an Exported symbol is also Local). Storing one entry instead of three independent map entries is the primary memory win behind the redesign tracked by issue #4761.

const (
	CategoryLocal SymbolCategory = 1 << iota
	CategoryImported
	CategoryExported

	// CategoryDynamic is a convenience mask matching anything that appears in
	// the dynamic symbol table: imports plus exports.
	CategoryDynamic = CategoryImported | CategoryExported
)

type Symbols

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

Symbols holds the classified symbols of a single shared object.

Internally each unique symbol name maps to a SymbolCategory bitmask. Views onto a specific category (Local / Imported / Exported / Dynamic) are materialized on demand via View and are owned by the caller.

func NewSOSymbols

func NewSOSymbols() Symbols

NewSOSymbols returns an empty Symbols container.

func (*Symbols) Has

func (s *Symbols) Has(name string, mask SymbolCategory) bool

Has reports whether name matches any of the bits in mask.

func (*Symbols) Len

func (s *Symbols) Len() int

Len returns the number of distinct symbol names stored across all categories.

func (*Symbols) View

func (s *Symbols) View(mask SymbolCategory) map[string]bool

View returns a fresh map[string]bool of all names matching any of the bits in mask. The returned map is owned by the caller and is safe to mutate; it is recomputed on every call.

View allocates a fresh map on every call by design. The layout collapses three parallel maps (Local / Imported / Exported) into one bitmask-backed store, saving two map headers and bucket arrays per cached Symbols. Callers that iterate the same category repeatedly should cache the returned map.

type UnsupportedFileError

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

func InitUnsupportedFileError

func InitUnsupportedFileError(err error) *UnsupportedFileError

func (*UnsupportedFileError) Error

func (fileTypeErr *UnsupportedFileError) Error() string

func (*UnsupportedFileError) Unwrap

func (fileTypeErr *UnsupportedFileError) Unwrap() error

Jump to

Keyboard shortcuts

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